From 7c300acaa3f45a93bb51e1743ac5eb18b2259485 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 16 Jul 2016 20:00:21 -0300 Subject: [PATCH 01/21] No particles for vanished players! --- .../core/gadget/commands/subscription/MonthlyCommand.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java new file mode 100644 index 000000000..b913bacfc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java @@ -0,0 +1,8 @@ +package mineplex.core.gadget.commands.subscription; + +public class MonthlyCommand +{ + + + +} From 0dce530438ce0926aa65c8dacfee95b156da740a Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 24 Jul 2016 13:15:32 -0300 Subject: [PATCH 02/21] PowerPlayClub managers and stuff --- .../core/gadget/commands/subscription/MonthlyCommand.java | 8 -------- .../mineplex/core/gadget/gadgets/morph/MorphMetalMan.java | 5 +++++ .../mineplex/core/gadget/gadgets/morph/MorphSquid.java | 5 +++++ .../gadget/gadgets/particle/unrelated/MetalManEffect.java | 5 +++++ .../gadget/gadgets/particle/unrelated/SquidEffect.java | 5 +++++ .../core/gadget/powerplayclub/PowerPlayClubManager.java | 5 +++++ 6 files changed, 25 insertions(+), 8 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java deleted file mode 100644 index b913bacfc..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/subscription/MonthlyCommand.java +++ /dev/null @@ -1,8 +0,0 @@ -package mineplex.core.gadget.commands.subscription; - -public class MonthlyCommand -{ - - - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java new file mode 100644 index 000000000..901547ff4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -0,0 +1,5 @@ +package mineplex.core.gadget.gadgets.morph; + +public class MorphMetalMan +{ +} 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 new file mode 100644 index 000000000..116318cb3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -0,0 +1,5 @@ +package mineplex.core.gadget.gadgets.morph; + +public class MorphSquid +{ +} 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 new file mode 100644 index 000000000..652f6dd36 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java @@ -0,0 +1,5 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +public class MetalManEffect +{ +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java new file mode 100644 index 000000000..44e46857f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java @@ -0,0 +1,5 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +public class SquidEffect +{ +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java new file mode 100644 index 000000000..c28dd20f8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java @@ -0,0 +1,5 @@ +package mineplex.core.gadget.powerplayclub; + +public class PowerPlayClubManager +{ +} From 195a82f78f5ceb65c426a2c29fcece21b755db26 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 24 Jul 2016 13:18:33 -0300 Subject: [PATCH 03/21] Github is annoying me about this, but I don't know what it is --- .../mineplex/core/common/skin/SkinData.java | 41 ++++-- .../disguise/disguises/DisguisePlayer.java | 23 +-- .../mineplex/core/gadget/GadgetManager.java | 139 +++++++++--------- .../core/gadget/gadgets/morph/MorphBat.java | 4 +- .../core/gadget/gadgets/morph/MorphBlaze.java | 4 +- .../core/gadget/gadgets/morph/MorphBlock.java | 4 +- .../core/gadget/gadgets/morph/MorphBunny.java | 4 +- .../gadget/gadgets/morph/MorphChicken.java | 4 +- .../core/gadget/gadgets/morph/MorphCow.java | 4 +- .../gadget/gadgets/morph/MorphCreeper.java | 4 +- .../gadget/gadgets/morph/MorphEnderman.java | 4 +- .../gadget/gadgets/morph/MorphMetalMan.java | 130 +++++++++++++++- .../core/gadget/gadgets/morph/MorphPig.java | 4 +- .../gadgets/morph/MorphPumpkinKing.java | 4 +- .../core/gadget/gadgets/morph/MorphSlime.java | 4 +- .../gadget/gadgets/morph/MorphSnowman.java | 4 +- .../core/gadget/gadgets/morph/MorphSquid.java | 88 ++++++++++- .../core/gadget/gadgets/morph/MorphTitan.java | 4 +- .../gadget/gadgets/morph/MorphUncleSam.java | 4 +- .../gadget/gadgets/morph/MorphVillager.java | 4 +- .../gadget/gadgets/morph/MorphWither.java | 4 +- .../gadgets/particle/unrelated/Effect.java | 11 ++ .../particle/unrelated/MetalManEffect.java | 47 +++++- .../particle/unrelated/SquidEffect.java | 28 +++- .../powerplayclub/PowerPlayClubManager.java | 36 +++++ .../core/gadget/types/MorphGadget.java | 4 +- .../src/mineplex/core/reward/RewardPool.java | 1 + .../mineplex/core/treasure/TreasureType.java | 4 +- .../src/mineplex/enjinTranslator/Enjin.java | 28 +++- .../src/mineplex/hub/HubManager.java | 20 +-- .../src/nautilus/game/arcade/Arcade.java | 2 +- 31 files changed, 511 insertions(+), 155 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index b89b34866..1612f92a0 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 @@ -32,6 +32,7 @@ public class SkinData public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg="); public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); 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("eyJ0aW1lc3RhbXAiOjE0Njg3ODAyMzk2ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hNzc5YWEzYzk3OTc0Mzk1YTY3MTZkZmQ5MTI4YWM0N2E1MzdlMzljMzdmMGM0ZjZkZjQ1YjJmMGI4ZjVkMiJ9fX0=", "acwmrIdtzzkuntsvQqD+o9UYaI09xzQoPgRXFtvS1hvGgGRbApdG7YbQ3Itjg/8WUl0trAMMJa1IL8TlXaOwTeClOj6if3HW2lJ8yO7E+MXEJoDZcjkxVOK3322NRCBiPG+VbNCwHE7IvT8P4awExvV2nHLbCk7upawxK3oKfR5U+YEq/eLG/UCC1TAnHNLXE0mr+6ZtNut5qgz1u0Y+VNQKI/vdjVit1ttYeBjIWpSszhlP4bH8Iw3u3ZRuDqU4xSAWzj6Qhw9UYm2T3s2N9s2yW3wiagijUEq9stbaw97n3UCqBas58lTBy46w524lBvwbYC1U9jwxPxSUo6L6omhPKZSwgK/u2w4mELvfNI09A4C7RNThnz9wgrT0FPajjXYkt31Ba5qaP7HwcThQu02Bb3gmYfHfMvuDBt8xUk4lFyUuL+lwqUHXlKRkUPGVkDLDpmsnk+y4LvaymNHBBWpOyqpm8y1BTpux02GqCIgK7nHtsRNH3q3yHR1YyM0tc6PKXOst5ex1cGP654/Q0KEUSAvAV5ozj/q5izRlPJNiwu9zPqhfs8oWSBSo/Sfej6p7Fu9u0h0j/k0m86bfZObe2RsCEgBe8GSF35cyYRou0qTvk+00hEr+jpxeat0e9JHe163jI/Ew9XPeGd6eT8GTy4iyJM0O/y1MlsRjUec="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin @@ -41,9 +42,9 @@ public class SkinData //public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); //public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); - private Property _skinProperty; + //private Property _skinProperty; - public SkinData(String value, String signature) + /*public SkinData(String value, String signature) { _skinProperty = new Property("textures", value, signature); } @@ -51,18 +52,45 @@ public class SkinData public SkinData(GameProfile profile) { _skinProperty = profile.getProperties().get("textures").iterator().next(); + }*/ + + private String _value; + private String _signature; + private Property _property; + + public SkinData(String value, String signature) + { + _value = value; + _signature = signature; + } + + public SkinData(GameProfile gameProfile) + { + Property property = gameProfile.getProperties().get("textures").iterator().next(); + _value = property.getValue(); + _signature = property.getSignature(); } public SkinData(Player player) { this(((CraftPlayer)player).getProfile()); } + + public Property getSkinProperty() + { + if (_property == null) + { + Property property = new Property("textures", _value, _signature); + _property = property; + } + return _property; + } public ItemStack getSkull() { NBTTagCompound arrayElement = new NBTTagCompound(); - arrayElement.setString("Value", _skinProperty.getValue()); - arrayElement.setString("Signature", _skinProperty.getSignature()); + arrayElement.setString("Value", getSkinProperty().getValue()); + arrayElement.setString("Signature", getSkinProperty().getSignature()); NBTTagList textures = new NBTTagList(); textures.add(arrayElement); @@ -95,11 +123,6 @@ public class SkinData return stack; } - public Property getProperty() - { - return new Property(_skinProperty.getName(), _skinProperty.getValue(), _skinProperty.getSignature()); - } - public static String getUnusedSkullName() { _nameCount++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 3e114c350..921a36831 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -2,25 +2,12 @@ package mineplex.core.disguise.disguises; import java.util.UUID; +import com.mojang.authlib.GameProfile; +import mineplex.core.common.skin.SkinData; +import net.minecraft.server.v1_8_R3.*; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import org.bukkit.Location; import org.bukkit.block.BlockFace; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.UtilPlayer; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.EntityTrackerEntry; -import net.minecraft.server.v1_8_R3.IntHashMap; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R3.WorldServer; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_8_R3.WorldSettings; import org.bukkit.entity.Entity; public class DisguisePlayer extends DisguiseHuman @@ -60,7 +47,7 @@ public class DisguisePlayer extends DisguiseHuman public void setSkinData(SkinData skin) { - _profile.getProperties().put("textures", skin.getProperty()); + _profile.getProperties().put("textures", skin.getSkinProperty()); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index c60d7594e..e99bd92cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -3,104 +3,65 @@ package mineplex.core.gadget; import java.util.*; import java.util.function.Predicate; -import mineplex.core.gadget.commands.LockCosmeticsCommand; -import mineplex.core.gadget.event.GadgetChangeEvent; -import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; -import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; -import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; -import mineplex.core.gadget.gadgets.hat.*; -import mineplex.core.gadget.gadgets.morph.*; -import mineplex.core.gadget.gadgets.outfit.windupsuit.*; -import mineplex.core.gadget.gadgets.particle.*; -import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; -import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; -import mineplex.core.gadget.gadgets.wineffect.*; -import mineplex.core.gadget.persistence.UserGadgetPersistence; -import mineplex.core.gadget.set.*; -import mineplex.core.gadget.types.*; -import mineplex.core.incognito.events.IncognitoHidePlayerEvent; -import mineplex.core.incognito.events.IncognitoStatusChangeEvent; -import org.bukkit.*; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; -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.common.util.*; 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.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; -import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; -import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; -import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; -import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; -import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; -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.ItemCoinBomb; -import mineplex.core.gadget.gadgets.item.ItemDuelingSword; -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.ItemFlowerGift; -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.ItemPaintbrush; -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.hat.HatItem; +import mineplex.core.gadget.gadgets.hat.HatType; +import mineplex.core.gadget.gadgets.item.*; +import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; @@ -110,20 +71,30 @@ 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.vampire.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; -import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; -import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; -import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; +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.gadgets.wineffect.*; +import mineplex.core.gadget.persistence.UserGadgetPersistence; +import mineplex.core.gadget.set.*; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; +import mineplex.core.gadget.types.*; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.hologram.HologramManager; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.MountManager; import mineplex.core.mount.event.MountActivateEvent; @@ -131,6 +102,18 @@ import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.plugin.java.JavaPlugin; public class GadgetManager extends MiniPlugin { @@ -147,6 +130,7 @@ public class GadgetManager extends MiniPlugin private final PacketHandler _packetManager; private final HologramManager _hologramManager; private final OutfitWindUpSuitBoosterManager _boosterManager; + private final IncognitoManager _incognitoManager; private NautHashMap> _gadgets; @@ -162,9 +146,9 @@ public class GadgetManager extends MiniPlugin private boolean _gadgetsEnabled = true; public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, - MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, - DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager, - PacketHandler packetHandler, HologramManager hologramManager) + MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, + DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager, + PacketHandler packetHandler, HologramManager hologramManager, IncognitoManager incognitoManager) { super("Gadget Manager", plugin); @@ -182,6 +166,7 @@ public class GadgetManager extends MiniPlugin _hologramManager = hologramManager; _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); + _incognitoManager = incognitoManager; createGadgets(); createSets(); @@ -278,6 +263,8 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphTitan(this)); addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); + addGadget(new MorphSquid(this)); + addGadget(new MorphMetalMan(this)); // Particles addGadget(new ParticleFoot(this)); @@ -919,6 +906,12 @@ public class GadgetManager extends MiniPlugin { if (!_gadgetsEnabled) event.setCancelled(true); + Player player = event.getPlayer(); + if (_incognitoManager.Get(player).Hidden && event.getGadget().getGadgetType() == GadgetType.PARTICLE) + { + event.setCancelled(true); + player.sendMessage(F.main("Cosmetics", "You cannot enable particles while vanished!")); + } } @EventHandler 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 5a3e85f68..7cc647520 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 @@ -56,7 +56,7 @@ public class MorphBat extends MorphGadget implements IThrown @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -67,7 +67,7 @@ public class MorphBat extends MorphGadget implements IThrown @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.setAllowFlight(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 0708fe148..3d4d9be48 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 @@ -39,7 +39,7 @@ public class MorphBlaze extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -50,7 +50,7 @@ public class MorphBlaze extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java index e1c9a15aa..5847c76e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java @@ -48,7 +48,7 @@ public class MorphBlock extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); _active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK)); } @@ -56,7 +56,7 @@ public class MorphBlock extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); BlockForm form = _active.remove(player); 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 762dc9a7c..55479bae5 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 @@ -67,7 +67,7 @@ public class MorphBunny extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -82,7 +82,7 @@ public class MorphBunny extends MorphGadget public void disableCustom(Player player, boolean message) { _jumpCharge.remove(player); - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.removePotionEffect(PotionEffectType.SPEED); 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 20c997d91..018c2380f 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 @@ -45,7 +45,7 @@ public class MorphChicken extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -56,7 +56,7 @@ public class MorphChicken extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.setAllowFlight(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 652c35330..97cce95be 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 @@ -33,7 +33,7 @@ public class MorphCow extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -44,7 +44,7 @@ public class MorphCow extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 149c59a82..6dadf5979 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 @@ -47,7 +47,7 @@ public class MorphCreeper extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -58,7 +58,7 @@ public class MorphCreeper extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 59e7d9e2f..8a2c1b52a 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 @@ -44,7 +44,7 @@ public class MorphEnderman extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -55,7 +55,7 @@ public class MorphEnderman extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java index 901547ff4..1cd765d4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -1,5 +1,133 @@ package mineplex.core.gadget.gadgets.morph; -public class MorphMetalMan +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.UUID; + +import com.mojang.authlib.GameProfile; +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.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +public class MorphMetalMan extends MorphGadget { + + private Map _playerColors = new HashMap<>(); + + public MorphMetalMan(GadgetManager manager) + { + super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), + 0, Material.IRON_INGOT, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player); + disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cYellow + "Metal " + C.cRed + "Man")); + SkinData metalMan = SkinData.METAL_MAN; + disguisePlayer.setSkinData(metalMan); + disguisePlayer.setSendSkinDataToSelf(true); + Manager.getDisguiseManager().disguise(disguisePlayer); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + Manager.getDisguiseManager().undisguise(player); + } + + @EventHandler + public void onPlayerClick(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player)) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) + return; + + if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) + return; + + // Creates colored laser + HashSet ignore = new HashSet(); + ignore.add(Material.AIR); + Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + + GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc); + Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent); + + // Checks to see if it's a valid location + if (gadgetSelectLocationEvent.isCancelled()) + { + if (gadgetSelectLocationEvent.canShowMessage()) + { + UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!")); + } + + return; + } + + // Creates the particle beam + int color = 0; + if (_playerColors.containsKey(player.getUniqueId())) + { + color = _playerColors.get(player.getUniqueId()); + } + MetalManEffect metalManEffect = new MetalManEffect(player.getEyeLocation(), loc, color, Manager.getPlugin()); + increaseColor(player.getUniqueId()); + metalManEffect.start(); + + // Creates the explosion and knockback players + loc.getWorld().createExplosion(loc, 0f); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers()); + HashMap players = UtilPlayer.getInRadius(loc, 12d); + for (Player ent : players.keySet()) + { + if (Manager.collideEvent(player, this, ent)) + continue; + + double mult = players.get(ent); + + //Knockback + UtilAction.velocity(ent, UtilAlg.getTrajectory(loc, ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true); + } + + } + + public void increaseColor(UUID uuid) + { + if (_playerColors.containsKey(uuid)) + { + int color = _playerColors.get(uuid); + if (color == 0) + color = 1; + else + color = 0; + _playerColors.put(uuid, color); + } + else + { + _playerColors.put(uuid, 0); + } + } + } 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 5a0e4f4c2..327ed2022 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 @@ -46,7 +46,7 @@ public class MorphPig extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguisePig disguise = new DisguisePig(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -57,7 +57,7 @@ public class MorphPig extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 ae4aa8913..723786236 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 @@ -30,7 +30,7 @@ public class MorphPumpkinKing extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); @@ -48,7 +48,7 @@ public class MorphPumpkinKing extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); 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 7ea51f3f0..843d5e5f0 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 @@ -45,7 +45,7 @@ public class MorphSlime extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -67,7 +67,7 @@ public class MorphSlime extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 3996d5626..2293da2cb 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 @@ -57,7 +57,7 @@ public class MorphSnowman extends MorphGadget @Override public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -68,7 +68,7 @@ public class MorphSnowman extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 116318cb3..d5aa93c28 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 @@ -1,5 +1,91 @@ package mineplex.core.gadget.gadgets.morph; -public class MorphSquid +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; + +public class MorphSquid extends MorphGadget implements IThrown { + + public MorphSquid(GadgetManager manager) + { + super(manager, "Squid Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), + 0, Material.MONSTER_EGG, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + DisguiseSquid disguiseSquid = new DisguiseSquid(player); + disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); + Manager.getDisguiseManager().disguise(disguiseSquid); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + Manager.getDisguiseManager().undisguise(player); + } + + @EventHandler + public void onSneak(PlayerToggleSneakEvent event) + { + + Player player = event.getPlayer(); + + if (!player.isSneaking()) + return; + + if (!isActive(player)) + return; + + if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.5, 0.8, true); + + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), + ItemStackFactory.Instance.CreateStack(Material.RAW_FISH)); + UtilAction.velocity(item, player.getLocation().getDirection(), + 0.01, true, -0.3, 1.5, 10, false); + + Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true, + null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } + } 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 c2bcd1cc7..9b6d48c5b 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 @@ -60,7 +60,7 @@ public class MorphTitan extends MorphGadget @Override public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -72,7 +72,7 @@ public class MorphTitan extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java index 44cad0b25..facef86c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java @@ -35,7 +35,7 @@ public class MorphUncleSam extends MorphGadget @Override public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguisePlayer disguisePlayer = new DisguisePlayer(player); disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cRed + "Uncle " + C.cBlue + "Sam")); @@ -48,7 +48,7 @@ public class MorphUncleSam extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 3480504e3..82d6d3c88 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 @@ -55,7 +55,7 @@ public class MorphVillager extends MorphGadget implements IThrown @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); @@ -66,7 +66,7 @@ public class MorphVillager extends MorphGadget implements IThrown @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); } 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 505551d3b..5532934f4 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 @@ -58,7 +58,7 @@ public class MorphWither extends MorphGadget @Override public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); player.setMaxHealth(300); player.setHealth(300); @@ -75,7 +75,7 @@ public class MorphWither extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(player); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java index 3a30b84c2..b819c0e56 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java @@ -9,6 +9,7 @@ public abstract class Effect public int _ticksToRun = 20, _ticks = 0, _task; public long _delay = 1; public EffectLocation _effectLocation; + public EffectLocation _targetLocation; protected JavaPlugin _javaPlugin; public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin) @@ -53,4 +54,14 @@ public abstract class Effect public abstract void runEffect(); + public void setTargetLocation(EffectLocation effectLocation) + { + _targetLocation = effectLocation; + } + + public EffectLocation getTargetLocation() + { + return _targetLocation; + } + } 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 652f6dd36..7e1b6baa1 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 @@ -1,5 +1,50 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -public class MetalManEffect +import java.awt.*; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class MetalManEffect extends Effect { + + private int _particles = 100; + private int _color; + private Vector _vector; + + public MetalManEffect(Location location, Location target, int color, JavaPlugin javaPlugin) + { + super(20, new EffectLocation(location), javaPlugin); + _color = color; + setTargetLocation(new EffectLocation(target)); + } + + @Override + public void runEffect() + { + Location location = _effectLocation.getFixedLocation().clone(); + if (_vector == null) + { + Location targetLoc = getTargetLocation().getFixedLocation().clone(); + Vector link = targetLoc.toVector().subtract(location.toVector()); + float length = (float) link.length(); + link.normalize(); + Vector vector = link.multiply(length / _particles); + _vector = vector; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((_color == 0) ? Color.YELLOW : Color.RED), _effectLocation.getLocation().clone()); + Location loc = location.clone().subtract(_vector); + for (int i = 0; i < _particles; i++) + { + loc.add(_vector); + coloredParticle.setLocation(loc); + coloredParticle.display(UtilParticle.ViewDist.LONG); + } + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java index 44e46857f..b1e1f9054 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java @@ -1,5 +1,31 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -public class SquidEffect +import java.util.Random; + +import mineplex.core.common.util.UtilParticle; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class SquidEffect extends Effect { + + private int _particles = 50; + + public SquidEffect(Player player, JavaPlugin javaPlugin) + { + super(1, new EffectLocation(player), javaPlugin); + } + + @Override + public void runEffect() + { + Random random = new Random(); + for (int i = 0; i < _particles; i++) + { + int x = random.nextInt(2) - 1, y = random.nextInt(2) - 1, z = random.nextInt(2) - 1; + UtilParticle.PlayParticle(UtilParticle.ParticleType.DRIP_WATER, + _effectLocation.getLocation().clone().add(x, y, z), 0f, 0f, 0f, 0f, 2, UtilParticle.ViewDist.NORMAL); + } + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java index c28dd20f8..5c18a33d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java @@ -1,5 +1,41 @@ package mineplex.core.gadget.powerplayclub; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.UUID; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.database.PlayerKeyValueRepository; + public class PowerPlayClubManager { + + public final PlayerKeyValueRepository _repository; + + public PowerPlayClubManager() + { + _repository = new PlayerKeyValueRepository<>("powerPlayClub", PreparedStatement::setInt, ResultSet::getInt); + } + + public Integer getPlayerMonths(UUID uuid) + { + final int[] months = {0}; + _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> + { + if (values.containsKey("monthsLeft")) + months[0] = values.get("monthsLeft"); + })); + return months[0]; + } + + public void addPlayerMonths(UUID uuid, int months) + { + _repository.put(uuid, "monthsLeft", getPlayerMonths(uuid) + months); + } + + public void decreasePlayerMonths(UUID uuid, int months) + { + _repository.put(uuid, "monthsLeft", getPlayerMonths(uuid) - months); + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index 3719d5583..335f9d0ff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -16,7 +16,7 @@ public abstract class MorphGadget extends Gadget super(manager, GadgetType.MORPH, name, desc, cost, mat, data); } - public void ApplyArmor(Player player, boolean message) + public void applyArmor(Player player, boolean message) { Manager.removeGadgetType(player, GadgetType.MORPH, this); @@ -26,7 +26,7 @@ public abstract class MorphGadget extends Gadget UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + ".")); } - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(getName()) + ".")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index c52d63dce..19e01f1f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -53,6 +53,7 @@ public class RewardPool VALENTINES_GIFT(false), ILLUMINATED(false), FREEDOM(false), + OMEGA(false), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 6e424f0b4..13c8ce735 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -18,7 +18,9 @@ public enum TreasureType ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, 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.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000), + + OMEGA(C.cBlue + "Omega Treasure", "Omega Treasure", "Omega", ) private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 3c569acb1..af93aba54 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -1,12 +1,10 @@ package mineplex.enjinTranslator; import java.text.SimpleDateFormat; -import java.util.AbstractMap; -import java.util.Date; -import java.util.Iterator; +import java.util.*; import java.util.Map.Entry; -import java.util.UUID; +import mineplex.core.gadget.powerplayclub.PowerPlayClubManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -35,6 +33,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor private DonationManager _donationManager; private InventoryManager _inventoryManager; private PurchaseManager _purchaseManager; + private PowerPlayClubManager _powerPlayClubManager; private NautHashMap> _cachedUUIDs = new NautHashMap>(); private static Object _commandLock = new Object(); @@ -43,13 +42,14 @@ public class Enjin extends MiniPlugin implements CommandExecutor private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PowerPlayClubManager powerPlayClubManager) { super("Enjin", plugin); _clientManager = clientManager; _donationManager = donationManager; _inventoryManager = inventoryManager; + _powerPlayClubManager = powerPlayClubManager; _purchaseManager = new PurchaseManager(plugin); @@ -293,4 +293,22 @@ public class Enjin extends MiniPlugin implements CommandExecutor return true; } + + protected boolean checkForPowerPlayClub(String[] args, final String name, final UUID playerUUID, final CoreClient client) + { + if (args.length != 3 || !args[0].equalsIgnoreCase("powerplayclub")) + return false; + + if (args[1].equalsIgnoreCase("month")) + { + _powerPlayClubManager.addPlayerMonths(playerUUID, 1); + } + else + { + _powerPlayClubManager.addPlayerMonths(playerUUID, 12); + } + + return true; + + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 37a50cbb3..43e8e08a1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,4 +1,13 @@ package mineplex.hub; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Random; + import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -91,15 +100,6 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; - public class HubManager extends MiniClientPlugin { // ☃❅ Snowman! @@ -191,7 +191,7 @@ public class HubManager extends MiniClientPlugin _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager, incognito); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 08de28ad9..2eee35d4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -158,7 +158,7 @@ public class Arcade extends JavaPlugin InventoryManager inventoryManager = new InventoryManager(this, _clientManager); PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); - GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); + GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito); BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); cosmeticManager.setInterfaceSlot(6); From ab52965e444e76b8d5e26d2f7803af8850c0fd12 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 28 Jul 2016 18:07:10 -0300 Subject: [PATCH 04/21] Power Play button inside Carl, and the power play manager --- .../mineplex/core/bonuses/BonusManager.java | 36 +++- .../bonuses/commands/PowerPlayCommand.java | 56 +++++ .../mineplex/core/bonuses/gui/BonusGui.java | 2 + .../gui/buttons/PowerPlayClubButton.java | 125 ++++++++++++ .../core/donation/DonationManager.java | 10 + .../particle/unrelated/SquidEffect.java | 31 --- .../powerplayclub/PowerPlayClubManager.java | 41 ---- .../powerplayclub/PowerPlayClubManager.java | 192 ++++++++++++++++++ .../mineplex/core/treasure/TreasureType.java | 4 +- .../src/mineplex/enjinTranslator/Enjin.java | 6 +- .../enjinTranslator/EnjinTranslator.java | 2 - .../src/mineplex/votifier/Votifier.java | 3 +- 12 files changed, 420 insertions(+), 88 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index f31e9ce0a..93455f16b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -1,5 +1,11 @@ package mineplex.core.bonuses; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.*; + import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -8,6 +14,7 @@ import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.bonuses.animations.AnimationCarl; import mineplex.core.bonuses.commands.AnimationCommand; import mineplex.core.bonuses.commands.GuiCommand; +import mineplex.core.bonuses.commands.PowerPlayCommand; import mineplex.core.bonuses.commands.TicketCommand; import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.bonuses.gui.BonusGui; @@ -31,6 +38,7 @@ import mineplex.core.npc.Npc; import mineplex.core.npc.NpcManager; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; +import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.recharge.Recharge; import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; @@ -61,12 +69,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.jooq.SQLDialect; import org.jooq.impl.DSL; -import java.sql.Date; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.*; - public class BonusManager extends MiniClientPlugin implements ILoginProcessor { @@ -124,6 +126,7 @@ public class BonusManager extends MiniClientPlugin implements I private FacebookManager _facebookManager; private YoutubeManager _youtubeManager; private BoosterManager _boosterManager; + private PowerPlayClubManager _powerPlayClubManager; public boolean _enabled; private Npc _carlNpc; private AnimationCarl _animation; @@ -150,6 +153,10 @@ public class BonusManager extends MiniClientPlugin implements I _repository = new BonusRepository(plugin, this, donationManager); _clientManager = clientManager; _donationManager = donationManager; + _powerPlayClubManager = donationManager.getPowerPlayClubManager(); + + System.out.print("VOTIFIER: "); + System.out.print("DONATION MANAGER - > " + _donationManager.toString()); _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); @@ -173,6 +180,9 @@ public class BonusManager extends MiniClientPlugin implements I _inventoryManager = inventoryManager; _boosterManager = boosterManager; + System.out.print("HUB: "); + System.out.print("DONATION MANAGER - > " + _donationManager.toString()); + _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); _pollManager = pollManager; @@ -180,6 +190,8 @@ public class BonusManager extends MiniClientPlugin implements I _facebookManager = facebookManager; _youtubeManager = youtubeManager; + _powerPlayClubManager = donationManager.getPowerPlayClubManager(); + _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); _voteList.add("http://vote2.mineplex.com"); @@ -226,6 +238,7 @@ public class BonusManager extends MiniClientPlugin implements I addCommand(new GuiCommand(this)); addCommand(new AnimationCommand(this)); addCommand(new TicketCommand(this)); + addCommand(new PowerPlayCommand(this)); } // Just keeping things up-to-date @@ -1198,4 +1211,15 @@ public class BonusManager extends MiniClientPlugin implements I { return _boosterManager; } + + public DonationManager getDonationManager() + { + return _donationManager; + } + + public PowerPlayClubManager getPowerPlayClubManager() + { + return _powerPlayClubManager; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java new file mode 100644 index 000000000..363d93d92 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -0,0 +1,56 @@ +package mineplex.core.bonuses.commands; + +import mineplex.core.bonuses.BonusManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import org.bukkit.entity.Player; + +public class PowerPlayCommand extends CommandBase +{ + + private BonusManager _bonusManager; + + public PowerPlayCommand(BonusManager manager) + { + super(manager, Rank.JNR_DEV, "powerplay"); + _bonusManager = manager; + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay "))); + return; + } + + final String targetName = args[0]; + final String months = args[1]; + Player target = UtilPlayer.searchExact(targetName); + + + rewardPowerPlay(caller, target, target.getName(), months); + } + + private void rewardPowerPlay(Player caller, Player target, String targetName, String months) + { + try + { + final int iMonths = Integer.parseInt(months); + _bonusManager.getPowerPlayClubManager().addPlayerMonths(target.getUniqueId(), iMonths); + UtilPlayer.message(caller, F.main("Power Play Club", "You gave " + F.elem(iMonths + " Months") + " to " + F.name(targetName) + ".")); + if (target != null && !target.equals(caller)) + { + UtilPlayer.message(target, F.main("Power Play Club", F.name(caller.getName()) + " gave you " + F.elem(iMonths + " Months") + ".")); + } + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Power Play Club", "Invalid Month Amount")); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index a8fef8c82..2421e2f0a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -38,6 +38,8 @@ public class BonusGui extends SimpleGui setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); + + setItem(35, new PowerPlayClubButton(player, manager.getDonationManager().getPowerPlayClubManager())); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java new file mode 100644 index 000000000..e92425b22 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -0,0 +1,125 @@ +package mineplex.core.bonuses.gui.buttons; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Locale; + +import mineplex.core.common.util.C; +import mineplex.core.gui.GuiItem; +import mineplex.core.powerplayclub.PowerPlayClubManager; +import mineplex.core.shop.item.ShopItem; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public class PowerPlayClubButton implements GuiItem +{ + + private ItemStack _item; + private Player _player; + private PowerPlayClubManager _powerPlayClubManager; + + public PowerPlayClubButton(Player player, PowerPlayClubManager powerPlayClubManager) + { + _player = player; + _powerPlayClubManager = powerPlayClubManager; + } + + @Override + public void setup() + { + setItem(); + } + + @Override + public void close() + { + + } + + @Override + public void click(ClickType clickType) + { + if (isAvailable()) + { + _player.closeInventory(); + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + _player.sendMessage("TEST"); + getMonthlyRewards().giveAllItems(); + updateLastClaimedMonth(); + } + else + { + _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); + } + } + + @Override + public ItemStack getObject() + { + return _item; + } + + private void setItem() + { + ArrayList lore = new ArrayList<>(); + Material material; + byte data = 0; + String itemName; + + if (isAvailable()) + { + material = Material.GOLD_INGOT; + itemName = C.cGreenB + "Power Play Club"; + lore.add(""); + lore.add(C.Reset + "Click to claim!"); + } + else + { + material = Material.REDSTONE_BLOCK; + itemName = C.cRedB + "Power Play Club"; + lore.add(""); + lore.add(C.Reset + "Months left: " + _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true) + "!"); + } + + lore.add(C.cYellow + "Rewards"); + lore.add(" " + C.cWhite + "2x Game Amplifiers"); + lore.add(" " + C.cWhite + "1x Omega Chest"); + for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) + { + lore.add(" " + C.cWhite + prize.getPrize()); + } + + _item = new ShopItem(material, data, itemName, lore.toArray(new String[0]), 1, false, false); + } + + private boolean isAvailable() + { + int monthsLeft = _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true); + int lastClaimed = _powerPlayClubManager.getLastClaimedMonth(_player.getUniqueId(), true); + int month = Calendar.getInstance().get(Calendar.MONTH); + if (monthsLeft > 0) + { + if (lastClaimed == -1) + return true; + return lastClaimed != month; + } + return false; + } + + private PowerPlayClubManager.PowerPlayClubRewards getMonthlyRewards() + { + String month = Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH); + return PowerPlayClubManager.PowerPlayClubRewards.valueOf(month.toUpperCase()); + } + + private void updateLastClaimedMonth() + { + int month = Calendar.getInstance().get(Calendar.MONTH); + _powerPlayClubManager.setLastClaimedMonth(_player.getUniqueId(), month); + _powerPlayClubManager.decreasePlayerMonth(_player.getUniqueId()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index fd0862c9d..68a7678e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -6,6 +6,7 @@ import java.util.LinkedList; import java.util.Queue; import java.util.UUID; +import mineplex.core.powerplayclub.PowerPlayClubManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -41,6 +42,8 @@ public class DonationManager extends MiniDbClientPlugin private NautHashMap> _goldQueue = new NautHashMap>(); private Queue _coinAttemptQueue; + + private PowerPlayClubManager _powerPlayClubManager; public DonationManager(JavaPlugin plugin, CoreClientManager clientManager, String webAddress) { @@ -49,6 +52,8 @@ public class DonationManager extends MiniDbClientPlugin _repository = new DonationRepository(plugin, webAddress); _coinAttemptQueue = new LinkedList<>(); + + _powerPlayClubManager = new PowerPlayClubManager(); } @Override @@ -528,4 +533,9 @@ public class DonationManager extends MiniDbClientPlugin { return "SELECT gold FROM accounts WHERE id = '" + accountId + "';"; } + + public PowerPlayClubManager getPowerPlayClubManager() + { + return _powerPlayClubManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java deleted file mode 100644 index b1e1f9054..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/SquidEffect.java +++ /dev/null @@ -1,31 +0,0 @@ -package mineplex.core.gadget.gadgets.particle.unrelated; - -import java.util.Random; - -import mineplex.core.common.util.UtilParticle; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -public class SquidEffect extends Effect -{ - - private int _particles = 50; - - public SquidEffect(Player player, JavaPlugin javaPlugin) - { - super(1, new EffectLocation(player), javaPlugin); - } - - @Override - public void runEffect() - { - Random random = new Random(); - for (int i = 0; i < _particles; i++) - { - int x = random.nextInt(2) - 1, y = random.nextInt(2) - 1, z = random.nextInt(2) - 1; - UtilParticle.PlayParticle(UtilParticle.ParticleType.DRIP_WATER, - _effectLocation.getLocation().clone().add(x, y, z), 0f, 0f, 0f, 0f, 2, UtilParticle.ViewDist.NORMAL); - } - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java deleted file mode 100644 index 5c18a33d0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/powerplayclub/PowerPlayClubManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package mineplex.core.gadget.powerplayclub; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.UUID; - -import mineplex.core.common.util.BukkitFuture; -import mineplex.core.database.PlayerKeyValueRepository; - -public class PowerPlayClubManager -{ - - public final PlayerKeyValueRepository _repository; - - public PowerPlayClubManager() - { - _repository = new PlayerKeyValueRepository<>("powerPlayClub", PreparedStatement::setInt, ResultSet::getInt); - } - - public Integer getPlayerMonths(UUID uuid) - { - final int[] months = {0}; - _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> - { - if (values.containsKey("monthsLeft")) - months[0] = values.get("monthsLeft"); - })); - return months[0]; - } - - public void addPlayerMonths(UUID uuid, int months) - { - _repository.put(uuid, "monthsLeft", getPlayerMonths(uuid) + months); - } - - public void decreasePlayerMonths(UUID uuid, int months) - { - _repository.put(uuid, "monthsLeft", getPlayerMonths(uuid) - months); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java new file mode 100644 index 000000000..42ba76735 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java @@ -0,0 +1,192 @@ +package mineplex.core.powerplayclub; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.*; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.UtilServer; +import mineplex.core.database.PlayerKeyValueRepository; +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; + +public class PowerPlayClubManager implements Listener +{ + + private PlayerKeyValueRepository _repository; + private Map _playerMonths = new HashMap<>(); + + public PowerPlayClubManager() + { + Bukkit.getPluginManager().registerEvents(this, UtilServer.getPlugin()); + _repository = new PlayerKeyValueRepository<>("powerPlayClub", PreparedStatement::setInt, ResultSet::getInt); + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + updatePlayer(event.getPlayer().getUniqueId()); + } + + public int getLastClaimedMonth(UUID uuid, boolean update) + { + if (update) + { + updatePlayer(uuid); + } + if (_playerMonths.containsKey(uuid)) + { + return _playerMonths.get(uuid).getLastClaimed(); + } + return -1; + } + + public void setLastClaimedMonth(UUID uuid, int month) + { + _repository.put(uuid, "lastClaimed", month); + PlayerMonths playerMonths = _playerMonths.get(uuid); + playerMonths.setLastClaimed(month); + _playerMonths.put(uuid, playerMonths); + } + + public int getPlayerMonths(UUID uuid, boolean update) + { + if (update) + { + updatePlayer(uuid); + } + if (_playerMonths.containsKey(uuid)) + { + return _playerMonths.get(uuid).getMonths(); + } + return 0; + } + + public void addPlayerMonths(UUID uuid, int months) + { + int currentMonths = getPlayerMonths(uuid, true); + _repository.put(uuid, "monthsLeft", currentMonths + months); + PlayerMonths playerMonths = _playerMonths.get(uuid); + playerMonths.setMonths(currentMonths + months); + _playerMonths.put(uuid, playerMonths); + } + + public void decreasePlayerMonth(UUID uuid) + { + addPlayerMonths(uuid, -1); + } + + private void updatePlayer(UUID uuid) + { + _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> + { + int lastClaimed = -1; + int months = 0; + if (values.containsKey("lastClaimed")) + { + lastClaimed = values.get("lastClaimed"); + } + + if (values.containsKey("monthsLeft")) + { + months = values.get("monthsLeft"); + } + + PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed); + _playerMonths.put(uuid, playerMonths); + })); + } + + public enum PowerPlayClubRewards + { + JANUARY, + FEBRUARY, + MARCH, + APRIL, + MAY, + JUNE, + JULY, + AUGUST(new PowerPlayClubItem("Squid Morph", 1)), + SEPTEMBER, + OCTOBER, + NOVEMBER, + DECEMBER; + + private PowerPlayClubItem[] _items; + + PowerPlayClubRewards(PowerPlayClubItem... items) + { + _items = items; + } + + public PowerPlayClubItem[] getItems() + { + return _items; + } + + public void giveAllItems() + { + // TODO + } + + } + + public static class PowerPlayClubItem + { + private final String _prize; + private final int _amount; + + public PowerPlayClubItem(String prize, int amount) + { + _prize = prize; + _amount = amount; + } + + public String getPrize() + { + return _prize; + } + + public int getAmount() + { + return _amount; + } + } + + protected class PlayerMonths + { + + private int _months; + private int _lastClaimed; + + public PlayerMonths(int months, int lastClaimed) + { + _months = months; + _lastClaimed = lastClaimed; + } + + public int getMonths() + { + return _months; + } + + public int getLastClaimed() + { + return _lastClaimed; + } + + public void setMonths(int months) + { + _months = months; + } + + public void setLastClaimed(int lastClaimed) + { + _lastClaimed = lastClaimed; + } + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 13c8ce735..6e424f0b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -18,9 +18,7 @@ public enum TreasureType ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, 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), - - OMEGA(C.cBlue + "Omega Treasure", "Omega Treasure", "Omega", ) + FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index af93aba54..8438a32d9 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -4,7 +4,7 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.Map.Entry; -import mineplex.core.gadget.powerplayclub.PowerPlayClubManager; +import mineplex.core.powerplayclub.PowerPlayClubManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -42,16 +42,16 @@ public class Enjin extends MiniPlugin implements CommandExecutor private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PowerPlayClubManager powerPlayClubManager) + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) { super("Enjin", plugin); _clientManager = clientManager; _donationManager = donationManager; _inventoryManager = inventoryManager; - _powerPlayClubManager = powerPlayClubManager; _purchaseManager = new PurchaseManager(plugin); + _powerPlayClubManager = donationManager.getPowerPlayClubManager(); plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java index 1304f0a3e..ec5810121 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java @@ -4,9 +4,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.command.CommandCenter; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; -import mineplex.core.punish.Punish; import mineplex.core.updater.Updater; - import org.bukkit.plugin.java.JavaPlugin; public class EnjinTranslator extends JavaPlugin diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java index f3fd02c9a..c314bdf85 100644 --- a/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java +++ b/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java @@ -1,11 +1,10 @@ package mineplex.votifier; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.account.CoreClientManager; import mineplex.core.bonuses.BonusManager; import mineplex.core.command.CommandCenter; import mineplex.core.donation.DonationManager; +import org.bukkit.plugin.java.JavaPlugin; /** * Created by shaun on 15-08-05. From f4175ed7245518f4a1b9e9e9afd209971308ab15 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 18 Aug 2016 18:07:32 -0300 Subject: [PATCH 05/21] Added PowerPlay managers, commands, button inside Carl to claim PowerPlay bonus... Includes a new SQL table, will be sent to Connor and Jaws so they can release it correctly! :D --- .../mineplex/core/bonuses/BonusManager.java | 5 + .../bonuses/commands/PowerPlayCommand.java | 41 +- .../mineplex/core/bonuses/gui/BonusGui.java | 4 +- .../gui/buttons/PowerPlayClubButton.java | 11 +- .../mineplex/core/gadget/GadgetManager.java | 3 +- .../gadget/commands/LockCosmeticsCommand.java | 120 +---- .../powerplayclub/PowerPlayClubManager.java | 68 ++- .../mineplex/core/reward/RewardManager.java | 465 +----------------- .../src/mineplex/core/reward/RewardPool.java | 17 + .../src/mineplex/core/reward/RewardType.java | 1 + .../reward/rewards/UnknownPackageReward.java | 5 + .../core/treasure/TreasureLocation.java | 41 +- .../mineplex/core/treasure/TreasureStyle.java | 7 + .../mineplex/core/treasure/TreasureType.java | 4 +- .../animation/BlockChangeAnimation.java | 10 +- .../core/treasure/gui/BuyChestButton.java | 6 + .../core/treasure/gui/TreasurePage.java | 14 +- .../src/mineplex/enjinTranslator/Enjin.java | 38 +- .../src/mineplex/clanshub/HubManager.java | 2 +- 19 files changed, 250 insertions(+), 612 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 93455f16b..b1fbc2894 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -1222,4 +1222,9 @@ public class BonusManager extends MiniClientPlugin implements I return _powerPlayClubManager; } + public InventoryManager getInventoryManager() + { + return _inventoryManager; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java index 363d93d92..64f9ca3b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -1,20 +1,30 @@ package mineplex.core.bonuses.commands; +import java.util.UUID; + import mineplex.core.bonuses.BonusManager; 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.common.util.UtilText; import org.bukkit.entity.Player; public class PowerPlayCommand extends CommandBase { + /** + * Examples: + * /powerplay LCastr0 5 -> Adds 5 months to player's power play club months + * /powerplay LCastr0 5 false -> same as above + * /powerplay LCastr0 5 true -> Sets the last claimed month as June + */ + private BonusManager _bonusManager; public PowerPlayCommand(BonusManager manager) { - super(manager, Rank.JNR_DEV, "powerplay"); + super(manager, Rank.SNR_MODERATOR, "powerplay"); _bonusManager = manager; } @@ -23,28 +33,45 @@ public class PowerPlayCommand extends CommandBase { if (args.length < 2) { - UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay "))); + UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay [setLastClaimed:true/false]"))); return; } final String targetName = args[0]; final String months = args[1]; + boolean setLastClaimed = false; + if (args.length >= 3) + { + setLastClaimed = Boolean.valueOf(args[2]); + } Player target = UtilPlayer.searchExact(targetName); - rewardPowerPlay(caller, target, target.getName(), months); + rewardPowerPlay(caller, target, target.getName(), months, setLastClaimed); } - private void rewardPowerPlay(Player caller, Player target, String targetName, String months) + private void rewardPowerPlay(Player caller, Player target, String targetName, String months, boolean setLastClaimed) { try { final int iMonths = Integer.parseInt(months); - _bonusManager.getPowerPlayClubManager().addPlayerMonths(target.getUniqueId(), iMonths); - UtilPlayer.message(caller, F.main("Power Play Club", "You gave " + F.elem(iMonths + " Months") + " to " + F.name(targetName) + ".")); + UUID targetUuid = target.getUniqueId(); + String messageCaller = "You gave " + F.elem(iMonths + UtilText.plural(" Month", iMonths)) + " to " + F.name(targetName) + "."; + String messageTarget = F.name(caller.getName()) + " gave you " + F.elem(iMonths + UtilText.plural(" Month", iMonths)) + "."; + if (setLastClaimed) + { + _bonusManager.getPowerPlayClubManager().setLastClaimedMonth(targetUuid, iMonths); + messageCaller = "You have set the last claimed month from " + F.name(targetName) + " to " + iMonths + "."; + messageTarget = F.name(caller.getName()) + " have set your last claimed month to " + iMonths + "."; + } + else + { + _bonusManager.getPowerPlayClubManager().addPlayerMonths(target.getUniqueId(), iMonths); + } + UtilPlayer.message(caller, F.main("Power Play Club", messageCaller)); if (target != null && !target.equals(caller)) { - UtilPlayer.message(target, F.main("Power Play Club", F.name(caller.getName()) + " gave you " + F.elem(iMonths + " Months") + ".")); + UtilPlayer.message(target, F.main("Power Play Club", messageTarget)); } } catch (Exception e) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 2421e2f0a..e7bf20748 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -37,9 +37,9 @@ public class BonusGui extends SimpleGui setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); - setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); + setItem(33, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); - setItem(35, new PowerPlayClubButton(player, manager.getDonationManager().getPowerPlayClubManager())); + setItem(29, new PowerPlayClubButton(player, manager)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index e92425b22..26fb15cbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; +import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; import mineplex.core.gui.GuiItem; +import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.shop.item.ShopItem; import org.bukkit.Material; @@ -20,11 +22,13 @@ public class PowerPlayClubButton implements GuiItem private ItemStack _item; private Player _player; private PowerPlayClubManager _powerPlayClubManager; + private InventoryManager _inventoryManager; - public PowerPlayClubButton(Player player, PowerPlayClubManager powerPlayClubManager) + public PowerPlayClubButton(Player player, BonusManager manager) { _player = player; - _powerPlayClubManager = powerPlayClubManager; + _powerPlayClubManager = manager.getPowerPlayClubManager(); + _inventoryManager = manager.getInventoryManager(); } @Override @@ -46,8 +50,7 @@ public class PowerPlayClubButton implements GuiItem { _player.closeInventory(); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); - _player.sendMessage("TEST"); - getMonthlyRewards().giveAllItems(); + getMonthlyRewards().giveAllItems(_player, _inventoryManager); updateLastClaimedMonth(); } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index e99bd92cb..d6fd2bbdb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -264,7 +264,8 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); addGadget(new MorphSquid(this)); - addGadget(new MorphMetalMan(this)); + // Not being added in this update! + //addGadget(new MorphMetalMan(this)); // Particles addGadget(new ParticleFoot(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index 1fc07c933..6751c430b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -1,19 +1,14 @@ package mineplex.core.gadget.commands; +import java.util.UUID; + import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.data.Item; -import mineplex.core.mount.Mount; -import mineplex.core.pet.Pet; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -30,104 +25,41 @@ public class LockCosmeticsCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - // Removes all cosmetic types - if (args.length == 0) - { - lockCosmetics(null, caller); - } - // Removes specific type - else - { - String type = args[0]; - if (type.equalsIgnoreCase("all")) - { - lockCosmetics(null, caller); - } - else if (type.equalsIgnoreCase("pet")) - { - lockPets(caller); - } - else if (type.equalsIgnoreCase("mount")) - { - lockMounts(caller); - } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - lockCosmetics(gadgetType, caller); - } - } - } - + lockCosmetics(caller); } - private void lockCosmetics(GadgetType gadgetType, Player caller) - { - if (gadgetType == null) - { - for (GadgetType type : GadgetType.values()) - { - lockCosmetics(type, caller); - } - lockMounts(caller); - lockPets(caller); - return; - } - int removed = 0; - for (Gadget gadget : _plugin.getGadgets(gadgetType)) - { - if (gadget.getGadgetType() == GadgetType.ITEM) - continue; - if (gadget.ownsGadget(caller)) - { - Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName()); - if (clientItem == null) - continue; - _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); - removed++; - } - } - UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() - .replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + - UtilText.plural("item", removed) + ")")); - } - - private void lockMounts(Player caller) + private void lockCosmetics(Player player) { - int removed = 0; - for (Mount mount : _plugin.getMountManager().getMounts()) + for (GadgetType gadgetType : GadgetType.values()) { - if (mount.hasMount(caller)) + for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - Item clientItem = _plugin.getInventoryManager().getItem(mount.getName()); - if (clientItem == null) - continue; - _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); - removed++; + if (gadget != null) + { + if (gadget.getName() != null) + { + lockCosmetic(gadget.getName(), player); + } + } } } - UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + - UtilText.plural("mount", removed) + "!")); } - private void lockPets(Player caller) + private void lockCosmetic(String itemName, Player player) { - int removed = 0; - for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + // First try, with Donation Manager + _plugin.getDonationManager().Get(player).RemoveUnknownSalesPackagesOwned(itemName); + // Second try, with Inventory Manager + Item item = _plugin.getInventoryManager().getItem(itemName); + if (item != null) { - if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) - { - _plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType()); - removed++; - } + _plugin.getInventoryManager().Get(player).removeItem(new ClientItem(item, 1)); } - UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + - UtilText.plural("pet", removed) + "!")); } + + private void lockCosmetic(String itemName, UUID uuid) + { + // TODO + } + } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java index 42ba76735..8c15239a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java @@ -5,9 +5,14 @@ import java.sql.ResultSet; import java.util.*; import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.database.PlayerKeyValueRepository; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.inventory.data.Item; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; @@ -15,6 +20,11 @@ import org.bukkit.event.player.PlayerJoinEvent; public class PowerPlayClubManager implements Listener { + /** + * Manager for the Power Play Club system + * Sends and receives information from/to the database + */ + private PlayerKeyValueRepository _repository; private Map _playerMonths = new HashMap<>(); @@ -78,6 +88,10 @@ public class PowerPlayClubManager implements Listener addPlayerMonths(uuid, -1); } + /** + * Updates player's months and last claimed month + * @param uuid the player's UUID + */ private void updatePlayer(UUID uuid) { _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> @@ -99,6 +113,9 @@ public class PowerPlayClubManager implements Listener })); } + /** + * Monthly rewards, based on each month, a different reward + */ public enum PowerPlayClubRewards { JANUARY, @@ -107,7 +124,7 @@ public class PowerPlayClubManager implements Listener APRIL, MAY, JUNE, - JULY, + JULY(new PowerPlayClubItem("Squid Morph", 1)), AUGUST(new PowerPlayClubItem("Squid Morph", 1)), SEPTEMBER, OCTOBER, @@ -126,13 +143,55 @@ public class PowerPlayClubManager implements Listener return _items; } - public void giveAllItems() + /** + * Gives the player the specific items for that month, plus + * 2x Game Boosters + * 1x Omega Chest + * @param player + * @param manager + */ + public void giveAllItems(Player player, InventoryManager manager) { - // TODO + for (PowerPlayClubItem item : _items) + { + Item fItem = manager.getItem(item.getPrize()); + if (fItem == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, fItem.Name, 1); + UtilPlayer.message(player, F.main("Power Play Club", "You received " + item.getAmount() + "x " + F.elem(item.getPrize()) + ".")); + } + } + Item gameAmplifier = manager.getItem("Game Booster"); + if (gameAmplifier == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, gameAmplifier.Name, 2); + UtilPlayer.message(player, F.main("Power Play Club", "You received 2x " + F.elem("Game Boosters") + ".")); + } + Item omegaChest = manager.getItem("Omega Chest"); + if (omegaChest == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, omegaChest.Name, 1); + UtilPlayer.message(player, F.main("Power Play Club", "You received 1x " + F.elem("Omega Chest") + ".")); + } } } + /** + * Class to help on monthly bonuses + */ public static class PowerPlayClubItem { private final String _prize; @@ -155,6 +214,9 @@ public class PowerPlayClubManager implements Listener } } + /** + * Class that stores player's months and last claimed month + */ protected class PlayerMonths { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 947cb4494..1e035fea6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -43,28 +43,8 @@ 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.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.MorphChicken; -import mineplex.core.gadget.gadgets.morph.MorphCow; -import mineplex.core.gadget.gadgets.morph.MorphEnderman; -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.item.*; +import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -73,13 +53,7 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.particle.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.*; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; @@ -91,36 +65,19 @@ 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.WinEffectBabyChicken; -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.*; 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.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.MountSlime; -import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.*; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; -import mineplex.core.reward.rewards.ExperienceReward; -import mineplex.core.reward.rewards.GemReward; -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.reward.rewards.*; import mineplex.core.stats.StatsManager; - import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -179,395 +136,7 @@ public class RewardManager addUncommon(); addRare(); addLegendary(); - -// addCommon(donationManager, inventoryManager, petManager, statsManager, commonValueMin, commonValueMax); -// addUncommon(donationManager, inventoryManager, petManager, statsManager, uncommonValueMin, uncommonValueMax); -// addRare(donationManager, inventoryManager, petManager, statsManager, rareValueMin, rareValueMax); -// addLegendary(donationManager, inventoryManager, petManager, statsManager, legendValueMin, legendValueMax); } - - /* - public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue) - { - RewardRarity rarity = RewardRarity.COMMON; - - // Coins - if (_carlSpinner) - { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 25, 0, rarity)); -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 25, 0, rarity)); - } - else - { -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 5, rarity)); - } - - //Increase Value - if (_doubleGadgetValue) - { - minValue *= 2; - maxValue *= 2; - } - - // Valentines - addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Cupid's Arrows", "Cupid's Arrows", 1, 5, - new ItemStack(Material.BOW, 1), rarity, 300, 0)); - // Pets - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow", - EntityType.COW, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep", - EntityType.SHEEP, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom", - EntityType.MUSHROOM_COW, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig", - EntityType.PIG, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat", - EntityType.OCELOT, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken", - EntityType.CHICKEN, rarity, 50, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog", - EntityType.WOLF, rarity, 50, _uncommonShards)); - // Discs - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "13 Disc", "13 Disc", - new ItemStack(2256), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Cat Disc", "Cat Disc", - new ItemStack(2257), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Blocks Disc", "Blocks Disc", - new ItemStack(2258), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Chirp Disc", "Chirp Disc", - new ItemStack(2259), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Far Disc", "Far Disc", - new ItemStack(2260), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mall Disc", "Mall Disc", - new ItemStack(2261), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mellohi Disc", "Mellohi Disc", - new ItemStack(2262), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Stal Disc", "Stal Disc", - new ItemStack(2263), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Strad Disc", "Strad Disc", - new ItemStack(2264), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Ward Disc", "Ward Disc", - new ItemStack(2265), rarity, 10, _uncommonShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Wait Disc", "Wait Disc", - new ItemStack(2267), rarity, 10, _uncommonShards)); - // Mounts - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Mule", "Mount Mule", - new ItemStack(Material.HAY_BLOCK), rarity, 4, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Minecart", "Minecart", - new ItemStack(Material.MINECART), rarity, 3, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Slime", "Slime Mount", - new ItemStack(Material.SLIME_BALL), rarity, 2, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Glacial Steed", "Glacial Steed", - new ItemStack(Material.SNOW_BALL), rarity, 1, _rareShards)); - - // Christmas - addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Coal", "Coal", 50, 100, - new ItemStack(Material.COAL), rarity, 10, 0)); - - addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Snowballs", "Snowball", 5, 20, - new ItemStack(Material.SNOW_BALL), rarity, 10, 0)); - - // Gadgets - addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun", - (int)(100*(minValue/500)), (int)(100*(maxValue/500)), - new ItemStack(Material.GOLD_BARDING), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", - (int)(50*(minValue/500)), (int)(50*(maxValue/500)), - new ItemStack(Material.FIREWORK), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", - (int)(50*(minValue/500)), (int)(50*(maxValue/500)), - new ItemStack(Material.MELON_BLOCK), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook", - (int)(40*(minValue/500)), (int)(40*(maxValue/500)), - new ItemStack(Material.getMaterial(131)), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl", - (int)(30*(minValue/500)), (int)(30*(maxValue/500)), - new ItemStack(Material.ENDER_PEARL), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster", - (int)(20*(minValue/500)), (int)(20*(maxValue/500)), - new ItemStack(Material.IRON_BARDING), rarity, 10, 0)); - - addReward(new InventoryReward(inventoryManager, "TNT", "TNT", - (int)(20*(minValue/500)), (int)(20*(maxValue/500)), - new ItemStack(Material.TNT), rarity, 10, 0)); - - - } - - public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue) - { - RewardRarity rarity = RewardRarity.UNCOMMON; - - // Coins - if (_carlSpinner) - { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 1200, 0, rarity)); -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 1200, 0, rarity)); - } - else - { -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON)); - } - - //Increase Value - if (_doubleGadgetValue) - { - minValue *= 2; - maxValue *= 2; - } - - // Valentines - addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, - new ItemStack(Material.POTION, 1), rarity, 100, 0)); - addReward(RewardPool.Type.VALENTINES_GIFT, new TreasureShardReward(_clientManager, donationManager, 100, 200, 25, rarity)); - - // Christmas - addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Freeze Cannon", "Freeze Cannon", 5, 10, - new ItemStack(Material.ICE), rarity, 10, 0)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Party Popper", "Party Popper", 5, 10, - new ItemStack(Material.GOLDEN_CARROT), rarity, 10, 0)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Present", "Present", - SkinData.PRESENT.getSkull(), rarity, 5, 100)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Snowman Head", "Snowman Head", - SkinData.SNOWMAN.getSkull(), rarity, 5, 100)); - - // Gadgets - addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun", - (int)(100*(minValue/500)), (int)(100*(maxValue/500)), - new ItemStack(Material.GOLD_BARDING), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", - (int)(50*(minValue/500)), (int)(50*(maxValue/500)), - new ItemStack(Material.FIREWORK), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", - (int)(50*(minValue/500)), (int)(50*(maxValue/500)), - new ItemStack(Material.MELON_BLOCK), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook", - (int)(40*(minValue/500)), (int)(40*(maxValue/500)), - new ItemStack(Material.getMaterial(131)), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl", - (int)(30*(minValue/500)), (int)(30*(maxValue/500)), - new ItemStack(Material.ENDER_PEARL), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster", - (int)(20*(minValue/500)), (int)(20*(maxValue/500)), - new ItemStack(Material.IRON_BARDING), rarity, 250, 0)); - - addReward(new InventoryReward(inventoryManager, "TNT", "TNT", - (int)(20*(minValue/500)), (int)(20*(maxValue/500)), - new ItemStack(Material.TNT), rarity, 250, 0)); - - // Pets - addReward(new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow", - EntityType.COW, rarity, 500, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep", - EntityType.SHEEP, rarity, 333, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom", - EntityType.MUSHROOM_COW, rarity, 200, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig", - EntityType.PIG, rarity, 200, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat", - EntityType.OCELOT, rarity, 167, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken", - EntityType.CHICKEN, rarity, 143, _uncommonShards)); - addReward(new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog", - EntityType.WOLF, rarity, 125, _uncommonShards)); - - // Music Discs - addReward(new UnknownPackageReward(donationManager, "Music Disc", "13 Disc", "13 Disc", - new ItemStack(2256), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Cat Disc", "Cat Disc", - new ItemStack(2257), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Blocks Disc", "Blocks Disc", - new ItemStack(2258), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Chirp Disc", "Chirp Disc", - new ItemStack(2259), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Far Disc", "Far Disc", - new ItemStack(2260), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Mall Disc", "Mall Disc", - new ItemStack(2261), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Mellohi Disc", "Mellohi Disc", - new ItemStack(2262), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Stal Disc", "Stal Disc", - new ItemStack(2263), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Strad Disc", "Strad Disc", - new ItemStack(2264), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Ward Disc", "Ward Disc", - new ItemStack(2265), rarity, 25, _uncommonShards)); - addReward(new UnknownPackageReward(donationManager, "Music Disc", "Wait Disc", "Wait Disc", - new ItemStack(2267), rarity, 25, _uncommonShards)); - } - - public void addRare(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue) - { - RewardRarity rarity = RewardRarity.RARE; - - // Coins - if (_carlSpinner) - { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 150, 0, rarity)); -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 150, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 150, 0, rarity)); - } - else - { -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE)); - } - - // Valentines - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Companion Hat", "Companion", - SkinData.COMPANION_CUBE.getSkull(), rarity, 100, 0)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Lovestruck Hat", "Lovestruck", - SkinData.LOVESTRUCK.getSkull(), rarity, 100, 0)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Secret Package Hat", "Secret Package", - SkinData.SECRET_PACKAGE.getSkull(), rarity, 100, 0)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Teddy Bear Hat", "Teddy Bear", - SkinData.TEDDY_BEAR.getSkull(), rarity, 100, 0)); - addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, - new ItemStack(Material.POTION, 1), rarity, 1, 0)); - - // Christmas - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Santa", "Santa", - SkinData.SANTA.getSkull(), rarity, 5, _rareShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new PetReward(petManager, inventoryManager, donationManager, "Elf", "Christmas Elf", - EntityType.VILLAGER, rarity, 5, _rareShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Death Effect", "Candy Cane Remains", "Candy Cane Remains", - new ItemStack(Material.SNOW_BALL), rarity, 5, _rareShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Particles", "Crushed Candy Cane", "Crushed Candy Cane", - new ItemStack(Material.SNOW_BALL), rarity, 5, _rareShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Arrow Effect", "Candy Cane Arrows", "Candy Cane Arrows", - new ItemStack(Material.SNOW_BALL), rarity, 5, _rareShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Jump Effect", "Candy Cane Blast", "Candy Cane Blast", - new ItemStack(Material.SNOW_BALL), rarity, 5, _rareShards)); - - // Mounts - addReward(new UnknownPackageReward(donationManager, "Mount", "Mule", "Mount Mule", - new ItemStack(Material.HAY_BLOCK), rarity, 200, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Mount", "Minecart", "Minecart", - new ItemStack(Material.MINECART), rarity, 100, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Mount", "Slime", "Slime Mount", - new ItemStack(Material.SLIME_BALL), rarity, 67, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Mount", "Glacial Steed", "Glacial Steed", - new ItemStack(Material.SNOW_BALL), rarity, 50, _rareShards)); - - // Morphs - addReward(new UnknownPackageReward(donationManager, "Morph", "Cow", "Cow Morph", - new ItemStack(Material.LEATHER), rarity, 167, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Morph", "Villager", "Villager Morph", - new ItemStack(Material.EMERALD), rarity, 83, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Morph", "Chicken", "Chicken Morph", - new ItemStack(Material.FEATHER), rarity, 50, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Morph", "Enderman", "Enderman Morph", - new ItemStack(Material.ENDER_PEARL), rarity, 33, _rareShards)); - - - // Costumes - addReward(new UnknownPackageReward(donationManager, "Costume", "Rave Hat", "Rave Hat", - new ItemStack(Material.LEATHER_HELMET), rarity, 30, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Rave Shirt", "Rave Shirt", - new ItemStack(Material.LEATHER_CHESTPLATE), rarity, 30, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Rave Pants", "Rave Pants", - new ItemStack(Material.LEATHER_LEGGINGS), rarity, 30, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Rave Boots", "Rave Boots", - new ItemStack(Material.LEATHER_BOOTS), rarity, 30, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Space Helmet", "Space Helmet", - new ItemStack(Material.GLASS), rarity, 50, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Space Jacket", "Space Jacket", - new ItemStack(Material.GOLD_CHESTPLATE), rarity, 50, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Space Pants", "Space Pants", - new ItemStack(Material.GOLD_LEGGINGS), rarity, 50, _rareShards)); - addReward(new UnknownPackageReward(donationManager, "Costume", "Space Boots", "Space Boots", - new ItemStack(Material.GOLD_BOOTS), rarity, 50, _rareShards)); - } - - public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue) - { - RewardRarity rarity = RewardRarity.LEGENDARY; - - // Coins - if (_carlSpinner) - { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 10, 0, rarity)); -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 10, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 10, 0, rarity)); - } - else - { -// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); - } - - // Valentines - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Arrow Effect", "Arrows of Cupid", "Arrows of Cupid", - new ItemStack(Material.POTION), rarity, 100, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Death Effect", "Broken Hearted", "Broken Hearted", - new ItemStack(Material.POTION), rarity, 100, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Jump Effect", "Wings of Love", "Wings of Love", - new ItemStack(Material.POTION), rarity, 100, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Particles", "Heartfelt Halo", "Heartfelt Halo", - new ItemStack(Material.POTION), rarity, 100, _rareShards)); - addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1, - new ItemStack(Material.POTION, 1), rarity, 2, 0)); - - // Christmas - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "The Grinch", "The Grinch", - SkinData.THE_GRINCH.getSkull(), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Morph", "Olaf", "Olaf Morph", - new ItemStack(Material.SNOW_BALL), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Mount", "Glacial Steed", "Glacial Steed", - new ItemStack(Material.SADDLE), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Mount", "Baby Reindeer", "Baby Reindeer", - new ItemStack(Material.GOLDEN_CARROT), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Particles", "Wind of the Frost Lord", "Wind of the Frost Lord", - new ItemStack(Material.SNOW_BALL), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Arrow Effect", "Arrows of the Frost Lord", "Arrows of the Frost Lord", - new ItemStack(Material.SNOW_BALL), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Jump Effect", "Gust of the Frost Lord", "Gust of the Frost Lord", - new ItemStack(Material.SNOW_BALL), rarity, 5, _legendaryShards)); - addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Death Effect", "Fall of the Frost Lord", "Fall of the Frost Lord", - new ItemStack(Material.SNOW_BALL), rarity, 5, _legendaryShards)); - - // Mounts - addReward(new UnknownPackageReward(donationManager, "Mount", "Infernal Horror", "Infernal Horror", - new ItemStack(Material.BONE), rarity, 33, _legendaryShards)); - - // Morphs - addReward(new UnknownPackageReward(donationManager, "Morph", "Bat", "Bat Morph", - new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), rarity, 25, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Morph", "Block", "Block Morph", - new ItemStack(Material.EMERALD_BLOCK), rarity, 20, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Morph", "Big Larry", "Big Larry Morph", - new ItemStack(Material.SLIME_BALL), rarity, 10, _legendaryShards)); - - - // Particles - addReward(new UnknownPackageReward(donationManager, "Particles", "Shadow Walk", "Shadow Walk", - new ItemStack(Material.LEATHER_BOOTS), rarity, 33, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Enchanted", "Enchanted", - new ItemStack(Material.BOOK), rarity, 25, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Flame Rings", "Flame Rings", - new ItemStack(Material.BLAZE_POWDER), rarity, 17, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Rain Cloud", "Rain Cloud", - new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), rarity, 13, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Blood Helix", "Blood Helix", - new ItemStack(Material.REDSTONE), rarity, 10, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Green Rings", "Green Ring", - new ItemStack(Material.EMERALD), rarity, 8, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Flame Fairy", "Flame Fairy", - new ItemStack(Material.APPLE), rarity, 4, _legendaryShards)); - addReward(new UnknownPackageReward(donationManager, "Particles", "Heart", "I Heart You", - new ItemStack(Material.BLAZE_POWDER), rarity, 2, _legendaryShards)); - } - */ public void addCommon() { @@ -642,6 +211,7 @@ public class RewardManager // WINTER Gadgets addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); + } @@ -890,7 +460,7 @@ public class RewardManager addReward(type, reward); return reward; } - + public UnknownPackageReward addGadget(RewardPool.Type type, Gadget gadget, RewardRarity rarity, int weight, int shards) { return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); @@ -1023,9 +593,24 @@ public class RewardManager if(pool == Type.NORMAL) { _rewardPools.get(Type.CARL_SPINNER).add(reward); - + if(!(reward instanceof InventoryReward)) + { _rewardPools.get(Type.ILLUMINATED).add(reward); + } + } + // OMEGA ITEMS + if (reward instanceof UnknownPackageReward) + { + UnknownPackageReward unknownPackageReward = (UnknownPackageReward) reward; + if (!unknownPackageReward.getHeader().equalsIgnoreCase("Game Modifiers")) + { + _rewardPools.get(Type.OMEGA).add(reward); + } + } + else if (!(reward instanceof InventoryReward) && !(reward instanceof TreasureShardReward)) + { + _rewardPools.get(Type.OMEGA).add(reward); } _rewardPools.get(pool).add(reward); } @@ -1033,7 +618,7 @@ public class RewardManager public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int amount = 4; - if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest) amount = 1; + if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest || type == RewardType.OmegaChest) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 19e01f1f1..89c4ea9dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -7,6 +7,8 @@ import java.util.List; import mineplex.core.reward.rewards.GemReward; import mineplex.core.reward.rewards.InventoryReward; +import mineplex.core.reward.rewards.TreasureShardReward; +import mineplex.core.reward.rewards.UnknownPackageReward; import org.bukkit.entity.Player; /** @@ -77,6 +79,21 @@ public class RewardPool return false; } } + if (this == OMEGA) + { + if (reward instanceof InventoryReward || reward instanceof TreasureShardReward) + { + return false; + } + else if (reward instanceof UnknownPackageReward) + { + UnknownPackageReward unknownPackageReward = (UnknownPackageReward) reward; + if (unknownPackageReward.getHeader().equalsIgnoreCase("Game Modifiers")) + { + return false; + } + } + } if (this == Type.CARL_SPINNER) { if (reward instanceof GemReward) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index c007105be..0fd48d5a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -13,6 +13,7 @@ public enum RewardType 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), SpinnerFiller( 0.1, 1, 4, 20), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java index aeb5b3550..50f2c0d72 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java @@ -75,4 +75,9 @@ public class UnknownPackageReward extends Reward } return false; } + + public String getHeader() + { + return _header; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index a2cc71f46..d0e794430 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -2,8 +2,22 @@ package mineplex.core.treasure; import java.util.List; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.*; +import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.reward.RewardPool; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramInteraction; +import mineplex.core.hologram.HologramManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.event.TreasureFinishEvent; +import mineplex.core.treasure.event.TreasureStartEvent; +import mineplex.core.treasure.gui.TreasureShop; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -21,29 +35,6 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.event.GadgetBlockEvent; -import mineplex.core.hologram.Hologram; -import mineplex.core.hologram.HologramInteraction; -import mineplex.core.hologram.HologramManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.reward.Reward; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.treasure.event.TreasureFinishEvent; -import mineplex.core.treasure.event.TreasureStartEvent; -import mineplex.core.treasure.gui.TreasureShop; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class TreasureLocation implements Listener { private TreasureManager _treasureManager; @@ -135,7 +126,7 @@ public class TreasureLocation implements Listener return; } - if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM) + if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index 671ca2ba1..54fdeaea6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -48,6 +48,13 @@ public enum TreasureStyle ParticleType.RED_DUST, Sound.FIZZ, Sound.FIREWORK_TWINKLE2 + ), + OMEGA( + ParticleType.CRIT, + null, + ParticleType.CRIT, + Sound.FIRE, + Sound.FIREWORK_TWINKLE ); 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 6e424f0b4..7293f2d5e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -18,7 +18,9 @@ public enum TreasureType ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, 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.FreedomChest, 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, true, 1); 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 4ec8090b9..092821c53 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -2,16 +2,12 @@ package mineplex.core.treasure.animation; import java.util.List; -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; - import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; public class BlockChangeAnimation extends Animation { 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 2d7203f06..62393077e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -54,6 +54,12 @@ public class BuyChestButton implements IButton return; } } + if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.OMEGA.getRewardPool(), player) + && _chestType == TreasureType.OMEGA) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player) && _chestType == TreasureType.ILLUMINATED) { 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 e1648228c..792a283a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -1,5 +1,8 @@ package mineplex.core.treasure.gui; +import java.util.ArrayList; +import java.util.List; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.skin.SkinData; @@ -27,9 +30,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.ArrayList; -import java.util.List; - public class TreasurePage extends ShopPageBase { private TreasureLocation _treasureLocation; @@ -58,6 +58,7 @@ public class TreasurePage extends ShopPageBase int christmasCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.CHRISTMAS.getItemName()); 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()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -176,13 +177,17 @@ public class TreasurePage extends ShopPageBase freedomLore.add(" "); freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); + List omegaLore = new ArrayList<>(); + omegaLore.add("PLACEHOLDER"); + 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); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false); 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.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore); + 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); addItem(40, shards); @@ -198,6 +203,7 @@ public class TreasurePage extends ShopPageBase addChest(20, basic, TreasureType.OLD, basicCount); addChest(22, heroic, TreasureType.ANCIENT, heroicCount); addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); + addChest(4, omega, TreasureType.OMEGA, omegaCount); } private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index cd50a732f..3487544c8 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -1,16 +1,11 @@ package mineplex.enjinTranslator; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.AbstractMap; +import java.util.Date; +import java.util.Iterator; import java.util.Map.Entry; - -import mineplex.core.powerplayclub.PowerPlayClubManager; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; +import java.util.UUID; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; @@ -22,6 +17,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; +import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -33,13 +29,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; -import java.text.SimpleDateFormat; -import java.util.AbstractMap; -import java.util.Date; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.UUID; - public class Enjin extends MiniPlugin implements CommandExecutor { private CoreClientManager _clientManager; @@ -144,14 +133,17 @@ public class Enjin extends MiniPlugin implements CommandExecutor { if (!checkForPurchase(args, name, client)) { - StringBuilder sb = new StringBuilder(); - - for (String arg : args) + if (!checkForPowerPlayClub(args, name, playerUUID, client)) { - sb.append(arg + " "); - } + StringBuilder sb = new StringBuilder(); - System.out.println("Received Command : " + sb.toString()); + for (String arg : args) + { + sb.append(arg + " "); + } + + System.out.println("Received Command : " + sb.toString()); + } } } } @@ -315,7 +307,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor if (args.length != 3 || !args[0].equalsIgnoreCase("powerplayclub")) return false; - if (args[1].equalsIgnoreCase("month")) + if (args[2].equalsIgnoreCase("month")) { _powerPlayClubManager.addPlayerMonths(playerUUID, 1); } else diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index 26f7065f6..6b5e6fad3 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -188,7 +188,7 @@ public class HubManager extends MiniPlugin _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager, incognito); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); From 25d64c6dee6d7b1439cd0b95ea9af644ad96be4d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 25 Aug 2016 20:12:00 -0300 Subject: [PATCH 06/21] Changes to lock command --- .../gadget/commands/LockCosmeticsCommand.java | 124 ++++++++++++++---- .../gadget/gadgets/morph/MorphMetalMan.java | 12 +- .../core/inventory/ClientInventory.java | 4 + .../src/mineplex/hub/HubManager.java | 9 +- 4 files changed, 114 insertions(+), 35 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index dfa63593c..107471e3c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -1,13 +1,17 @@ package mineplex.core.gadget.commands; -import java.util.UUID; - import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; -import mineplex.core.inventory.ClientItem; -import mineplex.core.inventory.data.Item; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.inventory.ClientInventory; +import mineplex.core.mount.Mount; +import mineplex.core.pet.Pet; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -21,31 +25,105 @@ public class LockCosmeticsCommand extends CommandBase _plugin = plugin; } - @Override - public void Execute(Player caller, String[] args) - { - lockCosmetics(caller); - } - - private void lockCosmetics(Player player) { - UtilPlayer.message(player, "This command is being re-created!"); - } - - private void lockCosmetic(String itemName, Player player) + @Override + public void Execute(Player caller, String[] args) { - // First try, with Donation Manager - _plugin.getDonationManager().Get(player).RemoveUnknownSalesPackagesOwned(itemName); - // Second try, with Inventory Manager - Item item = _plugin.getInventoryManager().getItem(itemName); - if (item != null) + // Adds all cosmetic types + if (args.length == 0) { - _plugin.getInventoryManager().Get(player).removeItem(new ClientItem(item, 1)); + removeCosmetics(null, caller); } + // Adds specific type + else + { + String type = args[0]; + if (type.equalsIgnoreCase("all")) + { + removeCosmetics(null, caller); + } + else if (type.equalsIgnoreCase("pet")) + { + removePets(caller); + } + else if (type.equalsIgnoreCase("mount")) + { + removeMounts(caller); + } + else + { + GadgetType gadgetType = GadgetType.valueOf(type); + if (gadgetType == null) + { + UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); + } + else + { + removeCosmetics(gadgetType, caller); + } + } + } + } - private void lockCosmetic(String itemName, UUID uuid) + private void removeCosmetics(GadgetType gadgetType, Player caller) { - // TODO + if (gadgetType == null) + { + for (GadgetType type : GadgetType.values()) + { + removeCosmetics(type, caller); + } + removeMounts(caller); + removePets(caller); + return; + } + ClientInventory clientInventory = _plugin.getInventoryManager().Get(caller); + int removed = 0; + int amount = -1; + for (Gadget gadget : _plugin.getGadgets(gadgetType)) + { + if (gadgetType == GadgetType.ITEM) + continue; + if (gadget.ownsGadget(caller)) + { + clientInventory.removeItem(clientInventory.getClientItem(gadget.getName())); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("item", removed) + ")")); + } + + private void removeMounts(Player caller) + { + int removed = 0; + ClientInventory clientInventory = _plugin.getInventoryManager().Get(caller); + for (Mount mount : _plugin.getMountManager().getMounts()) + { + if (mount.hasMount(caller)) + { + clientInventory.removeItem(clientInventory.getClientItem(mount.getName())); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("mount", removed) + "!")); + } + + private void removePets(Player caller) + { + int removed = 0; + for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + { + if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) + { + _plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType()); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("pet", removed) + "!")); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java index 1cd765d4f..77e2ee795 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -14,6 +14,7 @@ import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; +import mineplex.core.utils.UtilGameProfile; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -37,11 +38,12 @@ public class MorphMetalMan extends MorphGadget { applyArmor(player, message); - DisguisePlayer disguisePlayer = new DisguisePlayer(player); - disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cYellow + "Metal " + C.cRed + "Man")); - SkinData metalMan = SkinData.METAL_MAN; - disguisePlayer.setSkinData(metalMan); - disguisePlayer.setSendSkinDataToSelf(true); + GameProfile gameProfile = UtilGameProfile.getGameProfile(player); + gameProfile.getProperties().clear(); + gameProfile.getProperties().put("textures", SkinData.METAL_MAN.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); + disguisePlayer.showInTabList(true, 0); Manager.getDisguiseManager().disguise(disguisePlayer); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java index 589c85862..1f23f5e40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java @@ -24,6 +24,10 @@ public class ClientInventory if (Items.get(item.Item.Name).Count == 0) Items.remove(item.Item.Name); } + + public ClientItem getClientItem(String name) { + return Items.containsKey(name) ? Items.get(name) : null; + } public int getItemCount(String name) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d030e0ca5..5ea216465 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -3,10 +3,7 @@ import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; +import java.util.*; import mineplex.core.Managers; import mineplex.core.MiniClientPlugin; @@ -106,8 +103,6 @@ import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.plugin.java.JavaPlugin; -import java.util.*; - public class HubManager extends MiniClientPlugin { // ☃❅ Snowman! @@ -198,7 +193,7 @@ public class HubManager extends MiniClientPlugin _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager, incognito); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, Managers.get(ProjectileManager.class), achievementManager, packetHandler, hologramManager, incognito); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); From 3687c7ad986d96067336dc6b02fee7cf2f3fb4e1 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 29 Aug 2016 21:32:11 -0300 Subject: [PATCH 07/21] PowerPlayClub update --- .../mineplex/core/common/skin/SkinData.java | 1 + .../mineplex/core/bonuses/BonusManager.java | 56 ++++++- .../bonuses/animations/AnimationCarl.java | 49 ++++-- .../bonuses/commands/PowerPlayCommand.java | 2 +- .../event/PowerPlayClubClaimEvent.java | 48 ++++++ .../mineplex/core/bonuses/gui/BonusGui.java | 4 +- .../gui/buttons/PowerPlayClubButton.java | 87 +++++++++- .../core/bonuses/powerplay/ClaimRegister.java | 46 ++++++ .../bonuses/powerplay/PowerPlayAnimation.java | 29 ++++ .../mineplex/core/gadget/GadgetManager.java | 31 +++- .../gadget/commands/LockCosmeticsCommand.java | 23 ++- .../gadget/event/PlayerToggleSwimEvent.java | 41 +++++ .../core/gadget/gadgets/morph/MorphSquid.java | 65 +++++++- .../gadgets/morph/swim/SwimManager.java | 30 ++++ .../powerplayclub/PowerPlayClubManager.java | 65 ++++++-- .../mineplex/core/reward/RewardManager.java | 150 ++++++++++++++++-- .../src/mineplex/core/treasure/Treasure.java | 39 ++--- .../core/treasure/TreasureLocation.java | 22 +-- .../core/treasure/TreasureManager.java | 6 +- .../animation/BlockChangeAnimation.java | 22 +++ .../animation/ChestSpawnAnimation.java | 52 +++--- .../core/treasure/gui/BuyChestButton.java | 11 +- .../core/treasure/gui/TreasurePage.java | 17 +- .../src/mineplex/hub/HubManager.java | 48 +----- 24 files changed, 755 insertions(+), 189 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/PowerPlayAnimation.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java 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 333019f04..dcac2d504 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 @@ -56,6 +56,7 @@ public class SkinData public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); 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("eyJ0aW1lc3RhbXAiOjE0Njg3ODAyMzk2ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hNzc5YWEzYzk3OTc0Mzk1YTY3MTZkZmQ5MTI4YWM0N2E1MzdlMzljMzdmMGM0ZjZkZjQ1YjJmMGI4ZjVkMiJ9fX0=", "acwmrIdtzzkuntsvQqD+o9UYaI09xzQoPgRXFtvS1hvGgGRbApdG7YbQ3Itjg/8WUl0trAMMJa1IL8TlXaOwTeClOj6if3HW2lJ8yO7E+MXEJoDZcjkxVOK3322NRCBiPG+VbNCwHE7IvT8P4awExvV2nHLbCk7upawxK3oKfR5U+YEq/eLG/UCC1TAnHNLXE0mr+6ZtNut5qgz1u0Y+VNQKI/vdjVit1ttYeBjIWpSszhlP4bH8Iw3u3ZRuDqU4xSAWzj6Qhw9UYm2T3s2N9s2yW3wiagijUEq9stbaw97n3UCqBas58lTBy46w524lBvwbYC1U9jwxPxSUo6L6omhPKZSwgK/u2w4mELvfNI09A4C7RNThnz9wgrT0FPajjXYkt31Ba5qaP7HwcThQu02Bb3gmYfHfMvuDBt8xUk4lFyUuL+lwqUHXlKRkUPGVkDLDpmsnk+y4LvaymNHBBWpOyqpm8y1BTpux02GqCIgK7nHtsRNH3q3yHR1YyM0tc6PKXOst5ex1cGP654/Q0KEUSAvAV5ozj/q5izRlPJNiwu9zPqhfs8oWSBSo/Sfej6p7Fu9u0h0j/k0m86bfZObe2RsCEgBe8GSF35cyYRou0qTvk+00hEr+jpxeat0e9JHe163jI/Ew9XPeGd6eT8GTy4iyJM0O/y1MlsRjUec="); + 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="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index a25da963c..d6ec86c1e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -17,11 +17,13 @@ import mineplex.core.bonuses.commands.GuiCommand; import mineplex.core.bonuses.commands.PowerPlayCommand; import mineplex.core.bonuses.commands.TicketCommand; import mineplex.core.bonuses.event.CarlSpinnerEvent; +import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; import mineplex.core.bonuses.gui.BonusGui; import mineplex.core.bonuses.gui.SpinGui; +import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; +import mineplex.core.bonuses.powerplay.ClaimRegister; import mineplex.core.bonuses.redis.VoteHandler; import mineplex.core.bonuses.redis.VotifierCommand; -import mineplex.core.boosters.BoosterManager; import mineplex.core.common.Rank; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -132,6 +134,7 @@ public class BonusManager extends MiniClientPlugin implements I private Npc _carlNpc; private AnimationCarl _animation; private int _visualTick; + private ClaimRegister _claimRegister; // Streak // private StreakRecord _dailyStreak; @@ -167,6 +170,8 @@ public class BonusManager extends MiniClientPlugin implements I _coinQueue = new LinkedList(); _gemQueue = new LinkedList(); + _claimRegister = new ClaimRegister(); + updateOffSet(); } @@ -181,8 +186,10 @@ public class BonusManager extends MiniClientPlugin implements I _inventoryManager = inventoryManager; _thankManager = thankManager; - System.out.print("HUB: "); - System.out.print("DONATION MANAGER - > " + _donationManager.toString()); + if (gadgetManager == null) + { + System.out.print("GM NULL"); + } _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); @@ -202,6 +209,8 @@ public class BonusManager extends MiniClientPlugin implements I _coinQueue = new LinkedList(); _gemQueue = new LinkedList(); + _claimRegister = new ClaimRegister(); + if (npcManager != null) { @@ -522,7 +531,7 @@ public class BonusManager extends MiniClientPlugin implements I } else { - UtilPlayer.message(player, F.main("Carl", "There waa an error processing your request. Try again later")); + UtilPlayer.message(player, F.main("Carl", "There was an error processing your request. Try again later")); } } }); @@ -923,6 +932,7 @@ public class BonusManager extends MiniClientPlugin implements I if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++; if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++; + if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager)) availableRewards++; Hologram hologram; @@ -1105,7 +1115,7 @@ public class BonusManager extends MiniClientPlugin implements I { if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) { - if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player)) + if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubManager)) { if(_showCarl.containsKey(player.getName())) { @@ -1114,9 +1124,40 @@ public class BonusManager extends MiniClientPlugin implements I } } } + if (Recharge.Instance.use(player, "Power Play Inform", 400000, false, false)) + { + if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager) && PowerPlayClubButton.getMonthsLeft(player, true, _powerPlayClubManager) == 1) + { + if (_showCarl.containsKey(player.getName())) + { + if (_plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby") || _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + { + UtilPlayer.message(player, F.main("Power Play Club", "This is your last month of Power Play Club! Resubscribe at" + C.cAqua + " www.mineplex.com/shop" + C.Reset + " before you lose your subscription!")); + } + } + } + } } } + @EventHandler + public void removeClaims(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC_05) + return; + + _claimRegister.removeAll(); + } + + @EventHandler + public void addClaims(PowerPlayClubClaimEvent event) + { + if (!event.isSuccessful()) + return; + + _claimRegister.registerEvent(event); + } + @EventHandler public void processQueue(UpdateEvent event) { @@ -1228,4 +1269,9 @@ public class BonusManager extends MiniClientPlugin implements I return _inventoryManager; } + public ClaimRegister getClaimRegister() + { + return _claimRegister; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java index 4cc2ac529..6c966aedf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java @@ -2,33 +2,25 @@ package mineplex.core.bonuses.animations; import java.util.HashSet; import java.util.Iterator; -import java.util.Random; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; +import mineplex.core.bonuses.powerplay.PowerPlayAnimation; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.treasure.animation.Animation; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; @@ -78,7 +70,7 @@ public class AnimationCarl extends Animation } } - if(!((String) _type).contentEquals("DAILY")&& !((String) _type).contentEquals("RANK")&& !((String) _type).contentEquals("POLL")) + if(!((String) _type).contentEquals("DAILY") && !((String) _type).contentEquals("RANK") && !((String) _type).contentEquals("POLL")) { Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, " " + 64)); @@ -130,6 +122,37 @@ public class AnimationCarl extends Animation finish(); } } + if (_type instanceof PowerPlayAnimation) + { + for (int i = 50; i < 65; i++) + { + // Gem amplifier + Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i)); + _items.add(gem); + + Vector vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d)); + UtilAction.velocity(gem, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false); + + // Omega chest + Item omega = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), SkinData.OMEGA_CHEST.getSkull()); + _items.add(omega); + + vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d)); + UtilAction.velocity(omega, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false); + + // Monthly items + PowerPlayAnimation powerPlayAnimation = (PowerPlayAnimation) _type; + for (ItemStack itemStack : powerPlayAnimation.getAnimationItems()) + { + Item monthly = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(monthly); + + vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d)); + UtilAction.velocity(monthly, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false); + } + } + finish(); + } } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java index 64f9ca3b2..ff57ac804 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -24,7 +24,7 @@ public class PowerPlayCommand extends CommandBase public PowerPlayCommand(BonusManager manager) { - super(manager, Rank.SNR_MODERATOR, "powerplay"); + super(manager, Rank.MODERATOR, "powerplay"); _bonusManager = manager; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java new file mode 100644 index 000000000..ba14bb42c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java @@ -0,0 +1,48 @@ +package mineplex.core.bonuses.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PowerPlayClubClaimEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private long _time; + private boolean _successful; + + public PowerPlayClubClaimEvent(Player player, boolean successful) + { + _player = player; + _successful = successful; + _time = System.currentTimeMillis(); + } + + public Player getPlayer() + { + return _player; + } + + public boolean isSuccessful() + { + return _successful; + } + + public long getTime() + { + return _time; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index db9d174f5..ef2a35046 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -37,9 +37,9 @@ public class BonusGui extends SimpleGui setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, thankManager)); - setItem(33, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); - setItem(29, new PowerPlayClubButton(player, manager)); + + setItem(33, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index 26fb15cbf..6a341719e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -2,14 +2,20 @@ package mineplex.core.bonuses.gui.buttons; import java.util.ArrayList; import java.util.Calendar; +import java.util.List; import java.util.Locale; import mineplex.core.bonuses.BonusManager; +import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; +import mineplex.core.bonuses.powerplay.PowerPlayAnimation; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.GuiItem; import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.shop.item.ShopItem; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -23,10 +29,12 @@ public class PowerPlayClubButton implements GuiItem private Player _player; private PowerPlayClubManager _powerPlayClubManager; private InventoryManager _inventoryManager; + private BonusManager _bonusManager; public PowerPlayClubButton(Player player, BonusManager manager) { _player = player; + _bonusManager = manager; _powerPlayClubManager = manager.getPowerPlayClubManager(); _inventoryManager = manager.getInventoryManager(); } @@ -46,16 +54,26 @@ public class PowerPlayClubButton implements GuiItem @Override public void click(ClickType clickType) { - if (isAvailable()) + if (isAvailable() && !_bonusManager.getClaimRegister().alreadyClaimed(_player.getUniqueId())) { _player.closeInventory(); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); getMonthlyRewards().giveAllItems(_player, _inventoryManager); updateLastClaimedMonth(); + Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, true)); } else { _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); + if (getMonthsLeft(true) > 0) + { + UtilPlayer.message(_player, F.main("Power Play Club", "Already claimed!")); + } + else + { + UtilPlayer.message(_player, F.main("Power Play Club", "You have no months left! Buy more months at " + C.cAqua + "www.mineplex.com/shop" + C.Reset + "!")); + } + Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, false)); } } @@ -83,16 +101,29 @@ public class PowerPlayClubButton implements GuiItem { material = Material.REDSTONE_BLOCK; itemName = C.cRedB + "Power Play Club"; - lore.add(""); - lore.add(C.Reset + "Months left: " + _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true) + "!"); } lore.add(C.cYellow + "Rewards"); - lore.add(" " + C.cWhite + "2x Game Amplifiers"); - lore.add(" " + C.cWhite + "1x Omega Chest"); + lore.add(" " + C.cWhite + "2 Game Amplifiers"); + lore.add(" " + C.cWhite + "1 Omega Chest"); for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) { - lore.add(" " + C.cWhite + prize.getPrize()); + lore.add(" " + C.cWhite + prize.getAmount() + " " + prize.getPrize()); + } + lore.add(" "); + lore.add(C.cYellow + "Months left: " + C.cWhite + getMonthsLeft(true)); + if (!isAvailable()) + { + lore.add(" "); + if (getMonthsLeft(true) > 0) + { + lore.add(C.cRed + "Already claimed!"); + } + else + { + lore.add(C.cRed + "Get Power Play Club months at"); + lore.add(C.cAqua + "mineplex.com/shop"); + } } _item = new ShopItem(material, data, itemName, lore.toArray(new String[0]), 1, false, false); @@ -100,13 +131,17 @@ public class PowerPlayClubButton implements GuiItem private boolean isAvailable() { - int monthsLeft = _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true); + int monthsLeft = getMonthsLeft(true); int lastClaimed = _powerPlayClubManager.getLastClaimedMonth(_player.getUniqueId(), true); int month = Calendar.getInstance().get(Calendar.MONTH); + int actualYear = Calendar.getInstance().get(Calendar.YEAR); + int lastClaimedYear = _powerPlayClubManager.getLastClaimedYear(_player.getUniqueId(), true); if (monthsLeft > 0) { if (lastClaimed == -1) return true; + if (lastClaimedYear < actualYear) + return true; return lastClaimed != month; } return false; @@ -120,9 +155,47 @@ public class PowerPlayClubButton implements GuiItem private void updateLastClaimedMonth() { + // Send carl animation + List animationItems = new ArrayList<>(); + for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) + { + animationItems.add(prize.getDisplay()); + } + PowerPlayAnimation powerPlayAnimation = new PowerPlayAnimation(_player, animationItems); + _bonusManager.addPendingExplosion(_player, powerPlayAnimation); int month = Calendar.getInstance().get(Calendar.MONTH); + int year = Calendar.getInstance().get(Calendar.YEAR); _powerPlayClubManager.setLastClaimedMonth(_player.getUniqueId(), month); _powerPlayClubManager.decreasePlayerMonth(_player.getUniqueId()); + _powerPlayClubManager.setLastClaimedYear(_player.getUniqueId(), year); + } + + private int getMonthsLeft(boolean update) + { + return _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), update); + } + + public static int getMonthsLeft(Player player, boolean update, PowerPlayClubManager manager) + { + return manager.getPlayerMonths(player.getUniqueId(), update); + } + + public static boolean isAvailable(Player player, PowerPlayClubManager manager) + { + int monthsLeft = getMonthsLeft(player, true, manager); + int lastClaimed = manager.getLastClaimedMonth(player.getUniqueId(), true); + int month = Calendar.getInstance().get(Calendar.MONTH); + int actualYear = Calendar.getInstance().get(Calendar.YEAR); + int lastClaimedYear = manager.getLastClaimedYear(player.getUniqueId(), true); + if (monthsLeft > 0) + { + if (lastClaimed == -1) + return true; + if (lastClaimedYear < actualYear) + return true; + return lastClaimed != month; + } + return false; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java new file mode 100644 index 000000000..6d60b867c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java @@ -0,0 +1,46 @@ +package mineplex.core.bonuses.powerplay; + +import java.util.*; + +import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; + +public class ClaimRegister +{ + + /** + * Fixes the problem where the database isn't sync'd with the server so the player can still claim it if they try + * to click really quickly after it was already claimed. + * This stores the player information for 5 seconds, so if they try to claim again they won't be able to. + */ + + private Map _events = new HashMap<>(); + + public void registerEvent(PowerPlayClubClaimEvent event) + { + _events.put(event.getPlayer().getUniqueId(), event); + } + + public void removeAll() + { + List toRemove = new ArrayList<>(); + long currentTime = System.currentTimeMillis(); + for (Map.Entry eventEntry : _events.entrySet()) + { + PowerPlayClubClaimEvent event = eventEntry.getValue(); + if (currentTime - event.getTime() >= 5000) + { + toRemove.add(eventEntry.getKey()); + } + } + for (UUID uuid : toRemove) + { + _events.remove(uuid); + } + } + + public boolean alreadyClaimed(UUID uuid) + { + return _events.containsKey(uuid); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/PowerPlayAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/PowerPlayAnimation.java new file mode 100644 index 000000000..8c77afe1c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/PowerPlayAnimation.java @@ -0,0 +1,29 @@ +package mineplex.core.bonuses.powerplay; + +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PowerPlayAnimation +{ + + private List _animationItems; + private Player _player; + + public PowerPlayAnimation(Player player, List animationItems) + { + _animationItems = animationItems; + _player = player; + } + + public List getAnimationItems() + { + return _animationItems; + } + + public Player getPlayer() + { + return _player; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 1473890d7..708e2a6f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,12 +1,10 @@ package mineplex.core.gadget; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.function.Predicate; +import mineplex.core.gadget.event.PlayerToggleSwimEvent; +import mineplex.core.gadget.gadgets.morph.swim.SwimManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -1131,4 +1129,27 @@ public class GadgetManager extends MiniPlugin { return _userGadgetPersistence; } + + @EventHandler + public void checkPlayerSwim(PlayerMoveEvent event) + { + Material material = event.getPlayer().getLocation().getBlock().getType(); + UUID uuid = event.getPlayer().getUniqueId(); + if (material == Material.WATER || material == Material.STATIONARY_WATER) + { + if (!SwimManager.isSwimming(uuid)) + { + SwimManager.addPlayer(uuid); + Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true)); + } + } + else + { + if (SwimManager.isSwimming(uuid)) + { + SwimManager.removePlayer(uuid); + Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), false)); + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index 107471e3c..e6dd0484e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -10,6 +10,7 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.inventory.ClientInventory; +import mineplex.core.inventory.ClientItem; import mineplex.core.mount.Mount; import mineplex.core.pet.Pet; import org.bukkit.entity.Player; @@ -21,7 +22,7 @@ public class LockCosmeticsCommand extends CommandBase public LockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.JNR_DEV, new Rank[]{Rank.SNR_MODERATOR}, "lockCosmetics"); + super(plugin, Rank.JNR_DEV, new Rank[]{Rank.MODERATOR, Rank.SNR_MODERATOR}, "lockCosmetics"); _plugin = plugin; } @@ -71,6 +72,8 @@ public class LockCosmeticsCommand extends CommandBase { for (GadgetType type : GadgetType.values()) { + if (type == GadgetType.ITEM) + continue; removeCosmetics(type, caller); } removeMounts(caller); @@ -86,12 +89,16 @@ public class LockCosmeticsCommand extends CommandBase continue; if (gadget.ownsGadget(caller)) { - clientInventory.removeItem(clientInventory.getClientItem(gadget.getName())); - removed++; + ClientItem clientItem = clientInventory.getClientItem(gadget.getName()); + if (clientItem != null) + { + clientInventory.removeItem(clientItem); + removed++; + } } } UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() - .replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + + .replace("_", " ") + " gadgets! (Removed " + C.cRed + removed + C.cGray + " " + UtilText.plural("item", removed) + ")")); } @@ -103,8 +110,12 @@ public class LockCosmeticsCommand extends CommandBase { if (mount.hasMount(caller)) { - clientInventory.removeItem(clientInventory.getClientItem(mount.getName())); - removed++; + ClientItem clientItem = clientInventory.getClientItem(mount.getName()); + if (clientItem != null) + { + clientInventory.removeItem(clientInventory.getClientItem(mount.getName())); + removed++; + } } } UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java new file mode 100644 index 000000000..2d5c5f00b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java @@ -0,0 +1,41 @@ +package mineplex.core.gadget.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerToggleSwimEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private boolean _swimming; + + public PlayerToggleSwimEvent(Player player, boolean swimming) + { + _player = player; + _swimming = swimming; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isSwimming() + { + return _swimming; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} 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 d5aa93c28..620b34454 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 @@ -1,31 +1,42 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilText; +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.types.MorphGadget; +import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; public class MorphSquid extends MorphGadget implements IThrown { public MorphSquid(GadgetManager manager) { - super(manager, "Squid Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), - 0, Material.MONSTER_EGG, (byte) 0); + super(manager, "Squid Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "It's more fun to be a squid than to eat one. They're really rubbery.", + C.blankLine, + C.cWhite + "Swim to enable Fast Swimming", + C.cWhite + "Sneak to shoot a fish above you" + }, LineFormat.LORE), + 0, Material.INK_SACK, (byte) 0); } @Override @@ -35,6 +46,7 @@ public class MorphSquid extends MorphGadget implements IThrown DisguiseSquid disguiseSquid = new DisguiseSquid(player); disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); Manager.getDisguiseManager().disguise(disguiseSquid); + onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); } @Override @@ -44,6 +56,47 @@ public class MorphSquid extends MorphGadget implements IThrown Manager.getDisguiseManager().undisguise(player); } + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!isActive(player)) + continue; + UtilParticle.PlayParticle(UtilParticle.ParticleType.WATER_WAKE, player.getLocation().clone().add(0, .5, 0), 0.01f, 0.01f, 0.01f, + 0.001f, 1, UtilParticle.ViewDist.NORMAL); + } + } + + @EventHandler + public void onToggleSwim(PlayerToggleSwimEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (event.isSwimming()) + { + // Removes any costume player could be wearing + Manager.removeOutfit(event.getPlayer(), OutfitGadget.ArmorSlot.Boots); + + // Adds enchanted boot + ItemStack enchantedBoot = new ItemStack(Material.DIAMOND_BOOTS, 1); + enchantedBoot.addEnchantment(Enchantment.DEPTH_STRIDER, 3); + event.getPlayer().getInventory().setBoots(enchantedBoot); + + // Adds swiftness potion + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 3, true, true)); + } + else + { + event.getPlayer().getInventory().setBoots(new ItemStack(Material.AIR)); + event.getPlayer().removePotionEffect(PotionEffectType.SPEED); + } + } + @EventHandler public void onSneak(PlayerToggleSneakEvent event) { @@ -59,8 +112,6 @@ public class MorphSquid extends MorphGadget implements IThrown if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) return; - UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.5, 0.8, true); - Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.RAW_FISH)); UtilAction.velocity(item, player.getLocation().getDirection(), 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/swim/SwimManager.java new file mode 100644 index 000000000..a1945d257 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java @@ -0,0 +1,30 @@ +package mineplex.core.gadget.gadgets.morph.swim; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class SwimManager +{ + + private static List _swimming = new ArrayList<>(); + + public static void addPlayer(UUID uuid) + { + _swimming.add(uuid); + } + + public static void removePlayer(UUID uuid) + { + if (_swimming.contains(uuid)) + { + _swimming.remove(uuid); + } + } + + public static boolean isSwimming(UUID uuid) + { + return _swimming.contains(uuid); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java index 8c15239a9..8e8ee4776 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java @@ -4,18 +4,17 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.*; -import mineplex.core.common.util.BukkitFuture; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.*; import mineplex.core.database.PlayerKeyValueRepository; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; 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.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; public class PowerPlayClubManager implements Listener { @@ -56,11 +55,34 @@ public class PowerPlayClubManager implements Listener public void setLastClaimedMonth(UUID uuid, int month) { _repository.put(uuid, "lastClaimed", month); + updatePlayer(uuid); PlayerMonths playerMonths = _playerMonths.get(uuid); playerMonths.setLastClaimed(month); _playerMonths.put(uuid, playerMonths); } + public int getLastClaimedYear(UUID uuid, boolean update) + { + if (update) + { + updatePlayer(uuid); + } + if (_playerMonths.containsKey(uuid)) + { + return _playerMonths.get(uuid).getYear(); + } + return Calendar.getInstance().get(Calendar.YEAR); + } + + public void setLastClaimedYear(UUID uuid, int year) + { + _repository.put(uuid, "year", year); + updatePlayer(uuid); + PlayerMonths playerMonths = _playerMonths.get(uuid); + playerMonths.setYear(year); + _playerMonths.put(uuid, playerMonths); + } + public int getPlayerMonths(UUID uuid, boolean update) { if (update) @@ -78,6 +100,7 @@ public class PowerPlayClubManager implements Listener { int currentMonths = getPlayerMonths(uuid, true); _repository.put(uuid, "monthsLeft", currentMonths + months); + updatePlayer(uuid); PlayerMonths playerMonths = _playerMonths.get(uuid); playerMonths.setMonths(currentMonths + months); _playerMonths.put(uuid, playerMonths); @@ -96,8 +119,13 @@ public class PowerPlayClubManager implements Listener { _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> { + int year = Calendar.getInstance().get(Calendar.YEAR); int lastClaimed = -1; int months = 0; + if (values.containsKey("claimedYear")) + { + year = values.get("claimedYear"); + } if (values.containsKey("lastClaimed")) { lastClaimed = values.get("lastClaimed"); @@ -108,7 +136,7 @@ public class PowerPlayClubManager implements Listener months = values.get("monthsLeft"); } - PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed); + PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed, year); _playerMonths.put(uuid, playerMonths); })); } @@ -124,8 +152,8 @@ public class PowerPlayClubManager implements Listener APRIL, MAY, JUNE, - JULY(new PowerPlayClubItem("Squid Morph", 1)), - AUGUST(new PowerPlayClubItem("Squid Morph", 1)), + JULY(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))), + AUGUST(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))), SEPTEMBER, OCTOBER, NOVEMBER, @@ -196,11 +224,13 @@ public class PowerPlayClubManager implements Listener { private final String _prize; private final int _amount; + private final ItemStack _display; - public PowerPlayClubItem(String prize, int amount) + public PowerPlayClubItem(String prize, int amount, ItemStack display) { _prize = prize; _amount = amount; + _display = display; } public String getPrize() @@ -212,6 +242,11 @@ public class PowerPlayClubManager implements Listener { return _amount; } + + public ItemStack getDisplay() + { + return _display; + } } /** @@ -222,11 +257,13 @@ public class PowerPlayClubManager implements Listener private int _months; private int _lastClaimed; + private int _year; - public PlayerMonths(int months, int lastClaimed) + public PlayerMonths(int months, int lastClaimed, int year) { _months = months; _lastClaimed = lastClaimed; + _year = year; } public int getMonths() @@ -239,6 +276,11 @@ public class PowerPlayClubManager implements Listener return _lastClaimed; } + public int getYear() + { + return _year; + } + public void setMonths(int months) { _months = months; @@ -249,6 +291,11 @@ public class PowerPlayClubManager implements Listener _lastClaimed = lastClaimed; } + public void setYear(int year) + { + _year = year; + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 1e035fea6..c4ca55dda 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -10,6 +10,7 @@ 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.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; @@ -31,6 +32,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.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; @@ -212,6 +214,20 @@ public class RewardManager 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); + addMusicReward(Type.OMEGA, "Cat Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Chirp Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Far Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Mall Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Mellohi Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Stal Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Stard Disk", rarity, 25); + 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); } @@ -307,6 +323,67 @@ public class RewardManager addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); + + // Omega Chest + addGadget(Type.OMEGA, getGadget(DoubleJumpFreedom.class), rarity, 5); + addGadget(Type.OMEGA, getGadget(DoubleJumpBlood.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(DoubleJumpFirecracker.class), rarity, 33); + addGadget(Type.OMEGA, getGadget(DoubleJumpEmerald.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(DoubleJumpMusic.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(DoubleJumpShadow.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(DoubleJumpStorm.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(DoubleJumpCandyCane.class), rarity, 20); + + addGadget(Type.OMEGA, getGadget(DeathFreedom.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(DeathStorm.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(DeathBlood.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(DeathEmerald.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(DeathMusic.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(DeathPinataBurst.class), rarity, 27); + addGadget(Type.OMEGA, getGadget(DeathShadow.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(DeathCandyCane.class), rarity, 25); + + addGadget(Type.OMEGA, getGadget(ArrowTrailFreedom.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(ArrowTrailConfetti.class), rarity, 27); + addGadget(Type.OMEGA, getGadget(ArrowTrailBlood.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(ArrowTrailEmerald.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(ArrowTrailMusic.class), rarity, 27); + addGadget(Type.OMEGA, getGadget(ArrowTrailStorm.class), rarity, 30); + 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); + + addGadget(Type.OMEGA, getGadget(MorphChicken.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(MorphCow.class), rarity, 167); + addGadget(Type.OMEGA, getGadget(MorphEnderman.class), rarity, 33); + addGadget(Type.OMEGA, getGadget(MorphVillager.class), rarity, 83); + + addGadget(Type.OMEGA, getGadget(WinEffectFlames.class), rarity, 100); + addGadget(Type.OMEGA, getGadget(WinEffectSnowTrails.class), rarity, 100); + + addMount(Type.OMEGA, getMount(MountFrost.class), rarity, 50); + addMount(Type.OMEGA, getMount(MountCart.class), rarity, 100); + addMount(Type.OMEGA, getMount(MountMule.class), rarity, 200); + addMount(Type.OMEGA, getMount(MountSlime.class), rarity, 67); + + addGadget(Type.OMEGA, getGadget(OutfitRaveSuitBoots.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(OutfitRaveSuitChestplate.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(OutfitRaveSuitLeggings.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(OutfitRaveSuitHelmet.class), rarity, 30); + addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitBoots.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitChestplate.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitLeggings.class), rarity, 50); + addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitHelmet.class), rarity, 50); + + addGadget(Type.OMEGA, getGadget(ParticleCandyCane.class), rarity, 25); } public void addLegendary() @@ -394,7 +471,65 @@ public class RewardManager addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1); addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5); addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50); - + + // Omega items + addPetReward(Type.OMEGA, EntityType.VILLAGER, rarity, 1); + addPetReward(Type.OMEGA, EntityType.ZOMBIE, rarity, 10); + addPetReward(Type.OMEGA, EntityType.PIG_ZOMBIE, rarity, 1); + + addGadget(Type.OMEGA, getGadget(MorphBunny.class), rarity, 1); + addGadget(Type.OMEGA, getGadget(MorphUncleSam.class), rarity, 5); + addGadget(Type.OMEGA, getGadget(MorphPumpkinKing.class), rarity, 1); + addGadget(Type.OMEGA, getGadget(MorphBat.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(MorphSlime.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(MorphBlock.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(MorphSnowman.class), rarity, 10); + + addGadget(Type.OMEGA, getGadget(ParticleFreedom.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(ParticleWingsAngel.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(ParticleBlood.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(ParticleWingsDemons.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(ParticleEnchant.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(ParticleFairy.class), rarity, 4); + addGadget(Type.OMEGA, getGadget(ParticleFireRings.class), rarity, 17); + addGadget(Type.OMEGA, getGadget(ParticleEmerald.class), rarity, 8); + addGadget(Type.OMEGA, getGadget(ParticleHeart.class), rarity, 2); + addGadget(Type.OMEGA, getGadget(ParticleWingsInfernal.class), rarity, 4); + addGadget(Type.OMEGA, getGadget(ParticleMusic.class), rarity, 15); + addGadget(Type.OMEGA, getGadget(ParticleWingsPixie.class), rarity, 4); + addGadget(Type.OMEGA, getGadget(ParticleRain.class), rarity, 13); + addGadget(Type.OMEGA, getGadget(ParticleFoot.class), rarity, 33); + addGadget(Type.OMEGA, getGadget(ParticleYinYang.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(ParticleCoalFumes.class), rarity, 1); + addGadget(Type.OMEGA, getGadget(ParticleFrostLord.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(ParticlePartyTime.class), rarity, 25); + + addMount(Type.OMEGA, getMount(MountFreedomHorse.class), rarity, 1); + addMount(Type.OMEGA, getMount(MountZombie.class), rarity, 1); + addMount(Type.OMEGA, getMount(MountSpider.class), rarity, 1); + addMount(Type.OMEGA, getMount(MountUndead.class), rarity, 1); + addMount(Type.OMEGA, getMount(MountValentinesSheep.class), rarity, 33); + addMount(Type.OMEGA, getMount(MountBabyReindeer.class), rarity, 1); + + addGadget(Type.OMEGA, getGadget(WinEffectBabyChicken.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(WinEffectLavaTrap.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4); + addGadget(Type.OMEGA, getGadget(WinEffectLightningStrike.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(WinEffectMrPunchMan.class), rarity, 33); + + addGadget(Type.OMEGA, getGadget(DeathEnchant.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(DeathCupidsBrokenHeart.class), rarity, 25); + addGadget(Type.OMEGA, getGadget(DeathFrostLord.class), rarity, 20); + + addGadget(Type.OMEGA, getGadget(DoubleJumpEnchant.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(DoubleJumpCupidsWings.class), rarity, 5); + addGadget(Type.OMEGA, getGadget(DoubleJumpFrostLord.class), rarity, 10); + + addGadget(Type.OMEGA, getGadget(ArrowTrailEnchant.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(ArrowTrailFrostLord.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(ArrowTrailCupid.class), rarity, 15); + + addHat(Type.OMEGA, HatType.Grinch, rarity, 25); } @@ -599,19 +734,6 @@ public class RewardManager _rewardPools.get(Type.ILLUMINATED).add(reward); } } - // OMEGA ITEMS - if (reward instanceof UnknownPackageReward) - { - UnknownPackageReward unknownPackageReward = (UnknownPackageReward) reward; - if (!unknownPackageReward.getHeader().equalsIgnoreCase("Game Modifiers")) - { - _rewardPools.get(Type.OMEGA).add(reward); - } - } - else if (!(reward instanceof InventoryReward) && !(reward instanceof TreasureShardReward)) - { - _rewardPools.get(Type.OMEGA).add(reward); - } _rewardPools.get(pool).add(reward); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 3540a8c96..eee0c5fbe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,39 +1,29 @@ package mineplex.core.treasure; import java.awt.*; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; +import java.util.*; import java.util.List; -import java.util.Random; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -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.treasure.animation.*; -import org.bukkit.*; -import org.bukkit.block.Block; -import org.bukkit.block.Skull; -import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; -import org.bukkit.entity.Player; - import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.hologram.HologramManager; -import mineplex.core.reward.RankRewardData; -import mineplex.core.reward.Reward; -import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardRarity; -import mineplex.core.reward.RewardType; +import mineplex.core.reward.*; import mineplex.core.status.ServerStatusManager; import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; +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.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.Player; /** * Created by Shaun on 8/27/2014. @@ -92,8 +82,9 @@ public class Treasure _rewardType = rewardType; _rewards = rewards; - _chestData = new ChestData[chestBlocks.length]; - for (int i = 0; i < _chestData.length; i++) + int max = chestBlocks.length; + _chestData = new ChestData[max]; + for (int i = 0; i < max; i++) { _chestData[i] = new ChestData(chestBlocks[i]); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 9f292996f..bfacf8bb0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -1,21 +1,9 @@ package mineplex.core.treasure; -<<<<<<< HEAD import java.util.List; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.*; -======= -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilTextMiddle; ->>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06 import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetBlockEvent; @@ -47,11 +35,6 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; -<<<<<<< HEAD -======= -import java.util.List; - ->>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06 public class TreasureLocation implements Listener { private TreasureManager _treasureManager; @@ -169,7 +152,10 @@ public class TreasureLocation implements Listener if (treasureType != TreasureType.OLD) { - Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + UtilText.prefixPronoun(treasureType.getName()))); + 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())); } 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/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 3827c26e6..5ac5bcf68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -1,5 +1,8 @@ package mineplex.core.treasure; +import java.util.ArrayList; +import java.util.List; + import com.google.common.collect.Lists; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; @@ -23,9 +26,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; -import java.util.ArrayList; -import java.util.List; - /** * Created by Shaun on 8/27/2014. */ 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 092821c53..64c41c636 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -70,6 +70,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 11; } + else if (getTreasure().getTreasureType() == TreasureType.OMEGA) + { + mat = Material.ENDER_STONE; + data = 0; + } else continue; @@ -97,6 +102,11 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 14; } + else if (getTreasure().getTreasureType() == TreasureType.OMEGA) + { + mat = Material.ENDER_STONE; + data = 0; + } else continue; @@ -129,6 +139,18 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + for(Block c : _chests) + { + if(c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + b.setType(Material.ENDER_PORTAL_FRAME); + b.setData((byte) 0); + } + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 29d6a816f..217059f36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -3,32 +3,22 @@ package mineplex.core.treasure.animation; import java.awt.*; import java.util.List; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Vector; - -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.MathHelper; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.MathHelper; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; /** * Created by Shaun on 8/29/2014. @@ -50,6 +40,8 @@ public class ChestSpawnAnimation extends Animation private JavaPlugin _javaPlugin; private int _babyFireworks = 0; + private int _circleAmount = 0; + public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -164,6 +156,25 @@ public class ChestSpawnAnimation extends Animation _babyFireworks++; } } + else if (getTreasure().getTreasureType() == TreasureType.OMEGA) + { + if (_circleAmount <= 15) + { + int particles = 50; + int radius = 1; + + 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 = _centerLocation.clone().add(x, .1 * _circleAmount, z); + UtilParticle.PlayParticleToAll(ParticleType.PORTAL, loc, null, 0, 2, ViewDist.NORMAL); + } + } + + _circleAmount++; + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) @@ -172,6 +183,7 @@ public class ChestSpawnAnimation extends Animation { UtilBlock.setQuick(_block.getWorld(), _block.getX(), _block.getY(), _block.getZ(), 0, (byte) 0); } + _chestBlockInfo.add(new BlockInfo(_block)); getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction); _block.getLocation().getWorld().playSound(_centerLocation, getTreasure().getTreasureType().getStyle().getChestSpawnSound(), 0.5f, 1f); 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 eb4b44b01..1815e7b15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -2,7 +2,6 @@ package mineplex.core.treasure.gui; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.inventory.InventoryManager; import mineplex.core.recharge.Recharge; import mineplex.core.shop.confirmation.ConfirmationPage; @@ -60,18 +59,12 @@ public class BuyChestButton implements IButton return; } } - if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.OMEGA.getRewardPool(), player) - && _chestType == TreasureType.OMEGA) + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) + && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA)) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; } - if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player) - && _chestType == TreasureType.ILLUMINATED) - { - player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); - return; - } SalesPackageBase salesPackage = new ChestPackage(_chestName, _chestMat, _chestCost); _page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, salesPackage, _page.getDonationManager(), () -> { 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 792a283a9..8d23c05d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -178,7 +178,19 @@ public class TreasurePage extends ShopPageBase freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); List omegaLore = new ArrayList<>(); - omegaLore.add("PLACEHOLDER"); + omegaLore.add(" "); + omegaLore.add(F.value("Omega Chests Owned", "" + omegaCount)); + omegaLore.add(" "); + omegaLore.add(C.cGray + "The most powerful of all chests,"); + omegaLore.add(C.cGray + "it is able to go back in time to find"); + omegaLore.add(C.cGray + "loot that has been lost..."); + omegaLore.add(" "); + if (omegaCount > 0) + omegaLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + else + { + + } 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); @@ -187,7 +199,8 @@ 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); + //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); addItem(40, shards); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 977e47fe8..63e84b024 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -19,15 +19,7 @@ import mineplex.core.boosters.BoosterManager; import mineplex.core.botspam.BotSpamManager; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.*; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -80,15 +72,7 @@ import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; -import mineplex.hub.modules.ForcefieldManager; -import mineplex.hub.modules.HubVisibilityManager; -import mineplex.hub.modules.JumpManager; -import mineplex.hub.modules.KothManager; -import mineplex.hub.modules.NewsManager; -import mineplex.hub.modules.ParkourManager; -import mineplex.hub.modules.SoccerManager; -import mineplex.hub.modules.ValentinesManager; -import mineplex.hub.modules.WorldManager; +import mineplex.hub.modules.*; import mineplex.hub.modules.nonpremium.NonPremiumManager; import mineplex.hub.profile.gui.GUIProfile; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; @@ -102,11 +86,7 @@ import net.md_5.bungee.api.chat.HoverEvent.Action; import net.md_5.bungee.api.chat.TextComponent; import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityPlayer; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; +import org.bukkit.*; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; @@ -120,31 +100,11 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.player.*; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.plugin.java.JavaPlugin; -<<<<<<< HEAD -======= -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; -import java.util.UUID; - ->>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06 public class HubManager extends MiniClientPlugin { // ☃❅ Snowman! From 8e8719070cd740c5f00690d84121e34b9436ed31 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 31 Aug 2016 23:26:41 -0300 Subject: [PATCH 08/21] Changes Omega Chest to not be craftable Changes LockCosmetic and PowerPlay commands to be JNR_DEV+ --- .../src/mineplex/core/bonuses/commands/PowerPlayCommand.java | 2 +- .../src/mineplex/core/gadget/commands/LockCosmeticsCommand.java | 2 +- .../Mineplex.Core/src/mineplex/core/treasure/TreasureType.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java index ff57ac804..0902901c6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -24,7 +24,7 @@ public class PowerPlayCommand extends CommandBase public PowerPlayCommand(BonusManager manager) { - super(manager, Rank.MODERATOR, "powerplay"); + super(manager, Rank.JNR_DEV, "powerplay"); _bonusManager = manager; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index e6dd0484e..25e3cf585 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -22,7 +22,7 @@ public class LockCosmeticsCommand extends CommandBase public LockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.JNR_DEV, new Rank[]{Rank.MODERATOR, Rank.SNR_MODERATOR}, "lockCosmetics"); + super(plugin, Rank.JNR_DEV, "lockCosmetics"); _plugin = plugin; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 7293f2d5e..46751e601 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -20,7 +20,7 @@ public enum TreasureType FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, 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, true, 1); + OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OmegaChest, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000); private final String _name; private final RewardType _rewardType; From fdc54e1dd15b2aecd04fc3119f76186221fb8372 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 1 Sep 2016 08:29:51 -0500 Subject: [PATCH 09/21] Fix BestGame not cancelling for parties. --- .../nautilus/game/arcade/managers/NextBestGameManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index af551dfb6..15840eef1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -328,7 +328,7 @@ public class NextBestGameManager implements Listener owner.sendMessage(" "); - new CountdownRunnable(party); + _tasks.put(player.getUniqueId(), new CountdownRunnable(party)); } else { owner.sendMessage(" "); @@ -395,7 +395,7 @@ public class NextBestGameManager implements Listener if (_partyManager.getPreferencesManager().get(owner).isActive(Preference.COUNTDOWN_ON_CLICK)) { - new CountdownRunnable(party); + _tasks.put(player.getUniqueId(), new CountdownRunnable(owner)); player.getInventory().setItem(INVENTORY_SLOT, CANCEL_ITEM); } else { @@ -414,7 +414,7 @@ public class NextBestGameManager implements Listener if (_partyManager.getPreferencesManager().get(player).isActive(Preference.COUNTDOWN_ON_CLICK)) { - new CountdownRunnable(player); + _tasks.put(player.getUniqueId(), new CountdownRunnable(player)); player.getInventory().setItem(INVENTORY_SLOT, CANCEL_ITEM); } else { From 41936e0efc809898bfac57bb3a25afe75daf3f19 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 1 Sep 2016 08:31:16 -0500 Subject: [PATCH 10/21] Remove users from the map. --- .../src/nautilus/game/arcade/managers/NextBestGameManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index 15840eef1..420c2d802 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -628,7 +628,7 @@ public class NextBestGameManager implements Listener public void cancel(Player player, Party party) { - CountdownRunnable task = _tasks.get(player.getUniqueId()); + CountdownRunnable task = _tasks.remove(player.getUniqueId()); if (task == null) { From a6360249b785871ad0cbb8c0869f2f11f2f8d3ac Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 1 Sep 2016 08:47:43 -0500 Subject: [PATCH 11/21] Use party if a player has it. --- .../src/nautilus/game/arcade/command/CancelNextGameCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java index 76afa879e..8ac096981 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java @@ -19,6 +19,6 @@ public class CancelNextGameCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - Plugin.getNextBestGameManager().cancel(caller, null); + Plugin.getNextBestGameManager().cancel(caller, Plugin.getPartyManager().getParty(caller)); } } From d8486abbfd3580f726133fe6b13241555389ed61 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 1 Sep 2016 20:05:53 -0500 Subject: [PATCH 12/21] Fix minor best game issues. --- .../src/mineplex/hub/modules/WorldManager.java | 2 +- .../game/arcade/managers/GameRewardManager.java | 4 ++-- .../game/arcade/managers/NextBestGameManager.java | 14 +++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index 33f821703..0461c0078 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -243,7 +243,7 @@ public class WorldManager extends MiniPlugin for (Player player : Manager.GetSpawn().getWorld().getPlayers()) { - if (UtilMath.offset(player.getLocation(), Manager.GetSpawn()) > 330) + if (UtilMath.offset(player.getLocation(), Manager.GetSpawn()) > 350) { player.eject(); player.leaveVehicle(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java index 2b60a12da..a730ff2f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java @@ -41,7 +41,7 @@ public class GameRewardManager implements Listener boolean DoubleGem = false; boolean TimeReward = true; - + public GameRewardManager(ArcadeManager manager) { Manager = manager; @@ -248,7 +248,7 @@ public class GameRewardManager implements Listener { changeName(player, oldName); } - + } private void changeName(Player player, String newName) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index 420c2d802..13f31f375 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -19,6 +19,8 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.minestrike.Minestrike; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.wither.WitherGame; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.HoverEvent; @@ -238,7 +240,7 @@ public class NextBestGameManager implements Listener @EventHandler public void onDeath(PlayerStateChangeEvent event) { - if(event.GetGame() instanceof Minestrike) + if(event.GetGame() instanceof Minestrike || event.GetGame() instanceof WitherGame || event.GetGame() instanceof Paintball) { return; } @@ -357,6 +359,16 @@ public class NextBestGameManager implements Listener return; } + if(getGame() == null) + { + return; + } + + if(getGame().IsAlive(player)) + { + return; + } + if (inHand == null || (inHand.getType() != Material.REDSTONE_BLOCK && inHand.getType() != Material.EMERALD_BLOCK)) { return; From 9e0bb6ff967c69852f33844b443c756f9992162c Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 1 Sep 2016 20:59:28 -0500 Subject: [PATCH 13/21] Tweak invite starting index. Disable NextBestGame in an MPS --- .../src/mineplex/core/party/ui/menus/PartyInvitesMenu.java | 2 +- .../nautilus/game/arcade/managers/NextBestGameManager.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java index bfbe08da1..fbba8908a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java @@ -37,7 +37,7 @@ public class PartyInvitesMenu extends PartyMenu private final int INV_SIZE = 54; private final int SLOTS_PER_PAGE = 27; - private final int STARTING_SLOT = 18; + private final int STARTING_SLOT = 19; private final int BACK_BUTTON_SLOT = 0; private final int DENY_ALL_BUTTON_SLOW = 4; private final int FILTER_BUTTON_SLOT = 8; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index 13f31f375..0d0f378ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -240,7 +240,10 @@ public class NextBestGameManager implements Listener @EventHandler public void onDeath(PlayerStateChangeEvent event) { - if(event.GetGame() instanceof Minestrike || event.GetGame() instanceof WitherGame || event.GetGame() instanceof Paintball) + if(event.GetGame() instanceof Minestrike + || event.GetGame() instanceof WitherGame + || event.GetGame() instanceof Paintball + || event.GetGame().Manager.GetHost() != null) { return; } From 71b880793ffce36323590e207d8e12b8fb101698 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 1 Sep 2016 23:59:34 -0500 Subject: [PATCH 14/21] Implement power play logging and initial rewards --- .../mineplex/core/bonuses/BonusManager.java | 71 +---- .../bonuses/commands/PowerPlayCommand.java | 64 +--- .../event/PowerPlayClubClaimEvent.java | 48 --- .../gui/buttons/PowerPlayClubButton.java | 99 +----- .../core/bonuses/powerplay/ClaimRegister.java | 46 --- .../core/donation/DonationManager.java | 16 +- .../core/powerplayclub/PPCPlayerData.java | 26 ++ .../powerplayclub/PowerPlayClubManager.java | 301 ------------------ .../PowerPlayClubRepository.java | 118 +++++++ .../powerplayclub/PowerPlayClubRewards.java | 147 +++++++++ .../src/mineplex/enjinTranslator/Enjin.java | 40 ++- 11 files changed, 361 insertions(+), 615 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PPCPlayerData.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index d6ec86c1e..85addffe3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -1,11 +1,5 @@ package mineplex.core.bonuses; -import java.sql.Date; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.*; - import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -17,11 +11,9 @@ import mineplex.core.bonuses.commands.GuiCommand; import mineplex.core.bonuses.commands.PowerPlayCommand; import mineplex.core.bonuses.commands.TicketCommand; import mineplex.core.bonuses.event.CarlSpinnerEvent; -import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; import mineplex.core.bonuses.gui.BonusGui; import mineplex.core.bonuses.gui.SpinGui; import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; -import mineplex.core.bonuses.powerplay.ClaimRegister; import mineplex.core.bonuses.redis.VoteHandler; import mineplex.core.bonuses.redis.VotifierCommand; import mineplex.core.common.Rank; @@ -40,7 +32,7 @@ import mineplex.core.npc.Npc; import mineplex.core.npc.NpcManager; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; -import mineplex.core.powerplayclub.PowerPlayClubManager; +import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.recharge.Recharge; import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; @@ -72,6 +64,12 @@ import org.bukkit.plugin.java.JavaPlugin; import org.jooq.SQLDialect; import org.jooq.impl.DSL; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.*; + public class BonusManager extends MiniClientPlugin implements ILoginProcessor { @@ -128,13 +126,12 @@ public class BonusManager extends MiniClientPlugin implements I private StatsManager _statsManager; private FacebookManager _facebookManager; private YoutubeManager _youtubeManager; - private PowerPlayClubManager _powerPlayClubManager; + private PowerPlayClubRepository _powerPlayClubRepository; private ThankManager _thankManager; public boolean _enabled; private Npc _carlNpc; private AnimationCarl _animation; private int _visualTick; - private ClaimRegister _claimRegister; // Streak // private StreakRecord _dailyStreak; @@ -157,7 +154,7 @@ public class BonusManager extends MiniClientPlugin implements I _repository = new BonusRepository(plugin, this, donationManager); _clientManager = clientManager; _donationManager = donationManager; - _powerPlayClubManager = donationManager.getPowerPlayClubManager(); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); System.out.print("VOTIFIER: "); System.out.print("DONATION MANAGER - > " + _donationManager.toString()); @@ -170,8 +167,6 @@ public class BonusManager extends MiniClientPlugin implements I _coinQueue = new LinkedList(); _gemQueue = new LinkedList(); - _claimRegister = new ClaimRegister(); - updateOffSet(); } @@ -198,7 +193,7 @@ public class BonusManager extends MiniClientPlugin implements I _facebookManager = facebookManager; _youtubeManager = youtubeManager; - _powerPlayClubManager = donationManager.getPowerPlayClubManager(); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager); _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); @@ -209,8 +204,6 @@ public class BonusManager extends MiniClientPlugin implements I _coinQueue = new LinkedList(); _gemQueue = new LinkedList(); - _claimRegister = new ClaimRegister(); - if (npcManager != null) { @@ -932,7 +925,7 @@ public class BonusManager extends MiniClientPlugin implements I if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++; if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++; - if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager)) availableRewards++; + if (PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) availableRewards++; Hologram hologram; @@ -1115,7 +1108,7 @@ public class BonusManager extends MiniClientPlugin implements I { if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) { - if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubManager)) + if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) { if(_showCarl.containsKey(player.getName())) { @@ -1124,40 +1117,9 @@ public class BonusManager extends MiniClientPlugin implements I } } } - if (Recharge.Instance.use(player, "Power Play Inform", 400000, false, false)) - { - if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager) && PowerPlayClubButton.getMonthsLeft(player, true, _powerPlayClubManager) == 1) - { - if (_showCarl.containsKey(player.getName())) - { - if (_plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby") || _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) - { - UtilPlayer.message(player, F.main("Power Play Club", "This is your last month of Power Play Club! Resubscribe at" + C.cAqua + " www.mineplex.com/shop" + C.Reset + " before you lose your subscription!")); - } - } - } - } } } - @EventHandler - public void removeClaims(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC_05) - return; - - _claimRegister.removeAll(); - } - - @EventHandler - public void addClaims(PowerPlayClubClaimEvent event) - { - if (!event.isSuccessful()) - return; - - _claimRegister.registerEvent(event); - } - @EventHandler public void processQueue(UpdateEvent event) { @@ -1259,9 +1221,9 @@ public class BonusManager extends MiniClientPlugin implements I return _donationManager; } - public PowerPlayClubManager getPowerPlayClubManager() + public PowerPlayClubRepository getPowerPlayClubRepository() { - return _powerPlayClubManager; + return _powerPlayClubRepository; } public InventoryManager getInventoryManager() @@ -1269,9 +1231,4 @@ public class BonusManager extends MiniClientPlugin implements I return _inventoryManager; } - public ClaimRegister getClaimRegister() - { - return _claimRegister; - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java index 0902901c6..edc65deb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -1,25 +1,19 @@ package mineplex.core.bonuses.commands; -import java.util.UUID; - import mineplex.core.bonuses.BonusManager; 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.common.util.UtilText; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import java.time.LocalDate; + public class PowerPlayCommand extends CommandBase { - /** - * Examples: - * /powerplay LCastr0 5 -> Adds 5 months to player's power play club months - * /powerplay LCastr0 5 false -> same as above - * /powerplay LCastr0 5 true -> Sets the last claimed month as June - */ - private BonusManager _bonusManager; public PowerPlayCommand(BonusManager manager) @@ -31,53 +25,21 @@ public class PowerPlayCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - if (args.length < 2) + if (args.length < 1) { - UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay [setLastClaimed:true/false]"))); + UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay "))); return; } - final String targetName = args[0]; - final String months = args[1]; - boolean setLastClaimed = false; - if (args.length >= 3) - { - setLastClaimed = Boolean.valueOf(args[2]); + Player player = Bukkit.getPlayer(args[0]); + if (player == null) { + caller.sendMessage(ChatColor.RED + "Couldn't find player"); + return; } - Player target = UtilPlayer.searchExact(targetName); + _bonusManager.getPowerPlayClubRepository().Get(player).setSubscribed(true); + _bonusManager.getPowerPlayClubRepository().addSubscription(_bonusManager.getClientManager().Get(player).getAccountId(), LocalDate.now(), "month"); - rewardPowerPlay(caller, target, target.getName(), months, setLastClaimed); + caller.sendMessage(ChatColor.GREEN + "Gave a month's subscription to " + player.getName()); } - - private void rewardPowerPlay(Player caller, Player target, String targetName, String months, boolean setLastClaimed) - { - try - { - final int iMonths = Integer.parseInt(months); - UUID targetUuid = target.getUniqueId(); - String messageCaller = "You gave " + F.elem(iMonths + UtilText.plural(" Month", iMonths)) + " to " + F.name(targetName) + "."; - String messageTarget = F.name(caller.getName()) + " gave you " + F.elem(iMonths + UtilText.plural(" Month", iMonths)) + "."; - if (setLastClaimed) - { - _bonusManager.getPowerPlayClubManager().setLastClaimedMonth(targetUuid, iMonths); - messageCaller = "You have set the last claimed month from " + F.name(targetName) + " to " + iMonths + "."; - messageTarget = F.name(caller.getName()) + " have set your last claimed month to " + iMonths + "."; - } - else - { - _bonusManager.getPowerPlayClubManager().addPlayerMonths(target.getUniqueId(), iMonths); - } - UtilPlayer.message(caller, F.main("Power Play Club", messageCaller)); - if (target != null && !target.equals(caller)) - { - UtilPlayer.message(target, F.main("Power Play Club", messageTarget)); - } - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main("Power Play Club", "Invalid Month Amount")); - } - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java deleted file mode 100644 index ba14bb42c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/event/PowerPlayClubClaimEvent.java +++ /dev/null @@ -1,48 +0,0 @@ -package mineplex.core.bonuses.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class PowerPlayClubClaimEvent extends Event -{ - - private static final HandlerList handlers = new HandlerList(); - - private Player _player; - private long _time; - private boolean _successful; - - public PowerPlayClubClaimEvent(Player player, boolean successful) - { - _player = player; - _successful = successful; - _time = System.currentTimeMillis(); - } - - public Player getPlayer() - { - return _player; - } - - public boolean isSuccessful() - { - return _successful; - } - - public long getTime() - { - return _time; - } - - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index 6a341719e..103bdf28e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -1,33 +1,28 @@ package mineplex.core.bonuses.gui.buttons; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.Locale; - import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; -import mineplex.core.bonuses.powerplay.PowerPlayAnimation; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.GuiItem; import mineplex.core.inventory.InventoryManager; -import mineplex.core.powerplayclub.PowerPlayClubManager; +import mineplex.core.powerplayclub.PowerPlayClubRepository; +import mineplex.core.powerplayclub.PowerPlayClubRewards; import mineplex.core.shop.item.ShopItem; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; + public class PowerPlayClubButton implements GuiItem { private ItemStack _item; private Player _player; - private PowerPlayClubManager _powerPlayClubManager; + private PowerPlayClubRepository _powerPlayClubRepository; private InventoryManager _inventoryManager; private BonusManager _bonusManager; @@ -35,7 +30,7 @@ public class PowerPlayClubButton implements GuiItem { _player = player; _bonusManager = manager; - _powerPlayClubManager = manager.getPowerPlayClubManager(); + _powerPlayClubRepository = manager.getPowerPlayClubRepository(); _inventoryManager = manager.getInventoryManager(); } @@ -54,18 +49,16 @@ public class PowerPlayClubButton implements GuiItem @Override public void click(ClickType clickType) { - if (isAvailable() && !_bonusManager.getClaimRegister().alreadyClaimed(_player.getUniqueId())) + if (isAvailable() && !_bonusManager.getPowerPlayClubRepository().alreadyClaimed(_player)) { _player.closeInventory(); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); - getMonthlyRewards().giveAllItems(_player, _inventoryManager); - updateLastClaimedMonth(); - Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, true)); + PowerPlayClubRewards.giveAllItems(_player, _inventoryManager, _powerPlayClubRepository); } else { _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); - if (getMonthsLeft(true) > 0) + if (_powerPlayClubRepository.alreadyClaimed(_player)) { UtilPlayer.message(_player, F.main("Power Play Club", "Already claimed!")); } @@ -73,7 +66,6 @@ public class PowerPlayClubButton implements GuiItem { UtilPlayer.message(_player, F.main("Power Play Club", "You have no months left! Buy more months at " + C.cAqua + "www.mineplex.com/shop" + C.Reset + "!")); } - Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, false)); } } @@ -106,16 +98,16 @@ public class PowerPlayClubButton implements GuiItem lore.add(C.cYellow + "Rewards"); lore.add(" " + C.cWhite + "2 Game Amplifiers"); lore.add(" " + C.cWhite + "1 Omega Chest"); - for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) + for (PowerPlayClubRewards.PowerPlayClubItem prize : PowerPlayClubRewards.septemberItems()) { lore.add(" " + C.cWhite + prize.getAmount() + " " + prize.getPrize()); } - lore.add(" "); - lore.add(C.cYellow + "Months left: " + C.cWhite + getMonthsLeft(true)); + //lore.add(" "); + //lore.add(C.cYellow + "Months left: " + C.cWhite + getMonthsLeft(true)); //TODO: figure this out if (!isAvailable()) { lore.add(" "); - if (getMonthsLeft(true) > 0) + if (_powerPlayClubRepository.alreadyClaimed(_player)) { lore.add(C.cRed + "Already claimed!"); } @@ -131,71 +123,12 @@ public class PowerPlayClubButton implements GuiItem private boolean isAvailable() { - int monthsLeft = getMonthsLeft(true); - int lastClaimed = _powerPlayClubManager.getLastClaimedMonth(_player.getUniqueId(), true); - int month = Calendar.getInstance().get(Calendar.MONTH); - int actualYear = Calendar.getInstance().get(Calendar.YEAR); - int lastClaimedYear = _powerPlayClubManager.getLastClaimedYear(_player.getUniqueId(), true); - if (monthsLeft > 0) - { - if (lastClaimed == -1) - return true; - if (lastClaimedYear < actualYear) - return true; - return lastClaimed != month; - } - return false; + return _powerPlayClubRepository.canClaim(_player); } - private PowerPlayClubManager.PowerPlayClubRewards getMonthlyRewards() + public static boolean isAvailable(Player player, PowerPlayClubRepository repo) { - String month = Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH); - return PowerPlayClubManager.PowerPlayClubRewards.valueOf(month.toUpperCase()); - } - - private void updateLastClaimedMonth() - { - // Send carl animation - List animationItems = new ArrayList<>(); - for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) - { - animationItems.add(prize.getDisplay()); - } - PowerPlayAnimation powerPlayAnimation = new PowerPlayAnimation(_player, animationItems); - _bonusManager.addPendingExplosion(_player, powerPlayAnimation); - int month = Calendar.getInstance().get(Calendar.MONTH); - int year = Calendar.getInstance().get(Calendar.YEAR); - _powerPlayClubManager.setLastClaimedMonth(_player.getUniqueId(), month); - _powerPlayClubManager.decreasePlayerMonth(_player.getUniqueId()); - _powerPlayClubManager.setLastClaimedYear(_player.getUniqueId(), year); - } - - private int getMonthsLeft(boolean update) - { - return _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), update); - } - - public static int getMonthsLeft(Player player, boolean update, PowerPlayClubManager manager) - { - return manager.getPlayerMonths(player.getUniqueId(), update); - } - - public static boolean isAvailable(Player player, PowerPlayClubManager manager) - { - int monthsLeft = getMonthsLeft(player, true, manager); - int lastClaimed = manager.getLastClaimedMonth(player.getUniqueId(), true); - int month = Calendar.getInstance().get(Calendar.MONTH); - int actualYear = Calendar.getInstance().get(Calendar.YEAR); - int lastClaimedYear = manager.getLastClaimedYear(player.getUniqueId(), true); - if (monthsLeft > 0) - { - if (lastClaimed == -1) - return true; - if (lastClaimedYear < actualYear) - return true; - return lastClaimed != month; - } - return false; + return repo.canClaim(player); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java deleted file mode 100644 index 6d60b867c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/powerplay/ClaimRegister.java +++ /dev/null @@ -1,46 +0,0 @@ -package mineplex.core.bonuses.powerplay; - -import java.util.*; - -import mineplex.core.bonuses.event.PowerPlayClubClaimEvent; - -public class ClaimRegister -{ - - /** - * Fixes the problem where the database isn't sync'd with the server so the player can still claim it if they try - * to click really quickly after it was already claimed. - * This stores the player information for 5 seconds, so if they try to claim again they won't be able to. - */ - - private Map _events = new HashMap<>(); - - public void registerEvent(PowerPlayClubClaimEvent event) - { - _events.put(event.getPlayer().getUniqueId(), event); - } - - public void removeAll() - { - List toRemove = new ArrayList<>(); - long currentTime = System.currentTimeMillis(); - for (Map.Entry eventEntry : _events.entrySet()) - { - PowerPlayClubClaimEvent event = eventEntry.getValue(); - if (currentTime - event.getTime() >= 5000) - { - toRemove.add(eventEntry.getKey()); - } - } - for (UUID uuid : toRemove) - { - _events.remove(uuid); - } - } - - public boolean alreadyClaimed(UUID uuid) - { - return _events.containsKey(uuid); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 4abd058f5..596bf68c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -1,9 +1,5 @@ package mineplex.core.donation; -import java.util.LinkedList; -import java.util.Queue; -import java.util.UUID; - import com.google.gson.Gson; import mineplex.cache.player.PlayerCache; import mineplex.core.MiniClientPlugin; @@ -16,7 +12,6 @@ import mineplex.core.donation.command.GemCommand; import mineplex.core.donation.command.ShardCommand; import mineplex.core.donation.repository.DonationRepository; import mineplex.core.donation.repository.token.DonorTokenWrapper; -import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -25,6 +20,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; +import java.util.LinkedList; +import java.util.Queue; +import java.util.UUID; + public class DonationManager extends MiniClientPlugin { private final int MAX_GIVE_ATTEMPTS = 10; @@ -36,7 +35,6 @@ public class DonationManager extends MiniClientPlugin private Queue _coinAttemptQueue; - private PowerPlayClubManager _powerPlayClubManager; private final CoreClientManager _clientManager; public DonationManager(JavaPlugin plugin, CoreClientManager clientManager, String webAddress) @@ -47,7 +45,6 @@ public class DonationManager extends MiniClientPlugin _coinAttemptQueue = new LinkedList<>(); - _powerPlayClubManager = new PowerPlayClubManager(); _clientManager = clientManager; } @@ -381,9 +378,4 @@ public class DonationManager extends MiniClientPlugin { return new Donor(); } - - public PowerPlayClubManager getPowerPlayClubManager() - { - return _powerPlayClubManager; - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PPCPlayerData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PPCPlayerData.java new file mode 100644 index 000000000..f4156ddd7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PPCPlayerData.java @@ -0,0 +1,26 @@ +package mineplex.core.powerplayclub; + +public class PPCPlayerData { + private boolean _subscribed; + private boolean _claimed; + + public void setSubscribed(boolean subscribed) + { + _subscribed = subscribed; + } + + public void setClaimed(boolean claimed) + { + _claimed = claimed; + } + + public boolean hasClaimed() + { + return _claimed; + } + + public boolean hasSubscribed() + { + return _subscribed; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java deleted file mode 100644 index 8e8ee4776..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubManager.java +++ /dev/null @@ -1,301 +0,0 @@ -package mineplex.core.powerplayclub; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.*; - -import mineplex.core.common.util.*; -import mineplex.core.database.PlayerKeyValueRepository; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.inventory.data.Item; -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.PlayerJoinEvent; -import org.bukkit.inventory.ItemStack; - -public class PowerPlayClubManager implements Listener -{ - - /** - * Manager for the Power Play Club system - * Sends and receives information from/to the database - */ - - private PlayerKeyValueRepository _repository; - private Map _playerMonths = new HashMap<>(); - - public PowerPlayClubManager() - { - Bukkit.getPluginManager().registerEvents(this, UtilServer.getPlugin()); - _repository = new PlayerKeyValueRepository<>("powerPlayClub", PreparedStatement::setInt, ResultSet::getInt); - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - updatePlayer(event.getPlayer().getUniqueId()); - } - - public int getLastClaimedMonth(UUID uuid, boolean update) - { - if (update) - { - updatePlayer(uuid); - } - if (_playerMonths.containsKey(uuid)) - { - return _playerMonths.get(uuid).getLastClaimed(); - } - return -1; - } - - public void setLastClaimedMonth(UUID uuid, int month) - { - _repository.put(uuid, "lastClaimed", month); - updatePlayer(uuid); - PlayerMonths playerMonths = _playerMonths.get(uuid); - playerMonths.setLastClaimed(month); - _playerMonths.put(uuid, playerMonths); - } - - public int getLastClaimedYear(UUID uuid, boolean update) - { - if (update) - { - updatePlayer(uuid); - } - if (_playerMonths.containsKey(uuid)) - { - return _playerMonths.get(uuid).getYear(); - } - return Calendar.getInstance().get(Calendar.YEAR); - } - - public void setLastClaimedYear(UUID uuid, int year) - { - _repository.put(uuid, "year", year); - updatePlayer(uuid); - PlayerMonths playerMonths = _playerMonths.get(uuid); - playerMonths.setYear(year); - _playerMonths.put(uuid, playerMonths); - } - - public int getPlayerMonths(UUID uuid, boolean update) - { - if (update) - { - updatePlayer(uuid); - } - if (_playerMonths.containsKey(uuid)) - { - return _playerMonths.get(uuid).getMonths(); - } - return 0; - } - - public void addPlayerMonths(UUID uuid, int months) - { - int currentMonths = getPlayerMonths(uuid, true); - _repository.put(uuid, "monthsLeft", currentMonths + months); - updatePlayer(uuid); - PlayerMonths playerMonths = _playerMonths.get(uuid); - playerMonths.setMonths(currentMonths + months); - _playerMonths.put(uuid, playerMonths); - } - - public void decreasePlayerMonth(UUID uuid) - { - addPlayerMonths(uuid, -1); - } - - /** - * Updates player's months and last claimed month - * @param uuid the player's UUID - */ - private void updatePlayer(UUID uuid) - { - _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> - { - int year = Calendar.getInstance().get(Calendar.YEAR); - int lastClaimed = -1; - int months = 0; - if (values.containsKey("claimedYear")) - { - year = values.get("claimedYear"); - } - if (values.containsKey("lastClaimed")) - { - lastClaimed = values.get("lastClaimed"); - } - - if (values.containsKey("monthsLeft")) - { - months = values.get("monthsLeft"); - } - - PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed, year); - _playerMonths.put(uuid, playerMonths); - })); - } - - /** - * Monthly rewards, based on each month, a different reward - */ - public enum PowerPlayClubRewards - { - JANUARY, - FEBRUARY, - MARCH, - APRIL, - MAY, - JUNE, - JULY(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))), - AUGUST(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))), - SEPTEMBER, - OCTOBER, - NOVEMBER, - DECEMBER; - - private PowerPlayClubItem[] _items; - - PowerPlayClubRewards(PowerPlayClubItem... items) - { - _items = items; - } - - public PowerPlayClubItem[] getItems() - { - return _items; - } - - /** - * Gives the player the specific items for that month, plus - * 2x Game Boosters - * 1x Omega Chest - * @param player - * @param manager - */ - public void giveAllItems(Player player, InventoryManager manager) - { - for (PowerPlayClubItem item : _items) - { - Item fItem = manager.getItem(item.getPrize()); - if (fItem == null) - { - UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); - } - else - { - manager.addItemToInventory(player, fItem.Name, 1); - UtilPlayer.message(player, F.main("Power Play Club", "You received " + item.getAmount() + "x " + F.elem(item.getPrize()) + ".")); - } - } - Item gameAmplifier = manager.getItem("Game Booster"); - if (gameAmplifier == null) - { - UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); - } - else - { - manager.addItemToInventory(player, gameAmplifier.Name, 2); - UtilPlayer.message(player, F.main("Power Play Club", "You received 2x " + F.elem("Game Boosters") + ".")); - } - Item omegaChest = manager.getItem("Omega Chest"); - if (omegaChest == null) - { - UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); - } - else - { - manager.addItemToInventory(player, omegaChest.Name, 1); - UtilPlayer.message(player, F.main("Power Play Club", "You received 1x " + F.elem("Omega Chest") + ".")); - } - } - - } - - /** - * Class to help on monthly bonuses - */ - public static class PowerPlayClubItem - { - private final String _prize; - private final int _amount; - private final ItemStack _display; - - public PowerPlayClubItem(String prize, int amount, ItemStack display) - { - _prize = prize; - _amount = amount; - _display = display; - } - - public String getPrize() - { - return _prize; - } - - public int getAmount() - { - return _amount; - } - - public ItemStack getDisplay() - { - return _display; - } - } - - /** - * Class that stores player's months and last claimed month - */ - protected class PlayerMonths - { - - private int _months; - private int _lastClaimed; - private int _year; - - public PlayerMonths(int months, int lastClaimed, int year) - { - _months = months; - _lastClaimed = lastClaimed; - _year = year; - } - - public int getMonths() - { - return _months; - } - - public int getLastClaimed() - { - return _lastClaimed; - } - - public int getYear() - { - return _year; - } - - public void setMonths(int months) - { - _months = months; - } - - public void setLastClaimed(int lastClaimed) - { - _lastClaimed = lastClaimed; - } - - public void setYear(int year) - { - _year = year; - } - - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java new file mode 100644 index 000000000..1e7c68564 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -0,0 +1,118 @@ +package mineplex.core.powerplayclub; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; +import mineplex.serverdata.database.DBPool; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import java.sql.*; +import java.time.LocalDate; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +public class PowerPlayClubRepository extends MiniClientPlugin { + + private final CoreClientManager _clientManager; + + public PowerPlayClubRepository(JavaPlugin plugin, CoreClientManager clientManager) { + super("PowerPlayClubRepository", plugin); + + _clientManager = clientManager; + + clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() { + @Override + public String getName() { + return "PPC Claim Grabber"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException { + PowerPlayClubRepository.this.Get(uuid).setClaimed(resultSet.next()); + } + + @Override + public String getQuery(int accountId, String uuid, String name) { + return "SELECT * FROM powerPlayClaims WHERE accountId = " + accountId + ";"; + } + }); + + clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() { + @Override + public String getName() { + return "PPC Subscription Grabber"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException { + PowerPlayClubRepository.this.Get(uuid).setSubscribed(resultSet.next()); + } + + @Override + public String getQuery(int accountId, String uuid, String name) { + return "SELECT * FROM powerPlaySubs WHERE accountId = " + accountId + ";"; + } + }); + } + + public CompletableFuture addSubscription(int accountId, LocalDate date, String duration) + { + return CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("INSERT INTO powerPlaySubs (accountId, startDate, duration) VALUES (?, ?, ?)"); + statement.setInt(1, accountId); + statement.setDate(2, Date.valueOf(date)); + statement.setString(3, duration); + statement.executeUpdate(); + + } catch (SQLException e) + { + e.printStackTrace(); + } + + return null; + }); + } + + public CompletableFuture attemptClaim(Player player) + { + int accountId = _clientManager.Get(player).getAccountId(); + + return CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + LocalDate date = LocalDate.now(); + PreparedStatement statement = connection.prepareStatement("INSERT IGNORE INTO powerPlayClaims (accountId, claimMonth, claimYear) VALUES (?, ?, ?)"); + statement.setInt(1, accountId); + statement.setInt(2, date.getMonthValue()); + statement.setInt(3, date.getYear()); + + return statement.executeUpdate() == 1; + + } catch (SQLException e) + { + e.printStackTrace(); + } + return false; + }); + } + + public boolean alreadyClaimed(Player player) + { + return Get(player).hasClaimed(); + } + + public boolean canClaim(Player player) + { + return Get(player).hasSubscribed() && !Get(player).hasClaimed(); + } + + @Override + protected PPCPlayerData addPlayer(UUID uuid) { + return new PPCPlayerData(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java new file mode 100644 index 000000000..c937d4414 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -0,0 +1,147 @@ +package mineplex.core.powerplayclub; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.inventory.data.Item; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.time.Month; +import java.time.Year; +import java.util.*; + +public class PowerPlayClubRewards +{ + private static final Map> rewards = new HashMap<>(); + + static + { + setRewards(2016, Month.SEPTEMBER, new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))); + } + + public static List septemberItems() // TODO: figure this out + { + return rewards.values().iterator().next(); + } + + private static void setRewards(int year, Month month, PowerPlayClubItem... items) + { + rewards.put(new RewardMonth(Year.of(year), month), Arrays.asList(items)); + } + + private static class RewardMonth + { + private final Year year; + private final Month month; + + static RewardMonth of(Year year, Month month) + { + return new RewardMonth(year, month); + } + + RewardMonth(Year year, Month month) + { + this.year = year; + this.month = month; + } + + @Override + public boolean equals(Object obj) { + if (obj == null || getClass() != obj.getClass()) return false; + + RewardMonth that = (RewardMonth) obj; + + return Objects.equals(this.year, that.year) && Objects.equals(this.month, that.month); + } + + @Override + public int hashCode() { + return Objects.hash(year, month); + } + } + + public static class PowerPlayClubItem + { + private final String _prize; + private final int _amount; + private final ItemStack _display; + + public PowerPlayClubItem(String prize, int amount, ItemStack display) + { + _prize = prize; + _amount = amount; + _display = display; + } + + public String getPrize() + { + return _prize; + } + + public int getAmount() + { + return _amount; + } + + public ItemStack getDisplay() + { + return _display; + } + } + + + public static void giveAllItems(Player player, InventoryManager manager, PowerPlayClubRepository repo) + { + UtilPlayer.message(player, F.main("Power Play Club", "Verifying subscription..")); + + repo.attemptClaim(player).thenCompose(BukkitFuture.accept(success -> + { + + if (!success) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + return; + } + + repo.Get(player).setClaimed(true); + + for (PowerPlayClubItem item : septemberItems()) // TODO: figure this out + { + Item fItem = manager.getItem(item.getPrize()); + if (fItem == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, fItem.Name, 1); + UtilPlayer.message(player, F.main("Power Play Club", "You received " + item.getAmount() + "x " + F.elem(item.getPrize()) + ".")); + } + } + Item gameAmplifier = manager.getItem("Game Booster"); + if (gameAmplifier == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, gameAmplifier.Name, 2); + UtilPlayer.message(player, F.main("Power Play Club", "You received 2x " + F.elem("Game Boosters") + ".")); + } + Item omegaChest = manager.getItem("Omega Chest"); + if (omegaChest == null) + { + UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); + } + else + { + manager.addItemToInventory(player, omegaChest.Name, 1); + UtilPlayer.message(player, F.main("Power Play Club", "You received 1x " + F.elem("Omega Chest") + ".")); + } + })); + } + +} diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 36a003bc1..27ceffa54 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -1,12 +1,5 @@ package mineplex.enjinTranslator; -import java.text.SimpleDateFormat; -import java.util.AbstractMap; -import java.util.Date; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.UUID; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -14,10 +7,9 @@ import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; -import mineplex.core.powerplayclub.PowerPlayClubManager; +import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -29,13 +21,21 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.AbstractMap; +import java.util.Date; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.UUID; + public class Enjin extends MiniPlugin implements CommandExecutor { private CoreClientManager _clientManager; private DonationManager _donationManager; private InventoryManager _inventoryManager; private PurchaseManager _purchaseManager; - private PowerPlayClubManager _powerPlayClubManager; + private PowerPlayClubRepository _powerPlayClubRepository; private NautHashMap> _cachedUUIDs = new NautHashMap>(); private static Object _commandLock = new Object(); @@ -53,7 +53,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _inventoryManager = inventoryManager; _purchaseManager = new PurchaseManager(plugin); - _powerPlayClubManager = donationManager.getPowerPlayClubManager(); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); @@ -287,18 +287,24 @@ public class Enjin extends MiniPlugin implements CommandExecutor protected boolean checkForPowerPlayClub(String[] args, final String name, final UUID playerUUID, final CoreClient client) { - if (args.length != 3 || !args[0].equalsIgnoreCase("powerplayclub")) + if (args.length < 3 || !args[0].equalsIgnoreCase("powerplayclub")) return false; - if (args[2].equalsIgnoreCase("month")) + if (args[2].equalsIgnoreCase("add")) { - _powerPlayClubManager.addPlayerMonths(playerUUID, 1); - } else + String[] splitDate = args[3].split("/"); + LocalDate date = LocalDate.of(Integer.parseInt(splitDate[2]), Integer.parseInt(splitDate[0]), Integer.parseInt(splitDate[1])); + + String duration = args[4]; + + _powerPlayClubRepository.addSubscription(client.getAccountId(), date, duration); + + } else if (args[2].equalsIgnoreCase("cancel")) { - _powerPlayClubManager.addPlayerMonths(playerUUID, 12); + // TODO: cancel it in our logs? I don't think this is necessary. } - return true; + return false; } protected boolean checkForClansPurchase(String[] args, final String name, final CoreClient client) From 9abbe1bfb9b805fae892052fbca00f55f7ec3f4c Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Thu, 1 Sep 2016 23:01:34 -0400 Subject: [PATCH 15/21] Update support whitelist and op list --- .../src/mineplex/staffServer/StaffServer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 124d6dc2a..cf99fcb03 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -87,7 +87,6 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EstherCS")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); @@ -95,7 +94,7 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder")); - + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); From e2f974e1e62729f46f8bc60d2d2592c6d90c9eab Mon Sep 17 00:00:00 2001 From: TadahTech Date: Fri, 2 Sep 2016 00:40:23 -0500 Subject: [PATCH 16/21] Add sounds and messages to basketball. --- .../game/games/basketball/Basketball.java | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java index 5899dbbd6..a6b901ba9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java @@ -1,9 +1,5 @@ package nautilus.game.arcade.game.games.basketball; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -13,6 +9,7 @@ import mineplex.core.common.util.UtilMath; 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.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; @@ -31,11 +28,11 @@ import nautilus.game.arcade.game.games.basketball.data.ThrowData; import nautilus.game.arcade.game.games.basketball.kit.BasketballPlayerKit; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.BlockPosition; - import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; @@ -54,6 +51,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + /** * Main game class for Basketball */ @@ -318,6 +319,26 @@ public class Basketball extends TeamGame { UtilTextMiddle.display("", team.GetColor() + team.getDisplayName() + " has scored!", 0, 20 * 2, 0); int points = getWorth(_throwData.getThrowOrigin(), hoop); + + if(_throwData.getThrower() != null) + { + String player = team.GetColor() + _throwData.getThrower().getName() + C.mBody + ""; + String broad = player + " has scored a " + F.elem(points + " pointer!"); + Location location = _throwData.getThrower().getLocation(); + double dist = UtilMath.offset2d(_throwData.getThrowOrigin(), hoop); + + if(dist <= 3) + { + broad = player + C.cGreen + " scored a layup!"; + if(hoop.getY() < location.getY()) + { + broad = player + C.cGreenB + " dunked on em!"; + } + } + + UtilServer.broadcast(broad); + } + _score.addPoint(team, points); _ball.remove(); _ball = null; @@ -339,11 +360,14 @@ public class Basketball extends TeamGame key = DataLoc.RED_SCORE_SPAWN.getKey(); player.teleport(WorldData.GetCustomLocs(key).get(i % WorldData.GetCustomLocs(key).size())); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0f, 1.0f); } } + for (Player player : team.GetPlayers(true)) { player.teleport(team.GetSpawn()); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0f, 1.0f); } Location teleport = WorldData.GetCustomLocs(DataLoc.BLUE_UNDER_HOOP.getKey()).get(0); From 2bce540c5d6baa51afdf0596d728f7a39190a872 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 2 Sep 2016 02:51:34 -0500 Subject: [PATCH 17/21] Disable Antihack in the staff server --- .../src/mineplex/staffServer/StaffServer.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index cf99fcb03..f2e88544f 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -3,7 +3,6 @@ package mineplex.staffServer; import com.mojang.authlib.GameProfile; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; -import mineplex.core.antihack.AntiHack; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; @@ -71,8 +70,7 @@ public class StaffServer extends JavaPlugin require(PacketHandler.class); require(DisguiseManager.class); - require(AntiHack.class); - + new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), new StatsManager(this, clientManager))); //new Password(this, serverStatusManager.getCurrentServerName()); From c9358d8c5aca13346aa25c45da4c0171fd12d269 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 2 Sep 2016 19:10:30 -0500 Subject: [PATCH 18/21] Add power play to support server --- .../PowerPlayClubRepository.java | 36 +++++++++++++++++++ .../customerSupport/CustomerSupport.java | 18 +++++----- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java index 1e7c68564..2e64c98a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -111,6 +111,42 @@ public class PowerPlayClubRepository extends MiniClientPlugin { return Get(player).hasSubscribed() && !Get(player).hasClaimed(); } + public CompletableFuture hasSubscription(int accountId) + { + return CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlaySubs WHERE accountId = ?"); + statement.setInt(1, accountId); + return statement.executeQuery().next(); + + } catch (SQLException e) { + e.printStackTrace(); + } + + return false; + }); + } + + public CompletableFuture hasClaimed(int accountId) + { + return CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlayClaims WHERE accountId = ?"); + statement.setInt(1, accountId); + return statement.executeQuery().next(); + + } catch (SQLException e) { + e.printStackTrace(); + } + + return false; + }); + } + @Override protected PPCPlayerData addPlayer(UUID uuid) { return new PPCPlayerData(); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index ae823b7fa..b77c30e81 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -19,6 +19,7 @@ import mineplex.core.donation.DonationManager; 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.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; import org.bukkit.GameMode; @@ -39,6 +40,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable private DonationManager _donationManager; private SalesPackageManager _salesPackageManager; private CustomerSupportRepository _repository; + private PowerPlayClubRepository _powerPlayRepo; private NautHashMap> _agentCacheMap = new NautHashMap>(); private NautHashMap> _accountBonusLog = new NautHashMap<>(); @@ -51,6 +53,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable _donationManager = donationManager; _salesPackageManager = salesPackageManager; _repository = new CustomerSupportRepository(getPlugin()); + _powerPlayRepo = new PowerPlayClubRepository(plugin, clientManager); } @EventHandler @@ -110,6 +113,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable public void run() { _repository.loadBonusLogForAccountId(client.getAccountId(), instance); + + boolean powerPlaySub = _powerPlayRepo.hasSubscription(client.getAccountId()).join(); + boolean powerPlayClaim = _powerPlayRepo.hasClaimed(client.getAccountId()).join(); runSync(new Runnable() { @@ -276,17 +282,11 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - caller.sendMessage(C.cBlue + "Freedom Mount: " + getLockedFreedomStr(client.getUniqueId(), "Freedom Mount")); - caller.sendMessage(C.cBlue + "Uncle Sam Morph: " + getLockedFreedomStr(client.getUniqueId(), "Uncle Sam Morph")); - caller.sendMessage(C.cBlue + "Freedom Aura: " + getLockedFreedomStr(client.getUniqueId(), "Freedom Aura")); - caller.sendMessage(C.cBlue + "Shock and Awe: " + getLockedFreedomStr(client.getUniqueId(), "Shock and Awe")); - caller.sendMessage(C.cBlue + "Leap of Freedom: " + getLockedFreedomStr(client.getUniqueId(), "Leap of Freedom")); - caller.sendMessage(C.cBlue + "Price of Freedom: " + getLockedFreedomStr(client.getUniqueId(), "Price of Freedom")); - caller.sendMessage(C.cBlue + "Uncle Sam Hat: " + getLockedFreedomStr(client.getUniqueId(), "Uncle Sam Hat")); - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage")); - caller.sendMessage(C.cBlue + "Uncle Sam Morph: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + caller.sendMessage(C.cBlue + "Power play subscription (September): " + powerPlaySub); + caller.sendMessage(C.cBlue + "Power play claim (September): " + powerPlayClaim); _accountBonusLog.remove(client.getAccountId()); } From 0ea1d3eca2d2a366312c581189bff2bf95a96cba Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 3 Sep 2016 00:56:36 -0400 Subject: [PATCH 19/21] Fix enjin listener else bug --- .../src/mineplex/enjinTranslator/Enjin.java | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index e0296c21b..0389f39b5 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -103,34 +103,37 @@ public class Enjin extends MiniPlugin implements CommandExecutor uuid = _clientManager.loadUUIDFromDB(name); if (uuid == null) + uuid = UUIDFetcher.getUUIDOf(name); + } + + if (uuid == null) + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID."); + return; + } + + final UUID playerUUID = uuid; + + _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); + + if (!checkForClansPurchase(args, name, client)) + { + if (!checkForBoosterPurchase(args, name, playerUUID, client)) { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID."); - return; - } - - final UUID playerUUID = uuid; - - _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); - - if (!checkForClansPurchase(args, name, client)) - { - if (!checkForBoosterPurchase(args, name, playerUUID, client)) + if (!checkForCoinPurchase(args, name, playerUUID, client)) { - if (!checkForCoinPurchase(args, name, playerUUID, client)) + if (!checkForRankPurchase(args, name, playerUUID, client)) { - if (!checkForRankPurchase(args, name, playerUUID, client)) + if (!checkForPurchase(args, name, client)) { - if (!checkForPurchase(args, name, client)) + StringBuilder sb = new StringBuilder(); + + for (String arg : args) { - StringBuilder sb = new StringBuilder(); - - for (String arg : args) - { - sb.append(arg + " "); - } - - System.out.println("Received Command : " + sb.toString()); + sb.append(arg + " "); } + + System.out.println("Received Command : " + sb.toString()); } } } @@ -165,7 +168,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor final Rank rank = mineplex.core.common.Rank.valueOf(args[2]); final boolean perm = Boolean.parseBoolean(args[3]); - + _clientManager.loadClientByName(name, loadedClient -> { if (rank == Rank.ALL || loadedClient.GetRank() == Rank.ALL || !loadedClient.GetRank().has(rank) || loadedClient.GetRank() == rank) @@ -188,7 +191,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor { if (args.length < 3 || !args[0].equalsIgnoreCase("purchase")) return false; - + final int amount = Integer.parseInt(args[2]); String tempName = args[4]; From 586a768c7b57aa828a46b3725a0a7860dd5c2a14 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 3 Sep 2016 00:59:15 -0400 Subject: [PATCH 20/21] Fix enjin listener else bug --- .../src/mineplex/enjinTranslator/Enjin.java | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 27ceffa54..c270f2211 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -7,6 +7,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubRepository; @@ -104,38 +105,38 @@ public class Enjin extends MiniPlugin implements CommandExecutor { // Fails if not in DB and if duplicate. uuid = _clientManager.loadUUIDFromDB(name); + } - if (uuid == null) + if (uuid == null) + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID."); + return; + } + + final UUID playerUUID = uuid; + + _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); + + if (!checkForClansPurchase(args, name, client)) + { + if (!checkForBoosterPurchase(args, name, playerUUID, client)) { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID."); - return; - } - - final UUID playerUUID = uuid; - - _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); - - if (!checkForClansPurchase(args, name, client)) - { - if (!checkForBoosterPurchase(args, name, playerUUID, client)) + if (!checkForCoinPurchase(args, name, playerUUID, client)) { - if (!checkForCoinPurchase(args, name, playerUUID, client)) + if (!checkForRankPurchase(args, name, playerUUID, client)) { - if (!checkForRankPurchase(args, name, playerUUID, client)) + if (!checkForPurchase(args, name, client)) { - if (!checkForPurchase(args, name, client)) + if (!checkForPowerPlayClub(args, name, playerUUID, client)) { - if (!checkForPowerPlayClub(args, name, playerUUID, client)) + StringBuilder sb = new StringBuilder(); + + for (String arg : args) { - StringBuilder sb = new StringBuilder(); - - for (String arg : args) - { - sb.append(arg + " "); - } - - System.out.println("Received Command : " + sb.toString()); + sb.append(arg + " "); } + + System.out.println("Received Command : " + sb.toString()); } } } From e57d0093412785a7adaa551f3212e1deafa8f596 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 3 Sep 2016 01:11:50 -0400 Subject: [PATCH 21/21] Remove unused import! --- .../src/mineplex/enjinTranslator/Enjin.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index c270f2211..1463aa537 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -7,7 +7,6 @@ import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubRepository;