World-change code for set(lobby)region.

This commit is contained in:
garbagemule 2013-08-15 03:41:21 +02:00
parent a87831a12f
commit b6f81e0823
3 changed files with 31 additions and 8 deletions

View File

@ -1,5 +1,7 @@
package com.garbagemule.MobArena.commands.setup;
import com.garbagemule.MobArena.framework.Arena;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -33,8 +35,18 @@ public class SetLobbyRegionCommand implements Command
Messenger.tellPlayer(sender, "Usage: /ma setlobbyregion l1|l2");
return true;
}
am.getSelectedArena().getRegion().set(arg1, p.getLocation());
Arena arena = am.getSelectedArena();
World aw = arena.getWorld();
World pw = p.getLocation().getWorld();
if (!aw.getName().equals(pw.getName())) {
String msg = String.format("Changing world of arena '%s' from '%s' to '%s'", arena.configName(), aw.getName(), pw.getName());
Messenger.tellPlayer(sender, msg);
}
arena.setWorld(p.getWorld());
arena.getRegion().set(arg1, p.getLocation());
Messenger.tellPlayer(sender, "Lobby region point " + arg1 + " for arena '" + am.getSelectedArena().configName() + "' set.");
return true;
}

View File

@ -1,5 +1,7 @@
package com.garbagemule.MobArena.commands.setup;
import com.garbagemule.MobArena.framework.Arena;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -33,10 +35,20 @@ public class SetRegionCommand implements Command
Messenger.tellPlayer(sender, "Usage: /ma setregion p1|p2");
return true;
}
am.getSelectedArena().getRegion().set(arg1, p.getLocation());
Arena arena = am.getSelectedArena();
World aw = arena.getWorld();
World pw = p.getLocation().getWorld();
if (!aw.getName().equals(pw.getName())) {
String msg = String.format("Changing world of arena '%s' from '%s' to '%s'", arena.configName(), aw.getName(), pw.getName());
Messenger.tellPlayer(sender, msg);
}
arena.setWorld(p.getWorld());
arena.getRegion().set(arg1, p.getLocation());
Messenger.tellPlayer(sender, "Region point " + arg1 + " for arena '" + am.getSelectedArena().configName() + "' set.");
am.getSelectedArena().getRegion().checkData(am.getPlugin(), sender, true, true, false, false);
arena.getRegion().checkData(am.getPlugin(), sender, true, true, false, false);
return true;
}
}

View File

@ -69,9 +69,8 @@ public class SetWarpCommand implements Command
// Notify the player if world changed
if (changeWorld) {
Messenger.tellPlayer(sender, "Changed world of arena '" + arena.configName() +
"' from '" + aw.getName() +
"' to '" + pw.getName() + "'");
String msg = String.format("Changed world of arena '%s' from '%s' to '%s'", arena.configName(), aw.getName(), pw.getName());
Messenger.tellPlayer(sender, msg);
}
// Then notify about point set