From 8da5813f299aa0686f5acad0c8f7e198b7c6422b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 11:27:45 -0300 Subject: [PATCH] Add Halloween Cosmetics (#227) * Internal: Changed imports from java.awt.Color to org.bukkit.Color External: Added Double Jump Halloween Added Arrow Trail Halloween Added Pumpkin Hat * Internal: Fixed Arrow Trail Halloween Added new methods to ParticleData Renamed playerNPC to _playerNPC (WinEffectLavaTrap) Removed unecessary method (WinEffectManager) Added a command to test win rooms properly Fixed Squid Morph not showing name unless players hovered over it Created a Manager for the Morphs so we avoid using deprecated methods External: Added Halloween Win Room Added Grim Reaper Morph Added Headless Horseman Morph Added Nightmare Steed * Internal: Renamed RewardType enums to have upper case External: Added Halloween Death Effect Added Haunted Chest Added Baby Zombie Jockey Pet Changed the names of the items Added Grim Reaper pet * Slack integration to test stuff (Will not be in the code in the last commit) * Fixed Grim Reaper Hoe not being removed after the morph is disabled * Details for the Haunted Chest * Details for all the items (lores, icons, texts, effects, etc) Removed Headless Horseman Morph * Fixes for lores and names Support server stuff * Fixes for the Lock and Unlock cosmetics commands * Fixes for the Grim Reaper Morph * Fixes for the Grim Reaper Morph Removed debug messages * Fixed a memory leak. Thanks to Sam * Fix imports * Removed unused code Added javadocs to UtilTextBottom#displayProgress() Added javadocs to UtilAlg#getRandomLocation() * Removed Death Effect Increased Arrow Trail particles Increased Double Jump particles --- .../core/common/shape/ShapeWings.java | 13 + .../mineplex/core/common/skin/SkinData.java | 3 + .../mineplex/core/common/util/UtilAlg.java | 34 ++- .../core/common/util/UtilTextBottom.java | 32 ++- .../util/particles/ColoredParticle.java | 11 +- .../common/util/particles/DustSpellColor.java | 2 +- .../core/common/util/particles/NoteColor.java | 2 +- .../common/util/particles/ParticleColor.java | 2 - .../common/util/particles/ParticleData.java | 22 +- .../bonuses/commands/AnimationCommand.java | 2 +- .../mineplex/core/bonuses/gui/SpinGui.java | 6 +- .../core/cosmetic/CosmeticManager.java | 30 ++- .../cosmetic/event/SlackCosmeticEvent.java | 45 ++++ .../core/cosmetic/ui/page/GadgetPage.java | 5 + .../core/cosmetic/ui/page/MountPage.java | 13 +- .../core/cosmetic/ui/page/PetPage.java | 33 ++- .../disguise/disguises/DisguiseZombie.java | 8 +- .../src/mineplex/core/elo/TopEloCommand.java | 6 +- .../core/events/AddConditionEvent.java | 232 ++++++++++++++++++ .../core/events/EnableArcadeSpawnEvent.java | 37 +++ .../mineplex/core/gadget/GadgetManager.java | 61 +++-- .../gadget/commands/WinRoomTestCommand.java | 72 ++++++ .../arrowtrail/ArrowTrailHalloween.java | 56 +++++ .../arrowtrail/freedom/ArrowTrailFreedom.java | 5 +- .../doublejump/DoubleJumpHalloween.java | 78 ++++++ .../cupidslove/DoubleJumpCupidsWings.java | 13 +- .../core/gadget/gadgets/hat/HatType.java | 23 +- .../core/gadget/gadgets/item/ItemCoal.java | 2 +- .../core/gadget/gadgets/morph/BlockForm.java | 7 +- .../core/gadget/gadgets/morph/MorphBat.java | 11 +- .../core/gadget/gadgets/morph/MorphBlaze.java | 11 +- .../core/gadget/gadgets/morph/MorphBunny.java | 23 +- .../gadget/gadgets/morph/MorphChicken.java | 13 +- .../core/gadget/gadgets/morph/MorphCow.java | 11 +- .../gadget/gadgets/morph/MorphCreeper.java | 13 +- .../gadget/gadgets/morph/MorphEnderman.java | 13 +- .../gadget/gadgets/morph/MorphGrimReaper.java | 228 +++++++++++++++++ .../core/gadget/gadgets/morph/MorphPig.java | 11 +- .../gadgets/morph/MorphPumpkinKing.java | 18 +- .../core/gadget/gadgets/morph/MorphSlime.java | 11 +- .../gadget/gadgets/morph/MorphSnowman.java | 11 +- .../core/gadget/gadgets/morph/MorphSquid.java | 12 +- .../core/gadget/gadgets/morph/MorphTitan.java | 11 +- .../gadget/gadgets/morph/MorphVillager.java | 17 +- .../gadget/gadgets/morph/MorphWither.java | 11 +- .../gadgets/morph/managers/SoulManager.java | 112 +++++++++ .../morph/{swim => managers}/SwimManager.java | 2 +- .../gadgets/morph/managers/UtilMorph.java | 81 ++++++ .../unrelated/BabyFireworkEffect.java | 40 ++- .../unrelated/FreedomFireworkEffect.java | 2 +- .../unrelated/FreedomTrailEffect.java | 2 - .../unrelated/HalloweenSmashedEffect.java | 25 ++ .../particle/unrelated/MetalManEffect.java | 1 + .../wineffect/WinEffectBabyChicken.java | 46 +--- .../gadgets/wineffect/WinEffectHalloween.java | 181 ++++++++++++++ .../gadgets/wineffect/WinEffectLavaTrap.java | 8 +- .../mineplex/core/gadget/types/Gadget.java | 19 +- .../core/gadget/types/WinEffectGadget.java | 72 +++++- .../listeners/GlobalGiveItem.java | 4 +- .../src/mineplex/core/mount/MountManager.java | 1 + .../core/mount/types/MountNightmareSteed.java | 123 ++++++++++ .../core/mount/types/MountSpider.java | 4 +- .../core/mount/types/MountZombie.java | 9 +- .../core/pet/GrimReaperPetManager.java | 85 +++++++ .../src/mineplex/core/pet/Pet.java | 20 +- .../src/mineplex/core/pet/PetFactory.java | 6 +- .../src/mineplex/core/pet/PetManager.java | 162 +++++++----- .../mineplex/core/reward/RewardManager.java | 127 +++++++--- .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 25 +- .../core/reward/rewards/RankReward.java | 4 +- .../core/shop/item/SalesPackageBase.java | 4 +- .../src/mineplex/core/slack/SlackAPI.java | 8 +- .../src/mineplex/core/slack/SlackMessage.java | 23 +- .../src/mineplex/core/slack/SlackTeam.java | 2 +- .../src/mineplex/core/treasure/Treasure.java | 12 +- .../core/treasure/TreasureLocation.java | 8 +- .../mineplex/core/treasure/TreasureStyle.java | 7 + .../mineplex/core/treasure/TreasureType.java | 16 +- .../animation/BlockChangeAnimation.java | 38 ++- .../animation/ChestSpawnAnimation.java | 36 ++- .../treasure/event/TreasureStartEvent.java | 10 +- .../core/treasure/gui/BuyChestButton.java | 3 +- .../core/treasure/gui/TreasurePage.java | 51 ++-- .../valentines/ValentinesGiftManager.java | 4 +- .../src/mineplex/hub/HubManager.java | 2 +- .../hub/modules/HolidayGiftManager.java | 2 +- .../src/mineplex/hub/modules/JumpManager.java | 24 +- .../mineplex/hub/modules/StackerManager.java | 54 ++-- .../game/core/condition/Condition.java | 15 +- .../customerSupport/CustomerSupport.java | 45 ++++ .../salespackage/SalesPackageManager.java | 20 +- .../salespackages/HauntedChest.java | 19 ++ .../nautilus/game/arcade/ArcadeManager.java | 98 +++++--- .../arcade/game/games/typewars/Minion.java | 2 +- .../game/arcade/managers/GameLootManager.java | 4 +- .../game/arcade/managers/HolidayManager.java | 85 +++++-- .../arcade/wineffect/WinEffectManager.java | 10 +- 98 files changed, 2517 insertions(+), 527 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/{swim => managers}/SwimManager.java (89%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java index f42dcaddc..6d5ca87be 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java @@ -35,6 +35,19 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape "00$#$0000000000$#$00", "000$000000000000$000", }; + + public static final String[] SMALL_ANGEL_WING_PATTERN = new String[] + { + "00$0000$00", + "0$#$00$#$0", + "$##$00$##$", + "$###$$###$", + "$########$", + "$########$", + "$##$$$$##$", + "0$#$00$#$0", + "00$0000$00" + }; public static final String[] BUTTERFLY_WING_PATTERN = new String[] { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index b551ca902..29abc2b86 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 @@ -57,6 +57,9 @@ public class SkinData public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M="); public final static SkinData METAL_MAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTExNTk3OTQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDdlOGQ3MmI0MzI3MjIzZmI1ZjI5OWViN2NiNTVhMTU4OTM4MGYxMWE2ZDIzYmVmZTQ1OWFjNzg3YWY2YTcifX19", "EYXUVtnqtDhaSjBE313TpxriRtW0X7wNdmVR0ARa9qvE8CtP//AhnNxyKkERue1XIyefrYApzM4DWGzU5ZvzraOXg98p/3PSFW5p0PAp14ud/1uJWoq0FuEiJDn7Qo/+K0cuoCVsAn6Bx8nWexxr0XB8ANq/0vpRZpDOPO+irFFGwF8CPbt+7sh09glaHD9q7CM4JzPXrNjLt+ZkhYt7wEuevCXuOONT50tH0BlmfHajs9ai0IiwEwC3R+o0DooMVdCViuVEKWQfMnBDNHN4ZLwEazAcRiFO4VXOG0k/+dbKfX0EwnnygN0qmHKyhQeuR7PUumaRUMHn7sCvWmvgpNzzJMv4f9Biw2SWSI2gpaxHdCoCfFMjCdal+/BbXue6jCvDYq6yQEu+C9BjB3vT633/mbXZZMCl7bRjBzqG/jfeI1ove9o0oSqc4Nx3aA1cOnRE2iMEE74ChgY/sVk4aRVx+GTxKtyRGSzt2V7AvOVlfJh17FQhT/PkiztJ6L1RFLsFKaxQxyiCPgZSXpQ4Dz0iPonxFZl0FjAluElHYb3zn4Uop9sPBqOIeskVUl9zbdlRb7CgDG8a57YkUfs7ZyzzYYmZyt6t08H/PQr++cflY0kfy9eOBDmf9gtes7FLrHHRTE6GJ1+xAkLi5gNEkEUZKZy2embgI5JzuwCIIY8="); public final static SkinData OMEGA_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzI1MTAzNzAwOTksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MDM2MjNjMmRkMjdhNWM0Y2NlYzY5MWY3NjM0YTNkMzVkNTRiNDg0YjIzNTdhNWQ1ZWFmYmYwNTRkY2NlIn19fQ==", "cQty4zNF2QgzNuVOHTGGX5YVofApKr01KkQ70bO1n+I9nlkc9qqhcigA+uBYdw4THANFsTRwIrskgTS3TTmuaXYmMUoNnj7gr2Gp7D2t7L53QyJJhIw0hHNDvQucf19SOxhtR9FvW+xnh1JcgOTF3VZxIeRaN4bCtqkeFitCJwts4Z7SlDxB4EFZVsifM+gK4iel9YWYGNnZiQm48lxU+dMFd0cCa4L00ngBExQoWC8zbJc3K9LGdqI1YOMh3bCt81F4jcrPnDycxWwOTj/tBri4yeXK1htq5dAixHwq1EF86gQMnfeIIk6D/BREtVKoXK9K4lstYPHLFiBqkwpijArbC0sZp8s/j88NYUz9PgSJ2z/b5jhPChH2OkoGQOL0/QrxqUZUet+WHaIQtvFoqmcFRCKJQembgJGZV0X86XQxEEtevkNgXPigJVyQ5GVuDCeowRkMGfSadQCBsnmdOVZNshS60tBSDcbd2oWeQUJn1+OJkmz+OktbMbP4ttN6x3+MPMSZoGT1bc1BSRNFRYOBZuNz1zLWsHFRyNLaVS3ep/ktE+Rt5sbapo+r4GjrKGV7Unx6pbfoxcnMVxWZ9X/sMgztQdwYEQlnvAxGvCY/1ZIm3/izqB2zAgG7ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg="); + public final static SkinData HEADLESS_HORSEMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM4ODc2MjAzODksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZGM2M2M5NWFjOTA1YjEyMWU5YTE3NmY5ZDFiN2M0MDc2ZGJjMTk3NzhkYjgzMzBlOWIzNTdhOTQ3MzMxZCJ9fX0=", "pQgM6o3nO6+NaxEmkoK33gQefe726HeVA5TVcbnGRY99S8l1UVlTu1W9Unc4IczHRYZ29I75aXUz6UDA7kIRQj4NOQHBXOxlw4cah34WkDECXYwKbgcM3HkRI/JGQf6Uooe5Mz/IaWlisEdXp9i7+WPeqz1qvzwuJ2jUqF8gaJyCbgKSWE8135k+YwinFVA78+so5meRZ6qBNfSeU48Bhf9j3H+Jmq/vwi9EJGDXKAzjYSufdYWQA7gXJQHiUFVgVKSC0wBAMHBVK7ABE2g5GIaLxOfjhOKN8Gdea9dqOUN+uXrGvg7uHxJd9Obw7MbBDVPgXnYDWYDU18DAWJcGVA8tnuPnN2a+mQrbTn9UPftYReUYJA4zpkfEKkljW6lkQ5DkVN/ueQg9QDYjxvjLblSyKHV8lX/ATt4aGiQrCcaQn6c8EeLWijPwozO+pI3MX26ydF8l+B9lTvGvQOqfUS4+TgEI5SEKlKFF4i6rTBAYCHAH8uXry7fZQDoIkcpWiB5b+e7Tr29WoScyFNuR3BMIh0Nky1TPadLxxhkqht8o9AXtccYOmtoMMh06kKWZK5m8w16j+VTUNDYwTV+jxtSFBMh4FPuiH+TzpeHY6P2Cb4gT2UlozWj8ZxZHYIGbYXAFOlDT8IQmRh5zyrXeAZrwoXJPP2OoXl31roChTxw="); + public final static SkinData GHOST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5NjQxOTY3ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84NjViODU3N2NlNmFhYzY4N2IxNGQ0ZGIzYmQ1MGU1NjdlZGY4Njc4MDU3ZWM2NjMyZDcxMDQ4MzFhNDk3MmIifX19", "J3nw3OIZYuYxbhOKgPGL+Kn4kWv9cjEB9ygBD07xVJUY/rdPW/BeE15qKpZQt5d8kjj0VGp1Q7g3uIS24NuiQxDZ82l1GT4dLyUN2eOj0im6VGA2yXrnGPaedfu1oPAiG+STFq0ST2IYQKYuOcncsdovxHLrpNHF6ud3WJMnSOYSfAX5NOny1UNkswzCN2OCX+QzW9hwQ+gKOc2U6g47hIcpBcTNlmD3lqXjP7OTn0Ul3kJG5J3lnwBkPnNI5OV9+oI9OWs/fbTee3pK6UVHjgH2w+fO/0jlRnShw7o1BKv/ILBkWZYuq31YiAMWKRm508SS3+kjqU37t6mqBc9AUcAeKfR4G6UiW18+eRfDPaaSnY2mTBwD3boWHYI7fM7pnPF1LmSxwSa9QSu3wsrYF9ID0QI7vyyrPIeZU/eUXE+WbFZ+Nuo/2LlZMjUmcLWa/SuuPo6lA5zJtgkVc/Rgkph+s/sZnPwgeHTFmCr2VJqgWg+J9dnO/fLPkddgzjoy5uOCAO70E/cwbpqGxKD+0iQU0Vk9TzQnCMAUDtzeoyNkuk204cDSqPKtH5JIoQHa6wFAEgaKZoSETBJMZmKzZhne5pVr+NVkmGHOuZ/uE6JH1F4T+vTeeLSEroPDhrNfwVtrrqBFnI/xijfEHdPmtP9OTSDju7MHnEZu4RS7y6Q="); + 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="); // Comments this out for now, so it doesn't load the player profile diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index adcc05264..e22672fa7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -1,5 +1,7 @@ package mineplex.core.common.util; +import java.util.*; + import net.minecraft.server.v1_8_R3.AxisAlignedBB; import org.bukkit.Location; import org.bukkit.block.Block; @@ -10,15 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.TreeSet; - public class UtilAlg { public static TreeSet sortKey(Set toSort) @@ -663,4 +656,27 @@ public class UtilAlg int z = r.nextInt(radius * 2) - radius; return center.clone().add(x, y, z); } + + /** + * Gets a random location, with specific radius + * @param center The center location + * @param radiusX The X radius + * @param radiusY The Y radius + * @param radiusZ The Z radius + * @return A random location in that range + */ + public static Location getRandomLocation(Location center, double radiusX, double radiusY, double radiusZ) + { + double minX = radiusX * -1, minY = radiusY * -1, minZ = radiusZ * -1; + double x = minX + (UtilMath.random.nextDouble() * 2 * radiusX); + double y = minY + (UtilMath.random.nextDouble() * 2 * radiusY); + double z = minZ + (UtilMath.random.nextDouble() * 2 * radiusZ); + Location newLocation = center.clone().add((radiusX == 0) ? 0 : x, (radiusY == 0) ? 0 : y, (radiusZ == 0) ? 0 : z); + return newLocation; + } + + public static Location getRandomLocation(Location center, double radius) + { + return getRandomLocation(center, radius, radius, radius); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java index 98ebb1805..16589f2b3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java @@ -1,11 +1,11 @@ package mineplex.core.common.util; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.jsonchat.JsonMessage.MessageType; - import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.jsonchat.JsonMessage.MessageType; + public class UtilTextBottom { public static void display(String text, Player... players) @@ -52,5 +52,29 @@ public class UtilTextBottom } display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); - } + } + + /** + * Displays a bottom text progress bar with a specific number of bars + * @param prefix The prefix of the progress bar + * @param suffix The suffix of the progress bar + * @param bars The number of bars to display + * @param filledBars The number of filled bars + * @param players The players who will receive the progress bar + */ + public static void displayProgress(String prefix, String suffix, int bars, int filledBars, Player... players) + { + String progressBar = C.cGreen + ""; + for (int i = 0; i < bars; i++) + { + if (i > filledBars - 1) + { + progressBar += C.cRed; + } + progressBar += "▌"; + } + + display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); + } + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java index 09ef34668..03cb5e95e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java @@ -1,6 +1,5 @@ package mineplex.core.common.util.particles; - import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import org.bukkit.Location; @@ -36,6 +35,16 @@ public class ColoredParticle extends ParticleData UtilParticle.PlayParticle(_particleType, _location, x, _color.getY(), _color.getZ(), 1, 0, viewDist, players); } + @Override + public void display(int count, UtilParticle.ViewDist viewDist, Player... players) + { + // It's not possible to have colored particles with count, so just repeat it + for (int i = 0; i < count; i++) + { + display(viewDist, players); + } + } + @Override public void display(UtilParticle.ViewDist viewDist) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java index be36f059d..f3cb0466b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java @@ -1,6 +1,6 @@ package mineplex.core.common.util.particles; -import java.awt.*; +import org.bukkit.Color; public class DustSpellColor extends ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java index 94cf5d5d2..511c23528 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java @@ -1,6 +1,6 @@ package mineplex.core.common.util.particles; -import java.awt.*; +import org.bukkit.Color; public class NoteColor extends ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java index 56fff7eca..0bc1da18b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java @@ -1,7 +1,5 @@ package mineplex.core.common.util.particles; -import java.awt.*; - public abstract class ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java index c6e020ddf..b0eaa5b80 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java @@ -17,6 +17,15 @@ public class ParticleData _location = location; } + /** + * Displays the particles for all the players with a different ammount + * @param count the ammount of particles + */ + public void display(int count) + { + display(count, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); + } + /** * Displays the particles for selected players * @param viewDist The distance of the particle view @@ -24,7 +33,18 @@ public class ParticleData */ public void display(UtilParticle.ViewDist viewDist, Player... players) { - UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist); + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist, players); + } + + /** + * Displays the particles for the selected players, with a custom amount + * @param count the amount of particles + * @param viewDist the distance of the particle view + * @param players the players that will receive the particle + */ + public void display(int count, UtilParticle.ViewDist viewDist, Player... players) + { + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, count, viewDist, players); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java index f3b20f8f8..08ae3db23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java @@ -22,7 +22,7 @@ public class AnimationCommand extends CommandBase{ public void Execute(Player caller, String[] args) { caller = Bukkit.getPlayer(args[0]); - _plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SpinnerFiller, true)); + _plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SPINNER_FILLER, true)); if (args.length >= 2) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java index b1d9bdbb2..d450c357a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java @@ -102,16 +102,16 @@ public class SpinGui extends SimpleGui { if (i != _stopSpinnerAt + 4) { - _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerFiller, true); + _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SPINNER_FILLER, true); } else { - _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerReal, true); + _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SPINNER_REAL, true); _reward = _rewards[i]; } } - _reward.giveReward(RewardType.SpinnerReal, getPlayer(), new Callback() + _reward.giveReward(RewardType.SPINNER_REAL, getPlayer(), new Callback() { @Override public void run(RewardData data) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 8da12b5d9..be0c8a6bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -1,18 +1,8 @@ package mineplex.core.cosmetic; -import mineplex.core.boosters.BoosterManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; @@ -28,6 +18,15 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.MountManager; import mineplex.core.pet.PetManager; import mineplex.core.treasure.TreasureManager; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; public class CosmeticManager extends MiniPlugin { @@ -37,7 +36,7 @@ public class CosmeticManager extends MiniPlugin private PetManager _petManager; private TreasureManager _treasureManager; private BoosterManager _boosterManager; - + private CosmeticShop _shop; private boolean _showInterface = true; @@ -56,6 +55,12 @@ public class CosmeticManager extends MiniPlugin _shop = new CosmeticShop(this, clientManager, donationManager, _moduleName); } + + /*@Override + public void addCommands() + { + addCommand(new CosmeticsSlackCommand(this)); + }*/ public void showInterface(boolean showInterface) { @@ -213,4 +218,5 @@ public class CosmeticManager extends MiniPlugin } } } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java new file mode 100644 index 000000000..3bbc3380e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java @@ -0,0 +1,45 @@ +package mineplex.core.cosmetic.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SlackCosmeticEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private String _message; + private String _player; + + public SlackCosmeticEvent(String message) + { + _message = message; + _player = null; + } + + public SlackCosmeticEvent(String message, String player) + { + _message = message; + _player = player; + } + + public String getMessage() + { + return _message; + } + + public String getPlayer() + { + return _player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} 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 293e6b84d..d39c1e64b 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 @@ -146,6 +146,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Haunted Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 020297748..9f39b1322 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -1,5 +1,9 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -17,10 +21,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class MountPage extends ShopPageBase { public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) @@ -96,6 +96,11 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } + else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Chests"); + } //Rank Unlocks else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 77b4c15ee..57cc96538 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -1,9 +1,15 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; @@ -25,10 +31,6 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class PetPage extends ShopPageBase { public PetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) @@ -51,8 +53,14 @@ public class PetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); - + if (pet.getLore() != null) + { + Collections.addAll(itemLore, UtilText.splitLineToArray(C.cGray + pet.getLore(), LineFormat.LORE)); + } + else + { + itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); + } //Chest Unlocks if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType())) { @@ -74,13 +82,24 @@ public class PetPage extends ShopPageBase else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); + itemLore.add(C.cBlue + "Earned by defeating the Pumpkin King"); + itemLore.add(C.cBlue + "in the 2014 Christmas Chaos Event."); } else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } + else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -8) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Pumpkin's Revenge"); + } + else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Chests"); + } //Rank Unlocks else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java index c5f45f804..df1d4118e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java @@ -20,22 +20,22 @@ public class DisguiseZombie extends DisguiseMonster DataWatcher.a(14, Byte.valueOf((byte) 0), EntityZombie.META_CONVERTING, false); } - public boolean IsBaby() + public boolean isBaby() { return DataWatcher.getByte(12) == 1; } - public void SetBaby(boolean baby) + public void setBaby(boolean baby) { DataWatcher.watch(12, Byte.valueOf((byte) (baby ? 1 : 0)), EntityZombie.META_CHILD, baby); } - public boolean IsVillager() + public boolean isVillager() { return DataWatcher.getByte(13) == 1; } - public void SetVillager(boolean villager) + public void setVillager(boolean villager) { DataWatcher.watch(13, Byte.valueOf((byte) (villager ? 1 : 0)), EntityZombie.META_VILLAGER, villager); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java index 1f5e1a4de..9a8e6359c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java @@ -1,5 +1,7 @@ package mineplex.core.elo; +import java.util.List; + import com.google.common.collect.Lists; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; @@ -11,15 +13,13 @@ import mineplex.core.slack.SlackMessage; import mineplex.core.slack.SlackTeam; import org.bukkit.entity.Player; -import java.util.List; - /** * Generates a list of top elos */ public class TopEloCommand extends CommandBase { - private static final List NAMES = Lists.newArrayList("Relyh", "TadahTech"); + private static final List NAMES = Lists.newArrayList("Relyh", "TadahTech", "LCastr0"); public TopEloCommand(EloManager plugin) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java new file mode 100644 index 000000000..0ae983248 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java @@ -0,0 +1,232 @@ +package mineplex.core.events; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class AddConditionEvent extends Event +{ + + public enum CoreConditionType + { + CLOAK, + SHOCK, + POISON_SHOCK, + SILENCE, + BURNING, + FALLING, + LIGHTNING, + INVULNERABLE, + EXPLOSION, + FIRE_ITEM_IMMUNITY, + ARCADE_HUNGER_DISABLE, + + CUSTOM, + + ABSORBTION, + BLINDNESS, + CONFUSION, + DAMAGE_RESISTANCE, + FAST_DIGGING, + FIRE_RESISTANCE, + HARM, + HEAL, + HEALTH_BOOST, + HUNGER, + INCREASE_DAMAGE, + INVISIBILITY, + JUMP, + NIGHT_VISION, + POISON, + REGENERATION, + SLOW, + SLOW_DIGGING, + SPEED, + WATER_BREATHING, + WEAKNESS, + WITHER + } + + /** + * Allows adding Condition outside Arcade module + */ + + private static final HandlerList handlers = new HandlerList(); + + protected long _time; + + protected String _reason; + + protected String _informOn; + protected String _informOff; + + protected LivingEntity _ent; + protected LivingEntity _source; + + protected CoreConditionType _type; + protected int _mult; + protected int _ticks; + protected int _ticksTotal; + protected boolean _ambient; + + protected Material _indicatorType; + protected byte _indicatorData; + + protected boolean _add = false; + protected boolean _live = false; + + protected boolean _cancelPotion = false; + + protected boolean _showIndicator = true; + + public AddConditionEvent(String reason, LivingEntity ent, LivingEntity source, + CoreConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient) + { + _time = System.currentTimeMillis(); + + _reason = reason; + + _ent = ent; + _source = source; + + _type = type; + _mult = mult; + _ticks = ticks; + _ticksTotal = ticks; + _ambient = ambient; + + _indicatorType = visualType; + _indicatorData = visualData; + _showIndicator = showIndicator; + + _add = add; + + //Live if NOT Additive + _live = !add; + } + + public AddConditionEvent(String reason, LivingEntity ent, LivingEntity source, + CoreConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient, boolean cancelPotion) + { + _time = System.currentTimeMillis(); + + _reason = reason; + + _ent = ent; + _source = source; + + _type = type; + _mult = mult; + _ticks = ticks; + _ticksTotal = ticks; + _ambient = ambient; + + _indicatorType = visualType; + _indicatorData = visualData; + _showIndicator = showIndicator; + + _cancelPotion = cancelPotion; + + _add = add; + + //Live if NOT Additive + _live = !add; + } + + public long getTime() + { + return _time; + } + + public String getReason() + { + return _reason; + } + + public String getInformOn() + { + return _informOn; + } + + public String getInformOff() + { + return _informOff; + } + + public LivingEntity getEnt() + { + return _ent; + } + + public LivingEntity getSource() + { + return _source; + } + + public CoreConditionType getType() + { + return _type; + } + + public int getMult() + { + return _mult; + } + + public int getTicks() + { + return _ticks; + } + + public int getTicksTotal() + { + return _ticksTotal; + } + + public boolean isAmbient() + { + return _ambient; + } + + public Material getIndicatorType() + { + return _indicatorType; + } + + public byte getIndicatorData() + { + return _indicatorData; + } + + public boolean isAdd() + { + return _add; + } + + public boolean isLive() + { + return _live; + } + + public boolean isCancelPotion() + { + return _cancelPotion; + } + + public boolean isShowIndicator() + { + return _showIndicator; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java new file mode 100644 index 000000000..aed1bc944 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java @@ -0,0 +1,37 @@ +package mineplex.core.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class EnableArcadeSpawnEvent extends Event +{ + + /** + * Allows spawning mobs inside arcade games without having to do it inside Arcade's code + */ + + private static final HandlerList handlers = new HandlerList(); + + private boolean _enable; + + public EnableArcadeSpawnEvent(boolean enable) + { + _enable = enable; + } + + public boolean canEnable() + { + return _enable; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f2ffcee5d..a3695d0c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,11 +1,13 @@ package mineplex.core.gadget; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; import java.util.function.Predicate; -import mineplex.core.gadget.event.PlayerToggleSwimEvent; -import mineplex.core.gadget.gadgets.morph.swim.SwimManager; -import mineplex.core.treasure.TreasureManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -25,15 +27,23 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.util.*; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.LockCosmeticsCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; +import mineplex.core.gadget.commands.WinRoomTestCommand; import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.PlayerToggleSwimEvent; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -58,6 +68,7 @@ import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; @@ -78,7 +89,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStr import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatItem; import mineplex.core.gadget.gadgets.hat.HatType; -import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -104,14 +114,18 @@ import mineplex.core.gadget.gadgets.morph.MorphChicken; import mineplex.core.gadget.gadgets.morph.MorphCow; import mineplex.core.gadget.gadgets.morph.MorphCreeper; import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; +import mineplex.core.gadget.gadgets.morph.MorphSquid; import mineplex.core.gadget.gadgets.morph.MorphTitan; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; 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.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; @@ -143,17 +157,16 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.persistence.UserGadgetPersistence; -import mineplex.core.gadget.set.suits.SetRaveSuit; -import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; +import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; 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.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetEmerald; @@ -166,6 +179,8 @@ 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.SetRaveSuit; +import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -190,6 +205,7 @@ import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; +import mineplex.core.treasure.TreasureManager; public class GadgetManager extends MiniPlugin { @@ -208,6 +224,7 @@ public class GadgetManager extends MiniPlugin private final OutfitWindUpSuitBoosterManager _boosterManager; private final IncognitoManager _incognitoManager; private TreasureManager _treasureManager; + private SoulManager _soulManager; private NautHashMap> _gadgets; @@ -246,7 +263,8 @@ public class GadgetManager extends MiniPlugin _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); _incognitoManager = incognitoManager; - + _soulManager = new SoulManager(); + createGadgets(); createSets(); } @@ -257,6 +275,7 @@ public class GadgetManager extends MiniPlugin addCommand(new UnlockCosmeticsCommand(this)); addCommand(new LockCosmeticsCommand(this)); addCommand(new AmmoCommand(this)); + addCommand(new WinRoomTestCommand(this)); } private void createSets() @@ -343,8 +362,9 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); addGadget(new MorphSquid(this)); - addGadget(new MorphWitch(this)); - //addGadget(new MorphMetalMan(this)); // Soon: reward for signup + addGadget(new MorphGrimReaper(this)); + // Not being added in this update! + //addGadget(new MorphMetalMan(this)); // Particles addGadget(new ParticleFoot(this)); @@ -383,7 +403,8 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailBlood(this)); addGadget(new ArrowTrailMusic(this)); addGadget(new ArrowTrailFreedom(this)); - + addGadget(new ArrowTrailHalloween(this)); + // Death Effect addGadget(new DeathFrostLord(this)); addGadget(new DeathTitan(this)); @@ -397,7 +418,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); - + // Double Jump addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpTitan(this)); @@ -411,7 +432,8 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpBlood(this)); addGadget(new DoubleJumpMusic(this)); addGadget(new DoubleJumpFreedom(this)); - + addGadget(new DoubleJumpHalloween(this)); + // Hat for (HatType hatType : HatType.values()) { @@ -429,7 +451,8 @@ public class GadgetManager extends MiniPlugin addGadget(new WinEffectLightningStrike(this)); addGadget(new WinEffectRiseOfTheElderGuardian(this)); addGadget(new WinEffectLavaTrap(this)); - + addGadget(new WinEffectHalloween(this)); + // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, -2, 2257, 185000)); @@ -856,6 +879,7 @@ public class GadgetManager extends MiniPlugin _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); + _soulManager.giveSoul(event.getPlayer()); } @EventHandler @@ -1164,4 +1188,9 @@ public class GadgetManager extends MiniPlugin { return _treasureManager; } + + public SoulManager getSoulManager() + { + return _soulManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java new file mode 100644 index 000000000..a6a029bc5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java @@ -0,0 +1,72 @@ +package mineplex.core.gadget.commands; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.wineffect.*; +import mineplex.core.gadget.types.WinEffectGadget; +import org.bukkit.entity.Player; + +public class WinRoomTestCommand extends CommandBase +{ + + private GadgetManager _manager; + + public WinRoomTestCommand(GadgetManager manager) + { + super(manager, Rank.JNR_DEV, "winroomtest"); + _manager = manager; + } + + @Override + public void Execute(Player player, String[] args) + { + if (args.length < 1 || args.length > 2) + { + UtilPlayer.message(player, F.main("Win Rooms", "Usage: /winroomtest [play]")); + return; + } + boolean play = false; + if (args.length == 2) + { + if (args[1].equalsIgnoreCase("true")) + { + play = true; + } + } + loadWinRoom(args[0], player, play); + } + + private void loadWinRoom(String roomName, Player player, boolean play) + { + List names = Arrays.asList("BabyChicken", "DragonRider", "Fireworks", "Flames", "Halloween", "LavaTrap", + "LightningStrike", "MrPunchMan", "Podium", "RiseOfTheElderGuardian", "SnowTrails"); + List winClasses = Arrays.asList(WinEffectBabyChicken.class, WinEffectDragonRider.class, + WinEffectFireworks.class, WinEffectFlames.class, WinEffectHalloween.class, WinEffectLavaTrap.class, + WinEffectLightningStrike.class, WinEffectMrPunchMan.class, WinEffectPodium.class, + WinEffectRiseOfTheElderGuardian.class, WinEffectSnowTrails.class); + if (names.contains(roomName)) + { + int index = names.indexOf(roomName); + WinEffectGadget gadget = (WinEffectGadget) _manager.getGadget(winClasses.get(index)); + gadget.setup(player, new ArrayList<>(), new ArrayList<>(), player.getLocation().clone().add(100, 0, 100)); + gadget.buildWinnerRoom(); + gadget.teleport(); + if (play) + { + gadget.runPlay(); + } + } + else + { + UtilPlayer.message(player, F.main("Win Rooms", "Wrong room name!")); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java new file mode 100644 index 000000000..f9d03dd03 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java @@ -0,0 +1,56 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +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.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; + +public class ArrowTrailHalloween extends ArrowEffectGadget +{ + + private static Map _arrowColors = new HashMap<>(); + + public ArrowTrailHalloween(GadgetManager manager) + { + super(manager, "Halloween Arrows", UtilText.splitLineToArray(C.cGray + "Don't listen to the critics; orange and black is in all year.", LineFormat.LORE), + -9, Material.PUMPKIN, (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + if (_arrowColors.containsKey(arrow)) + { + Color nextColor = _arrowColors.get(arrow); + nextColor = (nextColor == Color.ORANGE) ? Color.BLACK : Color.ORANGE; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(nextColor), arrow.getLocation()); + coloredParticle.display(15); + _arrowColors.put(arrow, nextColor); + } + else + { + Color nextColor = Color.ORANGE; + _arrowColors.put(arrow, nextColor); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(nextColor), arrow.getLocation()); + coloredParticle.display(2); + } + } + + @Override + public void doHitEffect(Arrow arrow) + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java index dc7e1ccb2..8e6d2bd51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java @@ -1,8 +1,5 @@ package mineplex.core.gadget.gadgets.arrowtrail.freedom; -import java.awt.*; - -import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilText; @@ -10,9 +7,9 @@ import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; -import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; import mineplex.core.gadget.types.ArrowEffectGadget; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java new file mode 100644 index 000000000..8381c5a93 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java @@ -0,0 +1,78 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DoubleJumpHalloween extends DoubleJumpEffectGadget +{ + + private static final int PARTICLE_AMOUNT = 50; + + private HashMap _playerMap = new HashMap<>(); + + public DoubleJumpHalloween(GadgetManager manager) + { + super(manager, "Trick-Or-Leap", UtilText.splitLineToArray(C.cGray + "Unfortunately we're all out of candy, so have this instead!", LineFormat.LORE), -9, + Material.PUMPKIN, (byte) 0); + } + + @Override + public void doEffect(Player player) + { + _playerMap.put(player, System.currentTimeMillis() + 1000); + for(int amount = 0; amount < PARTICLE_AMOUNT; amount++) + { + Vector r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random() * 0.4); + Location loc = player.getLocation().add(r).add(0, UtilMath.random(.5, 2.3), 0); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), loc); + coloredParticle.display(7); + + r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random() * 0.4); + loc = player.getLocation().add(r).add(0, 0.3, 0); + coloredParticle.setLocation(loc); + coloredParticle.setColor(new DustSpellColor(Color.BLACK)); + coloredParticle.display(5); + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), player.getLocation().clone().add(0, .4, 0)); + coloredParticle.display(7); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if(event.getType() != UpdateType.FASTEST) return; + + for(Iterator> it = _playerMap.entrySet().iterator(); it.hasNext();) + { + Map.Entry e = it.next(); + if(e.getValue() >= System.currentTimeMillis()) + { + it.remove(); + continue; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), e.getKey().getLocation()); + coloredParticle.display(5); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java index f5bda1408..71a7b66b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java @@ -4,13 +4,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.util.Vector; - import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilParticle; @@ -21,6 +14,12 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.DoubleJumpEffectGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; public class DoubleJumpCupidsWings extends DoubleJumpEffectGadget { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java index 7a8fa997b..c6f623e20 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java @@ -11,17 +11,18 @@ import org.bukkit.inventory.ItemStack; public enum HatType { - Coal("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), - Companion_Block("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), - Grinch("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), - Lovestruck("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), - Present("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), - Rudolph("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), - Santa("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), - Secret_Package("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), - Snowman("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), - Teddy_Bear("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), - Uncle_Sam("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM); + COAL("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), + COMPANION_BLOCK("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), + GRINCH("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), + LOVESTRUCK("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), + PRESENT("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), + RUDOLPH("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), + SANTA("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), + SECRET_PACKAGE("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), + SNOWMAN("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), + TEDDY_BEAR("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), + UNCLE_SAM("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM), + PUMPKIN("Pumpkin Hat", UtilText.splitLineToArray(C.cGray + "Pumpkin on the head, don't end up dead!", LineFormat.LORE), -9, Material.PUMPKIN); private final String _name; private final String[] _lore; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index f031776d3..ebe2d8083 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -80,7 +80,7 @@ public class ItemCoal extends ItemGadget int goal = -1; //Coal Hat - if (!Manager.getHatGadget(HatType.Coal).ownsGadget(player)) + if (!Manager.getHatGadget(HatType.COAL).ownsGadget(player)) { goal = _hat; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java index 294e5f68c..94a9d55de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseCat; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import net.minecraft.server.v1_8_R3.Entity; @@ -65,7 +66,8 @@ public class BlockForm disguise.setBaby(); disguise.setSoundDisguise(new DisguiseCat(_player)); disguise.setInvisible(true); - _host.Manager.getDisguiseManager().disguise(disguise); + //_host.Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(_player, disguise, _host.Manager.getDisguiseManager()); // Apply Falling Block FallingBlockCheck(); @@ -91,7 +93,8 @@ public class BlockForm { SolidifyRemove(); - _host.Manager.getDisguiseManager().undisguise(_player); + //_host.Manager.getDisguiseManager().undisguise(_player); + UtilMorph.undisguise(_player, _host.Manager.getDisguiseManager()); // Remove FB if (_player.getPassenger() != null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index d7a971b6a..ae9608fe1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; @@ -59,16 +60,18 @@ public class MorphBat extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index 292731c04..a0c3dad2a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -42,16 +43,18 @@ public class MorphBlaze extends MorphGadget this.applyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index a79b99e70..08252f554 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -1,5 +1,9 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; @@ -7,6 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; @@ -25,10 +30,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - public class MorphBunny extends MorphGadget { private HashSet _jumpCharge = new HashSet(); @@ -55,10 +56,11 @@ public class MorphBunny extends MorphGadget this.applyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); - + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999999, 1)); } @@ -68,8 +70,9 @@ public class MorphBunny extends MorphGadget { _jumpCharge.remove(player); this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.removePotionEffect(PotionEffectType.SPEED); player.removePotionEffect(PotionEffectType.JUMP); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index a47ac5929..1b033eabb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -48,17 +49,19 @@ public class MorphChicken extends MorphGadget this.applyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index ab8854690..c8597bc3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -36,16 +37,18 @@ public class MorphCow extends MorphGadget this.applyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index acc2f9b55..af1aa5cb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -30,7 +31,7 @@ import mineplex.core.gadget.types.MorphGadget; public class MorphCreeper extends MorphGadget { - private HashMap _active = new HashMap(); + private HashMap _active = new HashMap<>(); public MorphCreeper(GadgetManager manager) { @@ -50,16 +51,18 @@ public class MorphCreeper extends MorphGadget this.applyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index 97b71e2f6..616364633 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.FireworkEffect; @@ -47,17 +48,19 @@ public class MorphEnderman extends MorphGadget this.applyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java new file mode 100644 index 000000000..6586967cd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java @@ -0,0 +1,228 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.SoulManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphGrimReaper extends MorphGadget +{ + + private Map _flying = new HashMap<>(); + private List _flyReady = new ArrayList<>(); + + private SoulManager _soulManager; + private ItemStack _hoe; + + private static final int FLY_DELAY = 15000; + + private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + + public MorphGrimReaper(GadgetManager manager) + { + super(manager, "Grim Reaper Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "The Grim Reaper is the collector of souls.", + "", + C.cWhite + "Right Click a player with Grim Reaper Scythe to steal their soul" + }, LineFormat.LORE), -9, + Material.WOOD_HOE, (byte) 0); + _soulManager = manager.getSoulManager(); + createHoe(); + } + + private void createHoe() + { + ItemStack hoe = new ItemStack(Material.WOOD_HOE); + ItemMeta meta = hoe.getItemMeta(); + meta.setDisplayName(C.cGreen + "Grim Reaper Scythe"); + meta.setLore(UtilText.splitLines(new String[]{C.cWhite + "Right Click a player to steal their soul!", + C.cWhite + "Cooldown of 10 seconds."}, LineFormat.LORE)); + hoe.setItemMeta(meta); + _hoe = hoe; + } + + @Override + public void enableCustom(Player player, boolean message) + { + this.applyArmor(player, message); + + ItemStack blackChest = new ItemStack(Material.LEATHER_CHESTPLATE), + blackPants = new ItemStack(Material.LEATHER_LEGGINGS), blackBoots = new ItemStack(Material.LEATHER_BOOTS); + LeatherArmorMeta chestMeta = (LeatherArmorMeta) blackChest.getItemMeta(), + pantsMeta = (LeatherArmorMeta) blackPants.getItemMeta(), bootsMeta = (LeatherArmorMeta) blackBoots.getItemMeta(); + chestMeta.setColor(Color.BLACK); + pantsMeta.setColor(Color.BLACK); + bootsMeta.setColor(Color.BLACK); + blackChest.setItemMeta(chestMeta); + blackPants.setItemMeta(pantsMeta); + blackBoots.setItemMeta(bootsMeta); + + player.getInventory().setItem(2, _hoe); + DisguiseSkeleton skeleton = new DisguiseSkeleton(player); + skeleton.SetSkeletonType(Skeleton.SkeletonType.WITHER); + skeleton.setChestplate(blackChest); + skeleton.setLeggings(blackPants); + skeleton.setBoots(blackBoots); + UtilMorph.disguise(player, skeleton, Manager.getDisguiseManager()); + } + + @Override + public void disableCustom(Player player, boolean message) + { + this.removeArmor(player); + _flying.remove(player); + _flyReady.remove(player); + _soulManager.resetSouls(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.getInventory().setItem(2, new ItemStack(Material.AIR)); + } + + @EventHandler + public void stealSoul(PlayerInteractEntityEvent event) + { + if (event.getRightClicked().getType() != EntityType.PLAYER) + return; + + if (_flyReady.contains(event.getPlayer())) + return; + + Player player = event.getPlayer(); + + if (!player.getItemInHand().equals(_hoe)) + return; + + Player clicked = (Player) event.getRightClicked(); + boolean stolen = _soulManager.stealSoul(player, clicked); + if (stolen) + { + player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1f, 1f); + UtilTextBottom.displayProgress("Grim Reaper Fly", _soulManager.checkSouls(player) + "/20 souls", 20, _soulManager.checkSouls(player), player); + if (_soulManager.checkSouls(player) == 20) + { + _flyReady.add(player); + UtilTextBottom.displayProgress("Grim Reaper Fly", 100, "Sneak to fly!", player); + } + } + } + + @EventHandler + public void sneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + Player player = event.getPlayer(); + + if (_soulManager.checkSouls(player) == 20) + { + setFlying(player, true, true); + _flying.put(player, System.currentTimeMillis()); + _soulManager.resetSouls(player); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + _soulManager.giveSoul(); + List stopFlying = new ArrayList<>(); + for (Player player : _flying.keySet()) + { + if (UtilTime.elapsed(_flying.get(player), FLY_DELAY)) + { + stopFlying.add(player); + setFlying(player, false, event.getType()==UpdateType.FAST); + } + else + { + setFlying(player, true, event.getType()==UpdateType.FAST); + } + } + stopFlying.forEach(p -> _flying.remove(p)); + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : _flyReady) + { + UtilTextBottom.displayProgress("Grim Reaper Fly", 100, "Sneak to fly!", player); + } + } + + private void setFlying(Player player, boolean flying, boolean isFast) + { + if (flying) + { + if (UtilPlayer.isSpectator(player)) + return; + + player.setAllowFlight(true); + player.setFlying(true); + + _flyReady.remove(player); + + if (UtilEnt.isGrounded(player)) + UtilAction.velocity(player, new Vector(0,1,0)); + + Location loc = player.getLocation().add(0, 1.2, 0).add(player.getLocation().getDirection().multiply(-0.2)); + if (isFast) + { + _wings.display(loc); + _wingsEdge.display(loc); + } + } + else + { + player.setAllowFlight(false); + } + } + + /** + * Removes the blindness effect for that player when they leave + * @param event + */ + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _soulManager.giveSoul(event.getPlayer()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 9ba729c67..f4584bcee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -49,16 +50,18 @@ public class MorphPig extends MorphGadget this.applyArmor(player, message); DisguisePig disguise = new DisguisePig(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index 175c37b02..21c28ec95 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; @@ -21,8 +22,11 @@ public class MorphPumpkinKing extends MorphGadget super(manager, "Pumpkin Kings Head", UtilText.splitLinesToArray(new String[] { C.cGray + "Transforms the wearer into the dreaded Pumpkin King!", + "", + C.cBlue + "Earned by defeating the Pumpkin King", + C.cBlue + "in the 2013 Halloween Horror Event" }, LineFormat.LORE), - -4, + -1, Material.PUMPKIN, (byte)0); } @@ -34,11 +38,12 @@ public class MorphPumpkinKing extends MorphGadget DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); - Manager.getDisguiseManager().disguise(disguise); - + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); + player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); @@ -49,7 +54,8 @@ public class MorphPumpkinKing extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.getInventory().setHelmet(null); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 5eac2c67f..0c41fc0a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -48,8 +49,8 @@ public class MorphSlime extends MorphGadget this.applyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); int size = 1 + (_achievementManager.getMineplexLevelNumber(player, _clientManager.Get(player).GetRank())) / 8; @@ -61,14 +62,16 @@ public class MorphSlime extends MorphGadget disguise.SetSize(size); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index fb18e05e2..e103f0d0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.WeakHashMap; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -59,16 +60,18 @@ public class MorphSnowman extends MorphGadget this.applyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 620b34454..618e48fd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -4,7 +4,8 @@ import mineplex.core.common.util.*; import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.PlayerToggleSwimEvent; -import mineplex.core.gadget.gadgets.morph.swim.SwimManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.gadgets.morph.managers.SwimManager; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -44,8 +45,10 @@ public class MorphSquid extends MorphGadget implements IThrown { applyArmor(player, message); DisguiseSquid disguiseSquid = new DisguiseSquid(player); - disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); - Manager.getDisguiseManager().disguise(disguiseSquid); + //disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); + //disguiseSquid.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguiseSquid); + UtilMorph.disguise(player, disguiseSquid, Manager); onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); } @@ -53,7 +56,8 @@ public class MorphSquid extends MorphGadget implements IThrown public void disableCustom(Player player, boolean message) { removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index d2a2002aa..d175ef849 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -63,17 +64,19 @@ public class MorphTitan extends MorphGadget this.applyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); disguise.setElder(true); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index f358e0662..f50043402 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -1,10 +1,14 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.HashSet; +import java.util.Iterator; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -24,9 +28,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import java.util.HashSet; -import java.util.Iterator; - public class MorphVillager extends MorphGadget implements IThrown { private HashSet _gems = new HashSet(); @@ -51,16 +52,18 @@ public class MorphVillager extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index fb765a163..6bca2d624 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.data.Item; @@ -64,9 +65,10 @@ public class MorphWither extends MorphGadget player.setHealth(300); DisguiseWither disguise = new DisguiseWither(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); //disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager, true); player.setMaxHealth(20); player.setHealth(20); @@ -76,8 +78,9 @@ public class MorphWither extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java new file mode 100644 index 000000000..c5c70dd28 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java @@ -0,0 +1,112 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +public class SoulManager +{ + + /** + * Steals souls from players + */ + + private Map _timer = new HashMap<>(); + private Map _stolenSouls = new HashMap<>(); + + /** + * Removes the soul from the player + * @param stealer Player that stole the soul + * @param player Player whose soul was stolen + * @return if the player had their soul stolen already or not + */ + public boolean stealSoul(Player stealer, Player player) + { + if (_timer.containsKey(player.getUniqueId())) + { + return false; + } + if (_stolenSouls.containsKey(stealer)) + { + if (_stolenSouls.get(stealer) == 20) + { + return false; + } + } + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100000, 1, true, false)); + UtilPlayer.message(player, F.main("Soul", "Your soul was stolen by " + F.name(stealer.getName()) + "!")); + UtilPlayer.message(stealer, F.main("Soul", "You stole " + F.name(player.getName()) + "'s soul!")); + _timer.put(player.getUniqueId(), System.currentTimeMillis()); + _stolenSouls.put(stealer.getUniqueId(), + (_stolenSouls.containsKey(stealer.getUniqueId()) ? _stolenSouls.get(stealer.getUniqueId()) + 1 : 1)); + return true; + } + + /** + * Gives the soul back to the players + */ + public void giveSoul() + { + for (Player player : UtilServer.getPlayers()) + { + if (!_timer.containsKey(player.getUniqueId())) + { + continue; + } + long timeStarted = _timer.get(player.getUniqueId()); + long currentTime = System.currentTimeMillis(); + if (timeStarted + 5000 < currentTime) + { + player.removePotionEffect(PotionEffectType.BLINDNESS); + UtilPlayer.message(player, F.main("Soul", "Oh well, I wasn't using it anyway I guess")); + _timer.remove(player.getUniqueId()); + } + } + } + + /** + * Forces giving a soul to that player + * @param player The player that will receive the soul + */ + public void giveSoul(Player player) + { + if (_timer.containsKey(player.getUniqueId())) + { + player.removePotionEffect(PotionEffectType.BLINDNESS); + UtilPlayer.message(player, F.main("Soul", "Oh well, I wasn't using it anyway I guess")); + _timer.remove(player.getUniqueId()); + } + } + + /** + * Checks how many souls that player has stolen + * @param player The player + * @return souls that they stole + */ + public int checkSouls(Player player) + { + if (_stolenSouls.containsKey(player.getUniqueId())) + { + return _stolenSouls.get(player.getUniqueId()); + } + return 0; + } + + /** + * Resets the souls that the player stole + * @param player The player + */ + public void resetSouls(Player player) + { + _stolenSouls.remove(player.getUniqueId()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java index a1945d257..6a76f4a96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.morph.swim; +package mineplex.core.gadget.gadgets.morph.managers; import java.util.ArrayList; import java.util.List; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java new file mode 100644 index 000000000..828e096eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java @@ -0,0 +1,81 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseInsentient; +import mineplex.core.gadget.GadgetManager; +import org.bukkit.entity.Player; + +public class UtilMorph +{ + + /** + * UtilMorph helps disguising and undisguising players, avoiding the use of deprecated methods + */ + + private static Map _disguises = new HashMap<>(); + + /** + * Disguises a player with custom name + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param gadgetManager The gadget manager + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + disguiseInsentient.setCustomNameVisible(true); + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + + /** + * Disguises a player with custom name (special case for the Wither Morph) + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param gadgetManager The gadget manager + * @param wither + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager, boolean wither) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + if (!wither) + { + disguiseInsentient.setCustomNameVisible(true); + } + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + + /** + * Disguises a player without a custom name + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param disguiseManager The disguise manager + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, DisguiseManager disguiseManager) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseManager.disguise(disguiseInsentient); + } + + /** + * Removes the disguise of a player + * @param player The player that will be undisguised + * @param disguiseManager The disguise manager + */ + public static void undisguise(Player player, DisguiseManager disguiseManager) + { + if (_disguises.containsKey(player.getUniqueId())) + { + DisguiseBase disguiseBase = _disguises.get(player.getUniqueId()); + disguiseManager.undisguise(disguiseBase); + _disguises.remove(player.getUniqueId()); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java index f6914a598..61f5c5c79 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java @@ -1,12 +1,12 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.*; import java.util.Random; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.common.util.particles.NormalParticle; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.plugin.java.JavaPlugin; @@ -18,6 +18,8 @@ public class BabyFireworkEffect extends Effect private Random _random = new Random(); private int _count = 0, _fireworkCount = 0; private boolean _multipleColors = false; + private int _currentColor = 0; + private Color[] _colors; public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) { @@ -31,6 +33,20 @@ public class BabyFireworkEffect extends Effect } } + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color... colors) + { + super(10, new EffectLocation(location), javaPlugin, 2); + _fireworkLocation = location.clone(); + _colors = colors; + _fireworkColor = _colors[0]; + _multipleColors = true; + } + + public void setCount(int count) + { + _count = count; + } + @Override public void runEffect() { @@ -79,12 +95,24 @@ public class BabyFireworkEffect extends Effect _fireworkCount++; if (_multipleColors) { - if (_fireworkColor == Color.RED) - _fireworkColor = Color.WHITE; - else if (_fireworkColor == Color.WHITE) - _fireworkColor = Color.BLUE; + if (_colors.length == 0) + { + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else + _fireworkColor = Color.RED; + } else - _fireworkColor = Color.RED; + { + _currentColor++; + if (_currentColor == _colors.length) + { + _currentColor = 0; + } + _fireworkColor = _colors[_currentColor]; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java index 5f1558e67..cc63e8fae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java @@ -1,6 +1,6 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.*; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java index 67b04993a..2a0be19fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.Color; - import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java new file mode 100644 index 000000000..c8ab96a6f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java @@ -0,0 +1,25 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import mineplex.core.common.util.UtilFirework; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +public class HalloweenSmashedEffect extends Effect +{ + + private FireworkEffect _fireworkEffect; + + public HalloweenSmashedEffect(Location location, FireworkEffect fireworkEffect, JavaPlugin javaPlugin) + { + super(140, new EffectLocation(location), javaPlugin, 5); + _fireworkEffect = fireworkEffect; + } + + @Override + public void runEffect() + { + UtilFirework.playFirework(_effectLocation.getLocation(), _fireworkEffect); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java index 5273f0e7e..b60de7ee9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java @@ -6,6 +6,7 @@ import java.util.HashMap; import mineplex.core.common.util.*; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; +import org.bukkit.Color; import mineplex.core.gadget.types.Gadget; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java index 9b5836cfe..d7d20aa75 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java @@ -1,34 +1,11 @@ package mineplex.core.gadget.gadgets.wineffect; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scoreboard.Team; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -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; @@ -38,6 +15,15 @@ import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_8_R3.PathfinderGoal; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; public class WinEffectBabyChicken extends WinEffectGadget { @@ -81,15 +67,7 @@ public class WinEffectBabyChicken extends WinEffectGadget public Chicken spawnChicken(Player player, Location loc) { Chicken chicken = loc.getWorld().spawn(loc, Chicken.class); - String rank = ""; - for(Team t : player.getScoreboard().getTeams()) - { - if(t.hasEntry(player.getName())) - { - rank = t.getPrefix(); - break; - } - } + String rank = getRank(player); chicken.setCustomName(rank + player.getName()); chicken.setCustomNameVisible(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java new file mode 100644 index 000000000..038495d65 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java @@ -0,0 +1,181 @@ +package mineplex.core.gadget.gadgets.wineffect; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; +import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +public class WinEffectHalloween extends WinEffectGadget +{ + + private DisguisePlayer _npc; + private Skeleton _skeleton; + private List _disguisePlayers = new ArrayList<>(); + private int _tick; + + public WinEffectHalloween(GadgetManager manager) + { + super(manager, "Return of The Pumpkin", UtilText.splitLineToArray(C.cGray + "The Pumpkin King will rise again...", LineFormat.LORE), + -9, Material.PUMPKIN, (byte) 0); + _schematicName = "HalloweenRoom"; + setGameTime(16000); + } + + @Override + public void setup(Player player, List team, List nonTeam, Location loc) + { + Location fixedLoc = loc.setDirection(loc.getDirection().multiply(-1)); + super.setup(player, team, nonTeam, fixedLoc); + } + + @Override + public void teleport() + { + Location loc = getBaseLocation().add(getBaseLocation().getDirection().normalize().multiply(17)).add(0, 3, 0); + loc.setDirection(getBaseLocation().clone().subtract(loc).toVector()); + super.teleport(loc); + } + + @Override + public void play() + { + spawnNPC(); + _tick = 0; + } + + @Override + public void finish() + { + UtilPlayer.showForAll(_player); + _team.forEach(p -> UtilPlayer.showForAll(p)); + _nonTeam.forEach(p -> UtilPlayer.showForAll(p)); + _disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove()); + _disguisePlayers.clear(); + _skeleton.remove(); + _skeleton = null; + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (!isRunning()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + _tick++; + + if (_tick == 50) + { + transformPlayer(); + } + + if (_tick > 50 && _tick <= 60) + { + int particles = 50; + double radius = 0.5; + + for (int i = 0; i < particles; i++) + { + double angle = (double) 2 * Math.PI * i / particles; + double x = Math.cos(angle) * radius; + double z = Math.sin(angle) * radius; + Location loc = getBaseLocation().clone().add(x, .2 * (_tick - 50), z); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor((i % 2 == 0) ? Color.ORANGE : Color.BLACK), loc); + coloredParticle.display(); + } + } + } + + private void spawnNPC() + { + Location loc = getBaseLocation().setDirection(getBaseLocation().getDirection()); + _npc = getNPC(_player, loc); + } + + private void transformPlayer() + { + _npc.getEntity().getBukkitEntity().remove(); + spawnSkeleton(); + spawnGhosts(); + UtilPlayer.hideFromAll(_player); + _player.getWorld().playSound(getBaseLocation(), Sound.CAT_MEOW, .5f, .5f); + } + + private void spawnSkeleton() + { + Skeleton skeleton = getBaseLocation().getWorld().spawn(getBaseLocation(), Skeleton.class); + skeleton.setCustomName(getRank(_player) + _player.getName()); + skeleton.setCustomNameVisible(true); + skeleton.setSkeletonType(Skeleton.SkeletonType.WITHER); + skeleton.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); + UtilEnt.ghost(skeleton, true, false); + UtilEnt.Vegetate(skeleton); + for (int i = 0; i < 15; i++) + { + playFirework(skeleton.getLocation().clone().add(0, 2, 0), i, true); + } + } + + private void spawnGhosts() + { + int i = 0; + List circle = UtilShapes.getPointsInCircle(getBaseLocation(), _nonTeam.size(), 7); + for (Player player : _nonTeam) + { + ItemStack playerHead = UtilSkull.getPlayerHead(player.getName(), player.getName() + " skull", null); + Location ghostLoc = circle.get(i); + // Makes sure the block under the zombie is not air + while (ghostLoc.clone().subtract(0, 1, 0).getBlock().getType() == Material.AIR) + { + ghostLoc.subtract(0, 1, 0); + } + DisguisePlayer disguisePlayer = getNPC(player, ghostLoc, SkinData.GHOST); + disguisePlayer.setHelmet(playerHead); + UtilEnt.CreatureLook(disguisePlayer.getEntity().getBukkitEntity(), getBaseLocation()); + UtilPlayer.hideFromAll(player); + for (int j = 0; j < 5; j++) + { + playFirework(ghostLoc.clone().add(0, 1, 0), j, false); + } + i++; + } + } + + private void playFirework(Location entityLocation, int i, boolean randomLoc) + { + Location randLocation = UtilAlg.getRandomLocation(entityLocation.clone(), 0.7d, 0.7d, 0d); + Color color = (i == 0) ? Color.ORANGE : Color.BLACK; + BabyFireworkEffect babyFireworkEffect; + if (i %2 == 0) + { + babyFireworkEffect = new BabyFireworkEffect((randomLoc) ? randLocation : entityLocation, Manager.getPlugin(), color); + } + else + { + babyFireworkEffect = new BabyFireworkEffect((randomLoc) ? randLocation : entityLocation, Manager.getPlugin(), Color.ORANGE, Color.BLACK); + } + // Starts without the firework trail + babyFireworkEffect.setCount(6); + babyFireworkEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java index 6624ce9a8..21dae8773 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java @@ -24,7 +24,7 @@ public class WinEffectLavaTrap extends WinEffectGadget private int _tick = 0; private Block _lever; - private DisguisePlayer playerNPC; + private DisguisePlayer _playerNPC; public WinEffectLavaTrap(GadgetManager manager) { @@ -42,7 +42,7 @@ public class WinEffectLavaTrap extends WinEffectGadget _lever = getBaseLocation().add(_baseLocation.getDirection().normalize()).getBlock(); _lever.setTypeIdAndData(Material.LEVER.getId(), (byte) 5, false); - playerNPC = getNPC(_player, getBaseLocation()); + _playerNPC = getNPC(_player, getBaseLocation()); { Vector forward = getBaseLocation().getDirection().normalize().multiply(1.3); @@ -101,13 +101,13 @@ public class WinEffectLavaTrap extends WinEffectGadget Location loc = getBaseLocation(); loc.setDirection(_lever.getLocation().add(0.5, 0, 0.5).subtract(loc.clone().add(0, 1.8, 0)).toVector()); - playerNPC.getEntity().getBukkitEntity().teleport(loc); + _playerNPC.getEntity().getBukkitEntity().teleport(loc); } if(_tick == 20*3) { - playerNPC.sendHit(); + _playerNPC.sendHit(); _lever.setTypeIdAndData(Material.LEVER.getId(), (byte) (5 | 0x8), false); _lever.getWorld().playSound(_lever.getLocation(), Sound.CLICK, 0.3f, 0.6f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index b76e4e86b..ba38e4d5f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -1,5 +1,14 @@ package mineplex.core.gadget.types; +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -8,14 +17,6 @@ import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetDisableEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.shop.item.SalesPackageBase; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.HashSet; public abstract class Gadget extends SalesPackageBase implements Listener { @@ -107,8 +108,6 @@ public abstract class Gadget extends SalesPackageBase implements Listener return; } - System.out.println(player.getName() + " has activated " + Name); - Manager.setActive(player, this); enableCustom(player, message); Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); 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 c328c1517..e2857ec77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -2,34 +2,30 @@ package mineplex.core.gadget.types; import java.io.File; import java.io.IOException; -import java.util.*; +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.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.block.schematic.Schematic; -import mineplex.core.common.block.schematic.UtilSchematic; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import org.spigotmc.event.entity.EntityDismountEvent; /** * A wrapper for different win effects @@ -42,6 +38,7 @@ public abstract class WinEffectGadget extends Gadget protected long _start; protected long _finish; protected Location _baseLocation; + private int _gameTime = 12000; /** * The file name of the schematic used for this win room. Schematics can be found in the "schematic" folder @@ -293,6 +290,30 @@ public abstract class WinEffectGadget extends Gadget Manager.getDisguiseManager().disguise(disguise); return disguise; } + + /** + * Get a disguised ArmorStand with the skin of the provided skindata at the provided location. The ArmorStand got no gravity and + * 2048 health. + * @param player The player to create the disguise from + * @param loc The location to spawn the ArmorStand at + * @param skinData The skin data to disguise the armorstand + * @return Returns a disguised ArmorStand at the given location + */ + public DisguisePlayer getNPC(Player player, Location loc, SkinData skinData) { + ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class); + + stand.setMaxHealth(2048); + stand.setHealth(2048); + stand.setGravity(false); + + GameProfile profile = new GameProfile(UUID.randomUUID(), player.getName()); + profile.getProperties().clear(); + profile.getProperties().put("textures", skinData.getProperty()); + + DisguisePlayer disguise = new DisguisePlayer(stand, profile); + Manager.getDisguiseManager().disguise(disguise); + return disguise; + } /** * Paste a schematic relative to the base location @@ -414,4 +435,29 @@ public abstract class WinEffectGadget extends Gadget blockLocation.getBlock().setType(Material.BARRIER); } + /** + * Gets the formatted rank of the player + * @param player + * @return + */ + protected String getRank(Player player) + { + return Manager.getClientManager().Get(player).getRealOrDisguisedRank().getTag(true, true) + " " + C.Reset; + } + + public int getGameTime() + { + return _gameTime; + } + + protected void setGameTime(int gameTime) + { + _gameTime = gameTime; + } + + protected void setBaseLocation(Location baseLocation) + { + _baseLocation = baseLocation; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java index 1420cac3e..53cd1dde6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java @@ -138,8 +138,8 @@ public class GlobalGiveItem implements Listener { for (final Player p : UtilServer.getPlayers()) { - Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GameLoot, true); - reward.giveReward(RewardType.GameLoot, p, new Callback() + Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GAME_LOOT, true); + reward.giveReward(RewardType.GAME_LOOT, p, new Callback() { @Override public void run(RewardData data) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 07f07b5a0..399bbd25c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -63,6 +63,7 @@ public class MountManager extends MiniPlugin _types.add(new MountBabyReindeer(this)); _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); + _types.add(new MountNightmareSteed(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java new file mode 100644 index 000000000..1e2459c3b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java @@ -0,0 +1,123 @@ +package mineplex.core.mount.types; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Horse; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +public class MountNightmareSteed extends HorseMount +{ + + private boolean _foot = false; + private HashMap _steps = new HashMap<>(); + + public MountNightmareSteed(MountManager manager) + { + super(manager, "Nightmare Steed", UtilText.splitLineToArray(C.cGray + "The Nightmare Steed comes in the darkness of night, the fires of the underworld still trailing from its hooves.", LineFormat.LORE), + Material.WOOL, (byte) 15, -9, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1, null); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + { + for (SingleEntityMountData singleEntityMountData : getActive().values()) + { + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FOOTSTEP, + singleEntityMountData.getEntity().getLocation(), 0f, 0f, 0f, 0f, 1, UtilParticle.ViewDist.NORMAL); + } + } + + if (event.getType() != UpdateType.FASTEST) + return; + + for (SingleEntityMountData singleEntityMountData : getActive().values()) + { + Entity entity = singleEntityMountData.getEntity(); + + if (event.getType() != UpdateType.FASTEST) return; + + _foot = !_foot; + + cleanSteps(); + + if (!UtilEnt.isGrounded(entity)) return; + + Vector offset; + + Vector dir = entity.getLocation().getDirection(); + dir.setY(0); + dir.normalize(); + + if (_foot) + { + offset = new Vector(dir.getZ() * -1, 0.1, dir.getX()); + } + else + { + offset = new Vector(dir.getZ(), 0.1, dir.getX() * -1); + } + + Location loc = entity.getLocation().add(offset.multiply(0.2)); + + if (nearStep(loc)) return; + + if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN))) return; + + _steps.put(loc, System.currentTimeMillis()); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); + + for (int i = 0; i < 10; i++) + { + Location randLoc = UtilAlg.getRandomLocation(singleEntityMountData.getEntity().getLocation().clone().add(0, 1, 0), 1d); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(Color.BLACK), randLoc); + coloredParticle.display(2); + } + + } + } + + public void cleanSteps() + { + if (_steps.isEmpty()) return; + + Iterator> stepIterator = _steps.entrySet().iterator(); + + while (stepIterator.hasNext()) + { + Map.Entry entry = stepIterator.next(); + + if (UtilTime.elapsed(entry.getValue(), 10000)) stepIterator.remove(); + } + } + + public boolean nearStep(Location loc) + { + for (Location other : _steps.keySet()) + { + if (UtilMath.offset(loc, other) < 0.3) return true; + } + + return false; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 6f22ffc3e..4ee91ff52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -50,8 +50,10 @@ public class MountSpider extends HorseMount C.blankLine, "#" + C.cWhite + "Look Up to use Wall Climb", "#" + C.cWhite + "Jump to use Leap", + "", + C.cBlue + "Only buyable during Halloween 2015" }, LineFormat.LORE), - Material.WEB, (byte) 0, -4, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); + Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java index 949a50f23..8e237ae73 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java @@ -16,10 +16,15 @@ public class MountZombie extends HorseMount public MountZombie(MountManager manager) { super(manager, "Decrepit Warhorse", - UtilText.splitLineToArray(C.cGray + "Once a fierce warhorse, this undead beast will send fear into the hearts of your enemies.", LineFormat.LORE), + UtilText.splitLinesToArray(new String[]{ + C.cGray + "Once a fierce warhorse, this undead beast will send fear into the hearts of your enemies.", + "", + C.cBlue + "Earned by defeating the Pumpkin King", + C.cBlue + "in the 2015 Halloween Horror Event." + }, LineFormat.LORE), Material.ROTTEN_FLESH, (byte)0, - -4, + -1, Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java new file mode 100644 index 000000000..781c0b884 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java @@ -0,0 +1,85 @@ +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.Player; +import org.bukkit.util.Vector; + +public class GrimReaperPetManager +{ + + /** + * Makes the Grim Reaper Pet fly around the player + * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} + */ + + private Player _player; + private Blaze _blaze; + private Location _grimReaperLoc, _target; + private Vector _direction; + private double _speed; + private long _idleTime; + + public GrimReaperPetManager(Player player, Blaze blaze) + { + _player = player; + _blaze = blaze; + _grimReaperLoc = player.getEyeLocation(); + _target = getNewTarget(); + _speed = 0.2; + _idleTime = 0; + _direction = new Vector(1, 0, 0); + } + + public void update() + { + //Update Target + if (UtilMath.offset(_player.getEyeLocation(), _target) > 3 || UtilMath.offset(_grimReaperLoc, _target) < 1) + _target = getNewTarget(); + + //Pause? + if (Math.random() > 0.98) + _idleTime = System.currentTimeMillis() + (long)(Math.random() * 3000); + + //Speed + if (UtilMath.offset(_player.getEyeLocation(), _grimReaperLoc) < 3) + { + if (_idleTime > System.currentTimeMillis()) + { + _speed = Math.max(0, _speed - 0.005); + } + else + { + _speed = Math.min(0.15, _speed + 0.005); + } + } + else + { + _idleTime = 0; + + _speed = Math.min(0.15 + UtilMath.offset(_player.getEyeLocation(), _grimReaperLoc) * 0.05, _speed + 0.02); + } + + + //Modify Direction + _direction.add(UtilAlg.getTrajectory(_grimReaperLoc, _target).multiply(0.15)); + if (_direction.length() < 1) + _speed = _speed * _direction.length(); + UtilAlg.Normalize(_direction); + + //Move + if (UtilMath.offset(_grimReaperLoc, _target) > 0.1) + _grimReaperLoc.add(_direction.clone().multiply(_speed)); + + _blaze.teleport(_grimReaperLoc); + _blaze.setVelocity(new Vector(0, .25, 0)); + } + + private Location getNewTarget() + { + return _player.getEyeLocation().add(Math.random() * 6 - 3, Math.random() * 1.5, Math.random() * 6 - 3); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index e6f918520..7ea9aebe7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -10,7 +10,8 @@ public class Pet extends SalesPackageBase { private String _name; private EntityType _petType; - + private String _lore = null; + public Pet(String name, EntityType petType, int cost) { super(name, Material.MONSTER_EGG, (byte)petType.getTypeId(), new String[] {}); @@ -21,6 +22,18 @@ public class Pet extends SalesPackageBase KnownPackage = false; } + + public Pet(String name, EntityType petType, int cost, String lore) + { + super(name, Material.MONSTER_EGG, (byte)petType.getTypeId(), new String[] {}); + + _name = name; + _petType = petType; + CurrencyCostMap.put(GlobalCurrency.TREASURE_SHARD, cost); + _lore = lore; + + KnownPackage = false; + } public EntityType getPetType() { @@ -36,4 +49,9 @@ public class Pet extends SalesPackageBase { return _name; } + + public String getLore() + { + return _lore; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java index 1b88b0e93..66565261e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -20,8 +20,8 @@ public class PetFactory public PetFactory(PetRepository repository) { _repository = repository; - _pets = new NautHashMap(); - _petExtras = new NautHashMap(); + _pets = new NautHashMap<>(); + _petExtras = new NautHashMap<>(); CreatePets(); CreatePetExtras(); @@ -41,6 +41,8 @@ public class PetFactory _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); _pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -12)); _pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -13)); + _pets.put(EntityType.RABBIT, new Pet("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them.")); + _pets.put(EntityType.BLAZE, new Pet("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?")); } private void CreatePetExtras() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 5b5442191..028fee9fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -1,26 +1,37 @@ package mineplex.core.pet; -import java.util.Collection; -import java.util.Iterator; +import java.util.*; import java.util.Map.Entry; -import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import com.google.gson.Gson; +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.donation.DonationManager; +import mineplex.core.events.AddConditionEvent; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.Creature; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Villager; -import org.bukkit.entity.Zombie; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent; @@ -34,33 +45,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.google.gson.Gson; - -import mineplex.core.MiniClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.account.event.ClientWebResponseEvent; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguiseGuardian; -import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.donation.DonationManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.pet.repository.PetRepository; -import mineplex.core.pet.repository.token.ClientPetTokenWrapper; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.NavigationAbstract; - public class PetManager extends MiniClientPlugin { private static Object _petOwnerSynch = new Object(); @@ -80,6 +64,11 @@ public class PetManager extends MiniClientPlugin private DonationManager _donationManager; private CoreClientManager _clientManager; private InventoryManager _inventoryManager; + + private Map _grimReaperMorphs = 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); public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager , InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) @@ -249,10 +238,49 @@ public class PetManager extends MiniClientPlugin if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { disguise.setName(Get(player).getPets().get(entityType)); + disguise.setCustomNameVisible(true); } _disguiseManager.disguise(disguise); } + else if (pet instanceof Rabbit) + { + UtilEnt.silence(pet, true); + DisguiseChicken disguise = new DisguiseChicken(pet); + _disguiseManager.disguise(disguise); + + Zombie zombie = pet.getWorld().spawn(pet.getLocation(), Zombie.class); + zombie.setBaby(true); + zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + disguise.getEntity().getBukkitEntity().setPassenger(zombie); + } + else if (pet instanceof Blaze) + { + + AddConditionEvent event = new AddConditionEvent("Pet", pet, pet, AddConditionEvent.CoreConditionType.SILENCE, 0, -1, true, Material.SNOW_BALL, (byte) 0, false, false); + Bukkit.getPluginManager().callEvent(event); + + DisguiseZombie disguiseZombie = new DisguiseZombie(pet); + disguiseZombie.setBaby(true); + disguiseZombie.setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.WITHER.ordinal())); + disguiseZombie.setChestplate(new ItemStack(Material.BANNER)); + disguiseZombie.setHeldItem(new ItemStack(Material.WOOD_HOE)); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + disguiseZombie.setName(Get(player).getPets().get(entityType)); + disguiseZombie.setCustomNameVisible(true); + } + + _disguiseManager.disguise(disguiseZombie); + GrimReaperPetManager grimReaperPetManager = new GrimReaperPetManager(player, (Blaze) pet); + _grimReaperMorphs.put((Blaze) pet, grimReaperPetManager); + } _activePetOwners.put(player.getName(), pet); _failedAttempts.put(player.getName(), 0); @@ -280,10 +308,14 @@ public class PetManager extends MiniClientPlugin //Wither Silverfish if (pet.getPassenger() != null) pet.getPassenger().remove(); - + + if (pet instanceof Blaze) + { + _grimReaperMorphs.remove(pet); + } + pet.remove(); - - + if (removeOwner) { _activePetOwners.remove(player.getName()); @@ -348,20 +380,25 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onUpdate(UpdateEvent event) { - if (event.getType() == UpdateType.TICK) + for(Creature pet : _activePetOwners.values()) { - for(Creature pet : _activePetOwners.values()) + if(pet instanceof PigZombie && event.getType() == UpdateType.TICK) { - if(pet instanceof PigZombie) + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie)pet).getHandle().isSilent()) { - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); - if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); - if(!((CraftPigZombie)pet).getHandle().isSilent()) - { - ((CraftPigZombie)pet).getHandle().setSilent(true); - } + ((CraftPigZombie)pet).getHandle().setSilent(true); } } + if (pet instanceof Blaze && event.getType() == UpdateType.FAST) + { + Location loc = pet.getLocation().clone().add(0, .5, 0).add(pet.getLocation().getDirection().multiply(-0.2)); + + if (event.getType() == UpdateType.FAST) _wings.display(loc); + if (event.getType() == UpdateType.FAST) _wingsEdge.display(loc); + + } } if (event.getType() != UpdateType.FAST) @@ -445,6 +482,21 @@ public class PetManager extends MiniClientPlugin Get(event.getUniqueId()).load(token.DonorToken); } + + /** + * Makes the Grim Reaper 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()) + { + GrimReaperPetManager grimReaperPetManager = entry.getValue(); + grimReaperPetManager.update(); + } + } @Override protected PetClient addPlayer(UUID uuid) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 0d7cc14d5..48fce2012 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,11 +5,16 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -32,6 +37,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; @@ -45,8 +51,31 @@ import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatType; -import mineplex.core.gadget.gadgets.item.*; -import mineplex.core.gadget.gadgets.morph.*; +import mineplex.core.gadget.gadgets.item.ItemBatGun; +import mineplex.core.gadget.gadgets.item.ItemBow; +import mineplex.core.gadget.gadgets.item.ItemCoal; +import mineplex.core.gadget.gadgets.item.ItemEtherealPearl; +import mineplex.core.gadget.gadgets.item.ItemFirework; +import mineplex.core.gadget.gadgets.item.ItemFleshHook; +import mineplex.core.gadget.gadgets.item.ItemFreezeCannon; +import mineplex.core.gadget.gadgets.item.ItemLovePotion; +import mineplex.core.gadget.gadgets.item.ItemMelonLauncher; +import mineplex.core.gadget.gadgets.item.ItemPaintballGun; +import mineplex.core.gadget.gadgets.item.ItemPartyPopper; +import mineplex.core.gadget.gadgets.item.ItemSnowball; +import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphBat; +import mineplex.core.gadget.gadgets.morph.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphBunny; +import mineplex.core.gadget.gadgets.morph.MorphChicken; +import mineplex.core.gadget.gadgets.morph.MorphCow; +import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; +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.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -55,7 +84,14 @@ 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.*; +import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; +import mineplex.core.gadget.gadgets.particle.ParticleFairy; +import mineplex.core.gadget.gadgets.particle.ParticleFireRings; +import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; +import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; +import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; +import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; +import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; @@ -67,22 +103,40 @@ import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.gadgets.wineffect.*; +import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; +import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; +import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; +import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; +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.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.Mount; -import mineplex.core.mount.types.*; +import mineplex.core.mount.types.MountBabyReindeer; +import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountFreedomHorse; +import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountMule; +import mineplex.core.mount.types.MountNightmareSteed; +import mineplex.core.mount.types.MountSlime; +import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.MountValentinesSheep; +import mineplex.core.mount.types.MountZombie; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; -import mineplex.core.reward.rewards.*; +import mineplex.core.reward.rewards.InventoryReward; +import mineplex.core.reward.rewards.PetReward; +import mineplex.core.reward.rewards.RankReward; +import mineplex.core.reward.rewards.TreasureShardReward; +import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class RewardManager { @@ -211,8 +265,8 @@ public class RewardManager // addInventoryReward(Type.VALENTINES_GIFT, getGadget(ItemFlowerGift.class), rarity, 100, 0, 1, 1); // WINTER Gadgets - addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); - addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.PRESENT, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.SNOWMAN, rarity, 5); // Omega items addMusicReward(Type.OMEGA, "Block Disk", rarity, 25); @@ -226,8 +280,8 @@ public class RewardManager addMusicReward(Type.OMEGA, "Wait Disk", rarity, 25); addMusicReward(Type.OMEGA, "Ward Disk", rarity, 25); - addHat(Type.OMEGA, HatType.Present, rarity, 5); - addHat(Type.OMEGA, HatType.Snowman, rarity, 5); + addHat(Type.OMEGA, HatType.PRESENT, rarity, 5); + addHat(Type.OMEGA, HatType.SNOWMAN, rarity, 5); } @@ -305,10 +359,10 @@ public class RewardManager // VALENTINES //Hats - addHat(Type.VALENTINES_GIFT, HatType.Companion_Block, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Lovestruck, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Secret_Package, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Teddy_Bear, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.COMPANION_BLOCK, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.LOVESTRUCK, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.SECRET_PACKAGE, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.TEDDY_BEAR, rarity, 100, 0); // WINTER @@ -319,7 +373,7 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleCandyCane.class), rarity, 5); // FREEDOM - addHat(Type.FREEDOM, HatType.Uncle_Sam, rarity, 100); + addHat(Type.FREEDOM, HatType.UNCLE_SAM, rarity, 100); addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); @@ -352,14 +406,14 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(ArrowTrailShadow.class), rarity, 15); addGadget(Type.OMEGA, getGadget(ArrowTrailCandyCane.class), rarity, 10); - addHat(Type.OMEGA, HatType.Uncle_Sam, rarity, 25); - addHat(Type.OMEGA, HatType.Companion_Block, rarity, 15); - addHat(Type.OMEGA, HatType.Lovestruck, rarity, 20); - addHat(Type.OMEGA, HatType.Secret_Package, rarity, 25); - addHat(Type.OMEGA, HatType.Teddy_Bear, rarity, 25); - addHat(Type.OMEGA, HatType.Santa, rarity, 25); - addHat(Type.OMEGA, HatType.Rudolph, rarity, 25); - addHat(Type.OMEGA, HatType.Coal, rarity, 25); + addHat(Type.OMEGA, HatType.UNCLE_SAM, rarity, 25); + addHat(Type.OMEGA, HatType.COMPANION_BLOCK, rarity, 15); + addHat(Type.OMEGA, HatType.LOVESTRUCK, rarity, 20); + addHat(Type.OMEGA, HatType.SECRET_PACKAGE, rarity, 25); + addHat(Type.OMEGA, HatType.TEDDY_BEAR, rarity, 25); + addHat(Type.OMEGA, HatType.SANTA, rarity, 25); + addHat(Type.OMEGA, HatType.RUDOLPH, rarity, 25); + addHat(Type.OMEGA, HatType.COAL, rarity, 25); addGadget(Type.OMEGA, getGadget(MorphChicken.class), rarity, 50); addGadget(Type.OMEGA, getGadget(MorphCow.class), rarity, 167); @@ -384,6 +438,11 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitHelmet.class), rarity, 50); addGadget(Type.OMEGA, getGadget(ParticleCandyCane.class), rarity, 25); + + // HAUNTED CHEST + addGadget(Type.HAUNTED, getGadget(DoubleJumpHalloween.class), rarity, 10); + addHat(Type.HAUNTED, HatType.PUMPKIN, rarity, 10); + addGadget(Type.HAUNTED, getGadget(ArrowTrailHalloween.class), rarity, 100); } public void addLegendary() @@ -451,7 +510,7 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleFrostLord.class), rarity, 5); - addHat(Type.WINTER_HOLIDAY, HatType.Grinch, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.GRINCH, rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(MorphSnowman.class), rarity, 5); addMount(Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); @@ -529,8 +588,13 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(ArrowTrailFrostLord.class), rarity, 20); addGadget(Type.OMEGA, getGadget(ArrowTrailCupid.class), rarity, 15); - addHat(Type.OMEGA, HatType.Grinch, rarity, 25); - + addHat(Type.OMEGA, HatType.GRINCH, rarity, 25); + + // HAUNTED + addPetReward(Type.HAUNTED, EntityType.RABBIT, rarity, 100); + addGadget(Type.HAUNTED, getGadget(MorphGrimReaper.class), rarity, 25); + addGadget(Type.HAUNTED, getGadget(WinEffectHalloween.class), rarity, 50); + addMount(Type.HAUNTED, getMount(MountNightmareSteed.class), rarity, 60); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) @@ -740,7 +804,8 @@ public class RewardManager public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int amount = 4; - if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest || type == RewardType.OmegaChest) amount = 1; + if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST + || type == RewardType.HAUNTED_CHEST) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; @@ -820,7 +885,7 @@ public class RewardManager //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { - if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) + if (canGiveMythical && type == RewardType.MYTHICAL_CHEST && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { return new RankReward(_clientManager, 0, 0, rarity); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 89c4ea9dc..2ccd852ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -56,6 +56,7 @@ public class RewardPool ILLUMINATED(false), FREEDOM(false), OMEGA(false), + HAUNTED(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 0fd48d5a3..ecd9ab3a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -5,19 +5,20 @@ import java.util.ArrayList; public enum RewardType { //% Chances Mythic Legend Rare Uncommon - GameLoot( 0.000001, 0.00001, 0.0001, 3), + GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), - OldChest( 0, 0.06, 0.8, 16), - AncientChest( 0, 2, 8, 32), - MythicalChest( 0.1, 4, 16, 72), - WinterChest( 0, 5, 18, 32), - IlluminatedChest( 0, 2, 16, 72), - FreedomChest( 0, 5, 18, 0), - OmegaChest( 0, 2, 16, 32), - ValentinesGift( 0, 7, 20, 20), + 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, 2, 16, 32), + VALENTINES_GIFT( 0, 7, 20, 20), - SpinnerFiller( 0.1, 1, 4, 20), - SpinnerReal( 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; @@ -50,7 +51,7 @@ public enum RewardType { int maxCount = Integer.MAX_VALUE; int openCount = 0; - RewardType type = RewardType.MythicalChest; + RewardType type = RewardType.MYTHICAL_CHEST; ArrayList data = new ArrayList(); for (RewardRarity rarity : RewardRarity.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index ac08ef75a..9dcb1f070 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -34,9 +34,9 @@ public class RankReward extends Reward if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; - else if (rewardType == RewardType.MythicalChest && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + else if (rewardType == RewardType.MYTHICAL_CHEST && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; - if (rewardType == RewardType.MythicalChest && _random.nextDouble() < 0.01) // 1 Percent + if (rewardType == RewardType.MYTHICAL_CHEST && _random.nextDouble() < 0.01) // 1 Percent rank = Rank.TITAN; if (rank == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java index bf7dacdce..9290244de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -31,12 +31,12 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack public SalesPackageBase(String name, Material material, byte displayData, String[] description) { - this(name, material, (byte)0, description, 0); + this(name, material, displayData, description, 0); } public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins) { - this(name, material, (byte)0, description, coins, 1); + this(name, material, displayData, description, coins, 1); } public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins, int quantity) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java index 9bce0f192..b9155e39f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java @@ -1,10 +1,10 @@ package mineplex.core.slack; +import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; @@ -62,12 +62,12 @@ public class SlackAPI */ private String runWebCall(SlackTeam team, JsonObject call) { - HttpURLConnection connection = null; + HttpsURLConnection connection = null; try { // Create connection. URL url = new URL(team.getURL()); - connection = (HttpURLConnection) url.openConnection(); + connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setConnectTimeout(5000); connection.setUseCaches(false); @@ -83,6 +83,8 @@ public class SlackAPI dos.flush(); dos.close(); + int responseCode = connection.getResponseCode(); + // Receive response. InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java index ad0ce7de4..22bb1f2c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java @@ -1,5 +1,7 @@ package mineplex.core.slack; +import java.net.URL; + import com.google.gson.JsonObject; /** @@ -9,6 +11,7 @@ public class SlackMessage { private String _username; private String _icon; + private URL _iconURL; private String _content; @@ -50,6 +53,20 @@ public class SlackMessage _content = content; } + /** + * Class constructor. + * + * @param username The username of the message. + * @param iconURL The icon url of the message. + * @param content The content of the message. + */ + public SlackMessage(String username, URL iconURL, String content) + { + _username = username; + _iconURL = iconURL; + _content = content; + } + /** * Converts the message to JSON format. * @@ -64,7 +81,11 @@ public class SlackMessage msg.addProperty("username", _username); } - if (_icon != null) + if (_iconURL != null) + { + msg.addProperty("icon_url", _iconURL.toString()); + } + else if (_icon != null) { msg.addProperty("icon_emoji", _icon); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java index 965346791..b1d913d5a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java @@ -6,7 +6,7 @@ package mineplex.core.slack; public enum SlackTeam { // Dev team - mineplex.slack.com - DEVELOPER("Mineplex Dev", "T045RUM7F", "B0VK6GFKN", "6GxwJsDfEpbVnQl8pYuEyq5T"), + DEVELOPER("Mineplex Dev", "T045RUM7F", "B2ED9B9Q9", "STwdq9LFar2Qt4H3JWyDK3Ow"), // QA team - mineplexqa.slack.com QA("Mineplex QA", "todo", "todo", "todo"), // TODO: new details diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index eee0c5fbe..7fb03ccb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,8 +1,6 @@ package mineplex.core.treasure; -import java.awt.*; import java.util.*; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import mineplex.core.blockrestore.BlockRestore; @@ -19,6 +17,7 @@ import mineplex.core.treasure.animation.*; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import org.bukkit.Bukkit; +import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; @@ -176,6 +175,15 @@ public class Treasure block.getLocation().add(.5 + rX, .7, .5 + rX)); coloredParticle.display(); } + else if (_treasureType == TreasureType.HAUNTED) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.ORANGE : Color.BLACK), + block.getLocation().add(.5 + rX, .7, .5 + rZ)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index bfacf8bb0..40f68c2ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -95,7 +95,7 @@ public class TreasureLocation implements Listener return; } - TreasureStartEvent event = new TreasureStartEvent(player); + TreasureStartEvent event = new TreasureStartEvent(player, treasureType); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) @@ -125,7 +125,8 @@ public class TreasureLocation implements Listener return; } - if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA) + if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA + || treasureType == TreasureType.HAUNTED) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { @@ -155,7 +156,8 @@ public class TreasureLocation implements Listener String pron = "a "; if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.OMEGA) pron = "an "; - Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + treasureType.getName())); + String name = treasureType.getName().replace("Chest", "Treasure"); + Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + name)); } Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index 54fdeaea6..81c1af8d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -55,6 +55,13 @@ public enum TreasureStyle ParticleType.CRIT, Sound.FIRE, Sound.FIREWORK_TWINKLE + ), + HALLOWEEN( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.IRONGOLEM_HIT, + Sound.IRONGOLEM_THROW ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 46751e601..2c66054f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -8,19 +8,21 @@ import mineplex.core.reward.RewardType; public enum TreasureType { - OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000), + OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OLD_CHEST, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000), - ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), + ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.ANCIENT_CHEST, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), - MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), + MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MYTHICAL_CHEST, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), - CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), + CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WINTER_CHEST, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), - ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), + ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.ILLUMINATED_CHEST, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), - FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000), + FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FREEDOM_CHEST, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000), - OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OmegaChest, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000); + OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OMEGA_CHEST, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000), + + HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, false, 100000); 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 64c41c636..182f7f136 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -75,6 +75,11 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + mat = Material.WOOL; + data = 1; + } else continue; @@ -107,6 +112,11 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + mat = Material.WOOL; + data = 15; + } else continue; @@ -139,15 +149,15 @@ public class BlockChangeAnimation extends Animation } } } - else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) { for(Block c : _chests) { if(c.equals(b)) { _blockInfoList.add(new BlockInfo(b)); - b.setType(Material.ENDER_PORTAL_FRAME); - b.setData((byte) 0); + b.setType(Material.PUMPKIN); + b.setData(getDirection(c)); } } } @@ -164,4 +174,26 @@ public class BlockChangeAnimation extends Animation { } + + private byte getDirection(Block block) + { + byte direction; + int relX = getTreasure().getCenterBlock().getX() - block.getX(); + int relZ = getTreasure().getCenterBlock().getZ() - block.getZ(); + if (Math.abs(relX) > Math.abs(relZ)) + { + if (relX > 0) + direction = (byte) 3; + else + direction = (byte) 1; + } + else + { + if (relZ > 0) + direction = (byte) 0; + else + direction = (byte) 2; + } + return direction; + } } 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 217059f36..eff9e7d70 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,6 +1,5 @@ package mineplex.core.treasure.animation; -import java.awt.*; import java.util.List; import mineplex.core.common.util.*; @@ -14,6 +13,7 @@ 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; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -42,6 +42,7 @@ public class ChestSpawnAnimation extends Animation private int _babyFireworks = 0; private int _circleAmount = 0; + private int _currentHauntedColor = 0; public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -175,6 +176,27 @@ public class ChestSpawnAnimation extends Animation _circleAmount++; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + float x = (float) (Math.sin(getTicks()/4D)); + float z = (float) (Math.cos(getTicks()/4D)); + + Location newLoc = _particleLocation.clone(); + newLoc.add(UtilAlg.getLeft(_particleDirection).multiply(x * scale)); + newLoc.add(UtilAlg.getUp(_particleDirection).multiply(z * scale)); + + Color color = (_currentHauntedColor == 0) ? Color.ORANGE : Color.BLACK; + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), newLoc); + coloredParticle.display(); + if (_currentHauntedColor == 0) + { + _currentHauntedColor = 1; + } + else + { + _currentHauntedColor = 0; + } + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) @@ -201,12 +223,12 @@ public class ChestSpawnAnimation extends Animation if (particleType != null) { - if (getTreasure().getTreasureType() != TreasureType.FREEDOM) + if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED) { UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } - else + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) { int r = (int) (Math.random() * 3); ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, @@ -214,6 +236,14 @@ public class ChestSpawnAnimation extends Animation _centerLocation.clone().add(.5, .5, .5)); coloredParticle.display(); } + else + { + int r = (int) (Math.random() * 2); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.ORANGE : Color.BLACK), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java index 528344c75..0c541f079 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.event; +import mineplex.core.treasure.TreasureType; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; @@ -13,11 +14,13 @@ public class TreasureStartEvent extends Event implements Cancellable private static final HandlerList handlers = new HandlerList(); private Player _player; + private TreasureType _treasureType; private boolean _cancelled = false; - public TreasureStartEvent(Player player) + public TreasureStartEvent(Player player, TreasureType treasureType) { _player = player; + _treasureType = treasureType; } public Player getPlayer() @@ -25,6 +28,11 @@ public class TreasureStartEvent extends Event implements Cancellable return _player; } + public TreasureType getTreasureType() + { + return _treasureType; + } + @Override public boolean isCancelled() { 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 1815e7b15..9256bc7a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -60,7 +60,8 @@ public class BuyChestButton implements IButton } } if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) - && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA)) + && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA + || _chestType == TreasureType.HAUNTED)) { 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 8d23c05d5..0b1aef8e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -25,7 +25,6 @@ import mineplex.core.treasure.TreasureLocation; import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureType; import org.bukkit.ChatColor; -import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -59,6 +58,7 @@ public class TreasurePage extends ShopPageBase int illuminatedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ILLUMINATED.getItemName()); int freedomCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.FREEDOM.getItemName()); int omegaCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OMEGA.getItemName()); + int hauntedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.HAUNTED.getItemName()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -192,6 +192,19 @@ public class TreasurePage extends ShopPageBase } + List hauntedLore = new ArrayList<>(); + hauntedLore.add(" "); + hauntedLore.add(F.value("Haunted Chests Owned", "" + hauntedCount)); + hauntedLore.add(" "); + hauntedLore.add(C.cGray + "The Haunted Chest can only be found"); + hauntedLore.add(C.cGray + "during the month of October when the"); + hauntedLore.add(C.cGray + "veil between this world and the shadow is thin..."); + hauntedLore.add(" "); + if (hauntedCount > 0) + { + hauntedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + } + 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); @@ -199,39 +212,23 @@ public class TreasurePage extends ShopPageBase ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); - //ShopItem omega = new ShopItem(Material.NETHER_STAR, C.cAquaB + "Omega Treasure", omegaLore.toArray(new String[0]), 0, false, false); ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); + ItemStack haunted = SkinData.HAUNTED_CHEST.getSkull(C.cGoldB + "Haunted Treasure", hauntedLore); - addItem(40, shards); + addItem(49, shards); - addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount); - if (!hasAllFreedomItems(getPlayer()) && freedomCount >= 1) - addChest(13, freedom, TreasureType.FREEDOM, freedomCount); - else - { - freedom = new ShopItem(Material.INK_SACK, DyeColor.SILVER.getData(), C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore.toArray(new String[0]), 0, true, false); - addChest(13, freedom, TreasureType.FREEDOM, freedomCount); - } - addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount); - addChest(20, basic, TreasureType.OLD, basicCount); - addChest(22, heroic, TreasureType.ANCIENT, heroicCount); - addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); - addChest(4, omega, TreasureType.OMEGA, omegaCount); + 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(28, basic, TreasureType.OLD, basicCount); + addChest(30, heroic, TreasureType.ANCIENT, heroicCount); + addChest(32, legendary, TreasureType.MYTHICAL, legendaryCount); + addChest(34, illuminated, TreasureType.ILLUMINATED, illuminatedCount); } private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) { - //boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - //testServer = false; - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - - /*if(testServer) - { - addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); - return; - }*/ - if (owned > 0) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java index 82ef1ef9d..042c141a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java @@ -85,14 +85,14 @@ public class ValentinesGiftManager extends MiniPlugin { if (data) { - _rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, to, new Callback() + _rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.VALENTINES_GIFT, false).giveReward(RewardType.VALENTINES_GIFT, to, new Callback() { @Override public void run(RewardData toData) { String toGift = ChatColor.stripColor(toData.getFriendlyName()); - _rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, from, new Callback() + _rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.VALENTINES_GIFT, false).giveReward(RewardType.VALENTINES_GIFT, from, new Callback() { @Override public void run(RewardData fromData) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 18235a673..b7f9cc73b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -112,7 +112,7 @@ import java.util.*; public class HubManager extends MiniClientPlugin implements IChatMessageFormatter { // ☃❅ Snowman! - public HubType Type = HubType.Normal; + public HubType Type = HubType.Halloween; private BlockRestore _blockRestore; private CoreClientManager _clientManager; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java index 6fa903565..3ce5c8664 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java @@ -80,7 +80,7 @@ public class HolidayGiftManager extends MiniPlugin { Reward reward = _rewards.generateRandom(); - reward.giveReward(RewardType.GameLoot, event.getPlayer(), rewardData -> { + reward.giveReward(RewardType.GAME_LOOT, event.getPlayer(), rewardData -> { UtilPlayer.message(event.getPlayer(), F.main("Gift", F.elem(colorLess) + " searches for your gift...")); UtilPlayer.message(event.getPlayer(), F.main("Gift", "You received " + rewardData.getFriendlyName() + C.mBody + "!")); }); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index 106e9a9c8..9e6730cb8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -1,5 +1,16 @@ package mineplex.hub.modules; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.UtilAction; @@ -16,16 +27,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.util.Vector; - -import java.util.HashSet; public class JumpManager extends MiniPlugin { @@ -47,6 +48,9 @@ public class JumpManager extends MiniPlugin if (player.getGameMode() == GameMode.CREATIVE) return; + if (player.isFlying()) + return; + Rank rank = Manager.GetClients().Get(player).GetRank(); if (Manager.getPreferences().get(player).isActive(Preference.INVISIBILITY) && (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 760bb8eba..c6b639b22 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -1,25 +1,7 @@ package mineplex.hub.modules; -import mineplex.core.Managers; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.event.StackerEvent; -import mineplex.core.gadget.gadgets.item.ItemBatGun; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.pet.PetManager; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileManager; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.hub.HubManager; +import java.util.HashSet; + import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; @@ -42,7 +24,27 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; -import java.util.HashSet; +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.event.StackerEvent; +import mineplex.core.gadget.gadgets.item.ItemBatGun; +import mineplex.core.gadget.gadgets.morph.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.hub.HubManager; public class StackerManager extends MiniPlugin implements IThrown { @@ -133,6 +135,14 @@ public class StackerManager extends MiniPlugin implements IThrown return; } + if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphGrimReaper) + { + if (stacker.getItemInHand().getType() == Material.WOOD_HOE) + { + return; + } + } + if (Manager.GetTreasure().isOpening(stacker)) return; @@ -314,8 +324,6 @@ public class StackerManager extends MiniPlugin implements IThrown if (!Manager.hasPlayerStackingEnabled(target)) return; - System.out.println("Stacker collide."); - //Velocity UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java index 8109e3ef2..de8724fa6 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -1,12 +1,12 @@ package mineplex.minecraft.game.core.condition; -import org.bukkit.Bukkit; +import mineplex.core.events.AddConditionEvent; +import net.minecraft.server.v1_8_R3.MobEffect; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.LivingEntity; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import net.minecraft.server.v1_8_R3.MobEffect; public class Condition { @@ -47,7 +47,8 @@ public class Condition SPEED, WATER_BREATHING, WEAKNESS, - WITHER + WITHER; + } protected ConditionManager Manager; @@ -133,6 +134,14 @@ public class Condition _live = !add; } + public Condition(ConditionManager manager, AddConditionEvent event) + { + + this(manager, event.getReason(), event.getEnt(), event.getSource(), ConditionType.valueOf(event.getType().name()), + event.getMult(), event.getTicks(), event.isAdd(), event.getIndicatorType(), event.getIndicatorData(), + event.isShowIndicator(), event.isAmbient(), event.isCancelPotion()); + } + public boolean Tick() { if (_live && _ticks > 0) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index d18740a49..cef1030bf 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Locale; import java.util.UUID; +import mineplex.core.Managers; import mineplex.core.powerplayclub.PowerPlayData; import org.bukkit.GameMode; import org.bukkit.entity.Player; @@ -36,8 +37,21 @@ import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; import mineplex.core.powerplayclub.PowerPlayClubRepository; +import mineplex.core.stats.PlayerStats; +import mineplex.core.stats.StatsManager; import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; public class CustomerSupport extends MiniPlugin implements ResultSetCallable { @@ -146,6 +160,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int runeAmplifier20 = 0; int runeAmplifier60 = 0; int omegaChestsReceived = 0; + int hauntedChestsReceived = 0; + int hauntedChestsOpened = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -234,6 +250,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable omegaChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Haunted Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + omegaChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + omegaChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -278,6 +305,22 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + StatsManager statsManager = Managers.get(StatsManager.class); + if (statsManager != null) + { + try + { + PlayerStats playerStats = statsManager.getOfflinePlayerStats(playerName); + if (playerStats != null) + { + hauntedChestsOpened = (int) playerStats.getStat("Global.Treasure.Haunted"); + } + } catch (SQLException e) + { + e.printStackTrace(); + } + } + // Strutt20 asked me to remove some stuff from the menu caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived); @@ -285,6 +328,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived); + caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived); + caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); 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 0a2e61f8d..897af4562 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -1,5 +1,6 @@ package mineplex.staffServer.salespackage; +import mineplex.staffServer.salespackage.salespackages.*; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -13,24 +14,6 @@ import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.stats.StatsManager; import mineplex.staffServer.salespackage.command.DisplayPackageCommand; import mineplex.staffServer.salespackage.command.Sales; -import mineplex.staffServer.salespackage.salespackages.AncientChest; -import mineplex.staffServer.salespackage.salespackages.ApplyKits; -import mineplex.staffServer.salespackage.salespackages.ClanBannerEditor; -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.IlluminatedChest; -import mineplex.staffServer.salespackage.salespackages.LifetimeHero; -import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; -import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; -import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; -import mineplex.staffServer.salespackage.salespackages.MythicalChest; -import mineplex.staffServer.salespackage.salespackages.OldChest; -import mineplex.staffServer.salespackage.salespackages.OmegaChest; -import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; -import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; -import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; public class SalesPackageManager extends MiniPlugin { @@ -81,6 +64,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, false)); AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); + AddSalesPackage(new HauntedChest(this)); } private void AddSalesPackage(SalesPackageBase salesPackage) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java new file mode 100644 index 000000000..acc9e802e --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class HauntedChest extends SalesPackageBase +{ + public HauntedChest(SalesPackageManager manager) + { + super(manager, "1 Haunted Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Haunted Chest", "Give 1 Haunted Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file 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 0b5f9ad30..58c49294b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1,5 +1,40 @@ package nautilus.game.arcade; +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.server.v1_8_R3.EntityLiving; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; + import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; @@ -30,6 +65,8 @@ import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.event.JoinMessageBroadcastEvent; +import mineplex.core.events.AddConditionEvent; +import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; @@ -77,10 +114,12 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; import mineplex.serverdata.Region; + import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; @@ -115,6 +154,7 @@ import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; +import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.NextBestGameManager; @@ -126,39 +166,6 @@ import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager; import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager; import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.shop.ArcadeShop; -import net.minecraft.server.v1_8_R3.EntityLiving; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.scoreboard.Team; -import org.bukkit.util.Vector; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; public class ArcadeManager extends MiniPlugin implements IRelation { @@ -337,7 +344,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _hologramManager = hologramManager; _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - // new HolidayManager(this, titanGiveaway); + new HolidayManager(this, titanGiveaway); new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); require(PlayerDisguiseManager.class); @@ -1977,6 +1984,29 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } + /** + * Allows mob spawning from core + * @param event + */ + @EventHandler + public void onEnableArcadeSpawn(EnableArcadeSpawnEvent event) + { + if (_game != null) + { + _game.CreatureAllowOverride = event.canEnable(); + } + } + + /** + * Allows adding a condition from another modules + * @param event + */ + @EventHandler + public void onAddCondition(AddConditionEvent event) + { + _conditionManager.AddCondition(new Condition(_conditionManager, event)); + } + public ProgressingKitManager getProgressionKitManager() { return _progressionKitManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 91d05aef2..51df05364 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -290,7 +290,7 @@ public class Minion if(disguise instanceof DisguiseZombie && i > 0) { DisguiseZombie zombie = (DisguiseZombie) disguise; - zombie.SetBaby(true); + zombie.setBaby(true); } if(disguise instanceof DisguiseSlime) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index 9a782a159..48ddb346b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -158,8 +158,8 @@ public class GameLootManager implements Listener return false; } - final Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); - reward.giveReward(RewardType.GameLoot, player, new Callback() + final Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GAME_LOOT, true); + reward.giveReward(RewardType.GAME_LOOT, player, new Callback() { @Override public void run(RewardData rewardData) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 2328f93dc..89e04c909 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -1,22 +1,20 @@ package nautilus.game.arcade.managers; +import java.util.EnumMap; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; +import mineplex.core.gadget.gadgets.particle.unrelated.HalloweenSmashedEffect; +import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.titangiveaway.TitanGiveawayAnimation; +import mineplex.core.reward.RewardPool; +import mineplex.core.reward.RewardRarity; import mineplex.core.titangiveaway.TitanGiveawayManager; +import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -25,27 +23,17 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; -import net.minecraft.server.v1_8_R3.TileEntity; -import net.minecraft.server.v1_8_R3.TileEntityEnderChest; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; public class HolidayManager implements Listener @@ -83,8 +71,8 @@ public class HolidayManager implements Listener } } - private HolidayType type = HolidayType.Christmas; - private String _statName = "Christmas Presents 2015"; + private HolidayType type = HolidayType.Halloween; + private String _statName = "Halloween 2016"; ArcadeManager Manager; private TitanGiveawayManager _titanManager; @@ -96,13 +84,23 @@ public class HolidayManager implements Listener private HashSet _coins = new HashSet(); private HashSet _gems = new HashSet(); + private static final double CHEST_CHANCE = 0.001; + public long _lastSpawn = System.currentTimeMillis(); + private EnumMap _rewardPools; + public HolidayManager(ArcadeManager manager, TitanGiveawayManager titanManager) { Manager = manager; _titanManager = titanManager; + _rewardPools = new EnumMap<>(RewardPool.Type.class); + for (RewardPool.Type type : RewardPool.Type.values()) + { + _rewardPools.put(type, new RewardPool()); + } + Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } @@ -327,7 +325,7 @@ public class HolidayManager implements Listener for (int i=0 ; i < 4 + Math.random()*8 ; i++) { Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin")); + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, @@ -358,7 +356,7 @@ public class HolidayManager implements Listener _gems.add(gem); } - + /* // Titan Giveaway if (player != null) { @@ -371,6 +369,35 @@ public class HolidayManager implements Listener new TitanGiveawayAnimation(_titanManager, location, 3000L); } }); + }*/ + + if (player != null) + { + InventoryManager manager = Manager.getInventoryManager(); + double rand = UtilMath.random.nextDouble(); + if (rand < CHEST_CHANCE) + { + if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) + { + FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) + .withColor(Color.ORANGE).withColor(Color.BLACK).withFade(Color.ORANGE) + .withFade(Color.BLACK).flicker(true).build(); + manager.addItemToInventory(player, "Haunted Chest", 1); + HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() + .add(.5, .5, .5), fireworkEffect, Manager.getPlugin()); + halloweenSmashedEffect.start(); + } + else + { + FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) + .withColor(Color.AQUA).withColor(Color.BLACK).withFade(Color.AQUA) + .withFade(Color.BLACK).flicker(true).build(); + manager.addItemToInventory(player, "Omega Chest", 1); + HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() + .add(.5, .5, .5), fireworkEffect, Manager.getPlugin()); + halloweenSmashedEffect.start(); + } + } } //Effect @@ -462,4 +489,14 @@ public class HolidayManager implements Listener spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); } } + + public boolean hasItemsToGivePlayer(RewardPool.Type pool, Player player) + { + for(RewardRarity rarity : new RewardRarity[]{ + RewardRarity.COMMON, RewardRarity.MYTHICAL, RewardRarity.LEGENDARY, RewardRarity.RARE, RewardRarity.UNCOMMON}) + { + if(_rewardPools.get(pool).hasItemsToGive(rarity, player)) return true; + } + return false; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index 35362f78f..7827eb64f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -32,7 +32,7 @@ public class WinEffectManager public void playWinEffect(Location loc) { - prepareSetup(loc); + buildWinnerRoom(loc); UtilEnt.getAllInRadius(loc, 20).keySet().stream().filter(e-> !(e instanceof Player)).forEach(e->e.remove()); _game.CreatureAllowOverride = true; for(Player p : UtilServer.getPlayers()) @@ -43,14 +43,10 @@ public class WinEffectManager playEffect(); } - public void prepareSetup(Location loc) { - buildWinnerRoom(loc); - } - - protected void buildWinnerRoom(Location loc) + protected void buildWinnerRoom(Location loc) { - _game.WorldTimeSet = 12000; WinEffectGadget effect = getWinEffect(); + _game.WorldTimeSet = effect.getGameTime(); effect.setup(_winner, _team, _nonTeam, loc); effect.buildWinnerRoom(); }