1 |
package dk.thoerup.bukkit.waterworld; |
2 |
|
3 |
import org.bukkit.ChatColor; |
4 |
import org.bukkit.Location; |
5 |
import org.bukkit.World; |
6 |
import org.bukkit.command.Command; |
7 |
import org.bukkit.command.CommandExecutor; |
8 |
import org.bukkit.command.CommandSender; |
9 |
import org.bukkit.entity.Player; |
10 |
|
11 |
public class WaterTeleportCommand implements CommandExecutor { |
12 |
|
13 |
@Override |
14 |
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { |
15 |
|
16 |
if (!(sender instanceof Player)) { // it's not a console command |
17 |
return false; |
18 |
} |
19 |
|
20 |
Player p = (Player) sender; |
21 |
|
22 |
if (!p.hasPermission("waterworld.tp") ) { |
23 |
p.sendMessage("You don't have permission to TP directly into WaterWorld"); |
24 |
return true; |
25 |
} |
26 |
|
27 |
World water = sender.getServer().getWorld("world_water"); |
28 |
|
29 |
Location dest = new Location(water, 0, 65,0); |
30 |
|
31 |
p.teleport( dest ); |
32 |
|
33 |
return true; |
34 |
} |
35 |
} |