Now using automated help. Fixed SeeChunk issues.
This commit is contained in:
@ -18,10 +18,19 @@ import org.bukkit.entity.Player;
|
||||
public class VisualizeUtil
|
||||
{
|
||||
protected static Map<String, Set<Location>> playerLocations = new HashMap<String, Set<Location>>();
|
||||
|
||||
public static void onPlayerPreLogin(String name)
|
||||
public static Set<Location> getPlayerLocations(Player player)
|
||||
{
|
||||
playerLocations.put(name, new HashSet<Location>());
|
||||
return getPlayerLocations(player.getName());
|
||||
}
|
||||
public static Set<Location> getPlayerLocations(String playerName)
|
||||
{
|
||||
Set<Location> ret = playerLocations.get(playerName);
|
||||
if (ret == null)
|
||||
{
|
||||
ret = new HashSet<Location>();
|
||||
playerLocations.put(playerName, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -30,13 +39,13 @@ public class VisualizeUtil
|
||||
|
||||
public static void addLocation(Player player, Location location, int typeId, byte data)
|
||||
{
|
||||
playerLocations.get(player.getName()).add(location);
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, typeId, data);
|
||||
}
|
||||
|
||||
public static void addLocation(Player player, Location location, int typeId)
|
||||
{
|
||||
playerLocations.get(player.getName()).add(location);
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, typeId, (byte) 0);
|
||||
}
|
||||
|
||||
@ -46,7 +55,7 @@ public class VisualizeUtil
|
||||
|
||||
public static void addLocations(Player player, Map<Location, Integer> locationMaterialIds)
|
||||
{
|
||||
Set<Location> ploc = playerLocations.get(player.getName());
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Entry<Location, Integer> entry : locationMaterialIds.entrySet())
|
||||
{
|
||||
ploc.add(entry.getKey());
|
||||
@ -56,7 +65,7 @@ public class VisualizeUtil
|
||||
|
||||
public static void addLocations(Player player, Collection<Location> locations, int typeId)
|
||||
{
|
||||
Set<Location> ploc = playerLocations.get(player.getName());
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Location location : locations)
|
||||
{
|
||||
ploc.add(location);
|
||||
@ -66,7 +75,7 @@ public class VisualizeUtil
|
||||
|
||||
public static void addBlocks(Player player, Collection<Block> blocks, int typeId)
|
||||
{
|
||||
Set<Location> ploc = playerLocations.get(player.getName());
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Block block : blocks)
|
||||
{
|
||||
Location location = block.getLocation();
|
||||
@ -81,14 +90,14 @@ public class VisualizeUtil
|
||||
|
||||
public static void clear(Player player)
|
||||
{
|
||||
Set<Location> locations = playerLocations.get(player.getName());
|
||||
Set<Location> locations = getPlayerLocations(player);
|
||||
if (locations == null) return;
|
||||
for (Location location : locations)
|
||||
{
|
||||
Block block = location.getWorld().getBlockAt(location);
|
||||
player.sendBlockChange(location, block.getTypeId(), block.getData());
|
||||
}
|
||||
playerLocations.remove(player);
|
||||
locations.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user