From 63cef754f6cda01cc2892a7d8cbe1233fd6d7d59 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 23 Feb 2017 14:57:52 -0300 Subject: [PATCH 01/21] St Patricks outfit --- .../core/cosmetic/ui/page/CostumePage.java | 17 ++- .../mineplex/core/gadget/GadgetManager.java | 13 ++ .../stpatricks/OutfitStPatricksBoots.java | 15 +++ .../OutfitStPatricksChestplate.java | 15 +++ .../stpatricks/OutfitStPatricksHat.java | 15 +++ .../stpatricks/OutfitStPatricksLeggings.java | 15 +++ .../stpatricks/OutfitStPatricksSuit.java | 121 ++++++++++++++++++ .../gadget/set/suits/SetStPatricksSuit.java | 22 ++++ 8 files changed, 227 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksBoots.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksChestplate.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksHat.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksLeggings.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetStPatricksSuit.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 66cb24998..73af59a89 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -1,23 +1,26 @@ package mineplex.core.cosmetic.ui.page; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuit; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuit; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuit; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksSuit; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; /** * Created by shaun on 14-09-15. @@ -42,11 +45,13 @@ public class CostumePage extends GadgetPage OutfitGadget outfitGadget = ((OutfitGadget) gadget); - int offset = 0; + int offset; if (gadget instanceof OutfitRaveSuit) offset = 0; else if (gadget instanceof OutfitSpaceSuit) offset = 1; - else offset = 2; + else if (gadget instanceof OutfitFreezeSuit) offset = 2; + else if (gadget instanceof OutfitStPatricksSuit) offset = 3; + else offset = 4; slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index b326e71e5..912f96dbc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -150,6 +150,10 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; @@ -203,6 +207,7 @@ import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.suits.SetFreezeSuit; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; +import mineplex.core.gadget.set.suits.SetStPatricksSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.BalloonGadget; import mineplex.core.gadget.types.DeathEffectGadget; @@ -312,8 +317,11 @@ public class GadgetManager extends MiniPlugin addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); addSet(new SetFreezeSuit(this)); + addSet(new SetStPatricksSuit(this)); // Hidden in this update //addSet(new SetWindUpSuit(this)); + + // Sets addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -369,6 +377,11 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitFreezeSuitChestplate(this)); addGadget(new OutfitFreezeSuitLeggings(this)); addGadget(new OutfitFreezeSuitBoots(this)); + + addGadget(new OutfitStPatricksHat(this)); + addGadget(new OutfitStPatricksChestplate(this)); + addGadget(new OutfitStPatricksLeggings(this)); + addGadget(new OutfitStPatricksBoots(this)); addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksBoots.java new file mode 100644 index 000000000..27c01b350 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksBoots.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.stpatricks; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitStPatricksBoots extends OutfitStPatricksSuit +{ + + public OutfitStPatricksBoots(GadgetManager manager) + { + super(manager, "St Patrick's Boots", -18, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksChestplate.java new file mode 100644 index 000000000..edc9f75f2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksChestplate.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.stpatricks; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitStPatricksChestplate extends OutfitStPatricksSuit +{ + + public OutfitStPatricksChestplate(GadgetManager manager) + { + super(manager, "St Patrick's Chest", -18, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte) 0); + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksHat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksHat.java new file mode 100644 index 000000000..f1b9a91a6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksHat.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.stpatricks; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitStPatricksHat extends OutfitStPatricksSuit +{ + + public OutfitStPatricksHat(GadgetManager manager) + { + super(manager, "St Patrick's Hat", -18, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksLeggings.java new file mode 100644 index 000000000..6b80314fc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksLeggings.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.stpatricks; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitStPatricksLeggings extends OutfitStPatricksSuit +{ + + public OutfitStPatricksLeggings(GadgetManager manager) + { + super(manager, "St Patrick's Pants", -18, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java new file mode 100644 index 000000000..74a3ff429 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java @@ -0,0 +1,121 @@ +package mineplex.core.gadget.gadgets.outfit.stpatricks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class OutfitStPatricksSuit extends OutfitGadget +{ + + private HashSet _items = new HashSet<>(); + + public OutfitStPatricksSuit(GadgetManager manager, String name, int cost, OutfitGadget.ArmorSlot slot, Material mat, byte data) + { + super(manager, name, UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), cost, slot, mat, data); + setColor(Color.fromRGB(0, 153, 0)); + ItemStack displayItem = new ItemStack(mat, 1, data); + if (displayItem.getItemMeta() instanceof LeatherArmorMeta) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) displayItem.getItemMeta(); + leatherArmorMeta.setColor(Color.fromRGB(0, 153, 0)); + displayItem.setItemMeta(leatherArmorMeta); + } + setDisplayItem(displayItem); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player, message); + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) + { + // Prevents event running 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (!setActive(event.getPlayer())) + return; + + // Drops emeralds + ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); + itemStack.setItemMeta(itemMeta); + Item emerald = event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(emerald); + emerald.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + // Prevents event running 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (event.getType() == UpdateType.TICK) + cleanItems(); + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) + { + // Prevents event running 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + private boolean setActive(Player player) + { + return getSet() != null && getSet().isActive(player); + } + + public void cleanItems() + { + Iterator it = _items.iterator(); + while (it.hasNext()) + { + Item item = it.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + it.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetStPatricksSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetStPatricksSuit.java new file mode 100644 index 000000000..1e04f08f9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetStPatricksSuit.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.set.suits; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings; +import mineplex.core.gadget.types.GadgetSet; + +public class SetStPatricksSuit extends GadgetSet +{ + + public SetStPatricksSuit(GadgetManager manager) + { + super(manager, "St Patrick's Suit", "Placeholder", + manager.getGadget(OutfitStPatricksHat.class), + manager.getGadget(OutfitStPatricksChestplate.class), + manager.getGadget(OutfitStPatricksLeggings.class), + manager.getGadget(OutfitStPatricksBoots.class)); + } + +} From e731a91e40eae64b4870cdc24ef25535585628cb Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 23 Feb 2017 17:35:50 -0300 Subject: [PATCH 02/21] Leprechaun pet --- .../mineplex/core/common/skin/SkinData.java | 1 + .../core/cosmetic/ui/page/PetPage.java | 22 +++++++++++++------ .../src/mineplex/core/pet/PetManager.java | 18 +++++++++++++++ .../src/mineplex/core/pet/PetType.java | 20 ++++++++++++++++- 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index ff803a28b..3e4c49575 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -64,6 +64,7 @@ public class SkinData public final static SkinData TURKEY = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzU3NzM2MTc5MDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzdmYjczMTRkNmY1ZTMzNmVjN2ViNTI1ZGM0ODMzOWNhMjI4ZDk3ODU1MDM3ZDZhNDIwOGZjNzYwNDc1NiJ9fX0=", "eZWi1LOD8ke7MCUAfhspBCnyfCoGM8suFLKtbW6b27CURoRBG3eKIfwLYYeMp3ObjoZ8gCB90s28Qyw5XMzwvvowy9W/b5cYC0OzQ8+GR7tDZoWc28tGqGBM8cmDJIFQgZdceBIIr2lXeAvEJfLbyrus46hPjk8YTiQW2DsBq88BhKIy6Igb1rGqJ1goVERF07b6+/yMdLKCaT8OZFzKLXfo5rY5gr6HLnvsQiNL9aTrl74agXn1GUcP+QVNe7/c9lYmv5vLCBst1YiIPq27NZASZ++Fwyv6+PRlaFZZYtMHVd4UZeYPl7ak1Cdi/1sUcRpkBbJM8AHIrqq0iuXxrLbc6ldQ2cYQKHg9ljIpW/EZanuf6Wgm/LK1JnxXne9GUb/xPzB1EnZ95i8/u9WJa+NixEcfc3pAzDPYncIR8lishFwyBRta6BCG76U3UY2lQr3YD/48AJ49r7+WVU0gOP/h2SDSdAZHEdvkpVJ0w/xA+SevJ7Y7xA5EJ655YMQ0F8f3WUFTf1pFklE5E+fwkMVCWOPw7UMy558IcRSpdWAPPyf8sc7CpDqRk37/vXWRDa+7YBfgskK6B2eXowrzThUOBx+AmDTF3Rv8ZSr1Un0FWGi+GQ5ny7W9dJBMomzyMUbzz9stsCml5XB+6xLP2MD+9lO1bHipKS6qkhtZChE="); public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw="); public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); + public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 503f2897d..e338dc8fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -22,6 +22,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; @@ -165,9 +167,12 @@ public class PetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), - pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", - itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); + ItemStack item = pet.getDisplayItem(); + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName("A"); + item.setItemMeta(itemMeta); + + addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivatePetButton(this, getPlugin().getPetManager())); addGlow(slot); } @@ -194,10 +199,13 @@ public class PetPage extends ShopPageBase //petItem.setType(Material.getMaterial(201)); } }*/ - - addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), - pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", - itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); + + ItemStack item = pet.getDisplayItem(); + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName("A"); + item.setItemMeta(itemMeta); + + addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivatePetButton(pet, this)); //addButton(slot, new ShopItem(petItem, false, false), iButton); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index ce936a333..fb9d96e57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -392,6 +392,24 @@ public class PetManager extends MiniClientPlugin UtilEnt.silence(villager, true); _trueLovePets.put(zombie, new TrueLoveData(player, zombie, villager)); } + else if (petType.equals(PetType.LEPRECHAUN)) + { + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + + UtilEnt.silence(zombie, true); + UtilEnt.ghost(zombie, true, true); + + ItemStack[] armors = new ItemStack[] + { + SkinData.LEPRECHAUN.getSkull(), + ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(1, 153, 0)), + ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(2, 153, 0)), + ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(3, 153, 0)) + }; + + zombie.getEquipment().setArmorContents(armors); + } _activePetOwnerTypes.put(player.getName(), petType); _activePetOwners.put(player.getName(), pet); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index d3aba90ab..fa16e8a11 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -6,6 +6,7 @@ import java.util.Optional; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; import mineplex.core.pet.sales.PetSalesPackage; @@ -30,7 +31,8 @@ public enum PetType BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"), GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), - TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)) + TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), + LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Placeholder") // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") @@ -42,6 +44,7 @@ public enum PetType private final Material _material; private final byte _data; private YearMonth _yearMonth; + private ItemStack _displayItem; PetType(String name, EntityType entityType, int price) { @@ -84,6 +87,12 @@ public enum PetType _yearMonth = yearMonth; } + PetType(String name, EntityType entityType, int price, String lore, ItemStack displayItem) + { + this(name, entityType, price, lore); + _displayItem = displayItem; + } + public String getName() { return _name; @@ -114,6 +123,15 @@ public enum PetType return _data; } + public ItemStack getDisplayItem() + { + if (_displayItem == null) + { + return new ItemStack(_material, _data); + } + return _displayItem; + } + public YearMonth getYearMonth() { return _yearMonth; From 8088cef29f7d080351b360709e4392e38f7f37ba Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 23 Feb 2017 20:12:11 -0300 Subject: [PATCH 03/21] Leprechaun pet fixed --- .../core/cosmetic/ui/page/PetPage.java | 25 +++---------------- .../src/mineplex/core/pet/PetManager.java | 14 ++++------- .../src/mineplex/core/pet/PetType.java | 5 ++-- 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index e338dc8fc..4feb82934 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -169,7 +169,8 @@ public class PetPage extends ShopPageBase ItemStack item = pet.getDisplayItem(); ItemMeta itemMeta = item.getItemMeta(); - itemMeta.setDisplayName("A"); + itemMeta.setDisplayName(C.cGreen + C.Bold + pet.getName() + C.cGreen + " (" + C.cWhite + petName + C.cGreen + ")"); + itemMeta.setLore(itemLore); item.setItemMeta(itemMeta); addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivatePetButton(this, getPlugin().getPetManager())); @@ -180,29 +181,11 @@ public class PetPage extends ShopPageBase { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - /* - ItemStack petItem = ItemStackFactory.Instance.CreateStack(pet.getMaterial(), pet.getData(), 1, - pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore); - - IButton iButton = new ActivatePetButton(pet, this); - - if (pet.equals(PetType.SHULKER)) - { - petItem = UtilItem.getVersionSpecificItem(_player, UtilPlayer.PlayerVersion._1_9, petItem); - if (petItem.getType().equals(Material.BARRIER)) - { - iButton = null; - } - else - { - // Does not set the item stack yet - //petItem.setType(Material.getMaterial(201)); - } - }*/ ItemStack item = pet.getDisplayItem(); ItemMeta itemMeta = item.getItemMeta(); - itemMeta.setDisplayName("A"); + itemMeta.setDisplayName(C.cGreen + C.Bold + pet.getName() + C.cGreen + " (" + C.cWhite + petName + C.cGreen + ")"); + itemMeta.setLore(itemLore); item.setItemMeta(itemMeta); addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivatePetButton(pet, this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index fb9d96e57..fbf972c22 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -398,17 +398,13 @@ public class PetManager extends MiniClientPlugin zombie.setBaby(true); UtilEnt.silence(zombie, true); - UtilEnt.ghost(zombie, true, true); - ItemStack[] armors = new ItemStack[] - { - SkinData.LEPRECHAUN.getSkull(), - ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(1, 153, 0)), - ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(2, 153, 0)), - ItemStackFactory.Instance.createColoredLeatherArmor(0, org.bukkit.Color.fromRGB(3, 153, 0)) - }; + zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - zombie.getEquipment().setArmorContents(armors); + zombie.getEquipment().setHelmet(SkinData.LEPRECHAUN.getSkull()); + zombie.getEquipment().setChestplate(ItemStackFactory.Instance.createColoredLeatherArmor(1, org.bukkit.Color.fromRGB(0, 153, 0))); + zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0))); + zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0))); } _activePetOwnerTypes.put(player.getName(), petType); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index fa16e8a11..52d953443 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -8,6 +8,7 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.skin.SkinData; import mineplex.core.pet.sales.PetSalesPackage; public enum PetType @@ -32,7 +33,7 @@ public enum PetType GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), - LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Placeholder") + LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Placeholder", SkinData.LEPRECHAUN.getSkull()) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") @@ -127,7 +128,7 @@ public enum PetType { if (_displayItem == null) { - return new ItemStack(_material, _data); + return new ItemStack(_material, 1, _data); } return _displayItem; } From a32cb6ab2fe778974ccf8a57bd1e1d3007f1f166 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Feb 2017 19:39:54 -0300 Subject: [PATCH 04/21] Mount --- .../stpatricks/OutfitStPatricksSuit.java | 8 +- .../src/mineplex/core/mount/MountManager.java | 5 +- .../mount/types/MountStPatricksHorse.java | 119 ++++++++++++++++++ .../particleeffects/RainbowTrailEffect.java | 112 +++++++++++++++++ 4 files changed, 238 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java index 74a3ff429..dd3adc971 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java @@ -65,14 +65,14 @@ public class OutfitStPatricksSuit extends OutfitGadget if (!setActive(event.getPlayer())) return; - // Drops emeralds + // Drops gold ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); itemStack.setItemMeta(itemMeta); - Item emerald = event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation().add(0.5, 1.5, 0.5), itemStack); - _items.add(emerald); - emerald.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); + Item gold = event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(gold); + gold.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 869f8e261..6371980f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -35,6 +35,7 @@ import mineplex.core.mount.types.MountMule; import mineplex.core.mount.types.MountNightmareSteed; import mineplex.core.mount.types.MountSlime; import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountStPatricksHorse; import mineplex.core.mount.types.MountTitan; import mineplex.core.mount.types.MountUndead; import mineplex.core.mount.types.MountValentinesSheep; @@ -48,7 +49,7 @@ public class MountManager extends MiniPlugin private DisguiseManager _disguiseManager; private List> _types; - private NautHashMap> _playerActiveMountMap = new NautHashMap>(); + private NautHashMap> _playerActiveMountMap = new NautHashMap<>(); public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, DisguiseManager disguiseManager) { @@ -79,10 +80,10 @@ public class MountManager extends MiniPlugin _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); _types.add(new MountNightmareSteed(this)); - // Hidden in this update _types.add(new MountChicken(this)); _types.add(new MountCake(this)); _types.add(new MountLoveTrain(this)); + _types.add(new MountStPatricksHorse(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java new file mode 100644 index 000000000..7129556b8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -0,0 +1,119 @@ +package mineplex.core.mount.types; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.HorseJumpEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.particleeffects.RainbowTrailEffect; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MountStPatricksHorse extends HorseMount +{ + + private HashSet _items = new HashSet<>(); + private Map, RainbowTrailEffect> _trailMap = new HashMap<>(); + + public MountStPatricksHorse(MountManager manager) + { + super(manager, "St Patrick's Mount", + UtilText.splitLineToArray(UtilText.colorWords("The British might be coming, but with this impressive mount you have nothing to fear.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + Material.FIREWORK, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); + } + + @Override + public void enableCustom(Player player) + { + super.enableCustom(player); + SingleEntityMountData horseData = getActive().get(player); + horseData.getEntity().getInventory().setArmor(new ItemStack(Material.GOLD_BARDING)); + _trailMap.put(horseData, new RainbowTrailEffect(horseData.getEntity(), Manager.getPlugin(), _items)); + _trailMap.get(horseData).start(); + } + + @Override + public void disable(Player player) + { + super.disable(player); + List> toRemove = new ArrayList<>(); + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getOwner().equals(player)) + toRemove.add(horseData); + } + for (SingleEntityMountData horseData : toRemove) + { + _trailMap.get(horseData).stop(); + _trailMap.remove(horseData); + } + } + + @EventHandler + public void horseJump(HorseJumpEvent event) + { + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getEntity().equals(event.getEntity())) + { + if (!Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics")) + { + event.setPower(0f); + event.setCancelled(true); + return; + } + _trailMap.get(horseData).setJumping(true); + } + } + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + cleanItems(); + } + + public void cleanItems() + { + Iterator it = _items.iterator(); + while (it.hasNext()) + { + Item item = it.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + it.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java new file mode 100644 index 000000000..f707165b7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java @@ -0,0 +1,112 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class RainbowTrailEffect extends Effect +{ + + private HashSet _items; + + private Color _color = Color.RED; + private long _count, _jumpingTimer = 0; + private boolean _isJumping = false; + private Entity _entity; + + private Color _red = new Color(255, 0, 0); + private Color _orange = new Color(255, 127, 0); + private Color _yellow = new Color(255, 255, 0); + private Color _green = new Color(0, 255, 0); + private Color _blue = new Color(0, 0, 255); + private Color _indigo = new Color(75, 0, 130); + private Color _violet = new Color(143, 0, 255); + + public RainbowTrailEffect(Entity entity, JavaPlugin javaPlugin, HashSet items) + { + super(-1, new EffectLocation(entity), javaPlugin); + _entity = entity; + _items = items; + } + + @Override + public void runEffect() + { + if (!_entity.isValid() || _entity.isDead()) + { + stop(); + return; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0)); + for (int i = 0; i < 7; i++) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + if (_isJumping) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(.25, .5, 0)); + coloredParticle.display(); + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, .25)); + coloredParticle.display(); + } + } + if (_isJumping) + { + _jumpingTimer++; + if (_jumpingTimer >= 30) + { + setJumping(false); + _jumpingTimer = 0; + } + } + _count++; + if (_count % 5 == 0) + { + if (_color.equals(_red)) + _color = _orange; + else if (_color.equals(_orange)) + _color = _yellow; + else if (_color.equals(_yellow)) + _color = _green; + else if (_color.equals(_green)) + _color = _blue; + else if (_color.equals(_blue)) + _color = _indigo; + else if (_color.equals(_indigo)) + _color = _violet; + else + _color = _red; + } + if (_count == Long.MAX_VALUE - 1) + _count = 0; + } + + public void setJumping(boolean jumping) + { + _isJumping = jumping; + if (_isJumping) + { + ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); + itemStack.setItemMeta(itemMeta); + Item gold = _entity.getWorld().dropItem(_entity.getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(gold); + gold.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); + } + } + +} From b2fd8ac748ca45f591c46290ab5389385f970acf Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Feb 2017 22:06:18 -0300 Subject: [PATCH 05/21] Rainbow taunt --- .../gadget/gadgets/taunts/RainbowTaunt.java | 48 ++++++++++++ .../particleeffects/RainbowTauntEffect.java | 76 +++++++++++++++++++ .../particleeffects/RainbowTrailEffect.java | 3 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java new file mode 100644 index 000000000..c506fd575 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -0,0 +1,48 @@ +package mineplex.core.gadget.gadgets.taunts; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.recharge.Recharge; + +public class RainbowTaunt extends TauntGadget +{ + + private static final int COOLDOWN = 30000; + private static final int PVP_COOLDOWN = 10000; + + public RainbowTaunt(GadgetManager manager) + { + super(manager, "Rainbow Taunt", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, + LineFormat.LORE), -18, Material.GLASS, (byte) 0); + setCanPlayWithPvp(false); + setPvpCooldown(PVP_COOLDOWN); + } + + @Override + public void onStart(Player player) + { + if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) + return; + + + } + + @Override + public void onPlay(Player player) + { + + } + + @Override + public void onFinish(Player player) + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java new file mode 100644 index 000000000..8af6585b0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -0,0 +1,76 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class RainbowTauntEffect extends Effect +{ + + private static final int PARTICLES = 100; + private static final int HEIGHT = 5; + + private int _step = 0; + + private Color _red = new Color(255, 0, 0); + private Color _orange = new Color(255, 127, 0); + private Color _yellow = new Color(255, 255, 0); + private Color _green = new Color(0, 255, 0); + private Color _blue = new Color(0, 0, 255); + private Color _indigo = new Color(75, 0, 130); + private Color _violet = new Color(143, 0, 255); + + private Color _color = _red; + + public RainbowTauntEffect(Player player, JavaPlugin javaPlugin) + { + super(-1, new EffectLocation(player), javaPlugin); + } + + @Override + public void runEffect() + { + Location location = getEffectLocation().getLocation(); + Location target = getTargetLocation().getLocation(); + Vector link = target.toVector().subtract(location.toVector()); + float length = (float) link.length(); + float pitch = (float) (4 * HEIGHT / Math.pow(length, 2)); + for (int i = 0; i < PARTICLES; i++) { + Vector v = link.clone().normalize().multiply(length * i / PARTICLES); + float x = ((float) i / PARTICLES) * length - length / 2; + float y = (float) (-pitch * Math.pow(x, 2) + HEIGHT); + location.add(v).add(0, y, 0); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + location.subtract(0, y, 0).subtract(v); + + _step++; + if (_step % 5 == 0) + { + if (_color.equals(_red)) + _color = _orange; + else if (_color.equals(_orange)) + _color = _yellow; + else if (_color.equals(_yellow)) + _color = _green; + else if (_color.equals(_green)) + _color = _blue; + else if (_color.equals(_blue)) + _color = _indigo; + else if (_color.equals(_indigo)) + _color = _violet; + else + _color = _red; + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java index f707165b7..04652f71e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java @@ -21,7 +21,6 @@ public class RainbowTrailEffect extends Effect private HashSet _items; - private Color _color = Color.RED; private long _count, _jumpingTimer = 0; private boolean _isJumping = false; private Entity _entity; @@ -34,6 +33,8 @@ public class RainbowTrailEffect extends Effect private Color _indigo = new Color(75, 0, 130); private Color _violet = new Color(143, 0, 255); + private Color _color = _red; + public RainbowTrailEffect(Entity entity, JavaPlugin javaPlugin, HashSet items) { super(-1, new EffectLocation(entity), javaPlugin); From d471ac112ec61a83eac2dcbc5a60578a7ceb69fe Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Feb 2017 22:08:04 -0300 Subject: [PATCH 06/21] Fixed rainbow taunt a bit --- .../src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java | 4 +++- .../src/mineplex/core/particleeffects/RainbowTauntEffect.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java index c506fd575..25e6f8557 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.particleeffects.RainbowTauntEffect; import mineplex.core.recharge.Recharge; public class RainbowTaunt extends TauntGadget @@ -30,7 +31,8 @@ public class RainbowTaunt extends TauntGadget if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) return; - + RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(player, Manager.getPlugin()); + rainbowTauntEffect.start(); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java index 8af6585b0..5875ea06c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -31,7 +31,7 @@ public class RainbowTauntEffect extends Effect public RainbowTauntEffect(Player player, JavaPlugin javaPlugin) { - super(-1, new EffectLocation(player), javaPlugin); + super(80, new EffectLocation(player), javaPlugin); } @Override From 7201e0ec0de349eefecf63c7a0bbec8009ab7b02 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Feb 2017 22:08:36 -0300 Subject: [PATCH 07/21] Added taunt to menu --- .../Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 912f96dbc..1d459ecb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -180,6 +180,7 @@ import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; import mineplex.core.gadget.gadgets.taunts.EternalTaunt; +import mineplex.core.gadget.gadgets.taunts.RainbowTaunt; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; @@ -570,6 +571,7 @@ public class GadgetManager extends MiniPlugin // TAUNTS!!! addGadget(new EternalTaunt(this)); addGadget(new BlowAKissTaunt(this)); + addGadget(new RainbowTaunt(this)); for (GadgetType gadgetType : GadgetType.values()) { From 28746c7873af35ec7013cba93e04a0bfc707ead8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 2 Mar 2017 15:50:56 -0300 Subject: [PATCH 08/21] St Patricks Chest --- .../mineplex/core/reward/RewardManager.java | 19 ++++++++++ .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 1 + .../mineplex/core/treasure/TreasureStyle.java | 7 ++++ .../mineplex/core/treasure/TreasureType.java | 4 ++- .../core/treasure/gui/BuyChestButton.java | 9 +++++ .../core/treasure/gui/TreasurePage.java | 35 ++++++++++++++++++- 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 8475fb95f..ea083fbbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -91,6 +91,10 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat; +import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings; import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; @@ -113,6 +117,7 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; +import mineplex.core.gadget.gadgets.taunts.RainbowTaunt; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; @@ -140,6 +145,7 @@ import mineplex.core.mount.types.MountMule; import mineplex.core.mount.types.MountNightmareSteed; import mineplex.core.mount.types.MountSlime; import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountStPatricksHorse; import mineplex.core.mount.types.MountUndead; import mineplex.core.mount.types.MountValentinesSheep; import mineplex.core.mount.types.MountZombie; @@ -545,6 +551,11 @@ public class RewardManager addPetReward(Type.LOVECHEST, PetType.CUPID_PET, rarity, 50, 500); addGadget(Type.LOVECHEST, getGadget(WinEffectLoveIsABattlefield.class), rarity, 100, 500); + + // ST PATRICKS + addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50); + addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50); + addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50); } public void addLegendary() @@ -761,6 +772,14 @@ public class RewardManager addGadget(Type.LOVECHEST, getGadget(MorphLoveDoctor.class), rarity, 30, 5000); addGadget(Type.LOVECHEST, getGadget(BlowAKissTaunt.class), rarity, 50, 5000); addGadget(Type.LOVECHEST, getGadget(ParticleWingsLove.class), rarity, 10, 5000); + + // ST PATRICKS + addGadget(Type.STPATRICKS, getGadget(RainbowTaunt.class), rarity, 30); + addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksHat.class), rarity, 15); + + addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30); + + addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index c8a1fc4fc..870dce7c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -65,6 +65,7 @@ public class RewardPool GINGERBREAD(false, 1), MINESTRIKE(true, 2), LOVECHEST(false, 1), + STPATRICKS(false, 1), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index f235c8dda..33381f37e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -21,6 +21,7 @@ public enum RewardType MINESTRIKE_CHEST( 0, 2, 16, 0), LOVE_CHEST( 0, 6, 18, 0), VALENTINES_GIFT( 0, 7, 20, 20), + ST_PATRICKS( 0, 6, 18, 0), SPINNER_FILLER( 0.1, 1, 4, 20), SPINNER_REAL( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index aab8d9172..b29622c3d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -90,6 +90,13 @@ public enum TreasureStyle ParticleType.HEART, Sound.VILLAGER_YES, Sound.VILLAGER_YES + ), + STPATRICKS( + ParticleType.HAPPY_VILLAGER, + ParticleType.HAPPY_VILLAGER, + ParticleType.HAPPY_VILLAGER, + Sound.VILLAGER_YES, + Sound.VILLAGER_YES ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 8766e644a..c81c578c6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -32,7 +32,9 @@ public enum TreasureType MINESTRIKE(C.cGold + "Minestrike Treasure", "Minestrike Chest", "MinestrikeChest", RewardType.MINESTRIKE_CHEST, Material.CHEST, TreasureStyle.MINESTRIKE, RewardPool.Type.MINESTRIKE, true, 10000), - LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000); + LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000), + + ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index ef1e9775a..12bc94e90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -49,6 +49,15 @@ public class BuyChestButton implements IButton return; } + if (_chestType == TreasureType.LOVE_CHEST) + { + if (!new File("../../update/files/EnableLoveChest.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + } + if (_chestType == TreasureType.TRICK_OR_TREAT) { if (!new File("../../update/files/EnableTrickOrTreat.dat").exists()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 4fda07f6c..5fe3c7c31 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -137,6 +137,7 @@ public class TreasurePage extends ShopPageBase int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName()); + int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName()); boolean availableChristmas = false; boolean availableFreedom = false; @@ -144,7 +145,8 @@ public class TreasurePage extends ShopPageBase boolean availableTrick = false; boolean availableThank = false; boolean availableGingerbread = false; - boolean availableLove = new File("../../update/files/EnableLoveChest.dat").exists(); + boolean availableLove = false; + boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists(); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -407,6 +409,30 @@ public class TreasurePage extends ShopPageBase } } + List stpatricksLore = Lists.newArrayList(); + stpatricksLore.add(" "); + stpatricksLore.add(F.value("Love Chests Owned", "" + loveCount)); + stpatricksLore.add(" "); + stpatricksLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE)); + stpatricksLore.add(" "); + if (stpatricksCount > 0) + { + stpatricksLore.add(C.cGreen + "Click to Open!"); + } + else + { + if (!availableStPatricks) + { + stpatricksLore.add(C.cRed + "This item is no longer available"); + } + else + { + stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.LOVE_CHEST.getPurchasePrice() + " Treasure Shards"); + stpatricksLore.add(" "); + stpatricksLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + } + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); // Normal chests @@ -425,6 +451,7 @@ public class TreasurePage extends ShopPageBase ItemStack thank = new ShopItem(Material.COOKED_CHICKEN, C.cGoldB + "Thankful Treasure", thankLore.toArray(new String[0]), 0, false, false); ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore); ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false); + ItemStack stpatricks = SkinData.LEPRECHAUN.getSkull(C.cGreenB + "St Patrick's Treasure", stpatricksLore); // Adds shard item addItem(49, shards); @@ -447,6 +474,7 @@ public class TreasurePage extends ShopPageBase TreasurePageItem thankTreasureItem = new TreasurePageItem(thank, thankCount, TreasureType.THANKFUL); TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD); TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST); + TreasurePageItem stPatricksItem = new TreasurePageItem(stpatricks, stpatricksCount, TreasureType.ST_PATRICKS); _normalTreasures.add(oldTreasureItem); _normalTreasures.add(ancientTreasureItem); @@ -455,6 +483,11 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); + if (availableStPatricks) + _specialTreasures.add(stPatricksItem); + else + _seasonalTreasures.add(stPatricksItem); + if (availableLove) _specialTreasures.add(loveChestItem); else From 2b18d62f0fd4b8d42edb9968be32ec20f9ebbebe Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 3 Mar 2017 21:50:16 -0300 Subject: [PATCH 09/21] Added icons and lores Added floor for the chest Fixed little copy paste error in BuyChestButton Reduced amount of gold in the costume --- .../stpatricks/OutfitStPatricksSuit.java | 37 ++++++++----------- .../gadget/gadgets/taunts/RainbowTaunt.java | 5 ++- .../mount/types/MountStPatricksHorse.java | 7 ++-- .../src/mineplex/core/pet/PetType.java | 2 +- .../animation/BlockChangeAnimation.java | 10 +++++ .../core/treasure/gui/BuyChestButton.java | 12 +----- 6 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java index dd3adc971..48cd96acb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java @@ -8,7 +8,6 @@ import org.bukkit.Material; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -31,7 +30,7 @@ public class OutfitStPatricksSuit extends OutfitGadget public OutfitStPatricksSuit(GadgetManager manager, String name, int cost, OutfitGadget.ArmorSlot slot, Material mat, byte data) { - super(manager, name, UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), cost, slot, mat, data); + super(manager, name, UtilText.splitLinesToArray(new String[]{C.cGray + "Wherever a Leprechaun goes he leaves behind a trail of gold and a hint of spring."}, LineFormat.LORE), cost, slot, mat, data); setColor(Color.fromRGB(0, 153, 0)); ItemStack displayItem = new ItemStack(mat, 1, data); if (displayItem.getItemMeta() instanceof LeatherArmorMeta) @@ -55,26 +54,6 @@ public class OutfitStPatricksSuit extends OutfitGadget removeArmor(player, message); } - @EventHandler - public void onPlayerMove(PlayerMoveEvent event) - { - // Prevents event running 4 times - if (getSlot() != ArmorSlot.HELMET) - return; - - if (!setActive(event.getPlayer())) - return; - - // Drops gold - ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); - itemStack.setItemMeta(itemMeta); - Item gold = event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation().add(0.5, 1.5, 0.5), itemStack); - _items.add(gold); - gold.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); - } - @EventHandler public void onUpdate(UpdateEvent event) { @@ -84,6 +63,20 @@ public class OutfitStPatricksSuit extends OutfitGadget if (event.getType() == UpdateType.TICK) cleanItems(); + + if (event.getType() == UpdateType.FASTER) + { + for (Player player : getActive()) + { + ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName(player.getName() + "DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); + itemStack.setItemMeta(itemMeta); + Item gold = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(gold); + gold.setVelocity(new Vector((Math.random() - 0.5) * 0.3, Math.random() - 0.4, (Math.random() - 0.5) * 0.3)); + } + } } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java index 25e6f8557..16e94cd67 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -19,10 +19,11 @@ public class RainbowTaunt extends TauntGadget public RainbowTaunt(GadgetManager manager) { - super(manager, "Rainbow Taunt", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, - LineFormat.LORE), -18, Material.GLASS, (byte) 0); + super(manager, "Rainbow Taunt", UtilText.splitLinesToArray(new String[]{C.cGray + "At the end of every Rainbow they say there is a pot of Gold.", C.cWhite + "Type /taunt in game to use this taunt."}, + LineFormat.LORE), -18, Material.WOOL, (byte) 11); setCanPlayWithPvp(false); setPvpCooldown(PVP_COOLDOWN); + setShouldPlay(false); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java index 7129556b8..0558f1644 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -7,7 +7,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Horse; import org.bukkit.entity.Item; @@ -17,6 +16,7 @@ import org.bukkit.event.entity.HorseJumpEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.mount.HorseMount; @@ -36,9 +36,8 @@ public class MountStPatricksHorse extends HorseMount public MountStPatricksHorse(MountManager manager) { super(manager, "St Patrick's Mount", - UtilText.splitLineToArray(UtilText.colorWords("The British might be coming, but with this impressive mount you have nothing to fear.", - ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), - Material.FIREWORK, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); + UtilText.splitLinesToArray(new String[]{C.cGray + "You know the cow that jumped over the moon? Total show off."}, LineFormat.LORE), + Material.CAULDRON, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 52d953443..e5453d7fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -33,7 +33,7 @@ public enum PetType GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), - LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Placeholder", SkinData.LEPRECHAUN.getSkull()) + LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index f98716e24..f2629eb1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -94,6 +94,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 6; } + else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + { + mat = Material.WOOL; + data = 13; + } else continue; @@ -141,6 +146,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 14; } + else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + { + mat = Material.GOLD_BLOCK; + data = 0; + } else continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 12bc94e90..087374d5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -49,15 +49,6 @@ public class BuyChestButton implements IButton return; } - if (_chestType == TreasureType.LOVE_CHEST) - { - if (!new File("../../update/files/EnableLoveChest.dat").exists()) - { - player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); - return; - } - } - if (_chestType == TreasureType.TRICK_OR_TREAT) { if (!new File("../../update/files/EnableTrickOrTreat.dat").exists()) @@ -107,7 +98,8 @@ public class BuyChestButton implements IButton } if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA - || _chestType == TreasureType.HAUNTED || _chestType == TreasureType.GINGERBREAD)) + || _chestType == TreasureType.HAUNTED || _chestType == TreasureType.GINGERBREAD + || _chestType == TreasureType.ST_PATRICKS)) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; From 4a496ea4c16dd1b22731ca46dc3914b8f381dcdc Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 3 Mar 2017 22:34:21 -0300 Subject: [PATCH 10/21] Added particle for when opening the chests --- .../core/common/shape/ShapeWings.java | 24 +++++++++++++++++++ .../animation/ChestSpawnAnimation.java | 15 +++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java index 439bf4958..3800260ed 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java @@ -110,6 +110,30 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape "00000$#$00000", "000000$000000" }; + + public static final String[] FOUR_LEAF_CLOVER = new String[] + { + "$$$$$$$$###$$$$$$$", + "$$$$$$##***#$$$$$$", + "$$$$##****%#$$$$$$", + "$$$#******%#$###$$", + "$$$#***%#%%##***#$", + "$$$$#**%#%#*****#$", + "$$$####*%%#*%%**#$", + "$##***#*%#**##**##", + "#***%%*###******%#", + "#**%##*%###%%%%%%#", + "#**#**%%#**######$", + "$#****%#*****#$$$$", + "$$#*%%%#******#$$$", + "$$#####**%#****#$$", + "$$$$$##**%#***%#$$", + "$$$$$###****%%%#$$", + "$$$$##$#%%%%%##$$$", + "$$$##$$$#####$$$$$", + "$###$$$$$$$$$$$$$$", + "$##$$$$$$$$$$$$$$$" + }; /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index ce268629c..04ffd2a14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -17,6 +17,7 @@ import org.bukkit.util.Vector; import com.google.common.collect.Lists; import mineplex.core.Managers; +import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -36,9 +37,6 @@ import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -/** - * Created by Shaun on 8/29/2014. - */ public class ChestSpawnAnimation extends Animation { private static final int ANIMATION_DURATION = 80; @@ -62,6 +60,10 @@ public class ChestSpawnAnimation extends Animation private List _bats = Lists.newArrayList(); + private ShapeWings _cloverBlack = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverDarkGreen = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverGreen = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '*', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { super(treasure); @@ -245,6 +247,13 @@ public class ChestSpawnAnimation extends Animation doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); } } + else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + { + Location location = _centerLocation.clone().add(0, 5, 0); + _cloverBlack.displayColored(location, Color.BLACK); + _cloverDarkGreen.displayColored(location, new Color(0, 100, 0)); + _cloverGreen.displayColored(location, Color.GREEN); + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) From d6605e973d731a31c1addedde4c0ad3c4a8e167f Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 3 Mar 2017 23:38:32 -0300 Subject: [PATCH 11/21] Changed chest animation --- .../core/particleeffects/CloverEffect.java | 33 +++++++++++++++++++ .../src/mineplex/core/treasure/Treasure.java | 12 +++++-- .../animation/ChestSpawnAnimation.java | 19 +++++------ 3 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CloverEffect.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CloverEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CloverEffect.java new file mode 100644 index 000000000..7f62e7100 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CloverEffect.java @@ -0,0 +1,33 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.UtilParticle; + +public class CloverEffect extends Effect +{ + + private ShapeWings _cloverBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverDarkGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '*', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + + public CloverEffect(JavaPlugin plugin, Location location) + { + super(-1, new EffectLocation(location), plugin, 1); + } + + @Override + public void runEffect() + { + Location location = getEffectLocation().getLocation(); + _cloverBlack.displayColored(location, Color.BLACK); + _cloverDarkGreen.displayColored(location, new Color(0, 100, 0)); + _cloverGreen.displayColored(location, Color.GREEN); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 71b04ad99..07811b870 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -49,9 +49,6 @@ import mineplex.core.treasure.animation.LootRareAnimation; import mineplex.core.treasure.animation.LootUncommonAnimation; import mineplex.core.treasure.animation.TreasureRemoveAnimation; -/** - * Created by Shaun on 8/27/2014. - */ public class Treasure { private BlockRestore _blockRestore; @@ -215,6 +212,15 @@ public class Treasure double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; UtilParticle.PlayParticle(type, block.getLocation().add(.5 + rX, .7, .5 + rZ), .5f, .5f, .5f, .25f, 1, ViewDist.NORMAL); } + else if (_treasureType == TreasureType.ST_PATRICKS) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.GREEN : new Color(0, 100, 0)), + block.getLocation().add(.5 + rX, .7, .5 + rZ)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 04ffd2a14..80eab149e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -17,7 +17,6 @@ import org.bukkit.util.Vector; import com.google.common.collect.Lists; import mineplex.core.Managers; -import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -44,7 +43,7 @@ public class ChestSpawnAnimation extends Animation private Block _block; private byte _direction; private Location _centerLocation; - + private Location _particleLocation; private Vector _particleDirection; @@ -60,10 +59,6 @@ public class ChestSpawnAnimation extends Animation private List _bats = Lists.newArrayList(); - private ShapeWings _cloverBlack = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); - private ShapeWings _cloverDarkGreen = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); - private ShapeWings _cloverGreen = new ShapeWings(ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '*', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); - public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { super(treasure); @@ -136,7 +131,8 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } - else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL || getTreasure().getTreasureType() == TreasureType.MINESTRIKE) + else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL || getTreasure().getTreasureType() == TreasureType.MINESTRIKE || + getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) { float y = 5 * scale; double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION); @@ -155,7 +151,10 @@ public class ChestSpawnAnimation extends Animation } else { - ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(Color.YELLOW), _centerLocation.clone().add(x * width, y, z * width)); + DustSpellColor minestrikeColor = new DustSpellColor(Color.YELLOW); + DustSpellColor stpatricksColor = new DustSpellColor(Color.GREEN); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + (getTreasure().getTreasureType() == TreasureType.MINESTRIKE) ? minestrikeColor : stpatricksColor, _centerLocation.clone().add(x * width, y, z * width)); coloredParticle.display(); } } @@ -250,9 +249,7 @@ public class ChestSpawnAnimation extends Animation else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) { Location location = _centerLocation.clone().add(0, 5, 0); - _cloverBlack.displayColored(location, Color.BLACK); - _cloverDarkGreen.displayColored(location, new Color(0, 100, 0)); - _cloverGreen.displayColored(location, Color.GREEN); + } //Spawn Chest From 85b5eee92f8a33425c737d1657e8dfac1b2fe085 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 4 Mar 2017 00:40:53 -0300 Subject: [PATCH 12/21] Fixed the rainbow taunt --- .../gadget/gadgets/taunts/RainbowTaunt.java | 9 ++++++ .../particleeffects/RainbowTauntEffect.java | 30 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java index 16e94cd67..70e8000b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.taunts; +import java.util.HashSet; + +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -8,6 +11,7 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.particleeffects.EffectLocation; import mineplex.core.particleeffects.RainbowTauntEffect; import mineplex.core.recharge.Recharge; @@ -32,7 +36,12 @@ public class RainbowTaunt extends TauntGadget if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) return; + HashSet ignore = new HashSet<>(); + ignore.add(Material.AIR); + Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(player, Manager.getPlugin()); + rainbowTauntEffect.setTargetLocation(new EffectLocation(loc)); rainbowTauntEffect.start(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java index 5875ea06c..886bc3aef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -37,7 +37,7 @@ public class RainbowTauntEffect extends Effect @Override public void runEffect() { - Location location = getEffectLocation().getLocation(); + /*Location location = getEffectLocation().getFixedLocation(); Location target = getTargetLocation().getLocation(); Vector link = target.toVector().subtract(location.toVector()); float length = (float) link.length(); @@ -48,7 +48,7 @@ public class RainbowTauntEffect extends Effect float y = (float) (-pitch * Math.pow(x, 2) + HEIGHT); location.add(v).add(0, y, 0); ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, - new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0)); + new DustSpellColor(_color), location); coloredParticle.display(); location.subtract(0, y, 0).subtract(v); @@ -70,6 +70,32 @@ public class RainbowTauntEffect extends Effect else _color = _red; } + }*/ + Location location = getEffectLocation().getFixedLocation(); + Location target = getTargetLocation().getFixedLocation(); + Color[] colors = new Color[]{_violet, _indigo, _blue, _green, _yellow, _orange, _red}; + + for (int i = 0; i < 7; i++) + { + line(location.clone().add(0, 0.25 * i, 0), target.clone().add(0, 0.25 * i, 0), colors[i]); + } + } + + private void line(Location startLocation, Location targetLocation, Color color) + { + Vector link = targetLocation.toVector().subtract(startLocation.toVector()); + float length = (float) link.length(); + float pitch = (float) (4 * HEIGHT / Math.pow(length, 2)); + for (int i = 0; i < PARTICLES; i++) + { + Vector v = link.clone().normalize().multiply(length * i / PARTICLES); + float x = ((float) i / PARTICLES) * length - length / 2; + float y = (float) (-pitch * Math.pow(x, 2) + HEIGHT); + startLocation.add(v).add(0, y, 0); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(color), startLocation); + coloredParticle.display(); + startLocation.subtract(0, y, 0).subtract(v); } } From f9b66e28f4650ad0c621ca5a021fe26f78f313d7 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 4 Mar 2017 14:07:24 -0300 Subject: [PATCH 13/21] Fixed taunts not being disabled correctly --- .../core/cosmetic/ui/page/TauntPage.java | 8 +++++--- .../src/mineplex/core/gadget/GadgetManager.java | 17 +++++++++-------- .../mineplex/core/gadget/types/TauntGadget.java | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java index a519cfce8..b4e8a1568 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java @@ -29,7 +29,7 @@ public class TauntPage extends GadgetPage @Override protected void buildPage() { - int slot = 10; + int slot = 10; List list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT); if(list != null) @@ -37,8 +37,10 @@ public class TauntPage extends GadgetPage { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget) - addGlow(slot); + if (gadget.isActive(getPlayer())) + { + addGlow(slot); + } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 1d459ecb4..014504a07 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -2,8 +2,10 @@ package mineplex.core.gadget; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.function.Predicate; @@ -28,7 +30,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -256,10 +257,10 @@ public class GadgetManager extends MiniPlugin private TreasureManager _treasureManager; private SoulManager _soulManager; - private NautHashMap> _gadgets; + private Map> _gadgets; - private final NautHashMap _lastMove = new NautHashMap<>(); - private final NautHashMap> _playerActiveGadgetMap = new NautHashMap<>(); + private final Map _lastMove = new HashMap<>(); + private final Map> _playerActiveGadgetMap = new HashMap<>(); private final HashSet _sets = new HashSet<>(); @@ -336,7 +337,7 @@ public class GadgetManager extends MiniPlugin private void createGadgets() { - _gadgets = new NautHashMap<>(); + _gadgets = new HashMap<>(); // Items addGadget(new ItemEtherealPearl(this)); @@ -1040,7 +1041,7 @@ public class GadgetManager extends MiniPlugin public void setActive(Player player, Gadget gadget) { if (!_playerActiveGadgetMap.containsKey(player)) - _playerActiveGadgetMap.put(player, new NautHashMap()); + _playerActiveGadgetMap.put(player, new HashMap<>()); _playerActiveGadgetMap.get(player).put(gadget.getGadgetType(), gadget); } @@ -1048,7 +1049,7 @@ public class GadgetManager extends MiniPlugin public Gadget getActive(Player player, GadgetType gadgetType) { if (!_playerActiveGadgetMap.containsKey(player)) - _playerActiveGadgetMap.put(player, new NautHashMap()); + _playerActiveGadgetMap.put(player, new HashMap<>()); return _playerActiveGadgetMap.get(player).get(gadgetType); } @@ -1056,7 +1057,7 @@ public class GadgetManager extends MiniPlugin public void removeActive(Player player, Gadget gadget) { if (!_playerActiveGadgetMap.containsKey(player)) - _playerActiveGadgetMap.put(player, new NautHashMap()); + _playerActiveGadgetMap.put(player, new HashMap<>()); _playerActiveGadgetMap.get(player).remove(gadget.getGadgetType()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java index 6076bcf0c..730cbcfcd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -70,6 +70,7 @@ public abstract class TauntGadget extends Gadget @Override public void disableCustom(Player player, boolean message) { + super.disableCustom(player, message); finish(player); } From 3d76f04508332ba7aa1c9911796ba6965a2a6014 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 4 Mar 2017 16:08:55 -0300 Subject: [PATCH 14/21] Fixed rainbow taunt lagging players --- .../gadget/gadgets/taunts/RainbowTaunt.java | 10 ++-- .../particleeffects/RainbowTauntEffect.java | 60 ++++--------------- .../core/titles/tracks/HolidayCheerTrack.java | 2 +- .../core/titles/tracks/LuckyTrack.java | 4 +- .../titles/tracks/TreasureHunterTrack.java | 4 +- .../src/mineplex/core/treasure/Treasure.java | 5 ++ .../core/treasure/TreasureLocation.java | 6 +- .../core/treasure/TreasureManager.java | 33 +++++++++- .../animation/StPatricksChestAnimation.java | 46 ++++++++++++++ .../treasure/event/TreasureStartEvent.java | 12 ++-- .../core/treasure/gui/TreasurePage.java | 2 +- 11 files changed, 111 insertions(+), 73 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/StPatricksChestAnimation.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java index 70e8000b4..db03bf13a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -1,13 +1,12 @@ package mineplex.core.gadget.gadgets.taunts; -import java.util.HashSet; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.TauntGadget; @@ -36,12 +35,11 @@ public class RainbowTaunt extends TauntGadget if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) return; - HashSet ignore = new HashSet<>(); - ignore.add(Material.AIR); - Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + double randX = UtilMath.random(3.5, 15), randZ = UtilMath.random(3.5, 15); + Location target = player.getLocation().clone().add(randX, 0, randZ); RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(player, Manager.getPlugin()); - rainbowTauntEffect.setTargetLocation(new EffectLocation(loc)); + rainbowTauntEffect.setTargetLocation(new EffectLocation(target)); rainbowTauntEffect.start(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java index 886bc3aef..8bba6d82c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -14,66 +14,28 @@ import mineplex.core.common.util.particles.DustSpellColor; public class RainbowTauntEffect extends Effect { - private static final int PARTICLES = 100; - private static final int HEIGHT = 5; + private static final int PARTICLES = 25; + private static final double HEIGHT = 4; - private int _step = 0; - - private Color _red = new Color(255, 0, 0); - private Color _orange = new Color(255, 127, 0); - private Color _yellow = new Color(255, 255, 0); - private Color _green = new Color(0, 255, 0); - private Color _blue = new Color(0, 0, 255); - private Color _indigo = new Color(75, 0, 130); - private Color _violet = new Color(143, 0, 255); - - private Color _color = _red; + private static final Color RED = new Color(255, 0, 0); + private static final Color ORANGE = new Color(255, 127, 0); + private static final Color YELLOW = new Color(255, 255, 0); + private static final Color GREEN = new Color(0, 255, 0); + private static final Color BLUE = new Color(0, 0, 255); + private static final Color INDIGO = new Color(75, 0, 130); + private static final Color VIOLET = new Color(143, 0, 255); public RainbowTauntEffect(Player player, JavaPlugin javaPlugin) { - super(80, new EffectLocation(player), javaPlugin); + super(16, new EffectLocation(player), javaPlugin, 5); } @Override public void runEffect() { - /*Location location = getEffectLocation().getFixedLocation(); - Location target = getTargetLocation().getLocation(); - Vector link = target.toVector().subtract(location.toVector()); - float length = (float) link.length(); - float pitch = (float) (4 * HEIGHT / Math.pow(length, 2)); - for (int i = 0; i < PARTICLES; i++) { - Vector v = link.clone().normalize().multiply(length * i / PARTICLES); - float x = ((float) i / PARTICLES) * length - length / 2; - float y = (float) (-pitch * Math.pow(x, 2) + HEIGHT); - location.add(v).add(0, y, 0); - ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, - new DustSpellColor(_color), location); - coloredParticle.display(); - location.subtract(0, y, 0).subtract(v); - - _step++; - if (_step % 5 == 0) - { - if (_color.equals(_red)) - _color = _orange; - else if (_color.equals(_orange)) - _color = _yellow; - else if (_color.equals(_yellow)) - _color = _green; - else if (_color.equals(_green)) - _color = _blue; - else if (_color.equals(_blue)) - _color = _indigo; - else if (_color.equals(_indigo)) - _color = _violet; - else - _color = _red; - } - }*/ Location location = getEffectLocation().getFixedLocation(); Location target = getTargetLocation().getFixedLocation(); - Color[] colors = new Color[]{_violet, _indigo, _blue, _green, _yellow, _orange, _red}; + Color[] colors = new Color[]{VIOLET, INDIGO, BLUE, GREEN, YELLOW, ORANGE, RED}; for (int i = 0; i < 7; i++) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java index 547a84087..00c807f43 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java @@ -111,7 +111,7 @@ public class HolidayCheerTrack extends Track @EventHandler public void onUseCosmetic(TreasureStartEvent event) { - if (!HOLIDAY_CHESTS.contains(event.getTreasureType())) + if (!HOLIDAY_CHESTS.contains(event.getTreasure().getTreasureType())) return; int points = 100; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java index a79ffe7ec..f839c01f6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java @@ -119,8 +119,8 @@ public class LuckyTrack extends Track int basePoints = POINTS.get(reward.getRarity()); - if (MULTIPLIER.get(event.getTreasureType()) != null) - basePoints *= MULTIPLIER.get(event.getTreasureType()); + if (MULTIPLIER.get(event.getTreasure().getTreasureType()) != null) + basePoints *= MULTIPLIER.get(event.getTreasure().getTreasureType()); incrementFor(event.getPlayer(), basePoints); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java index 24348b954..861ef4dbe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java @@ -79,9 +79,9 @@ public class TreasureHunterTrack extends Track @EventHandler public void onUseCosmetic(TreasureStartEvent event) { - if (POINTS.containsKey(event.getTreasureType())) + if (POINTS.containsKey(event.getTreasure().getTreasureType())) { - int basePoints = POINTS.get(event.getTreasureType()); + int basePoints = POINTS.get(event.getTreasure().getTreasureType()); if (isSetActive(event.getPlayer(), SetWisdom.class)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 07811b870..ae1be72ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -458,4 +458,9 @@ public class Treasure { return _treasureType; } + + public void addAnimation(Animation animation) + { + _animations.add(animation); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index cdef82335..ec1012733 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -172,12 +172,12 @@ public class TreasureLocation implements Listener Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + name)); } - TreasureStartEvent startEvent = new TreasureStartEvent(player, treasureType, Arrays.asList(rewards)); - UtilServer.CallEvent(startEvent); - Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; + TreasureStartEvent startEvent = new TreasureStartEvent(player, treasure, Arrays.asList(rewards)); + UtilServer.CallEvent(startEvent); + UtilTextMiddle.display(treasureType.getName(), "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open", 20, 180, 20, player); UtilPlayer.message(player, F.main("Treasure", "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 01c4b1e54..75e20150e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -1,10 +1,13 @@ package mineplex.core.treasure; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; @@ -25,10 +28,10 @@ import mineplex.core.reward.RewardPool; import mineplex.core.reward.RewardType; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.animation.Animation; +import mineplex.core.treasure.event.TreasureFinishEvent; +import mineplex.core.treasure.event.TreasureStartEvent; -/** - * Created by Shaun on 8/27/2014. - */ public class TreasureManager extends MiniPlugin { private CoreClientManager _clientManager; @@ -40,6 +43,8 @@ public class TreasureManager extends MiniPlugin private List _treasureLocations; private List _blockLocations; + private Map _treasureAnimations = new HashMap<>(); + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) { super("Treasure", plugin); @@ -161,4 +166,26 @@ public class TreasureManager extends MiniPlugin { return _blockLocations; } + + @EventHandler + public void playCustomAnimation(TreasureStartEvent event) + { + TreasureType treasureType = event.getTreasure().getTreasureType(); + /*if (treasureType == TreasureType.ST_PATRICKS) + { + StPatricksChestAnimation stPatricksChestAnimation = new StPatricksChestAnimation(event.getTreasure(), event.getTreasure().getCenterBlock()); + event.getTreasure().addAnimation(stPatricksChestAnimation); + _treasureAnimations.put(event.getTreasure(), stPatricksChestAnimation); + }*/ + } + + @EventHandler + public void stopCustomAnimation(TreasureFinishEvent event) + { + if (_treasureAnimations.containsKey(event.getTreasure())) + { + Animation animation = _treasureAnimations.get(event.getTreasure()); + animation.setRunning(false); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/StPatricksChestAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/StPatricksChestAnimation.java new file mode 100644 index 000000000..4b65b5787 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/StPatricksChestAnimation.java @@ -0,0 +1,46 @@ +package mineplex.core.treasure.animation; + +import java.awt.Color; + +import org.bukkit.block.Block; +import org.bukkit.util.Vector; + +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.treasure.Treasure; + +public class StPatricksChestAnimation extends Animation +{ + + private Block _center; + private int _tick = 0; + + private ShapeWings _cloverBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverDarkGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + private ShapeWings _cloverGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '*', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER); + + public StPatricksChestAnimation(Treasure treasure, Block center) + { + super(treasure); + _center = center; + } + + @Override + protected void tick() + { + _tick++; + if (_tick % 5 == 0) + { + _cloverBlack.displayColored(_center.getLocation().add(0, 5, 0), Color.BLACK); + _cloverDarkGreen.displayColored(_center.getLocation().add(0, 5, 0), new Color(0, 100, 0)); + _cloverGreen.displayColored(_center.getLocation().add(0, 5, 0), Color.GREEN); + } + } + + @Override + protected void onFinish() + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java index 771de876a..70c891f52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java @@ -8,20 +8,20 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import mineplex.core.reward.Reward; -import mineplex.core.treasure.TreasureType; +import mineplex.core.treasure.Treasure; public class TreasureStartEvent extends Event { private static final HandlerList handlers = new HandlerList(); private Player _player; - private TreasureType _treasureType; + private Treasure _treasure; private List _rewards; - public TreasureStartEvent(Player player, TreasureType treasureType, List rewards) + public TreasureStartEvent(Player player, Treasure treasure, List rewards) { _player = player; - _treasureType = treasureType; + _treasure = treasure; _rewards = rewards; } @@ -30,9 +30,9 @@ public class TreasureStartEvent extends Event return _player; } - public TreasureType getTreasureType() + public Treasure getTreasure() { - return _treasureType; + return _treasure; } public List getRewards() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 5fe3c7c31..0d55ba94e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -411,7 +411,7 @@ public class TreasurePage extends ShopPageBase List stpatricksLore = Lists.newArrayList(); stpatricksLore.add(" "); - stpatricksLore.add(F.value("Love Chests Owned", "" + loveCount)); + stpatricksLore.add(F.value("St Patrick's Chests Owned", "" + stpatricksCount)); stpatricksLore.add(" "); stpatricksLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE)); stpatricksLore.add(" "); From 3cc304d99c900d4385900842621737a27789aaa8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 4 Mar 2017 23:52:12 -0300 Subject: [PATCH 15/21] Used correct item for the mount --- .../src/mineplex/core/mount/types/MountStPatricksHorse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java index 0558f1644..a8366cb49 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -37,7 +37,7 @@ public class MountStPatricksHorse extends HorseMount { super(manager, "St Patrick's Mount", UtilText.splitLinesToArray(new String[]{C.cGray + "You know the cow that jumped over the moon? Total show off."}, LineFormat.LORE), - Material.CAULDRON, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); + Material.CAULDRON_ITEM, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); } @Override From 63b4dd1053e0ba5655a9b3a11b1804dfe421f3a5 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 6 Mar 2017 17:33:36 -0300 Subject: [PATCH 16/21] Support server stuff --- .../customerSupport/CustomerSupport.java | 12 +++++++++++ .../salespackage/SalesPackageManager.java | 4 +++- .../salespackages/StPatricksChest.java | 20 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/StPatricksChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 41e6239be..96198be33 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -166,6 +166,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int gingerbreadChestsReceived = 0; int minestrikeChestsReceived = 0; int loveChestsReceived = 0; + int stPatricksChestReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -319,6 +320,16 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable loveChestsReceived += 1; } } + if (transaction.SalesPackageName.startsWith("St Patricks Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + stPatricksChestReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + stPatricksChestReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) @@ -391,6 +402,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived + " " + C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived); caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived); caller.sendMessage(C.cBlue + "Love Chests Received: " + C.cYellow + loveChestsReceived); + caller.sendMessage(C.cBlue + "St Patrick's Chests Received: " + C.cYellow + stPatricksChestReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60); caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index a8ac55cf0..c1809951d 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -39,6 +39,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.StPatricksChest; import mineplex.staffServer.salespackage.salespackages.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; @@ -100,6 +101,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new HauntedChest(this)); AddSalesPackage(new MinestrikeChest(this)); AddSalesPackage(new LoveChest(this)); + AddSalesPackage(new StPatricksChest(this)); AddSalesPackage(new TrickOrTreatChest(this)); AddSalesPackage(new ThankfulChest(this)); @@ -171,7 +173,7 @@ public class SalesPackageManager extends MiniPlugin coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest - || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest) + || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/StPatricksChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/StPatricksChest.java new file mode 100644 index 000000000..32ae815a6 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/StPatricksChest.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class StPatricksChest extends SalesPackageBase +{ + public StPatricksChest(SalesPackageManager manager) + { + super(manager, "1 St Patricks Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item St Patricks Chest", "Give 1 St Patricks Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} From 1ffac1dd31096bcdc6504a322c90d9ebec89e1b2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 6 Mar 2017 18:09:42 -0300 Subject: [PATCH 17/21] Drop nuggets when removing chests --- .../src/mineplex/core/treasure/Treasure.java | 16 ++++++-- .../core/treasure/TreasureLocation.java | 3 +- .../core/treasure/TreasureManager.java | 39 ++++++++++++++++++ .../animation/TreasureRemoveAnimation.java | 40 +++++++++++++------ 4 files changed, 80 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index ae1be72ae..f1e489390 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -79,15 +79,18 @@ public class Treasure private HologramManager _hologramManager; private ServerStatusManager _statusManager; - public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager) + private TreasureManager _treasureManager; + + public Treasure(TreasureManager treasureManager, Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager) { - this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager); + this(treasureManager, player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager); _blockRestore = blockRestore; } - public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager) + public Treasure(TreasureManager treasureManager, Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager) { + _treasureManager = treasureManager; _player = player; _random = seed; @@ -326,7 +329,7 @@ public class Treasure if (isFinished()) { - TreasureRemoveAnimation animation = new TreasureRemoveAnimation(Treasure.this, _openedChestBlockInfo, _chestBlockInfo); + TreasureRemoveAnimation animation = new TreasureRemoveAnimation(Treasure.this, _chestBlockInfo); _animations.add(animation); _finished = true; } @@ -463,4 +466,9 @@ public class Treasure { _animations.add(animation); } + + public TreasureManager getTreasureManager() + { + return _treasureManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 69726109f..e0e9f13ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -115,6 +115,7 @@ public class TreasureLocation implements Listener return; } + chargeAccount(player, treasureType, new Callback() { @Override @@ -172,7 +173,7 @@ public class TreasureLocation implements Listener Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + name)); } - Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); + Treasure treasure = new Treasure(_treasureManager, player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; TreasureStartEvent startEvent = new TreasureStartEvent(player, treasure, Arrays.asList(rewards)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 75e20150e..13a13af58 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -1,14 +1,17 @@ package mineplex.core.treasure; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import org.bukkit.Location; import org.bukkit.block.Block; +import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.plugin.java.JavaPlugin; import com.google.common.collect.Lists; @@ -31,6 +34,8 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.treasure.animation.Animation; import mineplex.core.treasure.event.TreasureFinishEvent; import mineplex.core.treasure.event.TreasureStartEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public class TreasureManager extends MiniPlugin { @@ -42,6 +47,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; private List _blockLocations; + private List _items; private Map _treasureAnimations = new HashMap<>(); @@ -58,6 +64,7 @@ public class TreasureManager extends MiniPlugin _treasureLocations = Lists.newArrayList(); _blockLocations = Lists.newArrayList(); + _items = Lists.newArrayList(); for(Location location : LocationConstants.CHEST_LOCATIONS) { @@ -188,4 +195,36 @@ public class TreasureManager extends MiniPlugin animation.setRunning(false); } } + + public void addItem(Item item) + { + _items.add(item); + } + + @EventHandler + public void pickupItem(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeItems(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + Iterator it = _items.iterator(); + while (it.hasNext()) + { + Item item = it.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + it.remove(); + } + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java index a97d29f14..c0ada9705 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java @@ -3,22 +3,27 @@ package mineplex.core.treasure.animation; import java.util.List; import java.util.Random; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; +import mineplex.core.treasure.TreasureType; -/** - * Created by shaun on 14-09-15. - */ public class TreasureRemoveAnimation extends Animation { private Random _random = new Random(); - private List _openedChests; private List _otherChests; + private int _count = 0; - public TreasureRemoveAnimation(Treasure treasure, List openedChests, List otherChests) + public TreasureRemoveAnimation(Treasure treasure, List otherChests) { super(treasure); - _openedChests = openedChests; _otherChests = otherChests; } @@ -31,14 +36,13 @@ public class TreasureRemoveAnimation extends Animation { BlockInfo info = _otherChests.remove(_random.nextInt(_otherChests.size())); getTreasure().resetBlockInfo(info); -// System.out.println("otherchests"); + if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + { + // Drops gold nugget + dropItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_NUGGET, (byte) 0, 1, "DroppedNugget" + _count), info); + _count++; + } } -// else if (!_openedChests.isEmpty()) -// { -// System.out.println("openchests"); -// BlockInfo info = _openedChests.remove(_random.nextInt(_openedChests.size())); -// getTreasure().resetBlockInfo(info); -// } else { finish(); @@ -46,6 +50,16 @@ public class TreasureRemoveAnimation extends Animation } } + private void dropItem(ItemStack itemStack, BlockInfo blockInfo) + { + Location location = blockInfo.getBlock().getLocation(); + Item item = location.getWorld().dropItem(location.add(0, .5, 0), itemStack); + Vector vel = new Vector(Math.sin(_count * 9/5d), 0, Math.cos(_count * 9/5d)); + UtilAction.velocity(item, vel, Math.abs(Math.sin(_count * 12/3000d)), false, 0, 0.2 + + Math.abs(Math.cos(_count * 12/3000d))*0.6, 1, false); + getTreasure().getTreasureManager().addItem(item); + } + @Override protected void onFinish() { From 3469b890d491f8e0e313452ced4428704be32c6d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 7 Mar 2017 21:51:06 -0300 Subject: [PATCH 18/21] Rainbow taunt now uses sides of player as locations --- .../core/gadget/gadgets/taunts/RainbowTaunt.java | 14 +++++++++----- .../core/particleeffects/RainbowTauntEffect.java | 5 ++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java index db03bf13a..2d9ed339d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -3,10 +3,10 @@ package mineplex.core.gadget.gadgets.taunts; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.TauntGadget; @@ -35,11 +35,15 @@ public class RainbowTaunt extends TauntGadget if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) return; - double randX = UtilMath.random(3.5, 15), randZ = UtilMath.random(3.5, 15); - Location target = player.getLocation().clone().add(randX, 0, randZ); + Vector dir = player.getLocation().getDirection(); + Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX()); + Vector sideB = dir.clone().setX(dir.getZ()).setZ(-dir.getX()); - RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(player, Manager.getPlugin()); - rainbowTauntEffect.setTargetLocation(new EffectLocation(target)); + Location start = player.getLocation().clone().add(sideA.multiply(4).toLocation(player.getWorld())); + Location end = player.getLocation().clone().add(sideB.multiply(4).toLocation(player.getWorld())); + + RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin()); + rainbowTauntEffect.setTargetLocation(new EffectLocation(end)); rainbowTauntEffect.start(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java index 8bba6d82c..a571a3f0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -3,7 +3,6 @@ package mineplex.core.particleeffects; import java.awt.Color; import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -25,9 +24,9 @@ public class RainbowTauntEffect extends Effect private static final Color INDIGO = new Color(75, 0, 130); private static final Color VIOLET = new Color(143, 0, 255); - public RainbowTauntEffect(Player player, JavaPlugin javaPlugin) + public RainbowTauntEffect(Location start, JavaPlugin javaPlugin) { - super(16, new EffectLocation(player), javaPlugin, 5); + super(16, new EffectLocation(start), javaPlugin, 5); } @Override From 401738f19a550f2502c52035d22645a6ce410367 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 12 Mar 2017 20:53:43 -0300 Subject: [PATCH 19/21] Removed horse cooldown --- .../mount/types/MountStPatricksHorse.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java index a8366cb49..4d4c8bac6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -12,7 +12,6 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.HorseJumpEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; @@ -23,7 +22,6 @@ import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; import mineplex.core.mount.SingleEntityMountData; import mineplex.core.particleeffects.RainbowTrailEffect; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -67,24 +65,6 @@ public class MountStPatricksHorse extends HorseMount } } - @EventHandler - public void horseJump(HorseJumpEvent event) - { - for (SingleEntityMountData horseData : _trailMap.keySet()) - { - if (horseData.getEntity().equals(event.getEntity())) - { - if (!Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics")) - { - event.setPower(0f); - event.setCancelled(true); - return; - } - _trailMap.get(horseData).setJumping(true); - } - } - } - @EventHandler public void onItemPickup(PlayerPickupItemEvent event) { From 2b988a02d87e3766c0e6f818122ee0f33d2ea022 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 13 Mar 2017 19:39:14 -0300 Subject: [PATCH 20/21] Fixed horse --- .../core/mount/types/MountStPatricksHorse.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java index 4d4c8bac6..ad17c2f0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.HorseJumpEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; @@ -22,6 +23,7 @@ import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; import mineplex.core.mount.SingleEntityMountData; import mineplex.core.particleeffects.RainbowTrailEffect; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -65,6 +67,21 @@ public class MountStPatricksHorse extends HorseMount } } + @EventHandler + public void horseJump(HorseJumpEvent event) + { + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getEntity().equals(event.getEntity())) + { + if (Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics")) + { + _trailMap.get(horseData).setJumping(true); + } + } + } + } + @EventHandler public void onItemPickup(PlayerPickupItemEvent event) { From a3861d43c4df37d5b54da277ade8a83e267b21fa Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 13:32:49 -0300 Subject: [PATCH 21/21] Fixes costume throwing items without complete set --- .../stpatricks/OutfitStPatricksSuit.java | 17 +++++++------ .../game/arcade/managers/GameManager.java | 25 ++++++------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java index 48cd96acb..e409360b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java @@ -68,13 +68,16 @@ public class OutfitStPatricksSuit extends OutfitGadget { for (Player player : getActive()) { - ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setDisplayName(player.getName() + "DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); - itemStack.setItemMeta(itemMeta); - Item gold = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), itemStack); - _items.add(gold); - gold.setVelocity(new Vector((Math.random() - 0.5) * 0.3, Math.random() - 0.4, (Math.random() - 0.5) * 0.3)); + if (setActive(player)) + { + ItemStack itemStack = new ItemStack(Material.GOLD_INGOT); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName(player.getName() + "DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt()); + itemStack.setItemMeta(itemMeta); + Item gold = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(gold); + gold.setVelocity(new Vector((Math.random() - 0.5) * 0.3, Math.random() - 0.4, (Math.random() - 0.5) * 0.3)); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 7e063dd51..d87447cc1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -1,8 +1,9 @@ package nautilus.game.arcade.managers; -import mineplex.core.Managers; -import mineplex.core.PlayerSelector; -import mineplex.core.common.util.UtilLambda; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; @@ -14,11 +15,13 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import mineplex.core.PlayerSelector; import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilLambda; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; @@ -32,13 +35,13 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.mount.types.MountDragon; -import mineplex.core.titles.Titles; import mineplex.core.portal.GenericServer; import mineplex.core.portal.Intent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.RestartServerEvent; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.events.GamePrepareCountdownCommence; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -50,20 +53,6 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.gametutorial.TutorialPhase; import nautilus.game.arcade.gametutorial.TutorialText; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; public class GameManager implements Listener {