From 3a3ac9f8ce4eac1abdd187b250fbdb784990570f Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 23 Nov 2013 10:04:37 +1100 Subject: [PATCH] redblockstore --- .../game/games/hungergames/HungerGames.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index f3ae45fc1..0f05da4d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -90,6 +90,8 @@ public class HungerGames extends SoloGame private HashMap _redOutTime = new HashMap(); private ArrayList _redQueue = new ArrayList(); + + private HashMap>> _redMap = new HashMap>>(); //Supply Drop private ArrayList _supplyLocations = new ArrayList(); @@ -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>()); + if (!_redMap.get(loc.getBlockX()).containsKey(loc.getBlockY())) + _redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet()); + + _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 entry : _spreadTypeBlocks) { if (block.getTypeId() == entry.getKey() && block.getData() == entry.getValue()) return true; } - return false; + return false;*/ } public void SetRed(Location loc)