mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 10:37:41 +01:00
add /tpr <region id> spawn
This commit is contained in:
parent
ba4907e67b
commit
3a10a0969a
@ -35,36 +35,38 @@ public boolean handle(CommandSender sender, String senderName,
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
ch.checkPermission(sender, "/tpregion");
|
ch.checkPermission(sender, "/tpregion");
|
||||||
ch.checkArgs(args, 1, 1, "/tpregion <region name> ");
|
//ch.checkArgs(args, 1, 1, "/tpregion <region name> ");
|
||||||
//ch.checkArgs(args, 1, 2, "/tpregion <region name> {spawn}");
|
ch.checkArgs(args, 1, 2, "/tpregion <region name> {spawn}");
|
||||||
|
|
||||||
String id = args[0];
|
String id = args[0];
|
||||||
/* Boolean spawn = false;
|
Boolean spawn = false;
|
||||||
if(args.length==2 && args[1].equals("spawn")){
|
if(args.length==2 && args[1].equals("spawn")){
|
||||||
ch.checkPermission(player, "spawn");
|
ch.checkPermission(player, "spawn");
|
||||||
spawn = true;
|
spawn = true;
|
||||||
} */
|
}
|
||||||
RegionManager mgr = wg.getGlobalRegionManager().getRegionManager(player.getWorld().getName());
|
RegionManager mgr = wg.getGlobalRegionManager().getRegionManager(player.getWorld().getName());
|
||||||
ProtectedRegion region = mgr.getRegion(id);
|
ProtectedRegion region = mgr.getRegion(id);
|
||||||
if(region !=null){
|
if(region !=null){
|
||||||
AreaFlags flags = region.getFlags();
|
AreaFlags flags = region.getFlags();
|
||||||
/* if(spawn){
|
Double x,y,z;
|
||||||
Double x =flags.getDoubleFlag("spawn", "x");
|
World world;
|
||||||
Double y =flags.getDoubleFlag("spawn", "y");
|
if(spawn){
|
||||||
Double z =flags.getDoubleFlag("spawn", "z");
|
x =flags.getDoubleFlag("spawn", "x");
|
||||||
World world=wg.getServer().getWorld(flags.getFlag("teleport", "world"));
|
y =flags.getDoubleFlag("spawn", "y");
|
||||||
}else{ */
|
z =flags.getDoubleFlag("spawn", "z");
|
||||||
Double x =flags.getDoubleFlag("teleport", "x");
|
world=wg.getServer().getWorld(flags.getFlag("teleport", "world"));
|
||||||
Double y =flags.getDoubleFlag("teleport", "y");
|
}else{
|
||||||
Double z =flags.getDoubleFlag("teleport", "z");
|
x =flags.getDoubleFlag("teleport", "x");
|
||||||
World world=wg.getServer().getWorld(flags.getFlag("teleport", "world"));
|
y =flags.getDoubleFlag("teleport", "y");
|
||||||
//}
|
z =flags.getDoubleFlag("teleport", "z");
|
||||||
|
world=wg.getServer().getWorld(flags.getFlag("teleport", "world"));
|
||||||
|
}
|
||||||
if(x != null && y !=null && z != null &&world !=null){
|
if(x != null && y !=null && z != null &&world !=null){
|
||||||
Location location = new Location(world, x, y, z);
|
Location location = new Location(world, x, y, z);
|
||||||
player.teleportTo(location);
|
player.teleportTo(location);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
player.sendMessage(ChatColor.RED + "Region: "+id+" has no teleport location assign.");
|
player.sendMessage(ChatColor.RED + "Region: "+id+" has no teleport/spawn location assign.");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
player.sendMessage(ChatColor.RED + "Region: "+id+" not defined");
|
player.sendMessage(ChatColor.RED + "Region: "+id+" not defined");
|
||||||
|
Loading…
Reference in New Issue
Block a user