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 5494a5672..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 @@ -1,36 +1,22 @@ package mineplex.core.common.skin; import java.lang.reflect.Field; -import java.util.Base64; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.UUID; import com.google.common.collect.Maps; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.mojang.authlib.minecraft.InsecureTextureException; import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; -import net.minecraft.server.v1_8_R3.Item; -import net.minecraft.server.v1_8_R3.MinecraftKey; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.NBTTagList; -import net.minecraft.server.v1_8_R3.NBTTagString; import org.bukkit.inventory.meta.SkullMeta; public class SkinData @@ -69,6 +55,8 @@ 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="); + 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 @@ -78,11 +66,15 @@ 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 String _skinValue; + private String _skinSignature; + private Property _skinProperty = null; public SkinData(String value, String signature) { - _skinProperty = new Property("textures", value, signature); + _skinValue = value; + _skinSignature = signature; + //_skinProperty = new Property("textures", value, signature); } private SkinData(GameProfile profile) @@ -90,6 +82,11 @@ public class SkinData _skinProperty = profile.getProperties().get("textures").iterator().next(); } + private void getSkinProperty() + { + _skinProperty = new Property("textures", _skinValue, _skinSignature); + } + public ItemStack getSkull() { ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3); @@ -124,6 +121,10 @@ public class SkinData public Property getProperty() { + if (_skinProperty == null) + { + getSkinProperty(); + } return new Property(_skinProperty.getName(), _skinProperty.getValue(), _skinProperty.getSignature()); } @@ -168,4 +169,4 @@ public class SkinData return null; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 9d373e031..85addffe3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -8,10 +8,12 @@ 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; import mineplex.core.bonuses.gui.SpinGui; +import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; import mineplex.core.bonuses.redis.VoteHandler; import mineplex.core.bonuses.redis.VotifierCommand; import mineplex.core.common.Rank; @@ -30,6 +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.PowerPlayClubRepository; import mineplex.core.recharge.Recharge; import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; @@ -123,6 +126,7 @@ public class BonusManager extends MiniClientPlugin implements I private StatsManager _statsManager; private FacebookManager _facebookManager; private YoutubeManager _youtubeManager; + private PowerPlayClubRepository _powerPlayClubRepository; private ThankManager _thankManager; public boolean _enabled; private Npc _carlNpc; @@ -150,6 +154,10 @@ public class BonusManager extends MiniClientPlugin implements I _repository = new BonusRepository(plugin, this, donationManager); _clientManager = clientManager; _donationManager = donationManager; + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); + + System.out.print("VOTIFIER: "); + System.out.print("DONATION MANAGER - > " + _donationManager.toString()); _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); @@ -173,6 +181,11 @@ public class BonusManager extends MiniClientPlugin implements I _inventoryManager = inventoryManager; _thankManager = thankManager; + if (gadgetManager == null) + { + System.out.print("GM NULL"); + } + _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); _pollManager = pollManager; @@ -180,6 +193,8 @@ public class BonusManager extends MiniClientPlugin implements I _facebookManager = facebookManager; _youtubeManager = youtubeManager; + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager); + _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); _voteList.add("http://vote2.mineplex.com"); @@ -226,6 +241,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 @@ -508,7 +524,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")); } } }); @@ -909,6 +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, _powerPlayClubRepository)) availableRewards++; Hologram hologram; @@ -1091,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)) + 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())) { @@ -1199,4 +1216,19 @@ public class BonusManager extends MiniClientPlugin implements I return _thankManager; } + public DonationManager getDonationManager() + { + return _donationManager; + } + + public PowerPlayClubRepository getPowerPlayClubRepository() + { + return _powerPlayClubRepository; + } + + public InventoryManager getInventoryManager() + { + return _inventoryManager; + } + } 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 new file mode 100644 index 000000000..edc65deb4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/PowerPlayCommand.java @@ -0,0 +1,45 @@ +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.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import java.time.LocalDate; + +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 < 1) + { + UtilPlayer.message(caller, F.main("Power Play Club", "Missing Args: " + F.elem("/powerplay "))); + return; + } + + Player player = Bukkit.getPlayer(args[0]); + if (player == null) { + caller.sendMessage(ChatColor.RED + "Couldn't find player"); + return; + } + + _bonusManager.getPowerPlayClubRepository().Get(player).setSubscribed(true); + _bonusManager.getPowerPlayClubRepository().addSubscription(_bonusManager.getClientManager().Get(player).getAccountId(), LocalDate.now(), "month"); + + caller.sendMessage(ChatColor.GREEN + "Gave a month's subscription to " + player.getName()); + } +} 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 d5beff79e..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,7 +37,9 @@ public class BonusGui extends SimpleGui setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, thankManager)); - setItem(31, 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 new file mode 100644 index 000000000..103bdf28e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -0,0 +1,134 @@ +package mineplex.core.bonuses.gui.buttons; + +import mineplex.core.bonuses.BonusManager; +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.PowerPlayClubRepository; +import mineplex.core.powerplayclub.PowerPlayClubRewards; +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; + +import java.util.ArrayList; + +public class PowerPlayClubButton implements GuiItem +{ + + private ItemStack _item; + private Player _player; + private PowerPlayClubRepository _powerPlayClubRepository; + private InventoryManager _inventoryManager; + private BonusManager _bonusManager; + + public PowerPlayClubButton(Player player, BonusManager manager) + { + _player = player; + _bonusManager = manager; + _powerPlayClubRepository = manager.getPowerPlayClubRepository(); + _inventoryManager = manager.getInventoryManager(); + } + + @Override + public void setup() + { + setItem(); + } + + @Override + public void close() + { + + } + + @Override + public void click(ClickType clickType) + { + if (isAvailable() && !_bonusManager.getPowerPlayClubRepository().alreadyClaimed(_player)) + { + _player.closeInventory(); + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + PowerPlayClubRewards.giveAllItems(_player, _inventoryManager, _powerPlayClubRepository); + } + else + { + _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); + if (_powerPlayClubRepository.alreadyClaimed(_player)) + { + 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 + "!")); + } + } + } + + @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(C.cYellow + "Rewards"); + lore.add(" " + C.cWhite + "2 Game Amplifiers"); + lore.add(" " + C.cWhite + "1 Omega Chest"); + 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)); //TODO: figure this out + if (!isAvailable()) + { + lore.add(" "); + if (_powerPlayClubRepository.alreadyClaimed(_player)) + { + 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); + } + + private boolean isAvailable() + { + return _powerPlayClubRepository.canClaim(_player); + } + + public static boolean isAvailable(Player player, PowerPlayClubRepository repo) + { + return repo.canClaim(player); + } + +} 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/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index a97cd2921..7b45bada6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -1,56 +1,25 @@ package mineplex.core.disguise.disguises; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Future; + import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.playerdisguise.PlayerDisguiseManager; import mineplex.core.thread.ThreadPool; import mineplex.core.utils.UtilGameProfile; -import net.minecraft.server.v1_8_R3.AttributeInstance; -import net.minecraft.server.v1_8_R3.AttributeMapServer; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.IInventory; -import net.minecraft.server.v1_8_R3.ITileEntityContainer; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.MobEffect; -import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PacketPlayOutAbilities; -import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEffect; -import net.minecraft.server.v1_8_R3.PacketPlayOutExperience; -import net.minecraft.server.v1_8_R3.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.*; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_8_R3.PacketPlayOutPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes; -import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateHealth; -import net.minecraft.server.v1_8_R3.WorldSettings; -import org.bukkit.Bukkit; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerChangedWorldEvent; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; -import java.util.function.Supplier; public class DisguisePlayer extends DisguiseHuman { @@ -480,4 +449,4 @@ public class DisguisePlayer extends DisguiseHuman } return this._originalProfile.getId(); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 260ce09cd..596bf68c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -34,6 +34,7 @@ public class DonationManager extends MiniClientPlugin private NautHashMap> _coinQueue = new NautHashMap>(); private Queue _coinAttemptQueue; + private final CoreClientManager _clientManager; public DonationManager(JavaPlugin plugin, CoreClientManager clientManager, String webAddress) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 5bac4e047..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; @@ -26,11 +24,7 @@ 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; @@ -83,6 +77,7 @@ import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStr import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatItem; import mineplex.core.gadget.gadgets.hat.HatType; +import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -147,6 +142,9 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.gadget.persistence.UserGadgetPersistence; +import mineplex.core.gadget.set.suits.SetRaveSuit; +import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; @@ -155,7 +153,6 @@ import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; -import mineplex.core.gadget.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetEmerald; @@ -168,8 +165,6 @@ import mineplex.core.gadget.set.SetShadow; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; -import mineplex.core.gadget.set.suits.SetRaveSuit; -import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -185,6 +180,7 @@ import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.gadget.types.WinEffectGadget; 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; @@ -209,6 +205,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; @@ -226,9 +223,9 @@ public class GadgetManager extends MiniPlugin private Set _gadgetCollideWhitelist = new HashSet<>(); 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); @@ -246,6 +243,7 @@ public class GadgetManager extends MiniPlugin _hologramManager = hologramManager; _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); + _incognitoManager = incognitoManager; createGadgets(); createSets(); @@ -342,6 +340,9 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphTitan(this)); addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); + addGadget(new MorphSquid(this)); + // Not being added in this update! + //addGadget(new MorphMetalMan(this)); // Particles addGadget(new ParticleFoot(this)); @@ -1023,6 +1024,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 @@ -1122,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 36bdfd764..25e3cf585 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -9,11 +9,10 @@ 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.ClientInventory; 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 @@ -23,100 +22,107 @@ 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, "lockCosmetics"); _plugin = plugin; } - @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); - } + @Override + public void Execute(Player caller, String[] args) + { + // Adds all cosmetic types + if (args.length == 0) + { + removeCosmetics(null, caller); + } + // Adds specific type + else + { + String type = args[0]; + if (type.equalsIgnoreCase("all")) + { + removeCosmetics(null, caller); + } else if (type.equalsIgnoreCase("pet")) { - lockPets(caller); + removePets(caller); } else if (type.equalsIgnoreCase("mount")) { - lockMounts(caller); + removeMounts(caller); } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - lockCosmetics(gadgetType, 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 lockCosmetics(GadgetType gadgetType, Player caller) - { - if (gadgetType == null) - { - for (GadgetType type : GadgetType.values()) - { - lockCosmetics(type, caller); - } - lockMounts(caller); - lockPets(caller); - return; - } + private void removeCosmetics(GadgetType gadgetType, Player caller) + { + if (gadgetType == null) + { + for (GadgetType type : GadgetType.values()) + { + if (type == GadgetType.ITEM) + continue; + removeCosmetics(type, caller); + } + removeMounts(caller); + removePets(caller); + return; + } + ClientInventory clientInventory = _plugin.getInventoryManager().Get(caller); int removed = 0; - for (Gadget gadget : _plugin.getGadgets(gadgetType)) - { - if (gadget.getGadgetType() == GadgetType.ITEM) + int amount = -1; + for (Gadget gadget : _plugin.getGadgets(gadgetType)) + { + if (gadgetType == GadgetType.ITEM) continue; if (gadget.ownsGadget(caller)) { - Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName()); - if (clientItem == null) - continue; - _plugin.getInventoryManager().Get(caller).removeItem(new ClientItem(clientItem, 1)); - 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 + " " + - UtilText.plural("item", removed) + ")")); - } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + " gadgets! (Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("item", removed) + ")")); + } - private void lockMounts(Player caller) + private void removeMounts(Player caller) { int removed = 0; + ClientInventory clientInventory = _plugin.getInventoryManager().Get(caller); for (Mount mount : _plugin.getMountManager().getMounts()) { if (mount.hasMount(caller)) { - Item clientItem = _plugin.getInventoryManager().getItem(mount.getName()); - if (clientItem == null) - continue; - _plugin.getInventoryManager().Get(caller).removeItem(new ClientItem(clientItem, 1)); - 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 + " " + UtilText.plural("mount", removed) + "!")); } - private void lockPets(Player caller) + private void removePets(Player caller) { int removed = 0; for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) @@ -130,4 +136,5 @@ public class LockCosmeticsCommand extends CommandBase 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/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/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index 29641ce98..d7a971b6a 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).getRealOrDisguisedRank()); @@ -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 75dc613cb..292731c04 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).getRealOrDisguisedRank()); @@ -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 2c6be003f..a79b99e70 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 @@ -52,7 +52,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).getRealOrDisguisedRank()); @@ -67,7 +67,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 74faab8a5..a47ac5929 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).getRealOrDisguisedRank()); @@ -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 734d8f0e0..ab8854690 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).getRealOrDisguisedRank()); @@ -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 e0dd79087..acc2f9b55 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).getRealOrDisguisedRank()); @@ -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 0c8bcc296..97b71e2f6 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).getRealOrDisguisedRank()); @@ -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 new file mode 100644 index 000000000..77e2ee795 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -0,0 +1,135 @@ +package mineplex.core.gadget.gadgets.morph; + +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 mineplex.core.utils.UtilGameProfile; +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); + + 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); + } + + @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 dbf439dc0..9ba729c67 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).getRealOrDisguisedRank()); @@ -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 1faab01c8..175c37b02 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 bd7400c2c..5eac2c67f 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).getRealOrDisguisedRank()); @@ -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 dada28da5..fb18e05e2 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 @@ -56,7 +56,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).getRealOrDisguisedRank()); @@ -67,7 +67,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 new file mode 100644 index 000000000..620b34454 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -0,0 +1,142 @@ +package mineplex.core.gadget.gadgets.morph; + +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[]{ + 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 + 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); + onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + 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) + { + + Player player = event.getPlayer(); + + if (!player.isSneaking()) + return; + + if (!isActive(player)) + return; + + if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) + return; + + 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 f2ef8d5d8..d2a2002aa 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).getRealOrDisguisedRank()); @@ -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 e5fa3bca1..fd47f1695 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 @@ -45,7 +45,7 @@ public class MorphUncleSam extends MorphGadget @Override public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player, message); + this.applyArmor(player, message); GameProfile profile = UtilGameProfile.getGameProfile(player); profile.getProperties().clear(); @@ -61,7 +61,7 @@ public class MorphUncleSam extends MorphGadget @Override public void disableCustom(Player player, boolean message) { - this.RemoveArmor(player); + this.removeArmor(player); Manager.getDisguiseManager().undisguise(this._disguises.remove(player.getUniqueId())); } 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 e0f9edd70..f358e0662 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 @@ -48,7 +48,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).getRealOrDisguisedRank()); @@ -59,7 +59,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 682b79bd7..fb765a163 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/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/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 new file mode 100644 index 000000000..7e1b6baa1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java @@ -0,0 +1,50 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +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/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/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.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/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/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java new file mode 100644 index 000000000..2e64c98a0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -0,0 +1,154 @@ +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(); + } + + 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.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.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 947cb4494..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; @@ -43,28 +45,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 +55,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 +67,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 +138,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 +213,21 @@ public class RewardManager // WINTER Gadgets 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); } @@ -737,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() @@ -824,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); } @@ -890,7 +595,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 +728,11 @@ public class RewardManager if(pool == Type.NORMAL) { _rewardPools.get(Type.CARL_SPINNER).add(reward); - + if(!(reward instanceof InventoryReward)) + { _rewardPools.get(Type.ILLUMINATED).add(reward); + } } _rewardPools.get(pool).add(reward); } @@ -1033,7 +740,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 c52d63dce..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; /** @@ -53,6 +55,7 @@ public class RewardPool VALENTINES_GIFT(false), ILLUMINATED(false), FREEDOM(false), + OMEGA(false), CARL_SPINNER(true); private boolean _useDuplicates; @@ -76,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 edbc18dfe..2f82d9805 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/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 7c6f86666..bfacf8bb0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -1,14 +1,9 @@ package mineplex.core.treasure; +import java.util.List; + 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.common.util.*; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetBlockEvent; @@ -40,8 +35,6 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; -import java.util.List; - public class TreasureLocation implements Listener { private TreasureManager _treasureManager; @@ -132,7 +125,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)) { @@ -159,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 230730a6c..1dd1b3a8b 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; @@ -22,8 +25,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; -import java.util.List; - /** * Created by Shaun on 8/27/2014. */ 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..46751e601 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, false, 50000); 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..64c41c636 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 { @@ -74,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; @@ -101,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; @@ -133,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 4276e57ad..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,12 +59,12 @@ public class BuyChestButton implements IButton 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; - } + 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; + } 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 e1648228c..8d23c05d5 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,30 @@ public class TreasurePage extends ShopPageBase freedomLore.add(" "); freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); + List omegaLore = new ArrayList<>(); + 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); 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); + ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); addItem(40, shards); @@ -198,6 +216,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 e0296c21b..1463aa537 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -7,9 +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.PowerPlayClubRepository; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -22,6 +22,7 @@ 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; @@ -34,6 +35,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor private DonationManager _donationManager; private InventoryManager _inventoryManager; private PurchaseManager _purchaseManager; + private PowerPlayClubRepository _powerPlayClubRepository; private NautHashMap> _cachedUUIDs = new NautHashMap>(); private static Object _commandLock = new Object(); @@ -51,6 +53,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _inventoryManager = inventoryManager; _purchaseManager = new PurchaseManager(plugin); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); @@ -101,26 +104,29 @@ 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)) { StringBuilder sb = new StringBuilder(); @@ -278,6 +284,28 @@ 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[2].equalsIgnoreCase("add")) + { + 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")) + { + // TODO: cancel it in our logs? I don't think this is necessary. + } + + return false; + } protected boolean checkForClansPurchase(String[] args, final String name, final CoreClient client) { 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.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index d0f79058e..8a1f26fa0 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -184,7 +184,8 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter _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, Managers.get(ProjectileManager.class), 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/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 57574ac61..5bca51671 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,45 +1,4 @@ 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 java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -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.server.ServerListPingEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.Managers; import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; @@ -56,14 +15,7 @@ import mineplex.core.chat.ChatFormat; import mineplex.core.chat.IChatMessageFormatter; 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.*; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -117,16 +69,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.MavericksManager; -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; @@ -140,6 +83,30 @@ 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.*; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +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.*; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.*; public class HubManager extends MiniClientPlugin implements IChatMessageFormatter { @@ -228,7 +195,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess _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, Managers.get(ProjectileManager.class), achievementManager, packetHandler, hologramManager); + _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); 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/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()); 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()); } 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. 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 0f052bbfe..dec5c6343 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -160,7 +160,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); ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager); BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); 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)); } } 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); 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 af551dfb6..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 @@ -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,10 @@ 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 + || event.GetGame().Manager.GetHost() != null) { return; } @@ -328,7 +333,7 @@ public class NextBestGameManager implements Listener owner.sendMessage(" "); - new CountdownRunnable(party); + _tasks.put(player.getUniqueId(), new CountdownRunnable(party)); } else { owner.sendMessage(" "); @@ -357,6 +362,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; @@ -395,7 +410,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 +429,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 { @@ -628,7 +643,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) { diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java index f5d9f4215..e9ab99136 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java @@ -132,7 +132,7 @@ public class Hub extends JavaPlugin 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); + preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito); ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager); BoosterManager boosterManager = new BoosterManager(this, serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager); RewardManager rewardManager = new RewardManager(_clientManager, _donationManager, inventoryManager, petManager, statsManager, gadgetManager);