1 |
package dk.thoerup.bukkit.hoeruputils; |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
|
3 |
import org.bukkit.Location; |
import org.bukkit.ChatColor; |
|
import org.bukkit.World; |
|
4 |
import org.bukkit.command.Command; |
import org.bukkit.command.Command; |
5 |
import org.bukkit.command.CommandExecutor; |
import org.bukkit.command.CommandExecutor; |
6 |
import org.bukkit.command.CommandSender; |
import org.bukkit.command.CommandSender; |
27 |
return true; |
return true; |
28 |
} |
} |
29 |
|
|
30 |
|
@SuppressWarnings("deprecation")//user by name is our only option here |
31 |
Player source = p.getServer().getPlayer( args[0] ); |
Player source = p.getServer().getPlayer( args[0] ); |
|
|
|
32 |
if (source == null) { |
if (source == null) { |
33 |
p.sendMessage("Could not find source: " + args[0]); |
p.sendMessage("Could not find source: " + args[0]); |
34 |
return true; |
return true; |
35 |
} |
} |
36 |
|
|
37 |
|
@SuppressWarnings("deprecation")//user by name is our only option here |
38 |
Player dest = p.getServer().getPlayer( args[1] ); |
Player dest = p.getServer().getPlayer( args[1] ); |
39 |
if (dest == null) { |
if (dest == null) { |
40 |
p.sendMessage("Could not find destination: " + args[1]); |
p.sendMessage("Could not find destination: " + args[1]); |
45 |
p.sendMessage("you can't tp a player to himself"); |
p.sendMessage("you can't tp a player to himself"); |
46 |
return true; |
return true; |
47 |
} |
} |
48 |
|
dest.sendMessage( ChatColor.GRAY + source.getName() + " was teleported to you."); |
49 |
|
source.sendMessage( ChatColor.GRAY + "You was teleported to " + dest.getName() ); |
50 |
|
|
51 |
|
if (p != source && p != dest) { |
52 |
|
p.sendMessage( ChatColor.GRAY + source.getName() + " was teleported to " + dest.getName() ); |
53 |
|
} |
54 |
|
|
55 |
source.teleport( dest ); |
source.teleport( dest ); |
56 |
|
|
57 |
return true; |
return true; |