redblockstore

This commit is contained in:
Chiss 2013-11-23 10:04:37 +11:00
parent 189b22ab4c
commit 3a3ac9f8ce

View File

@ -90,6 +90,8 @@ public class HungerGames extends SoloGame
private HashMap<Player, Long> _redOutTime = new HashMap<Player, Long>();
private ArrayList<BlockChange> _redQueue = new ArrayList<BlockChange>();
private HashMap<Integer, HashMap<Integer, HashSet<Integer>>> _redMap = new HashMap<Integer, HashMap<Integer, HashSet<Integer>>>();
//Supply Drop
private ArrayList<Location> _supplyLocations = new ArrayList<Location>();
@ -680,9 +682,18 @@ public class HungerGames extends SoloGame
public void RedChangeBlock(Location loc, int id, byte data)
{
MapUtil.ChunkBlockChange(loc, id, data);
//Save Red
if (!_redMap.containsKey(loc.getBlockX()))
_redMap.put(loc.getBlockX(), new HashMap<Integer, HashSet<Integer>>());
if (!_redMap.get(loc.getBlockX()).containsKey(loc.getBlockY()))
_redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet<Integer>());
_redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ());
//Queue Disabled
//_redQueue.add(new BlockChange(loc, id, data));
for (Player player : UtilServer.getPlayers())
{
if (player.getLocation().getChunk().getX() - loc.getChunk().getX() > UtilServer.getServer().getViewDistance())
@ -700,6 +711,9 @@ public class HungerGames extends SoloGame
{
if (event.getType() != UpdateType.SEC)
return;
if (_redQueue.isEmpty())
return;
/** TYPE A **/
@ -750,13 +764,22 @@ public class HungerGames extends SoloGame
public boolean IsRed(Block block)
{
if (!_redMap.containsKey(block.getX()))
return false;
if (!_redMap.get(block.getX()).containsKey(block.getY()))
return false;
return _redMap.get(block.getX()).get(block.getY()).contains(block.getZ());
/*
for (Entry<Integer,Integer> entry : _spreadTypeBlocks)
{
if (block.getTypeId() == entry.getKey() && block.getData() == entry.getValue())
return true;
}
return false;
return false;*/
}
public void SetRed(Location loc)