mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Add comments to teleport, use the conventional ' ' for strings with no interpolation.
This commit is contained in:
@@ -1,14 +1,17 @@
|
|||||||
require 'java'
|
require 'java'
|
||||||
|
|
||||||
java_import 'org.apollo.game.model.Position'
|
java_import 'org.apollo.game.model.Position'
|
||||||
|
|
||||||
|
# Sends the player's position.
|
||||||
on :command, :pos, RIGHTS_MOD do |player, command|
|
on :command, :pos, RIGHTS_MOD do |player, command|
|
||||||
player.send_message("You are at: #{player.position}")
|
player.send_message('You are at: #{player.position}.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Teleports the player to the specified position.
|
||||||
on :command, :tele, RIGHTS_ADMIN do |player, command|
|
on :command, :tele, RIGHTS_ADMIN do |player, command|
|
||||||
args = command.arguments
|
args = command.arguments
|
||||||
unless (2..3).include?(args.length)
|
unless (2..3).include?(args.length)
|
||||||
player.send_message("Invalid syntax - ::tele [x] [y] [optional-z]")
|
player.send_message('Invalid syntax - ::tele [x] [y] [optional-z]')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -16,5 +19,5 @@ on :command, :tele, RIGHTS_ADMIN do |player, command|
|
|||||||
y = args[1].to_i
|
y = args[1].to_i
|
||||||
z = args.length == 3 ? args[2].to_i : player.position.height
|
z = args.length == 3 ? args[2].to_i : player.position.height
|
||||||
|
|
||||||
player.teleport Position.new(x, y, z) if (0..4).include?(z)
|
player.teleport(Position.new(x, y, z) if (0..4).include?(z))
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user