Created
February 6, 2012 22:25
-
-
Save mlooney/1755405 to your computer and use it in GitHub Desktop.
Zap!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bofh | |
include Purugin::Plugin, Purugin::Colors | |
description 'Bofh', 0.1 | |
player_command("zap", "zap player with lightning", "/zap") do |me, *args| | |
player = me.world.players.select {|x| x.name.downcase == args.first.downcase}.pop | |
if player | |
me.world.strikeLightning(player.location) | |
else | |
me.msg yellow("couldn't find player #{args.first}") | |
end | |
end | |
player_command("warn", "warn player with lightning", "/warn") do |me, *args| | |
player = me.world.players.select {|x| x.name.downcase == args.first.downcase}.pop | |
if player | |
me.world.strikeLightningEffect(player.location) | |
player.msg red("srsly dood, knock it off.") | |
else | |
me.msg yellow("couldn't find player #{args.first}") | |
end | |
end | |
player_command('tele', 'send player to arbitrary location', '/tele')do |me, *args| | |
me.msg yellow(args.inspect) | |
player = me.world.players.select {|x| x.name.downcase == args.first.downcase} | |
if player = player.first | |
x, y, z = player.location.x, player.location.y, player.location.z | |
me.msg yellow("Found player %s, at %f,%f,%f"%[player.name, x,y,z]) | |
dest = args.pop.strip | |
unless dest.empty? | |
dx,dy,dz = dest.split(',').map(&:strip) | |
me.msg yellow("Zapping to %f,%f,%f"%[dx,dy,dz]) | |
player.teleport(org.bukkit.Location.new(player.world, dx.to_f, dy.to_f, dz.to_f)) unless dx.empty? or dy.empty? or dz.empty? | |
else | |
me.msg yellow("couldn't find dest args.") | |
end | |
else | |
me.msg("couldn't find player #{player}") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment