Trap on bogus world names or player with bad current location

This commit is contained in:
Mike Primm 2011-05-08 22:27:03 -05:00 committed by FrozenCow
parent 95cc3ae869
commit dcdfb3da5d
2 changed files with 8 additions and 5 deletions

View File

@ -15,17 +15,17 @@ public class DynmapPlayerChatListener extends PlayerListener {
@Override @Override
public void onPlayerChat(PlayerChatEvent event) { public void onPlayerChat(PlayerChatEvent event) {
if(event.isCancelled()) return; if(event.isCancelled()) return;
plugin.mapManager.pushUpdate(new Client.ChatMessage("player", event.getPlayer().getDisplayName(), event.getMessage())); plugin.mapManager.pushUpdate(new Client.ChatMessage("player", event.getPlayer().getName(), event.getMessage()));
} }
@Override @Override
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
plugin.mapManager.pushUpdate(new Client.PlayerJoinMessage(event.getPlayer().getDisplayName())); plugin.mapManager.pushUpdate(new Client.PlayerJoinMessage(event.getPlayer().getName()));
} }
@Override @Override
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
plugin.mapManager.pushUpdate(new Client.PlayerQuitMessage(event.getPlayer().getDisplayName())); plugin.mapManager.pushUpdate(new Client.PlayerQuitMessage(event.getPlayer().getName()));
} }
} }

View File

@ -349,11 +349,14 @@ public class DynmapPlugin extends JavaPlugin {
if (args.length > 1) { if (args.length > 1) {
for (int i = 1; i < args.length; i++) { for (int i = 1; i < args.length; i++) {
World w = getServer().getWorld(args[i]); World w = getServer().getWorld(args[i]);
mapManager.renderFullWorld(new Location(w, 0, 0, 0)); if(w != null)
mapManager.renderFullWorld(new Location(w, 0, 0, 0));
} }
return true; return true;
} else if (player != null) { } else if (player != null) {
mapManager.renderFullWorld(player.getLocation()); Location loc = player.getLocation();
if(loc != null)
mapManager.renderFullWorld(loc);
return true; return true;
} }
} }