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
+5 -8
View File
@@ -10,12 +10,12 @@ blacklist = []
# Spawns a non-blacklisted npc in the specified position, or the player's position if both 'x' and 'y' are not supplied.
on :command, :spawn, RIGHTS_ADMIN do |player, command|
args = command.arguments
unless [1, 3].include? args.length and (id = args[0].to_i) > -1
unless [1, 3].include?(args.length) and (id = args[0].to_i) > -1
player.send_message('Invalid syntax - ::spawn [npc id] [optional-x] [optional-y]')
return
end
if blacklist.include? id
if blacklist.include?(id)
player.send_message("Sorry, npc #{id} is blacklisted!")
return
end
@@ -28,12 +28,12 @@ end
# Mass spawns npcs around the player.
on :command, :mass, RIGHTS_ADMIN do |player, command|
args = command.arguments
unless args.length == 2 and (id = args[0].to_i) > -1 and (1..5).include? (range = args[1].to_i)
unless args.length == 2 and (id = args[0].to_i) > -1 and (1..5).include?(range = args[1].to_i)
player.send_message('Invalid syntax - ::spawn [npc id] [range (1-5)]')
return
end
if blacklist.include? id
if blacklist.include?(id)
player.send_message("Sorry, npc #{id} is blacklisted!")
return
end
@@ -56,9 +56,6 @@ end
# Unregisters all npcs from the world npc repository.
on :command, :clearnpcs, RIGHTS_ADMIN do |player, command|
iterator = $world.npc_repository.iterator
while iterator.has_next
$world.unregister(iterator.next)
end
$world.npc_repository.each { |npc| $world.unregister(npc) }
player.send_message('Unregistered all npcs from the world.')
end