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
+20 -13
View File
@@ -7,11 +7,12 @@ java_import 'org.apollo.game.model.entity.Npc'
# An array of npcs that cannot be spawned.
blacklist = []
# Spawns a non-blacklisted npc in the specified position, or the player's position if both 'x' and 'y' are not supplied.
# 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
player.send_message('Invalid syntax - ::spawn [npc id] [optional-x] [optional-y]')
unless [1, 3, 4].include?(args.length) && (id = args[0].to_i) > -1
player.send_message('Invalid syntax - ::spawn [npc id] [optional-x] [optional-y] [optional-z]')
return
end
@@ -20,7 +21,12 @@ on :command, :spawn, RIGHTS_ADMIN do |player, command|
return
end
position = args.length == 1 ? player.position : Position.new(args[1].to_i, args[2].to_i, player.position.height)
if args.length == 1
position = player.position
else
height = args.length == 4 ? args[3].to_i : player.position.height
position = Position.new(args[1].to_i, args[2].to_i, height)
end
$world.register(Npc.new(id, position))
end
@@ -28,7 +34,7 @@ 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 && (id = args[0].to_i) > -1 && (1..5).include?(range = args[1].to_i)
player.send_message('Invalid syntax - ::spawn [npc id] [range (1-5)]')
return
end
@@ -40,22 +46,23 @@ on :command, :mass, RIGHTS_ADMIN do |player, command|
center_position = player.position
minX = center_position.x - range
minY = center_position.y - range
maxX = center_position.x + range
maxY = center_position.y + range
min_x = center_position.x - range
min_y = center_position.y - range
max_x = center_position.x + range
max_y = center_position.y + range
z = center_position.height
for x in minX..maxX do
for y in minY..maxY do
(min_x..max_x).each do |x|
(min_y..max_y).each do |y|
$world.register(Npc.new(id, Position.new(x, y, z)))
end
end
player.send_message("Mass spawning npcs with id #{id}.")
end
# Unregisters all npcs from the world npc repository.
on :command, :clearnpcs, RIGHTS_ADMIN do |player, command|
on :command, :clearnpcs, RIGHTS_ADMIN do |player, _command|
$world.npc_repository.each { |npc| $world.unregister(npc) }
player.send_message('Unregistered all npcs from the world.')
end
end