Update existing plugins to use the new utils plugin.

This commit is contained in:
Major-
2014-08-09 17:12:25 +01:00
parent 17975206cb
commit c162705cd4
16 changed files with 79 additions and 98 deletions
+7 -15
View File
@@ -2,13 +2,10 @@ require 'java'
java_import 'org.apollo.game.model.def.ItemDefinition'
# Adds the specified item to the player's own inventory.
# Adds the specified item to the player's inventory.
on :command, :item, RIGHTS_ADMIN do |player, command|
args = command.arguments
unless (1..2).include? args.length
player.send_message('Invalid syntax - ::item [id] [amount]')
next
end
next unless valid_arg_length(args, (1..2), player, 'Invalid syntax - ::item [id] [amount]')
id = args[0].to_i
amount = args.length == 2 ? args[1].to_i : 1
@@ -20,13 +17,10 @@ on :command, :item, RIGHTS_ADMIN do |player, command|
player.inventory.add(id, amount)
end
# Removes the specified item from the player's own inventory.
# Removes the specified item from the player's inventory.
on :command, :remove, RIGHTS_MOD do |player, command|
args = command.arguments
unless (1..2).include? args.length
player.send_message('Invalid syntax - ::remove [id] [amount]')
next
end
next unless valid_arg_length(args, (1..2), player, 'Invalid syntax - ::remove [id] [amount]')
id = args[0].to_i
amount = args.length == 2 ? args[1].to_i : 1
@@ -38,14 +32,12 @@ on :command, :remove, RIGHTS_MOD do |player, command|
player.inventory.remove(id, amount)
end
# Clears the player's own inventory.
# Clears the player's inventory.
on :command, :empty, RIGHTS_MOD do |player, command|
player.inventory.clear
end
# Gives the player one thousand of each rune.
# Gives the player 1,000 of each rune.
on :command, :runes, RIGHTS_ADMIN do |player, command|
(554..566).each do |i|
player.inventory.add(i, 1000)
end
(554..566).each { |item| player.inventory.add(item, 1000) }
end