Add default and none respawn styles

This commit is contained in:
Eric Stokes 2011-06-30 21:07:48 -06:00
parent 81315ba7a4
commit c43362bb5e

View File

@ -59,9 +59,9 @@ public class MVPlayerListener extends PlayerListener {
* Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias. * Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
*/ */
if (this.plugin.configMV.getBoolean("worldnameprefix", true)) { if (this.plugin.configMV.getBoolean("worldnameprefix", true)) {
String world = event.getPlayer().getWorld().getName(); String world = event.getPlayer().getWorld().getName();
String prefix = ""; String prefix = "";
// If we're not a MV world, don't do anything // If we're not a MV world, don't do anything
@ -70,9 +70,9 @@ public class MVPlayerListener extends PlayerListener {
} }
MVWorld mvworld = this.plugin.getMVWorld(world); MVWorld mvworld = this.plugin.getMVWorld(world);
prefix = mvworld.getColoredWorldString(); prefix = mvworld.getColoredWorldString();
String format = event.getFormat(); String format = event.getFormat();
event.setFormat("[" + prefix + "]" + format); event.setFormat("[" + prefix + "]" + format);
} }
} }
@ -84,10 +84,25 @@ public class MVPlayerListener extends PlayerListener {
// TODO: Handle Alternate Respawn from config // TODO: Handle Alternate Respawn from config
MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer()); MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer());
Location newrespawn = ps.getRespawnWorld().getSpawnLocation(); //Location newrespawn = ps.getRespawnWorld().getSpawnLocation();
MVRespawnEvent mvevent = new MVRespawnEvent(newrespawn, event.getPlayer(), this.plugin.configMV.getString("notchrespawnstyle", "none")); Location newrespawn = event.getPlayer().getWorld().getSpawnLocation();
this.plugin.getServer().getPluginManager().callEvent(mvevent); String respawnStyle = this.plugin.configMV.getString("notchrespawnstyle", "none");
event.setRespawnLocation(mvevent.getPlayersRespawnLocation()); String defaultWorld = this.plugin.configMV.getString("defaultspawnworld", "world");
if (respawnStyle.equalsIgnoreCase("none")) {
event.setRespawnLocation(newrespawn);
} else if (respawnStyle.equalsIgnoreCase("default")) {
if(this.plugin.isMVWorld(defaultWorld)) {
event.setRespawnLocation(this.plugin.getServer().getWorld(defaultWorld).getSpawnLocation());
} else {
event.setRespawnLocation(newrespawn);
}
} else {
MVRespawnEvent mvevent = new MVRespawnEvent(newrespawn, event.getPlayer(), respawnStyle);
this.plugin.getServer().getPluginManager().callEvent(mvevent);
event.setRespawnLocation(mvevent.getPlayersRespawnLocation());
}
} }
@Override @Override