From aaee5f01cecb9bb3baaa733acb1d1fe14dbfa4fb Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 17 Jul 2015 00:30:34 +1200 Subject: [PATCH] Clans: Modifications to map stuff, fix food level depleting too fast --- .../src/mineplex/game/clans/clans/ClansGame.java | 7 +++++++ .../mineplex/game/clans/clans/map/ItemMapManager.java | 2 ++ .../mineplex/game/clans/clans/map/ItemMapRenderer.java | 9 ++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 5b0a0ea4b..27e4829ee 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -21,6 +21,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -169,6 +170,12 @@ public class ClansGame extends MiniPlugin } + @EventHandler + public final void onFoodLevelChangeEvent(FoodLevelChangeEvent event) + { + ((Player) event.getEntity()).setSaturation(3.8F); // While not entirely accurate, this is a pretty good guess at original food level changes + } + @EventHandler(priority = EventPriority.LOW) public void BlockBreak(BlockBreakEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java index 5ebff8a0c..7acee719f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java @@ -519,6 +519,8 @@ public class ItemMapManager extends MiniPlugin || item.getDurability() > _mapId + 100) return; + event.setCancelled(true); + Player player = event.getPlayer(); MapInfo info = getMap(player); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java index 2a3926a6a..98319b42a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java @@ -77,6 +77,7 @@ public class ItemMapRenderer extends MapRenderer if (owningClan != null) { + boolean colorAll = scale > 0; Color clanColor = null; if (owningClan == clan) @@ -87,6 +88,8 @@ public class ItemMapRenderer extends MapRenderer { if (owningClan.isAdmin()) { + colorAll = false; + if (owningClan.getName().equals("Shops") || owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; @@ -121,7 +124,7 @@ public class ItemMapRenderer extends MapRenderer int chunkX1 = (int) Math.floor(blockX / 16D); int chunkZ1 = (int) Math.floor(blockZ / 16D); - if ( + if (colorAll || ((chunkBX == 0 || zoom == 13) && @@ -140,7 +143,7 @@ public class ItemMapRenderer extends MapRenderer owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) { Color cColor = MapPalette.getColor(color); - double clans = 0.65; + double clans = colorAll ? 1 : 0.8;// 0.65; double base = 1 - clans; int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans)); @@ -153,7 +156,7 @@ public class ItemMapRenderer extends MapRenderer { Color cColor = MapPalette.getColor(color); - double clans = 0.4; + double clans = 0.65;// 0.4; double base = 1 - clans; int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans));