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 28a189da6..1cabb2dd1 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 @@ -62,7 +62,7 @@ public class SkinData public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s="); public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY="); 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="); // 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.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 201f36c2f..f6287b349 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -1,8 +1,20 @@ package mineplex.core.common.util; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.UUID; + +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.Item; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MinecraftKey; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Location; import org.bukkit.Material; @@ -27,16 +39,10 @@ import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.material.Bed; +import com.mojang.authlib.GameProfile; + import mineplex.core.common.block.MultiBlockUpdaterAgent; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.Blocks; -import net.minecraft.server.v1_8_R3.IBlockData; -import net.minecraft.server.v1_8_R3.Item; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.MinecraftKey; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; -import net.minecraft.server.v1_8_R3.WorldServer; +import mineplex.core.common.skin.SkinData; public class UtilBlock { @@ -496,8 +502,6 @@ public class UtilBlock * @param location of explosion * @param strength of explosion * @param damageBlocksEqually - Treat all blocks as durability of dirt - * @param ensureDestruction - Ensure that the closest blocks are destroyed - * at least * @return */ public static ArrayList getExplosionBlocks(Location location, float strength, boolean damageBlocksEqually) @@ -1646,5 +1650,24 @@ public class UtilBlock { return liquid(block.getType()); } + + public static Skull blockToSkull(Block block, SkinData skinData) throws Exception + { + block.setType(Material.SKULL); + block.setData((byte) 1); + if (block.getState() instanceof Skull) + { + Skull skull = (Skull) block.getState(); + skull.setSkullType(SkullType.PLAYER); + Field field = Class.forName("org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull").getDeclaredField("profile"); + field.setAccessible(true); + GameProfile data = new GameProfile(UUID.randomUUID(), SkinData.getUnusedSkullName()); + data.getProperties().put("textures", skinData.getProperty()); + field.set(skull, data); + skull.update(); + return skull; + } + return null; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index b699559ff..27dca1730 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -8,15 +8,18 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; @@ -31,7 +34,10 @@ import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetChangeEvent; +import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger; import mineplex.core.gadget.gadgets.morph.MorphWitch; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuit; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; @@ -168,6 +174,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlue + "Bonus Item Unlocked with Power Play Club"); } } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -16) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Gingerbread Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) @@ -305,10 +316,22 @@ public class GadgetPage extends ShopPageBase { gadgetItemStack = ((MorphWitch) gadget).getWitchItem(); } + else if (gadget instanceof DeathPresentDanger) + { + gadgetItemStack = SkinData.PRESENT.getSkull(); + } else { gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); } + + if (gadget instanceof OutfitFreezeSuit && !(gadget instanceof OutfitFreezeSuitHelmet)) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) gadgetItemStack.getItemMeta(); + leatherArmorMeta.setColor(Color.fromRGB(129, 212, 250)); + gadgetItemStack.setItemMeta(leatherArmorMeta); + } + ItemMeta meta = gadgetItemStack.getItemMeta(); meta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); if (gadget.getActive().contains(getPlayer())) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java index 0bd0885c2..a488c922c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java @@ -35,7 +35,7 @@ public class ParticlePage extends GadgetPage slot++; - if (slot == 17 || slot == 26) + if (slot == 17 || slot == 26 || slot == 35) slot += 2; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 43f02ee30..29b0fcb3a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -56,6 +56,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger; import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; @@ -131,6 +132,10 @@ import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.gadgets.morph.managers.SoulManager; import mineplex.core.gadget.gadgets.morph.managers.SwimManager; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -140,6 +145,7 @@ 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.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -170,6 +176,7 @@ import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; +import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare; import mineplex.core.gadget.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCupidsLove; @@ -183,6 +190,7 @@ import mineplex.core.gadget.set.SetShadow; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; 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.types.ArrowEffectGadget; @@ -291,6 +299,7 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); + addSet(new SetFreezeSuit(this)); // Hidden in this update //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); @@ -343,6 +352,11 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); addGadget(new OutfitWindUpSuitBoots(this));*/ + + addGadget(new OutfitFreezeSuitHelmet(this)); + addGadget(new OutfitFreezeSuitChestplate(this)); + addGadget(new OutfitFreezeSuitLeggings(this)); + addGadget(new OutfitFreezeSuitBoots(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)); @@ -398,8 +412,8 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleWingsPixie(this)); addGadget(new ParticleYinYang(this)); addGadget(new ParticleFreedom(this)); - - + addGadget(new ParticleChristmasTree(this)); + // Arrow Trails addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailTitan(this)); @@ -428,6 +442,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); + addGadget(new DeathPresentDanger(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -462,6 +477,7 @@ public class GadgetManager extends MiniPlugin addGadget(new WinEffectRiseOfTheElderGuardian(this)); addGadget(new WinEffectLavaTrap(this)); addGadget(new WinEffectHalloween(this)); + addGadget(new WinEffectWinterWarfare(this)); // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); @@ -572,6 +588,12 @@ public class GadgetManager extends MiniPlugin event.getPlayer().setFlySpeed(0.1f); // Loads saved gadgets _userGadgetPersistence.load(event.getPlayer()); + + // Disables gadgets if there are more than 100 players in a server + if (UtilServer.getPlayers().length >= 100) + { + setGadgetEnabled(false); + } } public List getGadgets(GadgetType gadgetType) @@ -890,6 +912,12 @@ public class GadgetManager extends MiniPlugin event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); _soulManager.giveSoul(event.getPlayer()); + + // Enables gadgets if there are less than 100 players + if (UtilServer.getPlayers().length < 100) + { + setGadgetEnabled(true); + } } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java new file mode 100644 index 000000000..a0f73d33c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.gadget.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ToggleMobsEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private boolean _enable; + + public ToggleMobsEvent(boolean enable) + { + _enable = enable; + } + + public boolean enable() + { + return _enable; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java new file mode 100644 index 000000000..4d3ce92f7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java @@ -0,0 +1,92 @@ +package mineplex.core.gadget.gadgets.death.christmas; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.ToggleMobsEvent; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DeathPresentDanger extends DeathEffectGadget +{ + + private List _armorStands = new ArrayList<>(); + + public DeathPresentDanger(GadgetManager manager) + { + super(manager, "Present Danger", + UtilText.splitLineToArray(C.cGray + "Leave behind a little gift for your enemies.", LineFormat.LORE), + -16, + Material.INK_SACK, (byte)1); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + Location loc = event.getLocation(); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 14), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 4), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + + Bukkit.getPluginManager().callEvent(new ToggleMobsEvent(true)); + ArmorStand armorStand = loc.getWorld().spawn(loc.clone().subtract(0, 2.3, 0), ArmorStand.class); + armorStand.setVisible(false); + armorStand.setGravity(false); + armorStand.setSmall(true); + armorStand.setHelmet(SkinData.PRESENT.getSkull()); + _armorStands.add(armorStand); + Bukkit.getPluginManager().callEvent(new ToggleMobsEvent(false)); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _armorStands.iterator(); + while (iterator.hasNext()) + { + ArmorStand armorStand = iterator.next(); + if (armorStand.getTicksLived() >= 100 || !armorStand.isValid()) + { + Location loc = armorStand.getEyeLocation(); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 14), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 4), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + armorStand.remove(); + iterator.remove(); + } + } + } + + @EventHandler + public void removeArrows(EntityDamageByEntityEvent event) + { + if (event.getEntity() instanceof ArmorStand) + { + if (_armorStands.contains(event.getEntity())) + { + event.setCancelled(true); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java new file mode 100644 index 000000000..d4b8bd61b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java @@ -0,0 +1,102 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; + +public class FreezeSuitPathData +{ + + private ArrayList _blocks; + + public FreezeSuitPathData(Player player) + { + _blocks = new ArrayList<>(); + + //Add Blocks + if (Math.abs(player.getLocation().getDirection().getX()) > Math.abs(player.getLocation().getDirection().getZ())) + { + getBlocks(player.getLocation().add(0, 0, 1), 16); + getBlocks(player.getLocation().add(0, 0, -1), 16); + } + else + { + getBlocks(player.getLocation().add(1, 0, 0), 16); + getBlocks(player.getLocation().add(-1, 0, 0), 16); + } + + getBlocks(player.getLocation(), 16); + + //Sort Blocks + for (int i=0 ; i<_blocks.size() ; i++) + { + for (int j=0 ; j+1<_blocks.size() ; j++) + { + if (UtilMath.offset(player.getLocation(), _blocks.get(j).getLocation().add(0.5, 0.5, 0.5)) > + UtilMath.offset(player.getLocation(), _blocks.get(j+1).getLocation().add(0.5, 0.5, 0.5))) + { + Block temp = _blocks.get(j); + _blocks.set(j, _blocks.get(j+1)); + _blocks.set(j+1, temp); + } + } + } + } + + public void getBlocks(Location loc, int length) + { + //Below Player + loc.subtract(0, 1, 0); + + Vector dir = loc.getDirection(); + + double hLength = Math.sqrt(dir.getX()*dir.getX() + dir.getZ()*dir.getZ()); + + if (Math.abs(dir.getY()) > hLength) + { + if (dir.getY() > 0) + dir.setY(hLength); + else + dir.setY(-hLength); + + dir.normalize(); + } + + //Backtrack + loc.subtract(dir.clone().multiply(2)); + + double dist = 0; + while (dist < length) + { + dist += 0.2; + + loc.add(dir.clone().multiply(0.2)); + + if (loc.getBlock().getType() == Material.ICE) + continue; + + if (loc.getBlock().getType() == Material.AIR || loc.getBlock().getType() == Material.SNOW) + { + if (!_blocks.contains(loc.getBlock())) + { + _blocks.add(loc.getBlock()); + } + } + } + } + + public Block getNextBlock() + { + if (_blocks.isEmpty()) + return null; + + return _blocks.remove(0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java new file mode 100644 index 000000000..b4fc6f213 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java @@ -0,0 +1,175 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class OutfitFreezeSuit extends OutfitGadget +{ + + private Set _data = new HashSet<>(); + private Map _failedAttempts = new HashMap<>(); + + private static final int DURATION = 2000; + private static final int RANGE = 3; + private static final int MELT_TIME = 6000; + private static final int COOLDOWN = 15000; + + public OutfitFreezeSuit(GadgetManager manager, String name, int cost, ArmorSlot slot, Material mat, byte data) + { + super(manager, name, + UtilText.splitLineToArray(C.cGray + "Stolen directly from the Winter Lord's closet, this coat is designed to " + + "survive the coldest of weather! Press sneak to generate your ice bridge.", LineFormat.LORE), + cost, slot, mat, data); + setColor(Color.fromRGB(129, 212, 250)); + } + + @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 activateBridge(PlayerToggleSneakEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.Helmet) + return; + + if (!setActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + if (!Recharge.Instance.use(event.getPlayer(), "Ice Path", COOLDOWN, true, false, "Cosmetics")) + return; + + Player player = event.getPlayer(); + + player.teleport(player.getLocation().add(0, 1, 0)); + UtilAction.velocity(player, new Vector(0, 0.5, 0)); + + _data.add(new FreezeSuitPathData(player)); + } + + @EventHandler + public void snowAura(UpdateEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.Helmet) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for(Player player : UtilServer.getPlayers()) + { + if (!setActive(player)) + { + continue; + } + + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), + 0.25f, 0.25f, 0.25f, 0.1f, 1, UtilParticle.ViewDist.NORMAL); + + Map blocks = UtilBlock.getInRadius(player.getLocation(), RANGE); + + boolean setBlocks = true, forceBreak = false; + + for (Block block : blocks.keySet()) + { + if (Manager.getTreasureManager() != null) + { + if (Manager.getTreasureManager().isOpening(player)) + { + forceBreak= true; + } + for (Location blockLocation : Manager.getTreasureManager().getBlockLocations()) + { + if (blockLocation.distanceSquared(block.getLocation()) <= 25) + { + setBlocks = false; + } + } + } + if (forceBreak) + break; + + if (!setBlocks) + continue; + + Manager.getBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0); + } + } + } + + @EventHandler + public void icePath(UpdateEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.Helmet) + return; + + if (event.getType() != UpdateType.TICK) + return; + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FreezeSuitPathData data = dataIterator.next(); + + Block block = data.getNextBlock(); + + if (block == null) + { + dataIterator.remove(); + } + else + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); + Manager.getBlockRestore().add(block, 79, (byte) 0, MELT_TIME); + } + } + } + + private boolean setActive(Player player) + { + return getSet() != null && getSet().isActive(player); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java new file mode 100644 index 000000000..eae7ef9b7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitBoots extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitBoots(GadgetManager manager) + { + super(manager, "Freeze Boots", -16, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java new file mode 100644 index 000000000..744fd3cc1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitChestplate extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitChestplate(GadgetManager manager) + { + super(manager, "Freeze Chest", -16, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java new file mode 100644 index 000000000..641fa293a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitHelmet extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitHelmet(GadgetManager manager) + { + super(manager, "Freeze Helmet", -16, ArmorSlot.Helmet, Material.ICE, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java new file mode 100644 index 000000000..638c1d5c8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitLeggings extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitLeggings(GadgetManager manager) + { + super(manager, "Freeze Leggings", -16, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java new file mode 100644 index 000000000..8261df65c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java @@ -0,0 +1,58 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.ChristmasTreeEffect; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleChristmasTree extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleChristmasTree(GadgetManager manager) + { + super(manager, "Holiday Tree", UtilText.splitLinesToArray(new String[]{C.cGray + + "There's nothing like a well decorated tree to bring in the Holiday Spirit."}, LineFormat.LORE), + -16, Material.SAPLING, (byte) 1); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + + } + + @Override + public void startEffect(Player player) + { + if (!_effects.containsKey(player.getUniqueId())) + { + ChristmasTreeEffect christmasTreeEffect = new ChristmasTreeEffect(Manager.getPlugin(), player, Manager); + christmasTreeEffect.start(); + _effects.put(player.getUniqueId(), christmasTreeEffect); + } + } + + @Override + public void stopEffect(Player player) + { + if (_effects.containsKey(player.getUniqueId())) + { + ChristmasTreeEffect christmasTreeEffect = _effects.get(player.getUniqueId()); + christmasTreeEffect.stop(); + _effects.remove(player.getUniqueId()); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java new file mode 100644 index 000000000..67a9abe9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java @@ -0,0 +1,174 @@ +package mineplex.core.gadget.gadgets.wineffect; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.SchematicData; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.updater.UpdateType; + +public class WinEffectWinterWarfare extends WinEffectGadget +{ + + private Schematic _sleigh; + private Location _sleighLocation; + private DisguisePlayer _npc; + private Entity _entity; + private SchematicData _data; + private List _playersLeft; + + public WinEffectWinterWarfare(GadgetManager manager) + { + super(manager, "Winter Warfare", UtilText.splitLinesToArray(new String[]{C.cGray + + "Santa isn't only packing coal for the bad girls and boys this year!"}, LineFormat.LORE), -16, Material.TNT, (byte) 0); + _schematicName = "WinterWarfare"; + try + { + _sleigh = UtilSchematic.loadSchematic(new File("../../update/schematic/WinterWarfareSleigh.schematic")); + } catch (IOException e) + { + _sleigh = null; + e.printStackTrace(); + } + } + + @Override + public void play() + { + _sleighLocation = getBaseLocation().clone().subtract(0, -2, 0); + pasteSleigh(); + Location npcLocation = _sleighLocation.clone().add(44, 11, 4); + npcLocation.setYaw(90); + npcLocation.setPitch(0); + _npc = getNPC(_player, npcLocation); + List circle = UtilShapes.getPointsInCircle(getBaseLocation().clone().subtract(0, 2, 0), _other.size(), 3); + + _playersLeft = new ArrayList<>(); + + for(int i = 0; i < _other.size(); i++) + { + _playersLeft.add((ArmorStand) getNPC(_other.get(i), circle.get(i)).getEntity().getBukkitEntity()); + } + } + + @Override + public void finish() + { + Manager.getDisguiseManager().undisguise(_npc); + _npc = null; + } + + @Override + public void teleport() + { + Location loc = getBaseLocation().clone().subtract(0, -5, 15); + loc.setDirection(getBaseLocation().subtract(loc).toVector()); + super.teleport(loc); + } + + @Override + public void update(UpdateType type) + { + if (!isRunning()) + return; + + if (_sleighLocation == null) + return; + + if (type == UpdateType.FAST) + { + if (_npc == null) + return; + + TNTPrimed tnt = _sleighLocation.getWorld().spawn(_npc.getEntity().getBukkitEntity().getLocation().add(0, 3, 0), TNTPrimed.class); + int r = UtilMath.random.nextInt(50); + Vector vel = new Vector(Math.sin(r * 9/5d), 0, Math.cos(r * 9/5d)); + UtilAction.velocity(tnt, vel, Math.abs(Math.sin(r * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(r * 12/3000d))*0.6, 1, false); + } + + if (type != UpdateType.TICK) + return; + + // Teleports sleigh + _sleighLocation = _sleighLocation.subtract(1, 0, 0); + pasteSleigh(); + + if (_npc == null) + return; + + Location npcLocation = _sleighLocation.clone().add(44, 11, 4); + npcLocation.setYaw(90); + npcLocation.setPitch(0); + _npc.getEntity().getBukkitEntity().teleport(npcLocation); + } + + private void pasteSleigh() + { + if (_sleigh != null) + { + _data = _sleigh.paste(_sleighLocation); + } + } + + @EventHandler + public void onTNTExplode(EntityExplodeEvent event) + { + if (!isRunning()) + return; + + if (_playersLeft == null) + return; + + if (_playersLeft.size() < 1) + return; + + if (!(event.getEntity() instanceof TNTPrimed)) + return; + + boolean removePlayers = false; + + for(ArmorStand armorStand : _playersLeft) + { + if (armorStand.getLocation().distanceSquared(event.getEntity().getLocation()) <= 25) + { + removePlayers = true; + break; + } + } + + if (!removePlayers) + return; + + for(ArmorStand player : _playersLeft) + { + player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_HIT, 2, 1); + player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_DEATH, 1, 1); + player.remove(); + } + + _playersLeft.clear(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java new file mode 100644 index 000000000..4a7d41c0b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.set.suits; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; +import mineplex.core.gadget.types.GadgetSet; + +public class SetFreezeSuit extends GadgetSet +{ + + public SetFreezeSuit(GadgetManager manager) + { + super(manager, "Freeze Suit", "Grants the wearer a \"snow aura\" abd the ability to summon a bridge of ice.", + manager.getGadget(OutfitFreezeSuitHelmet.class), + manager.getGadget(OutfitFreezeSuitChestplate.class), + manager.getGadget(OutfitFreezeSuitLeggings.class), + manager.getGadget(OutfitFreezeSuitBoots.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index 72edc0486..3e69cb6e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -1,12 +1,14 @@ package mineplex.core.gadget.types; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.itemstack.ItemStackFactory; public abstract class OutfitGadget extends Gadget { @@ -31,18 +33,29 @@ public abstract class OutfitGadget extends Gadget } protected ArmorSlot _slot; + protected Color _color = null; public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames) { super(manager, GadgetType.COSTUME, name, desc, cost, mat, data, 1, altNames); _slot = slot; - } + } public ArmorSlot getSlot() { return _slot; } + + public void setColor(Color color) + { + _color = color; + } + + public Color getColor() + { + return _color; + } public void applyArmor(Player player, boolean message) { @@ -54,18 +67,26 @@ public abstract class OutfitGadget extends Gadget if (message) UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); + + ItemStack itemStack = new ItemStack(getDisplayMaterial(), 1, getDisplayData()); + if (getColor() != null) + { + if (itemStack.getItemMeta() instanceof LeatherArmorMeta) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta(); + leatherArmorMeta.setColor(getColor()); + leatherArmorMeta.setDisplayName(getName()); + itemStack.setItemMeta(leatherArmorMeta); + } + } + + if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(itemStack); - if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(itemStack); - else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(itemStack); - else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); - - else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(itemStack); } public void removeArmor(Player player, boolean message) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 0ab922d9d..36d104c15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -6,16 +6,11 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import com.mojang.authlib.GameProfile; -import mineplex.core.common.block.schematic.Schematic; -import mineplex.core.common.block.schematic.UtilSchematic; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.*; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; @@ -27,6 +22,21 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + /** * A wrapper for different win effects */ @@ -128,6 +138,12 @@ public abstract class WinEffectGadget extends Gadget * cleared. */ public abstract void finish(); + + /** + * This method is called when an update happens + * @param type The type of the update + */ + public void update(UpdateType type){}; public boolean isRunning() { @@ -236,6 +252,8 @@ public abstract class WinEffectGadget extends Gadget @EventHandler public void onUpdate(UpdateEvent event) { + update(event.getType()); + if (event.getType() != UpdateType.TICK) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index 5f6453616..7a06c5bf2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map.Entry; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; @@ -29,6 +30,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; @@ -1065,4 +1067,29 @@ public class ItemStackFactory extends MiniPlugin { _nameFormat = format; } + + public ItemStack createColoredLeatherArmor(int slot, Color color) + { + Material material = Material.LEATHER_HELMET; + switch (slot) + { + case 0: + material = Material.LEATHER_HELMET; + break; + case 1: + material = Material.LEATHER_CHESTPLATE; + break; + case 2: + material = Material.LEATHER_LEGGINGS; + break; + case 3: + material = Material.LEATHER_BOOTS; + break; + } + ItemStack stack = CreateStack(material); + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) stack.getItemMeta(); + leatherArmorMeta.setColor(color); + stack.setItemMeta(leatherArmorMeta); + return stack; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java index d0fdbc78e..98d1b2a35 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java @@ -17,12 +17,18 @@ public class BabyFireworkEffect extends Effect private Color _fireworkColor; private Location _fireworkLocation; private Random _random = new Random(); - private int _count = 0, _fireworkCount = 0; + private int _count = 0, _fireworkCount = 0, _maxCount = -1; private boolean _multipleColors = false; private int _currentColor = 0; private Color[] _colors; + private boolean _trail = true; public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) + { + this(location, javaPlugin, color, -1); + } + + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color, int maxCount) { super(10, new EffectLocation(location), javaPlugin, 2); _fireworkColor = color; @@ -34,6 +40,7 @@ public class BabyFireworkEffect extends Effect } _colors = new Color[0]; + _maxCount = maxCount; } public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color... colors) @@ -50,9 +57,30 @@ public class BabyFireworkEffect extends Effect _count = count; } + public void setTrail(boolean trail) + { + _trail = trail; + } + + @Override + public void onStart() + { + if (!_trail) + { + _count = 6; + } + } + @Override public void runEffect() { + if (_maxCount != -1) + { + if (_maxCount >= _fireworkCount) + { + stop(); + } + } if (_count == 0) { double randX = _random.nextDouble() * 2 - 1, randY = _random.nextDouble() + .5, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java new file mode 100644 index 000000000..07ade841a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java @@ -0,0 +1,76 @@ +package mineplex.core.particleeffects; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; + +public class ChristmasTreeEffect extends Effect +{ + + private Player _player; + private JavaPlugin _plugin; + private int _count = 0; + private double _currentRadius = 0; + private double _currentY = 0; + private BabyFireworkEffect _babyFireworkEffect = null; + private GadgetManager _manager; + + private static final double MAX_RADIUS = 1.; + private static final double MAX_Y = 2.5; + + public ChristmasTreeEffect(JavaPlugin plugin, Player player, GadgetManager manager) + { + super(-1, new EffectLocation(player), plugin, 5); + _player = player; + _plugin = plugin; + _manager = manager; + } + + @Override + public void runEffect() + { + if (_manager.isMoving(_player)) + { + Location loc = _player.getLocation().add(0, 1.2, 0).add(_player.getLocation().getDirection().multiply(-0.2)); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.MAROON), loc); + coloredParticle.display(); + coloredParticle.setColor(new DustSpellColor(Color.GREEN)); + coloredParticle.display(); + return; + } + if (_currentY < MAX_Y) + { + double radius = MAX_RADIUS - _currentRadius; + _currentRadius += 0.1; + CircleEffect circleEffect = new CircleEffect(_plugin, _player.getLocation().clone().add(0, _currentY, 0), radius, Color.GREEN); + circleEffect.addRandomColor(Color.RED); + circleEffect.addRandomColor(Color.YELLOW); + circleEffect.start(); + _currentY += 0.25; + } + else + { + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(_player.getLocation().clone().add(0, MAX_Y + .5, 0), _plugin, Color.YELLOW, 1); + babyFireworkEffect.setTrail(false); + babyFireworkEffect.start(); + _babyFireworkEffect = babyFireworkEffect; + _babyFireworkEffect.setCallback(new Callback() + { + @Override + public void run(Effect data) + { + _currentY = 0; + _currentRadius = 0; + } + }); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java new file mode 100644 index 000000000..ef5e25dfb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java @@ -0,0 +1,119 @@ +package mineplex.core.particleeffects; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Color; +import org.bukkit.Location; +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 CircleEffect extends Effect +{ + + private double _radius; + private Color _color; + private int _steps = 0; + private boolean _instantly = true; + private List _randomColors = new ArrayList<>(); + private int _maxCircles = -1; + private int _totalCircles = 0; + + private static final double RANDOM_COLOR_CHANCE = 0.5; + private static final int PARTICLES_PER_CIRCLE = 20; + + public CircleEffect(JavaPlugin plugin, Location location, double radius, Color color) + { + super(-1, new EffectLocation(location), plugin); + _radius = radius; + _color = color; + } + + public CircleEffect(JavaPlugin plugin, Location location, double radius, Color color, boolean instantly) + { + this(plugin, location, radius, color); + _instantly = instantly; + } + + public void addRandomColor(Color color) + { + _randomColors.add(color); + } + + public void setMaxCircles(int circles) + { + _maxCircles = circles; + } + + @Override + public void runEffect() + { + if (_instantly) + { + for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) + { + Location location = getEffectLocation().getFixedLocation(); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(_color), location.add(vector)); + coloredParticle.display(); + if (_randomColors.size() > 0) + { + double r = UtilMath.random.nextDouble(); + if (r < RANDOM_COLOR_CHANCE) + { + coloredParticle.setColor(new DustSpellColor(getRandomColor())); + coloredParticle.display(); + } + } + _steps++; + } + stop(); + } + else + { + if (_maxCircles != -1) + { + if (_totalCircles >= _maxCircles) + { + stop(); + return; + } + } + Location location = getEffectLocation().getFixedLocation(); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(_color), location.add(vector)); + coloredParticle.display(); + if (_randomColors.size() > 0) + { + double r = UtilMath.random.nextDouble(); + if (r < RANDOM_COLOR_CHANCE) + { + coloredParticle.setColor(new DustSpellColor(getRandomColor())); + coloredParticle.display(); + } + } + _steps++; + if (_steps >= PARTICLES_PER_CIRCLE) + { + _totalCircles++; + _steps = 0; + } + } + } + + private Color getRandomColor() + { + int r = UtilMath.random.nextInt(_randomColors.size()); + return _randomColors.get(r); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java index 818d75c63..5ddda6a72 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java @@ -3,6 +3,8 @@ package mineplex.core.particleeffects; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.common.util.Callback; + public abstract class Effect { @@ -12,6 +14,7 @@ public abstract class Effect public EffectLocation _targetLocation; protected JavaPlugin _javaPlugin; private boolean _running = false; + private Callback _callback; public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin) { @@ -47,6 +50,8 @@ public abstract class Effect { _running = false; Bukkit.getScheduler().cancelTask(_task); + if (_callback != null) + _callback.run(this); onStop(); } @@ -83,4 +88,9 @@ public abstract class Effect return _effectLocation; } + public void setCallback(Callback callback) + { + _callback = callback; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java new file mode 100644 index 000000000..ac29342af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.particleeffects.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.particleeffects.Effect; + +public class EffectStopEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Effect _effect; + + public EffectStopEvent(Effect effect) + { + _effect = effect; + } + + public Effect getEffect() + { + return _effect; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java similarity index 85% rename from Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java rename to Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java index 781c0b884..c736ea1f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java @@ -1,31 +1,32 @@ package mineplex.core.pet; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilMath; import org.bukkit.Location; -import org.bukkit.entity.Blaze; +import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -public class GrimReaperPetManager +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; + +public class FlyingPetManager { /** - * Makes the Grim Reaper Pet fly around the player + * Makes the Fkying pets fly around the player * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} */ private Player _player; - private Blaze _blaze; + private Creature _pet; private Location _grimReaperLoc, _target; private Vector _direction; private double _speed; private long _idleTime; - public GrimReaperPetManager(Player player, Blaze blaze) + public FlyingPetManager(Player player, Creature pet) { _player = player; - _blaze = blaze; + _pet = pet; _grimReaperLoc = player.getEyeLocation(); _target = getNewTarget(); _speed = 0.2; @@ -73,8 +74,8 @@ public class GrimReaperPetManager if (UtilMath.offset(_grimReaperLoc, _target) > 0.1) _grimReaperLoc.add(_direction.clone().multiply(_speed)); - _blaze.teleport(_grimReaperLoc); - _blaze.setVelocity(new Vector(0, .25, 0)); + _pet.teleport(_grimReaperLoc); + _pet.setVelocity(new Vector(0, .25, 0)); } private Location getNewTarget() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 0ffe4e595..842779688 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -8,15 +8,18 @@ import java.util.Map.Entry; import java.util.UUID; import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Bukkit; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.SkullType; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.entity.Ageable; import org.bukkit.entity.Blaze; @@ -30,6 +33,7 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; @@ -50,6 +54,7 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.util.F; +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -67,6 +72,7 @@ import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; import mineplex.core.events.AddConditionEvent; import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -92,7 +98,7 @@ public class PetManager extends MiniClientPlugin private CoreClientManager _clientManager; private InventoryManager _inventoryManager; - private Map _grimReaperMorphs = new HashMap<>(); + private Map _flyingPets = new HashMap<>(); private ShapeWings _wings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); @@ -259,7 +265,7 @@ public class PetManager extends MiniClientPlugin pet.setCustomName(Get(player).getPets().get(petType)); } - if (pet instanceof Zombie) + if (petType.equals(PetType.ZOMBIE)) { ((Zombie) pet).setBaby(true); pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); @@ -327,8 +333,30 @@ public class PetManager extends MiniClientPlugin } _disguiseManager.disguise(disguiseZombie); - GrimReaperPetManager grimReaperPetManager = new GrimReaperPetManager(player, (Blaze) pet); - _grimReaperMorphs.put((Blaze) pet, grimReaperPetManager); + FlyingPetManager flyingPetManager = new FlyingPetManager(player, pet); + _flyingPets.put(pet, flyingPetManager); + } + else if (petType.equals(PetType.GINGERBREAD_MAN)) + { + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + zombie.getEquipment().setHelmet(SkinData.GINGERBREAD.getSkull()); + zombie.getEquipment().setChestplate(ItemStackFactory.Instance.createColoredLeatherArmor(1, Color.fromRGB(203, 122, 56))); + zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, Color.fromRGB(203, 122, 56))); + zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, Color.fromRGB(203, 122, 56))); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + + // Makes it silent + net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) zombie).getHandle(); + NBTTagCompound tag = new NBTTagCompound(); + nmsEntity.c(tag); + tag.setByte("Silent", (byte) 1); + nmsEntity.f(tag); } _activePetOwnerTypes.put(player.getName(), petType); @@ -361,7 +389,7 @@ public class PetManager extends MiniClientPlugin if (pet instanceof Blaze) { - _grimReaperMorphs.remove(pet); + _flyingPets.remove(pet); } pet.remove(); @@ -535,17 +563,33 @@ public class PetManager extends MiniClientPlugin } /** - * Makes the Grim Reaper pet fly around the player + * Makes the Flying pet fly around the player * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} * @param event */ @EventHandler public void grimReaperFly(UpdateEvent event) { - for (Entry entry : _grimReaperMorphs.entrySet()) + for (Entry entry : _flyingPets.entrySet()) { - GrimReaperPetManager grimReaperPetManager = entry.getValue(); - grimReaperPetManager.update(); + FlyingPetManager flyingPetManager = entry.getValue(); + flyingPetManager.update(); + } + } + + /** + * Blocks zombie pets catching fire + * @param event + */ + @EventHandler + public void noFire(EntityCombustEvent event) + { + if (event.getEntity() instanceof Zombie) + { + if (_activePetOwners.containsValue((Creature) event.getEntity())) + { + event.setCancelled(true); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 4072f41c1..6c06165d4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -26,6 +26,7 @@ public enum PetType SKELETON("Guardian", EntityType.SKELETON, -13), RABBIT("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them."), 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."), // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 0ec82d7c0..df3708a80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -27,6 +27,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger; import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; @@ -76,6 +77,10 @@ import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -84,6 +89,7 @@ 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.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -111,6 +117,7 @@ import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; +import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; @@ -471,6 +478,12 @@ public class RewardManager addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); + + // GINGERBREAD CHEST + addGadget(Type.GINGERBREAD, getGadget(ParticleChristmasTree.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitChestplate.class), rarity, 100); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitLeggings.class), rarity, 100); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitBoots.class), rarity, 50); } public void addLegendary() @@ -638,6 +651,12 @@ public class RewardManager addMount(Type.THANKFUL, getMount(MountCake.class), rarity, 10); addPetReward(Type.THANKFUL, PetType.VILLAGER, rarity, 10); addPetReward(Type.THANKFUL, PetType.PIG_ZOMBIE, rarity, 10); + + // GINGERBREAD + addGadget(Type.GINGERBREAD, getGadget(DeathPresentDanger.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(WinEffectWinterWarfare.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitHelmet.class), rarity, 1); + addPetReward(Type.GINGERBREAD, PetType.GINGERBREAD_MAN, rarity, 10); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) @@ -847,7 +866,7 @@ public class RewardManager { int amount = 4; if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST - || type == RewardType.HAUNTED_CHEST) amount = 1; + || type == RewardType.HAUNTED_CHEST || type == RewardType.GINGERBREAD_CHEST) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 54568ea23..566e841be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -4,12 +4,12 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import org.bukkit.entity.Player; + import mineplex.core.reward.rewards.GemReward; import mineplex.core.reward.rewards.InventoryReward; - import mineplex.core.reward.rewards.TreasureShardReward; import mineplex.core.reward.rewards.UnknownPackageReward; -import org.bukkit.entity.Player; /** * Used to separate different "Reward Pools". This allows us to have treasure chests with different loot. @@ -59,6 +59,7 @@ public class RewardPool HAUNTED(false), TRICK_OR_TREAT(false), THANKFUL(false), + GINGERBREAD(false), 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 eb59b886f..c30336f2b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -5,22 +5,23 @@ import java.util.ArrayList; public enum RewardType { //% Chances Mythic Legend Rare Uncommon - GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), - - OLD_CHEST( 0, 0.06, 0.8, 16), - ANCIENT_CHEST( 0, 2, 8, 32), - MYTHICAL_CHEST( 0.1, 4, 16, 72), - WINTER_CHEST( 0, 5, 18, 32), - ILLUMINATED_CHEST( 0, 2, 16, 72), - FREEDOM_CHEST( 0, 5, 18, 0), - HAUNTED_CHEST( 0, 5, 18, 0), - OMEGA_CHEST( 0, 32, 16, 2), + GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), + + OLD_CHEST( 0, 0.06, 0.8, 16), + ANCIENT_CHEST( 0, 2, 8, 32), + MYTHICAL_CHEST( 0.1, 4, 16, 72), + WINTER_CHEST( 0, 5, 18, 32), + ILLUMINATED_CHEST( 0, 2, 16, 72), + FREEDOM_CHEST( 0, 5, 18, 0), + HAUNTED_CHEST( 0, 5, 18, 0), + OMEGA_CHEST( 0, 32, 16, 2), TRICK_OR_TREAT_CHEST(0.1, 2, 16, 0), THANKFUL_CHEST( 0.1, 2, 16, 0), - VALENTINES_GIFT( 0, 7, 20, 20), + GINGERBREAD_CHEST( 0, 2, 16, 0), + VALENTINES_GIFT( 0, 7, 20, 20), - SPINNER_FILLER( 0.1, 1, 4, 20), - SPINNER_REAL( 0.000001, 0.05, 0.4, 5); + SPINNER_FILLER( 0.1, 1, 4, 20), + SPINNER_REAL( 0.000001, 0.05, 0.4, 5); private double _mythicalChance; private double _legendaryChance; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 7bf4ec023..de8a2aa1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -135,7 +135,7 @@ public class TreasureLocation implements Listener } if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA - || treasureType == TreasureType.HAUNTED) + || treasureType == TreasureType.HAUNTED || treasureType == TreasureType.GINGERBREAD) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index 8c9c2f69d..c32d1e8da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -68,7 +68,15 @@ public enum TreasureStyle ParticleType.HAPPY_VILLAGER, ParticleType.HAPPY_VILLAGER, Sound.CHICKEN_IDLE, - Sound.CHICKEN_EGG_POP); + Sound.CHICKEN_EGG_POP + ), + GINGERBREAD( + ParticleType.SNOW_SHOVEL, + ParticleType.SNOW_SHOVEL, + ParticleType.SNOW_SHOVEL, + Sound.DIG_SNOW, + Sound.DIG_SNOW + ); private ParticleType _secondaryParticle; private ParticleType _chestSpawnParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 4e3dc49eb..dd0342370 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -26,7 +26,9 @@ public enum TreasureType TRICK_OR_TREAT(C.cGold + "Trick or Treat Treasure", "Trick or Treat Chest", "TrickOrTreat", RewardType.TRICK_OR_TREAT_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.TRICK_OR_TREAT, true, 20000), - THANKFUL(C.cGold + "Thankful Treasure", "Thankful Chest", "ThankFul", RewardType.THANKFUL_CHEST, Material.CHEST, TreasureStyle.THANKFUL, RewardPool.Type.THANKFUL, true, 20000); + THANKFUL(C.cGold + "Thankful Treasure", "Thankful Chest", "ThankFul", RewardType.THANKFUL_CHEST, Material.CHEST, TreasureStyle.THANKFUL, RewardPool.Type.THANKFUL, true, 20000), + + GINGERBREAD(C.cRed + "Gingerbread " + C.cGreen + "Treasure", "Gingerbread Chest", "Gingerbread", RewardType.GINGERBREAD_CHEST, Material.CHEST, TreasureStyle.GINGERBREAD, RewardPool.Type.GINGERBREAD, 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 5dbc7ebd4..59b91fcd7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -5,7 +5,10 @@ import java.util.List; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Skull; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.UtilBlock; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; @@ -81,6 +84,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 1; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + mat = Material.STAINED_CLAY; + data = 13; + } else continue; @@ -118,6 +126,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 15; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + mat = Material.STAINED_CLAY; + data = 14; + } else continue; @@ -174,6 +187,32 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + for (Block c : _chests) + { + if (c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + try + { + Skull skull = UtilBlock.blockToSkull(c, SkinData.GINGERBREAD); + if (skull != null) + { + skull.setRotation(getSkullDirection(skull.getBlock())); + skull.update(); + } + else + { + c.setType(Material.AIR); + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + } + } } } @@ -209,4 +248,22 @@ public class BlockChangeAnimation extends Animation } return direction; } + + private BlockFace getSkullDirection(Block block) + { + byte direction = getDirection(block); + switch (direction) + { + case (byte) 0: + return BlockFace.SOUTH; + case (byte) 1: + return BlockFace.WEST; + case (byte) 2: + return BlockFace.NORTH; + case (byte) 3: + return BlockFace.EAST; + default: + return BlockFace.SOUTH; + } + } } 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 7c81c9245..af45690f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -2,6 +2,9 @@ package mineplex.core.treasure.animation; import java.util.List; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.MathHelper; + import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.block.Block; @@ -28,11 +31,10 @@ import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.particleeffects.BabyFireworkEffect; +import mineplex.core.particleeffects.CircleEffect; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.MathHelper; /** * Created by Shaun on 8/29/2014. @@ -203,6 +205,12 @@ public class ChestSpawnAnimation extends Animation _circleAmount++; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + CircleEffect circleEffect = new CircleEffect(_javaPlugin, _centerLocation.clone().add(0, 0.5, 0), 1.3, Color.GREEN); + circleEffect.setMaxCircles(2); + circleEffect.start(); + } else if (getTreasure().getTreasureType() == TreasureType.HAUNTED || getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) { float x = (float) (Math.sin(getTicks()/4D)); @@ -233,7 +241,7 @@ public class ChestSpawnAnimation extends Animation //Spawn Chest if (getTicks() >= ANIMATION_DURATION) { - if(getTreasure().getTreasureType() == TreasureType.ILLUMINATED) + if(getTreasure().getTreasureType() == TreasureType.ILLUMINATED || getTreasure().getTreasureType() == TreasureType.GINGERBREAD) { UtilBlock.setQuick(_block.getWorld(), _block.getX(), _block.getY(), _block.getZ(), 0, (byte) 0); } @@ -260,7 +268,8 @@ public class ChestSpawnAnimation extends Animation if (particleType != null) { - if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED) + if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED + || getTreasure().getTreasureType() != TreasureType.GINGERBREAD) { UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, ViewDist.NORMAL, UtilServer.getPlayers()); @@ -273,6 +282,14 @@ public class ChestSpawnAnimation extends Animation _centerLocation.clone().add(.5, .5, .5)); coloredParticle.display(); } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + int r = (int) (Math.random() * 3); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor(Color.GREEN), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } else { int r = (int) (Math.random() * 2); 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 5e1ad96e3..5a519e16f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -80,7 +80,7 @@ public class BuyChestButton implements IButton } if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA - || _chestType == TreasureType.HAUNTED)) + || _chestType == TreasureType.HAUNTED || _chestType == TreasureType.GINGERBREAD)) { 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 3c123eb71..77d190c5a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -16,6 +16,8 @@ import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; @@ -65,6 +67,7 @@ public class TreasurePage extends ShopPageBase int hauntedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.HAUNTED.getItemName()); int trickCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.TRICK_OR_TREAT.getItemName()); int thankCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.THANKFUL.getItemName()); + int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -142,6 +145,7 @@ public class TreasurePage extends ShopPageBase christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); else { + christmasLore.add(C.cRed + "This item is no longer available!"); /* christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards"); christmasLore.add(" "); @@ -232,7 +236,7 @@ public class TreasurePage extends ShopPageBase boolean available = new File("../../update/files/EnableTrickOrTreat.dat").exists(); if (!available) { - trickLore.add(ChatColor.RESET + "This chest is currently unavailable"); + trickLore.add(C.cRed + "This item is no longer available!"); } else { @@ -259,7 +263,7 @@ public class TreasurePage extends ShopPageBase boolean available = new File("../../update/files/EnableThankful.dat").exists(); if (!available) { - thankLore.add(ChatColor.RESET + "This chest is currently unavailable"); + thankLore.add(C.cRed + "This item is no longer available!"); } else { @@ -269,6 +273,26 @@ public class TreasurePage extends ShopPageBase } } + List gingerbreadLore = Lists.newArrayList(); + gingerbreadLore.add(" "); + gingerbreadLore.add(F.value("Gingerbread Chests Owned", "" + gingerbreadCount)); + gingerbreadLore.add(" "); + gingerbreadLore.addAll(UtilText.splitLine(C.cGray + "The legendary burglar, " + + "the Gingerbread Man, has finally been caught! Now, for the first time his loot is available for auction." + + " There are 8 pieces available for to collect and no duplicates can be obtained from this chest!", + LineFormat.LORE)); + gingerbreadLore.add(" "); + if (gingerbreadCount > 0) + { + gingerbreadLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + } + else + { + gingerbreadLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); + gingerbreadLore.add(" "); + gingerbreadLore.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); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Treasure", heroicLore.toArray(new String[0]), 0, false, false); @@ -280,15 +304,17 @@ public class TreasurePage extends ShopPageBase ItemStack haunted = SkinData.HAUNTED_CHEST.getSkull(C.cGoldB + "Haunted Treasure", hauntedLore); ItemStack trick = new ShopItem(Material.SKULL_ITEM, C.cGoldB + "Trick or Treat Treasure", trickLore.toArray(new String[0]), 0, false, false); 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); addItem(49, shards); - addChest(3, trick, TreasureType.TRICK_OR_TREAT, trickCount); - addChest(5, thank, TreasureType.THANKFUL, thankCount); addChest(10, christmas, TreasureType.CHRISTMAS, christmasCount); addChest(12, freedom, TreasureType.FREEDOM, freedomCount); addChest(14, haunted, TreasureType.HAUNTED, hauntedCount); addChest(16, omega, TreasureType.OMEGA, omegaCount); + addChest(20, trick, TreasureType.TRICK_OR_TREAT, trickCount); + addChest(22, gingerbread, TreasureType.GINGERBREAD, gingerbreadCount); + addChest(24, thank, TreasureType.THANKFUL, thankCount); addChest(28, basic, TreasureType.OLD, basicCount); addChest(30, heroic, TreasureType.ANCIENT, heroicCount); addChest(32, legendary, TreasureType.MYTHICAL, legendaryCount); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index d5018baf1..735acabb0 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -160,6 +160,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int hauntedChestsOpened = 0; int trickOrTreatChestsReceived = 0; int thankfulChestsReceived = 0; + int gingerbreadChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -281,6 +282,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable thankfulChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Gingerbread Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + gingerbreadChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + gingerbreadChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -352,6 +364,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived); caller.sendMessage(C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived); + caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 134a38599..25bb9dffa 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -22,6 +22,7 @@ import mineplex.staffServer.salespackage.salespackages.ClanBannerUsage; import mineplex.staffServer.salespackage.salespackages.Coins; import mineplex.staffServer.salespackage.salespackages.DefaultRank; import mineplex.staffServer.salespackage.salespackages.FreedomChest; +import mineplex.staffServer.salespackage.salespackages.GingerbreadChest; import mineplex.staffServer.salespackage.salespackages.HauntedChest; import mineplex.staffServer.salespackage.salespackages.IlluminatedChest; import mineplex.staffServer.salespackage.salespackages.LifetimeEternal; @@ -83,6 +84,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new MythicalChest(this)); AddSalesPackage(new IlluminatedChest(this)); AddSalesPackage(new FreedomChest(this)); + AddSalesPackage(new GingerbreadChest(this)); //AddSalesPackage(new ValentinesGift(this)); //AddSalesPackage(new FrostLord(this)); //AddSalesPackage(new EasterBunny(this)); @@ -164,7 +166,8 @@ 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) + 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 GingerbreadChest) { 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/GingerbreadChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/GingerbreadChest.java new file mode 100644 index 000000000..c016dcfe1 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/GingerbreadChest.java @@ -0,0 +1,22 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class GingerbreadChest extends SalesPackageBase +{ + + public GingerbreadChest(SalesPackageManager manager) + { + super(manager, "1 Gingerbread Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Gingerbread Chest", "Give 1 Gingerbread Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 740a1acea..55cbdc20b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -69,6 +69,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; +import mineplex.core.gadget.event.ToggleMobsEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.hologram.HologramManager; @@ -1983,6 +1984,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation _conditionManager.AddCondition(new Condition(_conditionManager, event)); } + /** + * Allows toggling mob spawning from another module + * @param event + */ + @EventHandler + public void toggleMobSpawning(ToggleMobsEvent event) + { + if (_game != null) + { + _game.CreatureAllowOverride = event.enable(); + } + } + public ProgressingKitManager getProgressionKitManager() { return _progressionKitManager;