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.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/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index b22f39e3c..0c261460c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -260,7 +260,7 @@ public class BonusManager extends MiniClientPlugin implements I } else { - if(carlLocation != null) + if (carlLocation != null) { _carlNpc.setLocation(carlLocation); } @@ -405,14 +405,14 @@ public class BonusManager extends MiniClientPlugin implements I if (event.getType() != UpdateType.TICK) return; + _animation.itemClean(); + if (_canVote) return; if (!_enabled) return; - _animation.itemClean(); - if (!_animationRunning) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java index 4ea6aa93b..eadfe6cfc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java @@ -48,13 +48,13 @@ public class AnimationCarl extends Animation for (int i = 50; i < 60; i++) { Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i)); - Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i)); + Item shard = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, " " + i)); _items.add(gem); - _items.add(coin); + _items.add(shard); Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); - UtilAction.velocity(coin, vel, Math.abs(Math.sin(UtilMath.r(i) * 30/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 30/3000d))*0.6, 1, false); + UtilAction.velocity(shard, vel, Math.abs(Math.sin(UtilMath.r(i) * 30/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 30/3000d))*0.6, 1, false); } } @@ -62,11 +62,11 @@ public class AnimationCarl extends Animation { for (int i = 50; i < 60; i++) { - Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i)); - _items.add(coin); + Item shard = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, " " + i)); + _items.add(shard); Vector vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d)); - UtilAction.velocity(coin, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false); + UtilAction.velocity(shard, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java index f2cccf0a2..02709a26f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java @@ -135,12 +135,12 @@ public abstract class CommandBase implements ICom return matches; } - protected List tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args) + protected List tabCompletePlayerNames(CommandSender sender, String[] args) { - return tabCompletePlayerNames(sender, commandLabel, args, t -> true); + return tabCompletePlayerNames(sender, args, t -> true); } - protected List tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, Predicate filter) + protected List tabCompletePlayerNames(CommandSender sender, String[] args, Predicate filter) { if (sender instanceof Player) { 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/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 503f2897d..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 @@ -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,13 @@ 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(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())); addGlow(slot); } @@ -175,29 +181,14 @@ 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); + ItemStack item = pet.getDisplayItem(); + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(C.cGreen + C.Bold + pet.getName() + C.cGreen + " (" + C.cWhite + petName + C.cGreen + ")"); + itemMeta.setLore(itemLore); + item.setItemMeta(itemMeta); - 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)); - } - }*/ - - 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)); + 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/friend/command/AddFriend.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java index 691c350f0..62546317e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java @@ -47,6 +47,6 @@ public class AddFriend extends CommandBase @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return tabCompletePlayerNames(sender, commandLabel, args); + return tabCompletePlayerNames(sender, args); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 0537100f2..d2acbf740 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; @@ -153,6 +154,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; @@ -179,6 +184,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; @@ -206,6 +212,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; @@ -253,10 +260,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<>(); @@ -315,8 +322,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)); @@ -330,7 +340,7 @@ public class GadgetManager extends MiniPlugin private void createGadgets() { - _gadgets = new NautHashMap<>(); + _gadgets = new HashMap<>(); // Items addGadget(new ItemEtherealPearl(this)); @@ -372,6 +382,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)); @@ -561,6 +576,7 @@ public class GadgetManager extends MiniPlugin // TAUNTS!!! addGadget(new EternalTaunt(this)); addGadget(new BlowAKissTaunt(this)); + addGadget(new RainbowTaunt(this)); // Gem Hunters Mounts for (MountType mount : MountType.values()) @@ -1035,7 +1051,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); } @@ -1043,7 +1059,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); } @@ -1051,7 +1067,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/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..e409360b5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/stpatricks/OutfitStPatricksSuit.java @@ -0,0 +1,117 @@ +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.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 + "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) + { + 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 onUpdate(UpdateEvent event) + { + // Prevents event running 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (event.getType() == UpdateType.TICK) + cleanItems(); + + if (event.getType() == UpdateType.FASTER) + { + for (Player player : getActive()) + { + 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)); + } + } + } + } + + @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/gadgets/taunts/RainbowTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java new file mode 100644 index 000000000..2d9ed339d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/RainbowTaunt.java @@ -0,0 +1,62 @@ +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.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; + +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 + "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 + public void onStart(Player player) + { + if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) + return; + + 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()); + + 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(); + } + + @Override + public void onPlay(Player player) + { + + } + + @Override + public void onFinish(Player player) + { + + } + +} 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)); + } + +} 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 9326a4cdb..0cca83b9f 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); } @@ -159,4 +160,4 @@ public abstract class TauntGadget extends Gadget } } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java index 021c87684..3dab673b8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java @@ -35,6 +35,6 @@ public class MessageAdminCommand extends CommandBase @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return tabCompletePlayerNames(sender, commandLabel, args); + return tabCompletePlayerNames(sender, args); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java index bdc02920f..03ceaa5fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java @@ -45,6 +45,6 @@ public class MessageCommand extends CommandBase @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return tabCompletePlayerNames(sender, commandLabel, args); + return tabCompletePlayerNames(sender, args); } } 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..ad17c2f0d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountStPatricksHorse.java @@ -0,0 +1,115 @@ +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.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.C; +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.splitLinesToArray(new String[]{C.cGray + "You know the cow that jumped over the moon? Total show off."}, LineFormat.LORE), + Material.CAULDRON_ITEM, (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")) + { + _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/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/particleeffects/RainbowTauntEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java new file mode 100644 index 000000000..a571a3f0c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTauntEffect.java @@ -0,0 +1,63 @@ +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.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 = 25; + private static final double HEIGHT = 4; + + 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(Location start, JavaPlugin javaPlugin) + { + super(16, new EffectLocation(start), javaPlugin, 5); + } + + @Override + public void runEffect() + { + 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); + } + } + +} 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..04652f71e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/RainbowTrailEffect.java @@ -0,0 +1,113 @@ +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 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); + + private Color _color = _red; + + 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)); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java index b2435ca04..3e67e92a6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java @@ -1,6 +1,5 @@ package mineplex.core.party.command.cli; -import java.util.Arrays; import java.util.List; import org.bukkit.command.CommandSender; @@ -39,7 +38,7 @@ public class PartyInviteCommand extends CommandBase Player player = (Player) sender; Party party = Plugin.getPartyByPlayer(player); - return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other)); + return tabCompletePlayerNames(sender, args, other -> party == null || !party.isMember(other)); } return null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java index 7612a7325..5613e5758 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java @@ -50,7 +50,7 @@ public class PartyKickCommand extends CommandBase if (party != null && party.isOwner(player)) { - return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other)); + return tabCompletePlayerNames(sender, args, other -> other != player && party.isMember(other)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java index 402b0be83..68dac5f57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java @@ -77,7 +77,7 @@ public class PartyTransferOwnerCommand extends CommandBase if (party != null && party.isOwner(player)) { - return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other)); + return tabCompletePlayerNames(sender, args, other -> other != player && party.isMember(other)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java index f3832cbad..2ae17a558 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java @@ -38,7 +38,7 @@ public class PartyGUIInviteCommand extends CommandBase Player player = (Player) sender; Party party = Plugin.getPartyByPlayer(player); - return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other)); + return tabCompletePlayerNames(sender, args, other -> party == null || !party.isMember(other)); } return null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 3b7a1b0e3..9eae213a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -396,6 +396,20 @@ 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); + + zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + + 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); _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..e5453d7fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -6,7 +6,9 @@ import java.util.Optional; 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 @@ -30,7 +32,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, "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.") @@ -42,6 +45,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 +88,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 +124,15 @@ public enum PetType return _data; } + public ItemStack getDisplayItem() + { + if (_displayItem == null) + { + return new ItemStack(_material, 1, _data); + } + return _displayItem; + } + public YearMonth getYearMonth() { return _yearMonth; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java index 1f9166e6e..2b5ef2dbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -143,6 +143,6 @@ public class PunishCommand extends CommandBase @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return tabCompletePlayerNames(sender, commandLabel, args); + return tabCompletePlayerNames(sender, args); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index a80f5cf4b..855d747d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.banner.CountryFlag; @@ -91,6 +92,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 +118,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 +146,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; @@ -157,9 +164,11 @@ import mineplex.core.reward.rewards.PowerPlayReward; import mineplex.core.reward.rewards.RankReward; import mineplex.core.reward.rewards.RuneAmplifierReward; import mineplex.core.reward.rewards.SpinTicketReward; +import mineplex.core.reward.rewards.TitleReward; import mineplex.core.reward.rewards.TreasureShardReward; import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; +import mineplex.core.titles.tracks.TrackManager; import mineplex.core.treasure.TreasureType; public class RewardManager @@ -167,6 +176,7 @@ public class RewardManager private EnumMap _rewardPools; private Random _random; + private final TrackManager _trackManager = Managers.require(TrackManager.class); private CoreClientManager _clientManager; private DonationManager _donationManager; private InventoryManager _inventoryManager; @@ -413,7 +423,38 @@ public class RewardManager addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Desert_Eagle_Golden_Gun, rarity, 30, 2500); addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.P90_Asiimov, rarity, 100, 1000); addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.SG553_Pulse, rarity, 100, 1000); - + + // Titles + + addTitle(Type.NORMAL, "shrug", rarity, 10, 500); + addTitle(Type.NORMAL, "tableflip", rarity, 10, 500); + addTitle(Type.NORMAL, "tablerespecter", rarity, 15, 500); + addTitle(Type.NORMAL, "tableflip-disgusted", rarity, 15, 500); + addTitle(Type.NORMAL, "tableflip-enraged", rarity, 15, 500); + addTitle(Type.NORMAL, "tableflip-riot", rarity, 10, 500); + addTitle(Type.NORMAL, "teddy-bear", rarity, 10, 500); + addTitle(Type.NORMAL, "disgust", rarity, 10, 500); + addTitle(Type.NORMAL, "old-man", rarity, 5, 500); + addTitle(Type.NORMAL, "jake", rarity, 5, 500); + addTitle(Type.NORMAL, "finn", rarity, 5, 500); + addTitle(Type.NORMAL, "finn-and-jake", rarity, 5, 500); + addTitle(Type.NORMAL, "boxer", rarity, 5, 500); + addTitle(Type.NORMAL, "zoidberg", rarity, 5, 500); + + addTitle(Type.OMEGA, "shrug", rarity, 10, 500); + addTitle(Type.OMEGA, "tableflip", rarity, 10, 500); + addTitle(Type.OMEGA, "tablerespecter", rarity, 15, 500); + addTitle(Type.OMEGA, "tableflip-disgusted", rarity, 15, 500); + addTitle(Type.OMEGA, "tableflip-enraged", rarity, 15, 500); + addTitle(Type.OMEGA, "tableflip-riot", rarity, 10, 500); + addTitle(Type.OMEGA, "teddy-bear", rarity, 10, 500); + addTitle(Type.OMEGA, "disgust", rarity, 10, 500); + addTitle(Type.OMEGA, "old-man", rarity, 5, 500); + addTitle(Type.OMEGA, "jake", rarity, 5, 500); + addTitle(Type.OMEGA, "finn", rarity, 5, 500); + addTitle(Type.OMEGA, "finn-and-jake", rarity, 5, 500); + addTitle(Type.OMEGA, "boxer", rarity, 5, 500); + addTitle(Type.OMEGA, "zoidberg", rarity, 5, 500); // VALENTINES //Hats @@ -553,6 +594,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() @@ -624,6 +670,38 @@ public class RewardManager addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.XM1014_Pig_Gun, rarity, 10, 7500); addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.M4A4_Enderman, rarity, 10, 7500); + // Titles + + addTitle(Type.NORMAL, "ayyye", rarity, 25, 500); + addTitle(Type.NORMAL, "ameno", rarity, 15, 5000); + addTitle(Type.NORMAL, "magician", rarity, 25, 5000); + addTitle(Type.NORMAL, "fireball", rarity, 75, 5000); + addTitle(Type.NORMAL, "magic-missile", rarity, 75, 5000); + addTitle(Type.NORMAL, "pewpewpew", rarity, 75, 5000); + addTitle(Type.NORMAL, "stardust", rarity, 60, 5000); + addTitle(Type.NORMAL, "blow-a-kiss", rarity, 60, 5000); + addTitle(Type.NORMAL, "cool-guy", rarity, 60, 5000); + addTitle(Type.NORMAL, "deal-with-it", rarity, 60, 5000); + addTitle(Type.NORMAL, "party-time", rarity, 55, 5000); + addTitle(Type.NORMAL, "lalala", rarity, 30, 5000); + addTitle(Type.NORMAL, "gotta-go", rarity, 30, 5000); + addTitle(Type.NORMAL, "whaaat", rarity, 30, 5000); + + addTitle(Type.OMEGA, "ayyye", rarity, 25, 500); + addTitle(Type.OMEGA, "ameno", rarity, 15, 5000); + addTitle(Type.OMEGA, "magician", rarity, 25, 5000); + addTitle(Type.OMEGA, "fireball", rarity, 75, 5000); + addTitle(Type.OMEGA, "magic-missile", rarity, 75, 5000); + addTitle(Type.OMEGA, "pewpewpew", rarity, 75, 5000); + addTitle(Type.OMEGA, "stardust", rarity, 60, 5000); + addTitle(Type.OMEGA, "blow-a-kiss", rarity, 60, 5000); + addTitle(Type.OMEGA, "cool-guy", rarity, 60, 5000); + addTitle(Type.OMEGA, "deal-with-it", rarity, 60, 5000); + addTitle(Type.OMEGA, "party-time", rarity, 55, 5000); + addTitle(Type.OMEGA, "lalala", rarity, 30, 5000); + addTitle(Type.OMEGA, "gotta-go", rarity, 30, 5000); + addTitle(Type.OMEGA, "whaaat", rarity, 30, 5000); + //WINTER //Arrow Trails @@ -770,6 +848,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) @@ -855,6 +941,11 @@ public class RewardManager return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); } + public void addTitle(Type type, String trackName, RewardRarity rarity, int weight, int shards) + { + addReward(type, new TitleReward(_trackManager.getTrackById(trackName), rarity, weight, shards)); + } + public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight) { return addHat(type, hatType, rarity, weight, getShards(rarity)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index dc9f2cd9f..623552350 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -64,6 +64,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/reward/rewards/TitleReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TitleReward.java new file mode 100644 index 000000000..39b04375e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TitleReward.java @@ -0,0 +1,49 @@ +package mineplex.core.reward.rewards; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackManager; + +public class TitleReward extends Reward +{ + private final ItemStack ITEM_STACK = new ItemStack(Material.BOOK); + private final TrackManager _trackManager = Managers.require(TrackManager.class); + private final Track _track; + + public TitleReward(Track track, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + if (track == null) + { + throw new IllegalStateException(); + } + _track = track; + } + + @Override + protected RewardData giveRewardCustom(Player player, RewardType rewardType) + { + _trackManager.unlockTrack(player, _track); + return getFakeRewardData(player); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Title", getRarity().getColor() + _track.getLongName(), ITEM_STACK, getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return !_trackManager.hasTrack(player, _track); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java index 4ebce3925..c0e221b42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java @@ -3,6 +3,7 @@ package mineplex.core.titles; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,6 +71,7 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketInfo; +import mineplex.core.titles.commands.GiveTrackCommand; import mineplex.core.titles.commands.TrackCommand; import mineplex.core.titles.tracks.Track; import mineplex.core.titles.tracks.TrackFormat; @@ -301,21 +303,7 @@ public class Titles extends MiniDbClientPlugin implements IPacketHand tracks.removeIf(track -> track.getRequirements().getTier(player) == null && track.hideIfUnowned()); - tracks.sort((a, b) -> - { - if (a.hideIfUnowned() && !b.hideIfUnowned()) - { - return -1; - } - else if (!a.hideIfUnowned() && b.hideIfUnowned()) - { - return 1; - } - else - { - return a.getShortName().compareTo(b.getShortName()); - } - }); + tracks.sort(Comparator.comparing(Track::getShortName)); String bookTitle = C.cGreen + "Titles"; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/GiveTrackCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/GiveTrackCommand.java new file mode 100644 index 000000000..88c8f9c8f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/GiveTrackCommand.java @@ -0,0 +1,79 @@ +package mineplex.core.titles.commands; + +import java.util.List; +import java.util.stream.Collectors; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.titles.tracks.ItemizedTrack; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackManager; + +public class GiveTrackCommand extends CommandBase +{ + public GiveTrackCommand(TrackManager plugin) + { + super(plugin, Rank.ADMIN, "givetrack" ); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.help("/givetrack ", "Give a player an unlockable track", GetRequiredRank())); + return; + } + + String player = args[0]; + String track = args[1]; + + Track trackObj = Plugin.getTrackById(track); + + if (trackObj == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That is not a track" )); + return; + } + + if (!(trackObj instanceof ItemizedTrack)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That is not an unlockable track" )); + return; + } + + Plugin.unlockTrack(player, track, result -> { + switch (result) + { + case PLAYER_NOT_FOUND: + UtilPlayer.message(caller, F.main(Plugin.getName(), "That player has never joined Mineplex!")); + break; + case UNKNOWN_ERROR: + UtilPlayer.message(caller, F.main(Plugin.getName(), "Oops. Something has gone wrong while giving " + F.elem(player) + " the track " + F.elem(track) + "!")); + break; + case SUCCESS: + UtilPlayer.message(caller, F.main(Plugin.getName(), "Successfully gave " + F.elem(player) + " the track " + F.elem(track) + "!")); + break; + } + }); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (args.length == 1) + { + return tabCompletePlayerNames(sender, args); + } + if (args.length == 2) + { + return getMatches(args[1], Plugin.getAllTracks().stream().filter(track -> track instanceof ItemizedTrack).map(Track::getId).collect(Collectors.toList())); + } + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java index 0617028ff..f17dc9574 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java @@ -1,5 +1,8 @@ package mineplex.core.titles.commands; +import java.util.List; + +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import mineplex.core.Managers; @@ -10,6 +13,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.titles.Titles; +import mineplex.core.titles.tracks.ItemizedTrack; import mineplex.core.titles.tracks.Track; import mineplex.core.titles.tracks.TrackManager; @@ -52,4 +56,17 @@ public class TrackCommand extends CommandBase } Plugin.setOrToggleTrackForPlayer(caller, track, args.length > 1); } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (args.length == 1) + { + if (sender instanceof Player) + { + return getMatches(args[0], _trackManager.getAllTracks().stream().filter(track -> track.getRequirements().getTier((Player) sender) != null).map(Track::getId)); + } + } + return null; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/ItemizedTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/ItemizedTrack.java new file mode 100644 index 000000000..87086d516 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/ItemizedTrack.java @@ -0,0 +1,35 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.inventory.InventoryManager; + +public class ItemizedTrack extends Track +{ + private final InventoryManager _inventoryManager = Managers.require(InventoryManager.class); + + public ItemizedTrack(String trackId, String shortName, String description, boolean hideIfUnowned) + { + super(trackId, shortName, description, hideIfUnowned); + special(); + } + + public ItemizedTrack(String trackId, ChatColor color, String shortName, String longName, String description) + { + super(trackId, color, shortName, longName, description); + special(); + } + + public ItemizedTrack(String trackId, ChatColor color, String shortName, String longName, String description, boolean hideIfUnowned) + { + super(trackId, color, shortName, longName, description, hideIfUnowned); + special(); + } + + public boolean owns(Player player) { + return _inventoryManager.Get(player).getItemCount("track." + getId()) > 0; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java index 225733a00..bb436bd21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java @@ -50,7 +50,7 @@ public class Track implements Listener { // Book limits Validate.isTrue(shortName.length() <= 16, "Short name cannot be longer than 16 characters"); - Validate.isTrue(trackId.length() <= 16, "ID cannot be longer than 16 characters"); + Validate.isTrue(trackId.length() <= 32, "ID cannot be longer than 32 characters"); this._id = trackId; this._shortName = shortName; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java index 1e6e3b91c..7aac0b6b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java @@ -5,9 +5,41 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.Callback; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.titles.commands.GiveTrackCommand; +import mineplex.core.titles.tracks.award.Bridges2017Track; +import mineplex.core.titles.tracks.custom.DongerTrack; +import mineplex.core.titles.tracks.custom.EarlyBirdTrack; +import mineplex.core.titles.tracks.custom.HappyGaryTrack; +import mineplex.core.titles.tracks.custom.LeaderTrack; +import mineplex.core.titles.tracks.custom.SnekTrack; +import mineplex.core.titles.tracks.custom.TableFlipTrack; +import mineplex.core.titles.tracks.custom.TrackBuilder; +import mineplex.core.titles.tracks.custom.WizardTrack; +import mineplex.core.titles.tracks.standard.GemCollectorTrack; +import mineplex.core.titles.tracks.standard.HolidayCheerTrack; +import mineplex.core.titles.tracks.standard.LevelerTrack; +import mineplex.core.titles.tracks.standard.LuckyTrack; +import mineplex.core.titles.tracks.standard.MineplexMasteryTrack; +import mineplex.core.titles.tracks.standard.PartyAnimalTrack; +import mineplex.core.titles.tracks.standard.PeacefulTrack; +import mineplex.core.titles.tracks.standard.PerfectionistTrack; +import mineplex.core.titles.tracks.standard.PowerPlayTrack; +import mineplex.core.titles.tracks.standard.SweetToothTrack; +import mineplex.core.titles.tracks.standard.TreasureHunterTrack; +import mineplex.core.titles.tracks.standard.UnluckyTrack; +import mineplex.core.titles.tracks.standard.WarriorTrack; @ReflectivelyCreateMiniPlugin public class TrackManager extends MiniPlugin @@ -15,6 +47,9 @@ public class TrackManager extends MiniPlugin private final Map, Track> _registeredTracks = new LinkedHashMap<>(); private final Map _trackById = new HashMap<>(); + private final InventoryManager _inventoryManager = require(InventoryManager.class); + private final CoreClientManager _coreClientManager = require(CoreClientManager.class); + private TrackManager() { super("Track Manager"); @@ -42,10 +77,72 @@ public class TrackManager extends MiniPlugin // registerTrack(new SurvivorTrack()); registerTrack(new LevelerTrack()); registerTrack(new PerfectionistTrack()); + + // Awarded tracks + registerTrack(new Bridges2017Track()); + + // Custom tracks +// registerTrack(track("lenny", "Lenny", "( ͡° ͜ʖ ͡°)")); +// registerTrack(track("lenny-disgusted", "Disgusted Lenny", "( ͡ಠ ʖ̯ ͡ಠ)")); +// registerTrack(track("lenny-winking", "Winking Lenny", "( ͡~ ͜ʖ ͡°)")); + registerTrack(track("ayyye", "Ayyye", "(づ ̄ ³ ̄)づ")); + registerTrack(track("ameno", "Ameno", "༼ つ ◕_◕ ༽つ Gib me gems")); +// registerTrack(track("unknown", "Unknown", "(☞゚ヮ゚)☞")); + registerTrack(track("shrug", "Shrug", "¯\\_(ツ)_/¯")); + registerTrack(track("tableflip", "Tableflip", "(╯°□°)╯︵ ┻━┻")); + registerTrack(track("tablerespecter", "Table Respecter", "┬─┬ノ(ಠ_ಠノ)")); + registerTrack(track("tableflip-disgusted", "Disgusted Flip", "Disgusted Tableflip", "(╯ಠ_ಠ)╯︵ ┳━┳")); +// registerTrack(track("tableflip-donger", "Donger Flip", "ヽ༼ຈل͜ຈ༽ノ︵┻━┻")); + registerTrack(track("tableflip-enraged", "Enraged Flip", "(ノಠдಠ)ノ︵┻━┻")); + registerTrack(track("tableflip-riot", "Rioting Flip", "(┛◉Д◉)┛彡┻━┻")); + registerTrack(track("magician", "Magician", "(ノ◕ヮ◕)ノ*:・゚✧")); + registerTrack(track("teddy-bear", "Teddy Bear", "ʕ•ᴥ•ʔ")); + registerTrack(track("disgust", "Disgust", "ಠ_ಠ")); + registerTrack(track("old-man", "Old Man", "໒( •̀ ╭ ͟ʖ╮ •́ )७")); + registerTrack(track("jake", "Jake", "(❍ᴥ❍ʋ)")); + registerTrack(track("finn", "Finn", "| (• ◡•)|")); + registerTrack(track("finn-and-jake", "Finn 'n Jake", "| (• ◡•)| (❍ᴥ❍ʋ)")); + registerTrack(track("boxer", "Boxer", "(ง'̀-'́)ง")); + registerTrack(track0("zoidberg", "Zoidberg", "Why not?", "(\\/) (°,,°) (\\/)")); + registerTrack(track("crying", "Crying", "(ಥ﹏ಥ)")); +// registerTrack(track("unknown", "Unknown", "(◕‿◕✿)")); + registerTrack(track("fireball", "Fireball", "༼つಠ益ಠ༽つ ─=≡ΣO))")); + registerTrack(track("stardust", "Stardust", "(つ◕౪◕)つ━☆゚.*・。゚")); + registerTrack(track("magic-missile", "Magic Missile", "( °-°)シ ミ★ ミ☆")); + registerTrack(track("blow-a-kiss", "Blowing a Kiss", "♡(´ε` )")); + registerTrack(track("pewpewpew", "PEWPEWPEW", "(☞^o^)☞")); +// registerTrack(track("pewpew", "pew pew", "(☞゚ヮ゚)☞")); + registerTrack(track("cool-guy", "Cool Guy", "(⌐■_■)")); +// registerTrack(track("unknown", "Unknown", "(ง •̀ω•́)ง✧")); +// registerTrack(track("unknown", "Unknown", "(╯⊙ ⊱ ⊙╰ )")); + registerTrack(track("party-time", "Party Time", "♪~ ᕕ(ᐛ)ᕗ")); + registerTrack(track1("whats-a-liter", "What's a Liter?", "also wats a leader")); + + registerTrack(animatedTrack("deal-with-it", "Deal With It", "(⌐■_■)", "( •_•);( •_•)>⌐■-■;(⌐■_■);( •_•)>⌐■-■", 5)); + registerTrack(animatedTrack("this-guy", "This Guy", "(☞゚ヮ゚)☞", "(☞゚ヮ゚)☞;☜(゚ヮ゚☜)", 5)); + registerTrack(animatedTrack("lalala", "La La La", "♪┏(・o・) ┛", "♪┏(・o・) ┛;♪┗ ( ・o・) ┓♪;┏ ( ・o・) ┛♪;┗ (・o・ ) ┓♪;┏(・o・)┛♪", 1)); + registerTrack(animatedTrack("gotta-go", "Gotta Go", "┬┴┬┴┤(・_├┬┴┬┴", "┬┴┬┴┤(・_├┬┴┬┴;┬┴┬┴┤ (・├┬┴┬┴;┬┴┬┴┤ (├┬┴┬┴;┬┴┬┴┤ (・├┬┴┬┴", 5)); +// registerTrack(animatedTrack("unknown", "Unknown", "(o°▽°)o", "(o°▽°)o;(o_△_)o;(o°▽°)o", 5)); + registerTrack(animatedTrack("rolling-around", "Rolling Around", "(゚‐゚)", "(.-.);(:I );(゚‐゚);( I:)", 4)); +// registerTrack(animatedTrack("unknown", "Unknown", "('ω')", "('ω');( ε: );(.ω.);( :3 );('ω');( ε: );(.ω.);( :3 )", 5)); +// registerTrack(animatedTrack("whee", "Whee", "(゚ー゚)", "(゚ー゚);( ゚ー);( ゚);(  );(゚ );(ー゚ );(゚ー゚)", 1)); +// registerTrack(animatedTrack("lets-spin", "Let's Spin", "I Say, Let's Spin", "(・ω・)", "( ・ω);( ・);( );(・ );(ω・ );(・ω・)", 1)); +// registerTrack(animatedTrack("unknown", "Unknown", "(^∀^)", "(^∀^);( ^∀);( ^);(  );(^ );(∀^ );(^∀^)", 5)); + registerTrack(animatedTrack("whaaat", "Whaaaaaat?", "(°o°)", "(°o°);(°o。);(。o。);(。o°);(°o°);(°o。);(。o。);(。o°)", 5)); +// registerTrack(animatedTrack("spinning", "Spinning", "(゚◇゚)", "(゚◇゚);( ゚◇);( ゚);(  );(゚ );(◇゚ );(゚◇", 5)); +// registerTrack(animatedTrack("unknown", "Unknown", "(・∇・)", "(・∇・);( ・∇);( ・);(  );(・ );(∇・ );(・∇・)", 5)); + } + + @Override + public void addCommands() + { + addCommand(new GiveTrackCommand(this)); } private void registerTrack(Track track) { + if (_trackById.containsKey(track.getId())) + throw new IllegalArgumentException("Duplicate id: " + track.getId()); _registeredTracks.put(track.getClass(), track); _trackById.put(track.getId(), track); } @@ -62,6 +159,144 @@ public class TrackManager extends MiniPlugin public final List getAllTracks() { - return new ArrayList<>(_registeredTracks.values()); + return new ArrayList<>(_trackById.values()); + } + + public boolean hasTrack(Player player, Track track) + { + return _inventoryManager.Get(player).getItemCount("track." + track.getId()) > 0; + } + + public void unlockTrack(Player player, Track track) + { + unlockTrack(player, track, null); + } + + public void unlockTrack(Player player, Track track, Consumer consumer) + { + unlockTrack(player.getName(), track.getId(), consumer); + } + + public void unlockTrack(String player, String track, Consumer consumer) + { + _coreClientManager.getOrLoadClient(player, client -> + { + if (client == null) + { + if (consumer != null) + consumer.accept(TrackGiveResult.PLAYER_NOT_FOUND); + return; + } + + runAsync(() -> + { + Callback successCallback = success -> + { + if (success) + { + if (consumer != null) + consumer.accept(TrackGiveResult.SUCCESS); + } + else + { + if (consumer != null) + consumer.accept(TrackGiveResult.UNKNOWN_ERROR); + } + }; + + Player playerObj = Bukkit.getPlayer(client.getUniqueId()); + + if (playerObj != null) + { + _inventoryManager.addItemToInventory(successCallback, playerObj, "track." + track, 1); + } + else + { + _inventoryManager.addItemToInventoryForOffline(successCallback, client.getAccountId(), "track." + track, 1); + } + }); + }); + } + + public enum TrackGiveResult + { + PLAYER_NOT_FOUND, + UNKNOWN_ERROR, + SUCCESS + } + + // Begin helper methods + private ItemizedTrack animatedTrack(String id, String name, String desc, String frames, int ticks) + { + return TrackBuilder.builder(id) + .withShortName(name) + .withDescription(desc) + .setFrames(frames.split(";")) + .setTicks(ticks) + .withColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); + } + + private ItemizedTrack animatedTrack(String id, String name, String longName, String desc, String frames, int ticks) + { + return TrackBuilder.builder(id) + .withShortName(name) + .withLongName(longName) + .withDescription(desc) + .setFrames(frames.split(";")) + .setTicks(ticks) + .withColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); + } + + private ItemizedTrack track(String id, String name, String tierName) + { + return TrackBuilder.builder(id) + .withShortName(name) + .withDescription(tierName) + .setTierName(tierName) + .withColor(ChatColor.GOLD) + .setTierColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); + } + + private ItemizedTrack track0(String id, String shortName, String desc, String tierName) + { + return TrackBuilder.builder(id) + .withShortName(shortName) + .withDescription(desc) + .setTierName(tierName) + .withColor(ChatColor.GOLD) + .setTierColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); + } + + private ItemizedTrack track1(String id, String name, String desc) + { + return TrackBuilder.builder(id) + .withShortName(name) + .withDescription(desc) + .setTierName(name) + .withColor(ChatColor.GOLD) + .setTierColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); + } + + private ItemizedTrack track(String id, String shortName, String longName, String tierName) + { + return TrackBuilder.builder(id) + .withShortName(shortName) + .withLongName(longName) + .withDescription(tierName) + .setTierName(tierName) + .withColor(ChatColor.GOLD) + .setTierColor(ChatColor.GOLD) + .setHideIfUnowned(true) + .build(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/award/Bridges2017Track.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/award/Bridges2017Track.java new file mode 100644 index 000000000..90bb2fee3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/award/Bridges2017Track.java @@ -0,0 +1,31 @@ +package mineplex.core.titles.tracks.award; + +import net.md_5.bungee.api.ChatColor; + +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; +import mineplex.core.titles.tracks.ItemizedTrack; + +public class Bridges2017Track extends ItemizedTrack +{ + public Bridges2017Track() + { + super( + "tournament-br-2017", + ChatColor.GOLD, + "BotB 2017", + "2017 Bridges Champion", + "This track is awarded to the winners of the 2017 BotB Tournament", + true); + + special(); + + getRequirements() + .addTier(new TrackTier( + "2017 Bridges Champion", + null, + this::owns, + new TrackFormat(ChatColor.GOLD, ChatColor.GOLD) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/DongerTrack.java similarity index 75% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/DongerTrack.java index 9d03b4eb1..bdefb8144 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/DongerTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import java.util.Set; @@ -6,6 +6,10 @@ import net.md_5.bungee.api.ChatColor; import com.google.common.collect.Sets; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; + public class DongerTrack extends Track { private static final Set OWNERS = Sets.newHashSet( @@ -13,7 +17,7 @@ public class DongerTrack extends Track "a20d59d1-cfd8-4116-ac27-45d9c7eb4a97" ); - protected DongerTrack() + public DongerTrack() { super("donger", ChatColor.AQUA, "Donger", "Donger", "ヽ༼ຈل͜ຈ༽ノ", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/EarlyBirdTrack.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/EarlyBirdTrack.java index 9e7551900..5fd11ec04 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/EarlyBirdTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import java.sql.ResultSet; import java.sql.SQLException; @@ -15,12 +15,15 @@ import com.google.common.collect.Sets; import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class EarlyBirdTrack extends Track { private final Set _wonEternal = Sets.newConcurrentHashSet(); - protected EarlyBirdTrack() + public EarlyBirdTrack() { super("early-bird", ChatColor.AQUA, "Early Bird", "Early Bird", "This track is unlocked by receiving the Eternal rank from chickens in the 2016 Thanksgiving Event", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/HappyGaryTrack.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/HappyGaryTrack.java index fe75d1bf4..25b98d970 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/HappyGaryTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import java.util.Set; @@ -9,12 +9,15 @@ import com.google.common.collect.Sets; import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class HappyGaryTrack extends Track { private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); - protected HappyGaryTrack() + public HappyGaryTrack() { super("happygary", ChatColor.GOLD, "Happy Gary", "Happy Gary", "ᐛ", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/LeaderTrack.java similarity index 75% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/LeaderTrack.java index 80b14ce33..e7a600b17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/LeaderTrack.java @@ -1,16 +1,19 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import net.md_5.bungee.api.ChatColor; import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class LeaderTrack extends Track { private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); - protected LeaderTrack() + public LeaderTrack() { super("leader", ChatColor.DARK_RED, "Leader", "What's a Leader?", "also wat does dev mean", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/SnekTrack.java similarity index 74% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/SnekTrack.java index 7d2f1ad51..5744f36b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/SnekTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import java.util.Set; @@ -6,13 +6,17 @@ import net.md_5.bungee.api.ChatColor; import com.google.common.collect.Sets; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; + public class SnekTrack extends Track { private static final Set OWNERS = Sets.newHashSet( "b86b54da-93dd-46f9-be33-27bd92aa36d7" ); - protected SnekTrack() + public SnekTrack() { super("snek", ChatColor.DARK_GREEN, "Snek", "Snek", "oh you have do me a frighten", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TableFlipTrack.java similarity index 77% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TableFlipTrack.java index 4924fe3ef..8ea5f3590 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TableFlipTrack.java @@ -1,18 +1,21 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import net.md_5.bungee.api.ChatColor; import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class TableFlipTrack extends Track { private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); - protected TableFlipTrack() + public TableFlipTrack() { - super("tableflip", ChatColor.AQUA, "Tableflip", "Tableflip", "(╯°□°)╯ ︵ ┻━┻", true); + super("tableflipanim", ChatColor.AQUA, "Tableflip", "Tableflip", "(╯°□°)╯ ︵ ┻━┻", true); special(); getRequirements() .addTier(new TrackTier( diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TrackBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TrackBuilder.java new file mode 100644 index 000000000..1747b2c73 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/TrackBuilder.java @@ -0,0 +1,173 @@ +package mineplex.core.titles.tracks.custom; + +import net.md_5.bungee.api.ChatColor; + +import org.apache.commons.lang3.Validate; + +import mineplex.core.titles.tracks.ItemizedTrack; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; + +public class TrackBuilder +{ + private String _id; + private String _shortName; + private String _longName; + private ChatColor _color; + private String _desc; + private boolean _hideIfUnowned; + + private String _tierName; + private String _tierDesc; + private ChatColor _tierColor; + private ChatColor _magicColor; + + private int _ticks; + private String[] _frames; + + private TrackBuilder(String id) + { + this._id = id; + } + + public TrackBuilder withShortName(String shortName) + { + Validate.notNull(shortName, "Short name cannot be null"); + this._shortName = shortName.length() > 16 ? shortName.substring(0, 16) : shortName; + return this; + } + + public TrackBuilder withLongName(String longName) + { + Validate.notNull(longName, "Long name cannot be null"); + this._longName = longName; + return this; + } + + public TrackBuilder withColor(ChatColor color) + { + Validate.notNull(color, "Color cannot be null"); + this._color = color; + return this; + } + + public TrackBuilder withDescription(String desc) + { + Validate.notNull(desc, "Description cannot be null"); + this._desc = desc; + return this; + } + + public TrackBuilder setHideIfUnowned(boolean hide) + { + this._hideIfUnowned = hide; + return this; + } + + public TrackBuilder setTierName(String tierName) + { + Validate.notNull(tierName, "Tier name cannot be null"); + this._tierName = tierName; + return this; + } + + public TrackBuilder setTierDesc(String tierDesc) + { + Validate.notNull(tierDesc, "Tier desc cannot be null"); + this._tierDesc = tierDesc; + return this; + } + + public TrackBuilder setTierColor(ChatColor tierColor) + { + Validate.notNull(tierColor, "Tier color cannot be null"); + this._tierColor = tierColor; + return this; + } + + public TrackBuilder setTierMagicColor(ChatColor magicColor) + { + Validate.notNull(magicColor, "Magic color cannot be null"); + this._magicColor = magicColor; + return this; + } + + public TrackBuilder setFrames(String... frames) + { + Validate.notNull(frames, "Frames cannot be null"); + if (frames.length == 0) + return this; + this._frames = frames; + return this; + } + + public TrackBuilder setTicks(int ticks) + { + this._ticks = ticks; + return this; + } + + public T build() + { + Validate.notNull(_id, "ID cannot be null"); + Validate.notNull(_color, "Color cannot be null"); + Validate.notNull(_shortName, "Short name cannot be null"); + + if (_desc == null) + _desc = _shortName; + if (_longName == null) + _longName = _shortName; + if (_tierColor == null) + _tierColor = _color; + if (_tierName == null) + _tierName = _shortName; + if (_tierDesc == null) + _tierDesc = _desc; + + if (_frames == null) + { + return (T) new ItemizedTrack(_id, _color, _shortName, _longName, _desc, _hideIfUnowned) + { + ItemizedTrack init() + { + getRequirements() + .addTier(new TrackTier( + _tierName, + _tierDesc, + this::owns, + new TrackFormat(_tierColor, _magicColor) + )); + return this; + } + }.init(); + } + else + { + Validate.isTrue(_ticks >= 1, "Ticks must be >= 1"); + + return (T) new ItemizedTrack(_id, _color, _shortName, _longName, _desc, _hideIfUnowned) + { + ItemizedTrack init() + { + getRequirements() + .addTier(new TrackTier( + _tierName, + _tierDesc, + this::owns, + new TrackFormat(_tierColor, _magicColor) + .animated(_ticks, _frames) + )); + return this; + } + }.init(); + } + } + + public static TrackBuilder builder(String id) + { + Validate.notNull(id, "ID cannot be null"); + Validate.isTrue(id.length() <= 32, "ID must not be longer than 32 characters"); + return new TrackBuilder(id); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/WizardTrack.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/WizardTrack.java index 768c67620..3f0e85c3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/custom/WizardTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.custom; import java.util.Set; @@ -6,6 +6,10 @@ import net.md_5.bungee.api.ChatColor; import com.google.common.collect.Sets; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; + // hmu t3 public class WizardTrack extends Track { @@ -14,7 +18,7 @@ public class WizardTrack extends Track "2016b565-0a63-4a2d-800b-b786ac256288" ); - protected WizardTrack() + public WizardTrack() { super("wizard", ChatColor.DARK_PURPLE, "Wizard", "Wizard", "(ノ◕ヮ◕)ノ*:・゚✧", true); special(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/GemCollectorTrack.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/GemCollectorTrack.java index f3dfde3e5..1fa16a704 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/GemCollectorTrack.java @@ -1,10 +1,13 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; import org.bukkit.entity.Player; import mineplex.core.gadget.set.SetEmerald; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class GemCollectorTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java index 547a84087..5a3e67e76 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.HashMap; import java.util.HashSet; @@ -24,6 +24,9 @@ import mineplex.core.gadget.set.SetFreedom; import mineplex.core.gadget.set.SetFrostLord; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetSet; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.event.TreasureStartEvent; @@ -111,7 +114,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/KitCollectorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/KitCollectorTrack.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/KitCollectorTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/KitCollectorTrack.java index df1366f33..66657f5a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/KitCollectorTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/KitCollectorTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; @@ -8,6 +8,9 @@ import mineplex.core.Managers; import mineplex.core.achievement.AchievementCategory; import mineplex.core.donation.DonationManager; import mineplex.core.game.GameDisplay; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class KitCollectorTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LevelerTrack.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LevelerTrack.java index f079f9d52..5d16b8da8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LevelerTrack.java @@ -1,10 +1,13 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; import mineplex.core.Managers; import mineplex.core.achievement.Achievement; import mineplex.core.achievement.AchievementManager; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class LevelerTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java index a79ffe7ec..7a8d3f0b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.EnumMap; import java.util.HashSet; @@ -14,6 +14,9 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardRarity; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.event.TreasureStartEvent; @@ -119,8 +122,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/MineplexMasteryTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/MineplexMasteryTrack.java similarity index 86% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/MineplexMasteryTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/MineplexMasteryTrack.java index 6135da8af..326ac6d98 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/MineplexMasteryTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/MineplexMasteryTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; @@ -7,12 +7,15 @@ import org.bukkit.entity.Player; import mineplex.core.Managers; import mineplex.core.game.GameDisplay; import mineplex.core.stats.StatsManager; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class MineplexMasteryTrack extends Track { private final StatsManager _statsManager; - protected MineplexMasteryTrack() + public MineplexMasteryTrack() { super("mineplex-mastery", "Mineplex Mastery", "This track is unlocked by winning different games on Mineplex"); getRequirements() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PartyAnimalTrack.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PartyAnimalTrack.java index 96426f84d..a626e623d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PartyAnimalTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.HashMap; import java.util.Map; @@ -13,6 +13,9 @@ import mineplex.core.gadget.gadgets.item.ItemFirework; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.set.SetParty; import mineplex.core.gadget.types.Gadget; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class PartyAnimalTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PeacefulTrack.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PeacefulTrack.java index 123856b8d..1afd61773 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PeacefulTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.HashSet; import java.util.Set; @@ -9,6 +9,9 @@ import org.bukkit.entity.Player; import mineplex.core.gadget.set.SetMusic; import mineplex.core.game.GameDisplay; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class PeacefulTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PerfectionistTrack.java similarity index 86% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PerfectionistTrack.java index ceb768357..7bd458dd5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PerfectionistTrack.java @@ -1,10 +1,14 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; import org.bukkit.entity.Player; import mineplex.core.Managers; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackManager; +import mineplex.core.titles.tracks.TrackTier; public class PerfectionistTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java similarity index 53% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java index 72730bc78..81fe01721 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/PowerPlayTrack.java @@ -1,23 +1,25 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; import mineplex.core.Managers; import mineplex.core.bonuses.BonusManager; -import mineplex.core.powerplayclub.PowerPlayClubRepository; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class PowerPlayTrack extends Track { - private final PowerPlayClubRepository _powerPlayClubRepository = Managers.require(BonusManager.class).getPowerPlayClubRepository(); + private final BonusManager _bonusManager = Managers.require(BonusManager.class); - protected PowerPlayTrack() + public PowerPlayTrack() { super("power-play", ChatColor.AQUA, "Power Play", "Power Play VIP", "This track is unlocked by subscribing to the Power Play Club"); getRequirements() .addTier(new TrackTier( "Power Play Club", null, - player -> _powerPlayClubRepository.getCachedData(player).isSubscribed() ? 1L : 0L, + player -> _bonusManager.getPowerPlayClubRepository().getCachedData(player).isSubscribed() ? 1L : 0L, 1, new TrackFormat(ChatColor.AQUA, ChatColor.AQUA) )); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SurvivorTrack.java similarity index 80% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SurvivorTrack.java index 31b4dca30..6c4cd34ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SurvivorTrack.java @@ -1,7 +1,11 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; + public class SurvivorTrack extends Track { public SurvivorTrack() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SweetToothTrack.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SweetToothTrack.java index b3bd8ca15..b1e28da36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/SweetToothTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.HashMap; import java.util.Map; @@ -12,6 +12,9 @@ import mineplex.core.gadget.event.PlayerConsumeMelonEvent; import mineplex.core.gadget.gadgets.item.ItemLovePotion; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.types.Gadget; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class SweetToothTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java index 24348b954..d5afe5c49 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.EnumMap; @@ -7,6 +7,9 @@ import net.md_5.bungee.api.ChatColor; import org.bukkit.event.EventHandler; import mineplex.core.gadget.set.SetWisdom; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.event.TreasureStartEvent; @@ -79,9 +82,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/titles/tracks/UnluckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/UnluckyTrack.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/UnluckyTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/UnluckyTrack.java index a23a3b332..3883722bd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/UnluckyTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/UnluckyTrack.java @@ -1,4 +1,4 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import java.util.EnumMap; import java.util.HashSet; @@ -14,6 +14,9 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardRarity; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; import mineplex.core.treasure.event.TreasureStartEvent; public class UnluckyTrack extends Track diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/WarriorTrack.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java rename to Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/WarriorTrack.java index fb6c129af..dfdd2383d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/WarriorTrack.java @@ -1,10 +1,13 @@ -package mineplex.core.titles.tracks; +package mineplex.core.titles.tracks.standard; import net.md_5.bungee.api.ChatColor; import org.bukkit.entity.Player; import mineplex.core.gadget.set.SetVampire; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackTier; public class WarriorTrack extends Track { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 71b04ad99..f1e489390 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; @@ -82,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; @@ -215,6 +215,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, @@ -320,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; } @@ -452,4 +461,14 @@ public class Treasure { return _treasureType; } + + public void addAnimation(Animation animation) + { + _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 b729b5d15..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,12 +173,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); + 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)); + 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..13a13af58 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -1,11 +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; @@ -25,10 +31,12 @@ 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; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; -/** - * Created by Shaun on 8/27/2014. - */ public class TreasureManager extends MiniPlugin { private CoreClientManager _clientManager; @@ -39,6 +47,9 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; private List _blockLocations; + private List _items; + + 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) { @@ -53,6 +64,7 @@ public class TreasureManager extends MiniPlugin _treasureLocations = Lists.newArrayList(); _blockLocations = Lists.newArrayList(); + _items = Lists.newArrayList(); for(Location location : LocationConstants.CHEST_LOCATIONS) { @@ -161,4 +173,58 @@ 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); + } + } + + 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/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/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/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index ce268629c..80eab149e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -36,9 +36,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; @@ -46,7 +43,7 @@ public class ChestSpawnAnimation extends Animation private Block _block; private byte _direction; private Location _centerLocation; - + private Location _particleLocation; private Vector _particleDirection; @@ -134,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); @@ -153,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(); } } @@ -245,6 +246,11 @@ 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); + + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) 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/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() { 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/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index ef1e9775a..087374d5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -98,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; 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..0d55ba94e 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("St Patrick's Chests Owned", "" + stpatricksCount)); + 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 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); + } +} diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java index 2bb683ac8..68023807b 100644 --- a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java +++ b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java @@ -118,9 +118,8 @@ public class VotifierManager extends MiniPlugin } } - String lowerPlayerName = playerName.toLowerCase(); - final PlayerStatus usStatus = _usPlayerRepo.getElement(lowerPlayerName); - final PlayerStatus euStatus = _euPlayerRepo.getElement(lowerPlayerName); + final PlayerStatus usStatus = _usPlayerRepo.getElement(uuid.toString()); + final PlayerStatus euStatus = _euPlayerRepo.getElement(uuid.toString()); System.out.println("Loaded " + playerName + " with uuid " + uuid); System.out.println("Attempting to award bonus"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 794bc4cc6..d64e698de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -34,7 +34,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; -import mineplex.core.titles.tracks.HolidayCheerTrack; +import mineplex.core.titles.tracks.standard.HolidayCheerTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java index b1f19b179..7adb3c904 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java @@ -5,6 +5,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.games.AbsorptionFix; import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.micro.modes.kits.KitOverlord; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; /** @@ -23,7 +24,10 @@ public class OverpoweredMicroBattles extends Micro new KitOverlord(manager) }, GameType.Brawl); - + + getModule(TeamArmorModule.class) + .dontGiveTeamArmor(); + new AbsorptionFix(this); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java index 2eab38c90..9e66f6631 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitKnight; import nautilus.game.arcade.game.games.champions.kits.KitMage; import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.micro.Micro; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; /** @@ -41,6 +42,8 @@ public class TinyWinners extends Micro Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); StrictAntiHack = true; + getModule(TeamArmorModule.class) + .dontGiveTeamArmor(); manager.enableChampionsModules(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java index a55694553..b66971a8c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java @@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitKnight; import nautilus.game.arcade.game.games.champions.kits.KitMage; import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.sheep.SheepGame; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; /** @@ -47,6 +48,8 @@ public class EweHeroes extends SheepGame Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); StrictAntiHack = true; + getModule(TeamArmorModule.class) + .dontGiveTeamArmor(); new ChampionsFixes(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java index 8b44da93c..64a4c46ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java @@ -5,6 +5,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.games.AbsorptionFix; import nautilus.game.arcade.game.games.sheep.SheepGame; import nautilus.game.arcade.game.games.sheep.modes.kits.KitShepherd; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; /** @@ -21,7 +22,10 @@ public class OverpoweredSheepQuest extends SheepGame { new KitShepherd(manager) }, GameType.Brawl); - + + getModule(TeamArmorModule.class) + .dontGiveTeamArmor(); + new AbsorptionFix(this); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index b7a5ef10e..93f15841d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -9,12 +9,11 @@ import org.bukkit.block.Chest; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; -import mineplex.core.Managers; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.loot.ChestLoot; -import mineplex.core.titles.tracks.LuckyTrack; -import mineplex.core.titles.tracks.UnluckyTrack; +import mineplex.core.titles.tracks.standard.LuckyTrack; +import mineplex.core.titles.tracks.standard.UnluckyTrack; import nautilus.game.arcade.ArcadeManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index d15f72cf2..ab8ae6c56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java @@ -10,7 +10,6 @@ import java.util.UUID; import net.md_5.bungee.api.ChatColor; -import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; @@ -60,8 +59,6 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; -import mineplex.core.titles.tracks.LuckyTrack; -import mineplex.core.titles.tracks.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index a437aa169..a82efebfc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -68,8 +68,8 @@ import mineplex.core.explosion.ExplosionEvent; import mineplex.core.loot.ChestLoot; import mineplex.core.loot.RandomItem; import mineplex.core.recharge.Recharge; -import mineplex.core.titles.tracks.LuckyTrack; -import mineplex.core.titles.tracks.UnluckyTrack; +import mineplex.core.titles.tracks.standard.LuckyTrack; +import mineplex.core.titles.tracks.standard.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 56ceef7ed..d1a7665ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -101,8 +101,8 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.loot.ChestLoot; import mineplex.core.loot.RandomItem; import mineplex.core.recharge.Recharge; -import mineplex.core.titles.tracks.LuckyTrack; -import mineplex.core.titles.tracks.UnluckyTrack; +import mineplex.core.titles.tracks.standard.LuckyTrack; +import mineplex.core.titles.tracks.standard.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.visibility.VisibilityManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java index 1d75f12ac..e158fd9d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java @@ -37,13 +37,25 @@ public class TeamArmorModule extends Module public TeamArmorModule giveTeamArmor() { - this._giveTeamArmor = true; + _giveTeamArmor = true; return this; } public TeamArmorModule giveHotbarItem() { - this._giveHotbarItem = true; + _giveHotbarItem = true; + return this; + } + + public TeamArmorModule dontGiveTeamArmor() + { + _giveTeamArmor = false; + return this; + } + + public TeamArmorModule dontGiveHotbarItem() + { + _giveHotbarItem = false; return this; } 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 { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java index 4c8db7903..f1834bdaf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java @@ -7,7 +7,7 @@ import mineplex.core.boosters.Booster; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; -import mineplex.core.titles.tracks.GemCollectorTrack; +import mineplex.core.titles.tracks.standard.GemCollectorTrack; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.serverdata.Utility; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java index 7a24f23d1..d7d729926 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java @@ -5,7 +5,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.titles.tracks.WarriorTrack; +import mineplex.core.titles.tracks.standard.WarriorTrack; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java index 68c9de226..fd0b57ccb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import mineplex.core.titles.tracks.PeacefulTrack; +import mineplex.core.titles.tracks.standard.PeacefulTrack; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game;