Report world for players in updates.

This commit is contained in:
FrozenCow 2011-02-15 13:38:46 +01:00
parent 18ad2e1d79
commit 38df91bafe
3 changed files with 9 additions and 5 deletions

View File

@ -11,10 +11,12 @@ public class Client {
public static class Player {
public String type = "player";
public String name;
public String world;
public double x, y, z;
public Player(String name, double x, double y, double z) {
public Player(String name, String world, double x, double y, double z) {
this.name = name;
this.world = world;
this.x = x;
this.y = y;
this.z = z;

View File

@ -108,8 +108,8 @@ public class DynmapPlugin extends JavaPlugin {
public void registerEvents() {
BlockListener blockListener = new DynmapBlockListener(mapManager);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Monitor, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Monitor, this);
PlayerListener playerListener = new DynmapPlayerListener(mapManager, playerList, configuration);
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);

View File

@ -6,6 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -59,11 +60,12 @@ public class ClientUpdateHandler implements HttpHandler {
update.servertime = world.getTime() % 24000;
Player[] players = playerList.getVisiblePlayers(worldName);
Player[] players = playerList.getVisiblePlayers();
update.players = new Client.Player[players.length];
for(int i=0;i<players.length;i++) {
Player p = players[i];
update.players[i] = new Client.Player(p.getName(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
Location pl = p.getLocation();
update.players[i] = new Client.Player(p.getName(), pl.getWorld().getName(), pl.getX(), pl.getY(), pl.getZ());
}
update.updates = mapManager.getWorldUpdates(worldName, since);