mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 16:49:11 +00:00
Recursive plugin loading.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<plugin>
|
||||
<id>cmd-teleport</id>
|
||||
<version>1</version>
|
||||
<name>Teleport Commands</name>
|
||||
<description>Adds ::pos and ::tele commands.</description>
|
||||
<authors>
|
||||
<author>Graham</author>
|
||||
</authors>
|
||||
<scripts>
|
||||
<script>teleport.rb</script>
|
||||
</scripts>
|
||||
<dependencies />
|
||||
</plugin>
|
||||
@@ -0,0 +1,20 @@
|
||||
require 'java'
|
||||
java_import 'org.apollo.game.model.Position'
|
||||
|
||||
on :command, :pos, RIGHTS_MOD do |player, command|
|
||||
player.send_message("You are at: #{player.position}")
|
||||
end
|
||||
|
||||
on :command, :tele, RIGHTS_ADMIN do |player, command|
|
||||
args = command.arguments
|
||||
unless (2..3).include?(args.length)
|
||||
player.send_message("Invalid syntax - ::tele [x] [y] [optional-z]")
|
||||
return
|
||||
end
|
||||
|
||||
x = args[0].to_i
|
||||
y = args[1].to_i
|
||||
z = args.length == 3 ? args[2].to_i : player.position.height
|
||||
|
||||
player.teleport Position.new(x, y, z) if (0..4).include?(z)
|
||||
end
|
||||
Reference in New Issue
Block a user