Update all plugins to conform to Rubocop.

This commit is contained in:
Major-
2015-08-27 18:17:58 +01:00
parent 424d2bda29
commit 8f3fd75b33
75 changed files with 1625 additions and 1537 deletions
@@ -3,14 +3,13 @@ require 'java'
java_import 'org.apollo.game.message.impl.SetPlayerActionMessage'
java_import 'org.apollo.game.model.entity.Player'
# A right-click action for a Player.
class PlayerAction
attr_reader :slot, :primary, :name
def initialize(slot, primary, name)
index = [ :first, :second, :third, :fourth, :fifth ].find_index(slot)
raise "Unsupported action slot #{slot}." if index.nil?
index = [:first, :second, :third, :fourth, :fifth].find_index(slot)
fail "Unsupported action slot #{slot}." if index.nil?
@slot = index
@primary = primary
@@ -26,7 +25,7 @@ FOLLOW_ACTION = PlayerAction.new(:fifth, true, 'Follow')
# Shows multiple context menu action for the specified player
def show_actions(player, *actions)
raise 'Must specify at least one action' if actions.nil?
fail 'Must specify at least one action.' if actions.nil?
actions.each do |action|
player.add_action(action)
@@ -44,6 +43,7 @@ def hide_action(player, action)
show_action(player, PlayerAction.new(action.slot, action.primary, 'null'))
end
# Monkey-patch Player to provide action utility methods.
class Player
def actions
@@ -54,8 +54,8 @@ class Player
actions[action.slot] = action.name
end
def has_action(action)
def action?(action)
actions[action.slot] == action.name
end
end
end
+2 -2
View File
@@ -1,6 +1,6 @@
java_import 'org.apollo.game.model.entity.Player'
on :login do |event, player|
on :login do |_event, player|
show_action(player, TRADE_ACTION)
show_action(player, FOLLOW_ACTION)
end
end
+2 -2
View File
@@ -8,8 +8,8 @@
<author>Ryley</author>
</authors>
<scripts>
<script>player-action.rb</script>
<script>action.rb</script>
<script>login.rb</script>
</scripts>
<dependencies />
</plugin>
</plugin>