From 7e3cab9c87ba5d124f3c88426a87539b199e2fa3 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 09:57:47 +1100 Subject: [PATCH 01/13] map test --- .../game/clans/clans/map/ItemMapRenderer.java | 73 ++++++++++++------- 1 file changed, 47 insertions(+), 26 deletions(-) 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 504a029aa..98a7831f6 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 @@ -86,7 +86,8 @@ public class ItemMapRenderer extends MapRenderer { boolean colorAll = scale > 0; Color clanColor = null; - + Color clanColor2 = null; + if (owningClan == clan) { clanColor = Color.CYAN; @@ -94,18 +95,30 @@ public class ItemMapRenderer extends MapRenderer else { ClansUtility.ClanRelation relation = _manager.getClansUtility().rel(clan, owningClan); - + if (owningClan.isAdmin()) { colorAll = false; - if (owningClan.getName().equals("Shops") || owningClan.getName().equals("Spawn")) + if (owningClan.getName().equals("Shops")) + { + clanColor = Color.WHITE; + + if (relation == ClansUtility.ClanRelation.SAFE) + clanColor2 = Color.CYAN; + } + else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; } + if (owningClan.getName().equals("Fields")) + { + clanColor = Color.WHITE; + clanColor2 = Color.ORANGE; + } else { - clanColor = Color.GRAY; + clanColor = Color.LIGHT_GRAY; } } else if (relation == ClansUtility.ClanRelation.WAR_LOSING) @@ -138,34 +151,42 @@ public class ItemMapRenderer extends MapRenderer int chunkX1 = (int) Math.floor(blockX / 16D); int chunkZ1 = (int) Math.floor(blockZ / 16D); + //Checkin' + boolean checker = (mapX + (mapZ % 3)) % 3 == 0; + Color drawColor = clanColor; + if (checker && clanColor2 == null) + drawColor = clanColor2; + + //Inside if (colorAll || - ((chunkBX == 0 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1)) - - || ((chunkBZ == 0 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1))) - - || ((chunkBX + zoom > 15 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1)) - - || ((chunkBZ + zoom > 15 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) + ((chunkBX == 0 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1)) + + || ((chunkBZ == 0 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1))) + + || ((chunkBX + zoom > 15 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1)) + + || ((chunkBZ + zoom > 15 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) { Color cColor = MapPalette.getColor(color); double clans = colorAll ? 1 : 0.8;// 0.65; double base = 1 - clans; - - int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans)); - int b = (int) ((cColor.getBlue() * base) + (clanColor.getBlue() * clans)); - int g = (int) ((cColor.getGreen() * base) + (clanColor.getGreen() * clans)); + + int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); color = MapPalette.matchColor(r, g, b); } + //Border else { Color cColor = MapPalette.getColor(color); @@ -173,9 +194,9 @@ public class ItemMapRenderer extends MapRenderer double clans = 0.65;// 0.4; double base = 1 - clans; - int r = (int) ((cColor.getRed() * base) + (clanColor.getRed() * clans)); - int b = (int) ((cColor.getBlue() * base) + (clanColor.getBlue() * clans)); - int g = (int) ((cColor.getGreen() * base) + (clanColor.getGreen() * clans)); + int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); color = MapPalette.matchColor(r, g, b); } From 58d7e8562bcd478a8130dda33ff8d21ab9b096f5 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 29 Nov 2015 17:58:29 -0500 Subject: [PATCH 02/13] update clans version for next release --- Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 26307cfa1..0e35252e8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; public class Clans extends JavaPlugin { - public static final String VERSION = "0.14"; + public static final String VERSION = "0.16"; private String WEB_CONFIG = "webServer"; // Modules From af77a2ddeb5fca02f178bc77475874a4af47e1da Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:03:27 +1100 Subject: [PATCH 03/13] fix --- .../src/mineplex/game/clans/clans/map/ItemMapRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 98a7831f6..a1e264b4d 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 @@ -154,7 +154,7 @@ public class ItemMapRenderer extends MapRenderer //Checkin' boolean checker = (mapX + (mapZ % 3)) % 3 == 0; Color drawColor = clanColor; - if (checker && clanColor2 == null) + if (checker && clanColor2 != null) drawColor = clanColor2; //Inside From a886088f486802153df5271e1644518ec08af854 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:15:50 +1100 Subject: [PATCH 04/13] more changes --- .../game/clans/clans/map/ItemMapRenderer.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) 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 a1e264b4d..841d703b2 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 @@ -103,18 +103,17 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.getName().equals("Shops")) { clanColor = Color.WHITE; - - if (relation == ClansUtility.ClanRelation.SAFE) - clanColor2 = Color.CYAN; + clanColor2 = Color.CYAN; } else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; + clanColor2 = Color.GREEN; } if (owningClan.getName().equals("Fields")) { clanColor = Color.WHITE; - clanColor2 = Color.ORANGE; + clanColor2 = Color.RED; } else { @@ -151,12 +150,7 @@ public class ItemMapRenderer extends MapRenderer int chunkX1 = (int) Math.floor(blockX / 16D); int chunkZ1 = (int) Math.floor(blockZ / 16D); - //Checkin' - boolean checker = (mapX + (mapZ % 3)) % 3 == 0; - Color drawColor = clanColor; - if (checker && clanColor2 != null) - drawColor = clanColor2; - + //Inside if (colorAll || @@ -178,6 +172,16 @@ public class ItemMapRenderer extends MapRenderer { Color cColor = MapPalette.getColor(color); double clans = colorAll ? 1 : 0.8;// 0.65; + + //Stripes + boolean checker = (mapX + (mapZ % 3)) % 3 == 0; + Color drawColor = clanColor; + if (checker && clanColor2 != null) + { + drawColor = clanColor2; + clans = 0.65; + } + double base = 1 - clans; int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); @@ -192,6 +196,14 @@ public class ItemMapRenderer extends MapRenderer Color cColor = MapPalette.getColor(color); double clans = 0.65;// 0.4; + + //Use clanColor2 no matter what for admins + Color drawColor = clanColor; + if (owningClan.isAdmin() && clanColor2 != null) + { + drawColor = clanColor2; + } + double base = 1 - clans; int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); From cd6ecc1e67774b8aa69cf909f2863c29ea9d60eb Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:20:27 +1100 Subject: [PATCH 05/13] pt! --- .../src/mineplex/game/clans/clans/map/ItemMapRenderer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 841d703b2..2e8e54e22 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 @@ -99,11 +99,13 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.isAdmin()) { colorAll = false; - + if (owningClan.getName().equals("Shops")) { clanColor = Color.WHITE; - clanColor2 = Color.CYAN; + + if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) + clanColor2 = Color.CYAN; } else if (owningClan.getName().equals("Spawn")) { From e27808a0113410fef7d531d524583bc54968ae88 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:26:07 +1100 Subject: [PATCH 06/13] map! --- .../game/clans/clans/map/ItemMapRenderer.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 2e8e54e22..fd2342c0d 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 @@ -152,8 +152,7 @@ public class ItemMapRenderer extends MapRenderer int chunkX1 = (int) Math.floor(blockX / 16D); int chunkZ1 = (int) Math.floor(blockZ / 16D); - - //Inside + //Border if (colorAll || ((chunkBX == 0 || zoom == 13) && @@ -175,13 +174,11 @@ public class ItemMapRenderer extends MapRenderer Color cColor = MapPalette.getColor(color); double clans = colorAll ? 1 : 0.8;// 0.65; - //Stripes - boolean checker = (mapX + (mapZ % 3)) % 3 == 0; + //Use clanColor2 no matter what for admins Color drawColor = clanColor; - if (checker && clanColor2 != null) + if (owningClan.isAdmin() && clanColor2 != null) { drawColor = clanColor2; - clans = 0.65; } double base = 1 - clans; @@ -192,18 +189,23 @@ public class ItemMapRenderer extends MapRenderer color = MapPalette.matchColor(r, g, b); } - //Border + + + + //Inside else { Color cColor = MapPalette.getColor(color); double clans = 0.65;// 0.4; - //Use clanColor2 no matter what for admins + //Stripes + boolean checker = (mapX + (mapZ % 3)) % 3 == 0; Color drawColor = clanColor; - if (owningClan.isAdmin() && clanColor2 != null) + if (checker && clanColor2 != null) { drawColor = clanColor2; + clans = colorAll ? 1 : 0.8; } double base = 1 - clans; From 18b603ec2fa9298b2bb1283fb2e04ad5b38e5c5b Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:33:08 +1100 Subject: [PATCH 07/13] map color changes --- .../mineplex/game/clans/clans/map/ItemMapRenderer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 fd2342c0d..cc30a1a25 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 @@ -103,9 +103,10 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.getName().equals("Shops")) { clanColor = Color.WHITE; + clanColor2 = Color.CYAN; if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) - clanColor2 = Color.CYAN; + clanColor = Color.CYAN; } else if (owningClan.getName().equals("Spawn")) { @@ -115,11 +116,12 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.getName().equals("Fields")) { clanColor = Color.WHITE; - clanColor2 = Color.RED; + clanColor2 = Color.ORANGE; } else { - clanColor = Color.LIGHT_GRAY; + clanColor = Color.WHITE; + clanColor2 = Color.GRAY; } } else if (relation == ClansUtility.ClanRelation.WAR_LOSING) From 2ac21b14349078751b4571d766ce8c572e47fb2e Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:40:57 +1100 Subject: [PATCH 08/13] better colors --- .../mineplex/game/clans/clans/map/ItemMapRenderer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 cc30a1a25..09014c833 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 @@ -103,20 +103,20 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.getName().equals("Shops")) { clanColor = Color.WHITE; - clanColor2 = Color.CYAN; + clanColor2 = new Color(50, 150, 255); if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) - clanColor = Color.CYAN; + clanColor = new Color(100, 200, 255); } else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; - clanColor2 = Color.GREEN; + clanColor2 = new Color(0, 255, 100); } - if (owningClan.getName().equals("Fields")) + else if (owningClan.getName().equals("Fields")) { clanColor = Color.WHITE; - clanColor2 = Color.ORANGE; + clanColor2 = new Color(255, 120, 0); } else { From 0f79b5814f38fd289e846054103e8055c0d215dc Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 10:52:44 +1100 Subject: [PATCH 09/13] more color f ixes --- .../mineplex/game/clans/clans/map/ItemMapRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 09014c833..7760c1628 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 @@ -106,12 +106,12 @@ public class ItemMapRenderer extends MapRenderer clanColor2 = new Color(50, 150, 255); if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) - clanColor = new Color(100, 200, 255); + clanColor2 = new Color(50, 150, 255); } else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; - clanColor2 = new Color(0, 255, 100); + clanColor2 = new Color(50, 255, 150); } else if (owningClan.getName().equals("Fields")) { @@ -199,10 +199,10 @@ public class ItemMapRenderer extends MapRenderer { Color cColor = MapPalette.getColor(color); - double clans = 0.65;// 0.4; + double clans = 0.04; //Stripes - boolean checker = (mapX + (mapZ % 3)) % 3 == 0; + boolean checker = (mapX + (mapZ % 4)) % 4 == 0; Color drawColor = clanColor; if (checker && clanColor2 != null) { From 02bc7ffab6739fc6fe63382a30c6ef2171030193 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 30 Nov 2015 11:17:23 +1100 Subject: [PATCH 10/13] map changes --- .../mineplex/game/clans/clans/map/ItemMapRenderer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 7760c1628..bf85c900d 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 @@ -111,7 +111,7 @@ public class ItemMapRenderer extends MapRenderer else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; - clanColor2 = new Color(50, 255, 150); + clanColor2 = new Color(0, 255, 100); } else if (owningClan.getName().equals("Fields")) { @@ -181,6 +181,7 @@ public class ItemMapRenderer extends MapRenderer if (owningClan.isAdmin() && clanColor2 != null) { drawColor = clanColor2; + clans = 1; } double base = 1 - clans; @@ -199,15 +200,15 @@ public class ItemMapRenderer extends MapRenderer { Color cColor = MapPalette.getColor(color); - double clans = 0.04; + double clans = 0.065; //Stripes boolean checker = (mapX + (mapZ % 4)) % 4 == 0; Color drawColor = clanColor; - if (checker && clanColor2 != null) + if (checker && owningClan.isAdmin() && clanColor2 != null) { drawColor = clanColor2; - clans = colorAll ? 1 : 0.8; + clans = 1; } double base = 1 - clans; From 513810caaad56c5578c503b4b623bf4658683d1d Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 30 Nov 2015 14:26:25 -0600 Subject: [PATCH 11/13] Fixed memory leak in MarkedForDeath --- .../Skill/Assassin/MarkedForDeath.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java index 615508a77..e2ec6e686 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java @@ -197,6 +197,30 @@ public class MarkedForDeath extends SkillActive if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) arrowIterator.remove(); } + + for (Iterator activeIterator = _active.iterator(); activeIterator.hasNext();) + { + Player player = activeIterator.next(); + + if (!player.isOnline()) + activeIterator.remove(); + } + + for (Iterator markedTimeIterator = _markedTime.keySet().iterator(); markedTimeIterator.hasNext();) + { + LivingEntity markedTime = markedTimeIterator.next(); + + if (markedTime.isDead() || !markedTime.isValid()) + markedTimeIterator.remove(); + } + + for (Iterator markedDamageIterator = _markedDamage.keySet().iterator(); markedDamageIterator.hasNext();) + { + LivingEntity markedDamage = markedDamageIterator.next(); + + if (markedDamage.isDead() || !markedDamage.isValid()) + markedDamageIterator.remove(); + } } @Override From 666b9963e4e68286f18f8a3e544895efe4c05f7b Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 30 Nov 2015 17:42:48 -0500 Subject: [PATCH 12/13] Added an utility method in UtilBlock to get an ItemStack from a block and also handles correcting Material types and Data Values. --- .../mineplex/core/common/util/UtilBlock.java | 394 ++++++++++++++++++ 1 file changed, 394 insertions(+) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 0813441f2..642f20998 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -843,4 +843,398 @@ public class UtilBlock return blocks; } + + public static ItemStack blockToInventoryItemStack(Block block) + { + ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData()); + + switch (block.getType()) + { + case SAPLING: + itemStack.setDurability((short) 0); + break; + case WATER: + itemStack.setType(Material.WATER_BUCKET); + itemStack.setDurability((short) 0); + break; + case STATIONARY_WATER: + itemStack.setType(Material.WATER_BUCKET); + itemStack.setDurability((short) 0); + break; + case LAVA: + itemStack.setType(Material.LAVA_BUCKET); + itemStack.setDurability((short) 0); + break; + case STATIONARY_LAVA: + itemStack.setType(Material.LAVA_BUCKET); + itemStack.setDurability((short) 0); + break; + case LOG: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case LEAVES: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case DISPENSER: + itemStack.setDurability((short) 0); + break; + case BED_BLOCK: + itemStack.setType(Material.BED); + itemStack.setDurability((short) 0); + break; + case POWERED_RAIL: + itemStack.setDurability((short) 0); + break; + case DETECTOR_RAIL: + itemStack.setDurability((short) 0); + break; + case PISTON_STICKY_BASE: + itemStack.setDurability((short) 0); + break; + case PISTON_BASE: + itemStack.setDurability((short) 0); + break; + case PISTON_EXTENSION: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case PISTON_MOVING_PIECE: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case DOUBLE_STEP: + itemStack.setType(Material.STEP); + itemStack.setAmount(2); + break; + case STEP: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case TORCH: + itemStack.setDurability((short) 0); + break; + case FIRE: + itemStack.setType(Material.FIREBALL); + itemStack.setDurability((short) 0); + break; + case WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case CHEST: + itemStack.setDurability((short) 0); + break; + case REDSTONE_WIRE: + itemStack.setType(Material.REDSTONE); + itemStack.setDurability((short) 0); + break; + case CROPS: + itemStack.setType(Material.SEEDS); + itemStack.setDurability((short) 0); + break; + case SOIL: + itemStack.setType(Material.DIRT); + itemStack.setDurability((short) 0); + break; + case FURNACE: + itemStack.setDurability((short) 0); + break; + case BURNING_FURNACE: + itemStack.setType(Material.FURNACE); + itemStack.setDurability((short) 0); + break; + case SIGN_POST: + itemStack.setType(Material.SIGN); + itemStack.setDurability((short) 0); + break; + case WOODEN_DOOR: + itemStack.setType(Material.WOOD_DOOR); + itemStack.setDurability((short) 0); + break; + case LADDER: + itemStack.setDurability((short) 0); + break; + case RAILS: + itemStack.setDurability((short) 0); + break; + case COBBLESTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case WALL_SIGN: + itemStack.setType(Material.SIGN); + itemStack.setDurability((short) 0); + break; + case LEVER: + itemStack.setDurability((short) 0); + break; + case STONE_PLATE: + itemStack.setDurability((short) 0); + break; + case IRON_DOOR_BLOCK: + itemStack.setType(Material.IRON_DOOR); + itemStack.setDurability((short) 0); + break; + case WOOD_PLATE: + itemStack.setDurability((short) 0); + break; + case GLOWING_REDSTONE_ORE: + itemStack.setType(Material.REDSTONE_ORE); + break; + case REDSTONE_TORCH_OFF: + itemStack.setType(Material.REDSTONE_TORCH_ON); + itemStack.setDurability((short) 0); + break; + case REDSTONE_TORCH_ON: + itemStack.setDurability((short) 0); + break; + case STONE_BUTTON: + itemStack.setDurability((short) 0); + break; + case SNOW: + itemStack.setAmount(1 + itemStack.getDurability()); + itemStack.setDurability((short) 0); + break; + case CACTUS: + itemStack.setDurability((short) 0); + break; + case SUGAR_CANE_BLOCK: + itemStack.setType(Material.SUGAR_CANE); + itemStack.setDurability((short) 0); + break; + case JUKEBOX: + itemStack.setDurability((short) 0); + break; + case PORTAL: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case CAKE_BLOCK: + itemStack.setType(Material.CAKE); + itemStack.setDurability((short) 0); + break; + case DIODE_BLOCK_OFF: + itemStack.setType(Material.DIODE); + itemStack.setDurability((short) 0); + break; + case DIODE_BLOCK_ON: + itemStack.setType(Material.DIODE); + itemStack.setDurability((short) 0); + break; + case TRAP_DOOR: + itemStack.setDurability((short) 0); + break; + case HUGE_MUSHROOM_1: + itemStack.setDurability((short) 0); + break; + case HUGE_MUSHROOM_2: + itemStack.setDurability((short) 0); + break; + case PUMPKIN_STEM: + itemStack.setType(Material.PUMPKIN_SEEDS); + itemStack.setDurability((short) 0); + break; + case MELON_STEM: + itemStack.setType(Material.MELON_SEEDS); + itemStack.setDurability((short) 0); + break; + case VINE: + itemStack.setDurability((short) 0); + break; + case FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case BRICK_STAIRS: + itemStack.setDurability((short) 0); + break; + case SMOOTH_STAIRS: + itemStack.setDurability((short) 0); + break; + case NETHER_BRICK_STAIRS: + itemStack.setDurability((short) 0); + break; + case NETHER_WARTS: + itemStack.setType(Material.NETHER_STALK); + itemStack.setDurability((short) 0); + break; + case BREWING_STAND: + itemStack.setType(Material.BREWING_STAND_ITEM); + itemStack.setDurability((short) 0); + break; + case CAULDRON: + itemStack.setType(Material.CAULDRON_ITEM); + itemStack.setDurability((short) 0); + break; + case ENDER_PORTAL: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case ENDER_PORTAL_FRAME: + itemStack.setDurability((short) 0); + break; + case REDSTONE_LAMP_ON: + itemStack.setType(Material.REDSTONE_LAMP_OFF); + break; + case WOOD_DOUBLE_STEP: + itemStack.setType(Material.WOOD_STEP); + itemStack.setAmount(2); + break; + case WOOD_STEP: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case COCOA: + itemStack.setType(Material.INK_SACK); + itemStack.setDurability((short) 3); + break; + case SANDSTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case ENDER_CHEST: + itemStack.setDurability((short) 0); + break; + case TRIPWIRE_HOOK: + itemStack.setDurability((short) 0); + break; + case TRIPWIRE: + itemStack.setType(Material.STRING); + itemStack.setDurability((short) 0); + break; + case SPRUCE_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case BIRCH_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case JUNGLE_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case COMMAND: + itemStack.setDurability((short) 0); + break; + case FLOWER_POT: + itemStack.setType(Material.FLOWER_POT_ITEM); + itemStack.setDurability((short) 0); + break; + case CARROT: + itemStack.setType(Material.CARROT_ITEM); + itemStack.setDurability((short) 0); + break; + case POTATO: + itemStack.setType(Material.POTATO_ITEM); + itemStack.setDurability((short) 0); + break; + case WOOD_BUTTON: + itemStack.setDurability((short) 0); + break; + case SKULL: + itemStack.setType(Material.SKULL_ITEM); + break; + case TRAPPED_CHEST: + itemStack.setDurability((short) 0); + break; + case GOLD_PLATE: + itemStack.setDurability((short) 0); + break; + case IRON_PLATE: + itemStack.setDurability((short) 0); + break; + case REDSTONE_COMPARATOR_OFF: + itemStack.setType(Material.REDSTONE_COMPARATOR); + itemStack.setDurability((short) 0); + break; + case REDSTONE_COMPARATOR_ON: + itemStack.setType(Material.REDSTONE_COMPARATOR); + itemStack.setDurability((short) 0); + break; + case DAYLIGHT_DETECTOR: + itemStack.setDurability((short) 0); + break; + case HOPPER: + itemStack.setDurability((short) 0); + break; + case QUARTZ_STAIRS: + itemStack.setDurability((short) 0); + break; + case ACTIVATOR_RAIL: + itemStack.setDurability((short) 0); + break; + case DROPPER: + itemStack.setDurability((short) 0); + break; + case LEAVES_2: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case LOG_2: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case ACACIA_STAIRS: + itemStack.setDurability((short) 0); + break; + case DARK_OAK_STAIRS: + itemStack.setDurability((short) 0); + break; + case IRON_TRAPDOOR: + itemStack.setDurability((short) 0); + break; + case HAY_BLOCK: + itemStack.setDurability((short) 0); + break; + case STANDING_BANNER: + itemStack.setType(Material.BANNER); + itemStack.setDurability((short) 0); + break; + case WALL_BANNER: + itemStack.setType(Material.BANNER); + itemStack.setDurability((short) 0); + break; + case DAYLIGHT_DETECTOR_INVERTED: + itemStack.setType(Material.DAYLIGHT_DETECTOR); + itemStack.setDurability((short) 0); + break; + case RED_SANDSTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case DOUBLE_STONE_SLAB2: + itemStack.setType(Material.STONE_SLAB2); + itemStack.setAmount(2); + break; + case STONE_SLAB2: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case SPRUCE_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case BIRCH_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case JUNGLE_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case DARK_OAK_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case ACACIA_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case SPRUCE_DOOR: + itemStack.setType(Material.SPRUCE_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case BIRCH_DOOR: + itemStack.setType(Material.BIRCH_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case JUNGLE_DOOR: + itemStack.setType(Material.JUNGLE_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case ACACIA_DOOR: + itemStack.setType(Material.ACACIA_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case DARK_OAK_DOOR: + itemStack.setType(Material.DARK_OAK_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + } + + return itemStack; + } } From 7217cd0f333fa44e6affec8c2f0e8afc4c7342fc Mon Sep 17 00:00:00 2001 From: Cheese Date: Tue, 1 Dec 2015 10:44:13 +1100 Subject: [PATCH 13/13] remove conditions upon death --- .../src/nautilus/game/arcade/managers/GameFlagManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 50865ed1a..f0533de91 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -66,6 +66,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; public class GameFlagManager implements Listener @@ -676,6 +677,11 @@ public class GameFlagManager implements Listener final Player player = event.getEntity(); + //Remove all conditions + Manager.GetCondition().EndCondition(player, null, null); + for (PotionEffect potion : player.getActivePotionEffects()) + player.removePotionEffect(potion.getType()); + //Visual Manager.GetCondition().Factory().Blind("Ghost", player, player, 2.5, 0, false, false, false);