diff --git a/.gitignore b/.gitignore index 36fe02146..c493b1b8a 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,4 @@ zSotanna2 /.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments.gen /.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1 /.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock -/Pocket +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_ diff --git a/.recommenders/caches/identified-project-coordinates.json b/.recommenders/caches/identified-project-coordinates.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/.recommenders/caches/identified-project-coordinates.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.recommenders/caches/manual-mappings.json b/.recommenders/caches/manual-mappings.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/.recommenders/caches/manual-mappings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Art/BlackFriday.png b/Art/BlackFriday.png new file mode 100644 index 000000000..d63feef85 Binary files /dev/null and b/Art/BlackFriday.png differ diff --git a/Art/ChristmasChaos.png b/Art/ChristmasChaos.png new file mode 100644 index 000000000..92bf27cd3 Binary files /dev/null and b/Art/ChristmasChaos.png differ diff --git a/Art/ClansBanner.png b/Art/ClansBanner.png new file mode 100644 index 000000000..2de832c70 Binary files /dev/null and b/Art/ClansBanner.png differ diff --git a/Art/TitanLogo.png b/Art/TitanLogo.png new file mode 100644 index 000000000..55e0fb104 Binary files /dev/null and b/Art/TitanLogo.png differ diff --git a/Art/WinterTreasure.png b/Art/WinterTreasure.png new file mode 100644 index 000000000..6df116afc Binary files /dev/null and b/Art/WinterTreasure.png differ diff --git a/Art/WinterTreasureTrim.png b/Art/WinterTreasureTrim.png new file mode 100644 index 000000000..d40145a51 Binary files /dev/null and b/Art/WinterTreasureTrim.png differ diff --git a/Art/y5O7WYh.png b/Art/y5O7WYh.png new file mode 100644 index 000000000..774ca95a2 Binary files /dev/null and b/Art/y5O7WYh.png differ diff --git a/Art/zKzkfLE.png b/Art/zKzkfLE.png new file mode 100644 index 000000000..e349a664a Binary files /dev/null and b/Art/zKzkfLE.png differ diff --git a/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml b/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml index d44ba58ec..cc62eda71 100644 --- a/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml +++ b/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml index 55d803b0b..8ac831c95 100644 --- a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml +++ b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml @@ -20,8 +20,8 @@ - + \ No newline at end of file diff --git a/Plugins/.idea/artifacts/Nautilus_Core_Craftbukkit_jar.xml b/Plugins/.idea/artifacts/Nautilus_Core_Craftbukkit_jar.xml deleted file mode 100644 index b855273ea..000000000 --- a/Plugins/.idea/artifacts/Nautilus_Core_Craftbukkit_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - $PROJECT_DIR$/bin - - - - - - \ No newline at end of file diff --git a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml index 619cdf3df..79c3170ce 100644 --- a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml +++ b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml @@ -19,7 +19,7 @@ - + \ No newline at end of file diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index df8666836..ec08cea77 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -23,7 +23,7 @@ - + diff --git a/Plugins/.idea/dataSources.xml b/Plugins/.idea/dataSources.xml index dea8a489b..3aa4d521d 100644 --- a/Plugins/.idea/dataSources.xml +++ b/Plugins/.idea/dataSources.xml @@ -1,6 +1,6 @@ - + mysql true diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml index a8626a3f1..c3f549fab 100644 --- a/Plugins/.idea/modules.xml +++ b/Plugins/.idea/modules.xml @@ -5,19 +5,19 @@ + - - - - + + + + - - + diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml index 4200a7c8a..234d9f195 100644 --- a/Plugins/BuildFiles/common.xml +++ b/Plugins/BuildFiles/common.xml @@ -9,6 +9,7 @@ + @@ -86,7 +87,7 @@ - + @@ -110,6 +111,7 @@ + @@ -142,6 +144,7 @@ + @@ -158,7 +161,7 @@ - + @@ -191,6 +194,7 @@ + @@ -210,7 +214,7 @@ - + @@ -239,6 +243,7 @@ + @@ -249,7 +254,7 @@ - + @@ -276,6 +281,7 @@ + @@ -329,7 +335,7 @@ - + @@ -403,6 +409,7 @@ + @@ -435,6 +442,7 @@ + @@ -462,6 +470,7 @@ + @@ -490,6 +499,7 @@ + diff --git a/Plugins/Mineplex.Bungee.Mineplexer/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Bungee.Mineplexer/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Bungee.Mineplexer/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml b/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml index 872b77ead..a1a0bd8bf 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml +++ b/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml @@ -13,6 +13,6 @@ - + \ No newline at end of file diff --git a/Plugins/Mineplex.BungeeRotator/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.BungeeRotator/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.BungeeRotator/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.PlayerCache/.classpath b/Plugins/Mineplex.Cache/.classpath similarity index 100% rename from Plugins/Mineplex.PlayerCache/.classpath rename to Plugins/Mineplex.Cache/.classpath diff --git a/Plugins/Mineplex.Cache/.project b/Plugins/Mineplex.Cache/.project new file mode 100644 index 000000000..5321c2157 --- /dev/null +++ b/Plugins/Mineplex.Cache/.project @@ -0,0 +1,17 @@ + + + Mineplex.Cache + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.PlayerCache/Mineplex.PlayerCache.iml b/Plugins/Mineplex.Cache/Mineplex.Cache.iml similarity index 100% rename from Plugins/Mineplex.PlayerCache/Mineplex.PlayerCache.iml rename to Plugins/Mineplex.Cache/Mineplex.Cache.iml diff --git a/Plugins/Mineplex.PlayerCache/src/mineplex/cache/player/PlayerCache.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java similarity index 100% rename from Plugins/Mineplex.PlayerCache/src/mineplex/cache/player/PlayerCache.java rename to Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java diff --git a/Plugins/Mineplex.PlayerCache/src/mineplex/cache/player/PlayerInfo.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java similarity index 100% rename from Plugins/Mineplex.PlayerCache/src/mineplex/cache/player/PlayerInfo.java rename to Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java diff --git a/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Core.Common/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java index 6a007fefa..e54f9f28f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java @@ -4,10 +4,10 @@ import org.bukkit.Material; public enum CurrencyType { - Tokens(" Tokens", Material.EMERALD), - Coins(" Coins", Material.DOUBLE_PLANT), - Gems(" Gems", Material.EMERALD), - Gold(" Gold", Material.GOLD_NUGGET); + Tokens("Tokens", Material.EMERALD), + Coins("Treasure Shards", Material.PRISMARINE_SHARD), + Gems("Gems", Material.EMERALD), + Gold("Gold", Material.GOLD_NUGGET); private String _prefix; private Material _displayMaterial; 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 new file mode 100644 index 000000000..f53e986b2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -0,0 +1,97 @@ +package mineplex.core.common.skin; + +import java.util.List; + +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; + +public class SkinData +{ + + private static long _nameCount = -99999999999999L; + + public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); + 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 SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU="); + public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU="); + public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc="); + public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); + + private Property _skinProperty; + + public SkinData(String value, String signature) + { + _skinProperty = new Property("textures", value, signature); + } + + public SkinData(GameProfile profile) + { + _skinProperty = profile.getProperties().get("textures").iterator().next(); + } + + public SkinData(Player player) + { + this(((CraftPlayer)player).getProfile()); + } + + public ItemStack getSkull() + { + NBTTagCompound arrayElement = new NBTTagCompound(); + arrayElement.setString("Value", _skinProperty.getValue()); + arrayElement.setString("Signature", _skinProperty.getSignature()); + + NBTTagList textures = new NBTTagList(); + textures.add(arrayElement); + + NBTTagCompound properties = new NBTTagCompound(); + properties.set("textures", textures); + + NBTTagCompound skullOwner = new NBTTagCompound(); + skullOwner.set("Properties", properties); + skullOwner.set("Name", new NBTTagString(getUnusedSkullName())); + + NBTTagCompound tag = new NBTTagCompound(); + tag.set("SkullOwner", skullOwner); + + + net.minecraft.server.v1_8_R3.ItemStack nmsItem = new net.minecraft.server.v1_8_R3.ItemStack(Item.REGISTRY.get(new MinecraftKey("skull")), 1, 3); + nmsItem.setTag(tag); + + + return CraftItemStack.asBukkitCopy(nmsItem); + } + + public ItemStack getSkull(String name, List lore) + { + ItemStack stack = getSkull(); + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(name); + meta.setLore(lore); + stack.setItemMeta(meta); + return stack; + } + + public Property getProperty() + { + return new Property(_skinProperty.getName(), _skinProperty.getValue(), _skinProperty.getSignature()); + } + + public static String getUnusedSkullName() + { + _nameCount++; + return "_" + _nameCount; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java index 7d5f00c91..bab76df51 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java @@ -4,6 +4,8 @@ import org.bukkit.ChatColor; public class C { + public static final String blankLine = ChatColor.RESET + " "; + public static String Scramble = "§k"; public static String Bold = "§l"; public static String Strike = "§m"; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java index db1e528f3..fd2a34ec6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java @@ -106,6 +106,11 @@ public class F return rank.getTag(false, false); } + public static String value(String variable, int value) + { + return value(variable, "" + value); + } + public static String value(String variable, String value) { return value(0, variable, value); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/LineFormat.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/LineFormat.java index 8f5f7320e..2db7d259f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/LineFormat.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/LineFormat.java @@ -2,7 +2,7 @@ package mineplex.core.common.util; public enum LineFormat { - LORE(200), CHAT(319); + LORE(220), CHAT(319); private int _length; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index d7896c943..a1b747a9e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -249,12 +249,30 @@ public class UtilParticle public static void PlayParticleToAll(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist) { - PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers()); + float x = 0; + float y = 0; + float z = 0; + if(offset != null) + { + x = (float) offset.getX(); + y = (float) offset.getY(); + z = (float) offset.getZ(); + } + PlayParticle(type, location, x, y, z, speed, count, dist, UtilServer.getPlayers()); } public static void PlayParticle(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist, Player... players) { - PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, players); + float x = 0; + float y = 0; + float z = 0; + if(offset != null) + { + x = (float) offset.getX(); + y = (float) offset.getY(); + z = (float) offset.getZ(); + } + PlayParticle(type, location, x, y, z, speed, count, dist, players); } public static void PlayParticleToAll(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, @@ -283,4 +301,26 @@ public class UtilParticle UtilPlayer.sendPacket(player, packet); } } + + public static void PlayParticleToAll(String particle, Location location, Vector offset, float speed, int count, ViewDist dist) + { + float x = 0; + float y = 0; + float z = 0; + if(offset != null) + { + x = (float) offset.getX(); + y = (float) offset.getY(); + z = (float) offset.getZ(); + } + PlayParticle(particle, location, x, y, z, speed, count, dist, UtilServer.getPlayers()); + } + + public static void PlayParticleToAll(String particle, Location location, float offsetX, float offsetY, float offsetZ, + float speed, int count, ViewDist dist) + { + PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); + } + + } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 86826296e..38e540824 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -260,6 +260,16 @@ public class UtilText return string; } + public static String[] splitLinesToArray(String[] strings, LineFormat lineFormat) + { + ArrayList lineList = splitLines(strings, lineFormat); + + String[] lineArray = new String[lineList.size()]; + lineArray = lineList.toArray(lineArray); + + return lineArray; + } + public static ArrayList splitLines(String[] strings, LineFormat lineFormat) { ArrayList lines = new ArrayList(); @@ -271,10 +281,35 @@ public class UtilText return lines; } + + public static String[] splitLineToArray(String string, LineFormat lineFormat) + { + ArrayList lineList = splitLine(string, lineFormat); + + String[] lineArray = new String[lineList.size()]; + lineArray = lineList.toArray(lineArray); + + return lineArray; + } public static ArrayList splitLine(String string, LineFormat lineFormat) { ArrayList strings = new ArrayList(); + + //Ignore lines with # + if (string.startsWith("#")) + { + strings.add(string.substring(1, string.length())); + return strings; + } + + //Empty + if (string.equals("") || string.equals(" ")) + { + strings.add(string); + return strings; + } + String current = ""; int currentLength = 0; String[] split = string.split(" "); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java index 908272bc6..5d5174f16 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java @@ -3,6 +3,8 @@ package mineplex.core.common.util; import java.text.SimpleDateFormat; import java.util.Calendar; +import net.minecraft.server.v1_8_R3.MinecraftServer; + public class UtilTime { public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss"; @@ -41,6 +43,15 @@ public class UtilTime default: return "th"; } } + + /** + * + * @return Returns the current global server tick. Is reset on server restart. Starts out negative. Counts upwards. + */ + public static int getServerTick() + { + return MinecraftServer.currentTick; + } public enum TimeUnit { diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath index 067e728d7..6af7218d7 100644 --- a/Plugins/Mineplex.Core/.classpath +++ b/Plugins/Mineplex.Core/.classpath @@ -15,5 +15,7 @@ + + diff --git a/Plugins/Mineplex.Core/Mineplex.Core.iml b/Plugins/Mineplex.Core/Mineplex.Core.iml index 06f039df9..c6de528e3 100644 --- a/Plugins/Mineplex.Core/Mineplex.Core.iml +++ b/Plugins/Mineplex.Core/Mineplex.Core.iml @@ -20,6 +20,6 @@ - + \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index 790df2c43..af619626b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -35,6 +35,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerVelocityEvent; @@ -81,6 +83,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook _loggedIn.remove(event.getPlayer()); } + @EventHandler(priority = EventPriority.LOW) + public void playerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + player.setCustomName(""); + player.setCustomNameVisible(false); + } + @EventHandler public void ncpExempt(final PlayerToggleFlightEvent event) { @@ -140,7 +151,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { Entry> entry = iterator.next(); - for (Iterator> innerIterator = entry.getValue().entrySet().iterator(); innerIterator.hasNext();) + for (Iterator> innerIterator = entry.getValue().entrySet().iterator(); innerIterator + .hasNext();) { final Entry entry2 = innerIterator.next(); @@ -247,7 +259,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook _entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName); _entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[] { - newId + newId }); sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1); @@ -349,7 +361,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { newId = new Integer[] { - UtilEnt.getNewEntityId() + UtilEnt.getNewEntityId() }; _entityMap.get(owner.getName()).put(metaPacket.a, newId); @@ -469,8 +481,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook _entityRiding.get(owner.getName()).remove(attachPacket.b); - sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], - _entityNameMap.get(owner.getName()).get(vehicleId), verifier, true, ids.length > 1 ? ids[0] : -1); + sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], _entityNameMap.get(owner.getName()).get(vehicleId), + verifier, true, ids.length > 1 ? ids[0] : -1); } else { @@ -527,9 +539,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle())); squidWatcher.a(0, (byte) (0 | 1 << 5)); - final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); + PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); spawnPacket.a = squidId; spawnPacket.b = (byte) EntityType.SQUID.getTypeId(); + spawnPacket.c = 1000000; spawnPacket.l = squidWatcher; @@ -543,9 +556,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook UtilPlayer.sendPacket(owner, vehiclePacket); } - final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); + PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); spawnPacket.a = newEntityId; spawnPacket.b = (byte) 30; + spawnPacket.c = 1000000; spawnPacket.l = watcher; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 011a49065..e9e5e6cac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -109,7 +109,7 @@ public enum AchievementCategory ONE_IN_THE_QUIVER("One in the Quiver", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"), + Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit"), SUPER_PAINTBALL("Super Paintball", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -141,7 +141,7 @@ public enum AchievementCategory MICRO_BATTLE("Micro Battle", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.LAVA, 0, GameCategory.ARCADE, null), + Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null), BOMB_LOBBERS("Bomb Lobbers", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java index fd7b557af..0941d4a2a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java @@ -16,6 +16,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; public class Fly extends MiniPlugin implements Detector { @@ -128,6 +130,10 @@ public class Fly extends MiniPlugin implements Detector } } + for (PotionEffect effect : player.getActivePotionEffects()) + if (effect.getType() == PotionEffectType.JUMP || effect.getType().equals(PotionEffectType.JUMP)) + nearBlocks = true; + if (nearBlocks) { count = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java index bb6d8c9f3..bdd50e4d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java @@ -17,6 +17,9 @@ public class BonusAmount private int _experience; private int _bonusExperience; private int _tickets; + private int _oldChests; + private int _ancientChests; + private int _mythicalChests; public BonusAmount() { @@ -133,19 +136,52 @@ public class BonusAmount _tickets = tickets; } + public int getOldChests() + { + return _oldChests; + } + + public void setOldChests(int oldChests) + { + _oldChests = oldChests; + } + + public int getAncientChests() + { + return _ancientChests; + } + + public void setAncientChests(int ancientChests) + { + _ancientChests = ancientChests; + } + + public int getMythicalChests() + { + return _mythicalChests; + } + + public void setMythicalChests(int mythicalChests) + { + _mythicalChests = mythicalChests; + } + public boolean isGreaterThanZero() { - return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0; + return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0; } public void addLore(List lore) { lore.add(C.cYellow + "Rewards"); addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : "")); - addLore(lore, getCoins(), getBonusCoins(), "Coins"); + addLore(lore, getCoins(), getBonusCoins(), "Treasure Shards"); addLore(lore, getGems(), getBonusGems(), "Gems"); addLore(lore, getGold(), getBonusGold(), "Gold"); addLore(lore, getExperience(), getBonusExperience(), "Experience"); + addLore(lore, getOldChests(), 0, "Old Chest", "Old Chests"); + addLore(lore, getAncientChests(), 0, "Ancient Chest", "Ancient Chests"); + addLore(lore, getMythicalChests(), 0, "Mythical Chest", "Mythical Chests"); } private void addLore(List lore, int amount, int bonus, String suffix) @@ -156,4 +192,12 @@ public class BonusAmount // if (bonus > 0) // lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix); } + + private void addLore(List lore, int amount, int bonus, String suffix, String plural) + { + if (amount == 1) + lore.add(" " + C.cWhite + amount + " " + plural); + else if (amount > 0) + lore.add(" " + C.cWhite + amount + " " + suffix); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 71ee2abe0..e5076f9b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -43,6 +43,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.Tables; @@ -122,6 +123,7 @@ public class BonusManager extends MiniClientPlugin implements I private BonusRepository _repository; private CoreClientManager _clientManager; + private InventoryManager _inventoryManager; private DonationManager _donationManager; private PollManager _pollManager; private NpcManager _npcManager; @@ -174,6 +176,7 @@ public class BonusManager extends MiniClientPlugin implements I _donationManager = donationManager; _npcManager = npcManager; _hologramManager = hologramManager; + _inventoryManager = inventoryManager; _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, 100, 250, @@ -673,21 +676,21 @@ public class BonusManager extends MiniClientPlugin implements I BonusAmount data = new BonusAmount(); - if (rank.has(Rank.MODERATOR)) + if (rank.has(Rank.TITAN)) { - data.setCoins(35000); + data.setMythicalChests(5); } - if (rank.has(Rank.LEGEND)) + else if (rank.has(Rank.LEGEND)) { - data.setCoins(30000); + data.setMythicalChests(3); } else if (rank.has(Rank.HERO)) { - data.setCoins(15000); + data.setMythicalChests(2); } else if (rank.has(Rank.ULTRA)) { - data.setCoins(7500); + data.setMythicalChests(1); } return data; @@ -722,6 +725,27 @@ public class BonusManager extends MiniClientPlugin implements I final int coins = amount.getTotalCoins(); final int tickets = amount.getTickets(); int experience = amount.getTotalExperience(); + int oldChests = amount.getOldChests(); + int ancientChests = amount.getAncientChests(); + int mythicalChests = amount.getMythicalChests(); + + if (oldChests > 0) + { + _inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests); + UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests"))); + } + + if (ancientChests > 0) + { + UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); + _inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests); + } + + if (mythicalChests > 0) + { + UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); + _inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests); + } if (gems > 0) { @@ -750,7 +774,7 @@ public class BonusManager extends MiniClientPlugin implements I if (coins > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Coins"))); + UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards"))); _coinQueue.add(new GiveDonorData(player.getName(), coreClient.getAccountId(), player.getUniqueId(), coins)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java index 6c150e409..0c4a1c6f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java @@ -265,7 +265,7 @@ public class BonusRepository extends RepositoryBase final int accountId = _manager.getClientManager().Get(player).getAccountId(); final int coins = _manager.getRankBonusAmount(player).getCoins(); - if (coins == 0/* && gems == 0 */) { + if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) { result.run(false); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 48e7d35f2..9394628ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -19,7 +19,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.OutfitTeam; +import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.inventory.InventoryManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java new file mode 100644 index 000000000..e280de6c2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java @@ -0,0 +1,23 @@ +package mineplex.core.cosmetic.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.ArrowTrailPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.shop.item.IButton; + +public class OpenArrowTrails extends OpenPageButton +{ + public OpenArrowTrails(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new ArrowTrailPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Arrow Trails", player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java index 347a007be..01f528d6e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java @@ -1,23 +1,20 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.gadget.types.Gadget; -public class OpenCostumes implements IButton +public class OpenCostumes extends OpenPageButton { - private Menu _menu; - - public OpenCostumes(Menu menu) + public OpenCostumes(Menu menu, Gadget active) { - _menu = menu; + super(menu, active); } @Override - public void onClick(Player player, ClickType clickType) + protected void leftClick(Player player) { - _menu.openCostumes(player); + getMenu().openCostumes(player); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java new file mode 100644 index 000000000..f16d51e65 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java @@ -0,0 +1,24 @@ +package mineplex.core.cosmetic.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.DeathEffectPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.shop.item.IButton; + +public class OpenDeathAnimations extends OpenPageButton +{ + + public OpenDeathAnimations(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new DeathEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Death Animations", player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java new file mode 100644 index 000000000..4506defc4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java @@ -0,0 +1,23 @@ +package mineplex.core.cosmetic.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.DoubleJumpPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.shop.item.IButton; + +public class OpenDoubleJump extends OpenPageButton +{ + public OpenDoubleJump(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new DoubleJumpPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Double Jump Effects", player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java index 79a62a52f..a981afc88 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java @@ -2,23 +2,23 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -public class OpenGadgets implements IButton +public class OpenGadgets extends OpenPageButton { - private Menu _page; - - public OpenGadgets(Menu page) + + public OpenGadgets(Menu menu, Gadget active) { - _page = page; + super(menu, active); } @Override - public void onClick(Player player, ClickType clickType) + protected void leftClick(Player player) { - _page.getShop().openPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player)); + getMenu().getShop().openPageForPlayer(player, new GadgetPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Gadgets", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java new file mode 100644 index 000000000..126382e58 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java @@ -0,0 +1,21 @@ +package mineplex.core.cosmetic.ui.button; + +import org.bukkit.entity.Player; + +import mineplex.core.cosmetic.ui.page.HatPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; + +public class OpenHats extends OpenPageButton +{ + public OpenHats(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new HatPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Hats", player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java index 8666c1bfb..34d6ac932 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java @@ -2,22 +2,21 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.MorphPage; -import mineplex.core.shop.item.IButton; +import mineplex.core.gadget.types.Gadget; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -public class OpenMorphs implements IButton +public class OpenMorphs extends OpenPageButton { - private Menu _page; - - public OpenMorphs(Menu page) + + public OpenMorphs(Menu menu, Gadget active) { - _page = page; + super(menu, active); } - - public void onClick(Player player, ClickType clickType) + + @Override + protected void leftClick(Player player) { - _page.getShop().openPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player)); + getMenu().getShop().openPageForPlayer(player, new MorphPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Morphs", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java index d71c566a8..17dea9154 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java @@ -2,6 +2,8 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.MountPage; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.mount.Mount; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; @@ -9,15 +11,28 @@ import org.bukkit.event.inventory.ClickType; public class OpenMounts implements IButton { - private Menu _page; - - public OpenMounts(Menu page) + private Menu _menu; + private Mount _active; + + public OpenMounts(Menu menu, Mount active) { - _page = page; + _menu = menu; + _active = active; } - + + @Override public void onClick(Player player, ClickType clickType) { - _page.getShop().openPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player)); + if (clickType.isLeftClick()) + _menu.getShop().openPageForPlayer(player, new MountPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Mounts", player)); + else + { + if (_active != null) + { + _menu.playAcceptSound(player); + _active.Disable(player); + _menu.refresh(); + } + } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java index 72d1c2d18..b158901cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java @@ -4,22 +4,19 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; import mineplex.core.shop.item.IButton; -/** - * Created by shaun on 14-09-15. - */ -public class OpenMusic implements IButton +public class OpenMusic extends OpenPageButton { - private Menu _menu; - - public OpenMusic(Menu menu) + public OpenMusic(Menu menu, Gadget active) { - _menu = menu; + super(menu, active); } - public void onClick(Player player, ClickType clickType) + @Override + protected void leftClick(Player player) { - _menu.openMusic(player); + getMenu().openMusic(player); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java new file mode 100644 index 000000000..7e0a4159a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java @@ -0,0 +1,48 @@ +package mineplex.core.cosmetic.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.shop.item.IButton; + +public abstract class OpenPageButton implements IButton +{ + private Menu _menu; + private Gadget _active; + + public OpenPageButton(Menu menu, Gadget active) + { + _active = active; + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (clickType.isLeftClick()) + leftClick(player); + else + { + if (_active != null) + { + _menu.playAcceptSound(player); + _active.Disable(player); + _menu.refresh(); + } + } + } + + protected Menu getMenu() + { + return _menu; + } + + protected Gadget getActive() + { + return _active; + } + + protected abstract void leftClick(Player player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java index 37e9cf1e1..b464e0b22 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java @@ -2,22 +2,23 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.ParticlePage; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.Gadget; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -public class OpenParticles implements IButton +public class OpenParticles extends OpenPageButton { - private Menu _page; - - public OpenParticles(Menu page) + public OpenParticles(Menu menu, Gadget active) { - _page = page; + super(menu, active); } - public void onClick(Player player, ClickType clickType) + @Override + protected void leftClick(Player player) { - _page.getShop().openPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player)); + getMenu().getShop().openPageForPlayer(player, new ParticlePage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Particles", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java index fdaaa0e19..78c7790e0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java @@ -1,7 +1,9 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.cosmetic.ui.page.MountPage; import mineplex.core.cosmetic.ui.page.PetPage; +import mineplex.core.pet.Pet; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; @@ -9,16 +11,23 @@ import org.bukkit.event.inventory.ClickType; public class OpenPets implements IButton { - private Menu _page; - - public OpenPets(Menu page) + private Menu _menu; + + public OpenPets(Menu menu) { - _page = page; + _menu = menu; } @Override public void onClick(Player player, ClickType clickType) { - _page.getShop().openPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player)); + if (clickType.isLeftClick()) + _menu.getShop().openPageForPlayer(player, new PetPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Pets", player)); + else + { + _menu.playAcceptSound(player); + _menu.getPlugin().getPetManager().RemovePet(player, true); + _menu.refresh(); + } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java new file mode 100644 index 000000000..621b36d20 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java @@ -0,0 +1,53 @@ +package mineplex.core.cosmetic.ui.page; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class ArrowTrailPage extends GadgetPage +{ + + public ArrowTrailPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, + Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail)) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 144131e81..47e4ea4ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -1,18 +1,23 @@ package mineplex.core.cosmetic.ui.page; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuit; +import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuit; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; @@ -36,19 +41,20 @@ public class CostumePage extends GadgetPage { int slot; - List costumeClasses = new ArrayList(); - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) { + if (gadget.GetCost(CurrencyType.Coins) == -1) + continue; + OutfitGadget outfitGadget = ((OutfitGadget) gadget); - Class clazz = gadget.getClass(); - if (!costumeClasses.contains(clazz)) - { - costumeClasses.add(clazz); - } - - slot = (costumeClasses.indexOf(clazz) * 2) + 3 + 18; + int offset = 0; + + if (gadget instanceof OutfitRaveSuit) offset = 0; + else if (gadget instanceof OutfitSpaceSuit) offset = 1; + else offset = 2; + + slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest) slot += 9; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java new file mode 100644 index 000000000..65d92f6e0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java @@ -0,0 +1,53 @@ +package mineplex.core.cosmetic.ui.page; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class DeathEffectPage extends GadgetPage +{ + + public DeathEffectPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, + String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death)) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java new file mode 100644 index 000000000..5b7c18b70 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java @@ -0,0 +1,53 @@ +package mineplex.core.cosmetic.ui.page; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class DoubleJumpPage extends GadgetPage +{ + + public DoubleJumpPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, + Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump)) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 6a75916e6..264411b62 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -4,9 +4,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; @@ -19,10 +22,10 @@ import mineplex.core.cosmetic.ui.button.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton; import mineplex.core.cosmetic.ui.button.GadgetButton; import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.gadgets.MorphBlock; -import mineplex.core.gadget.gadgets.MorphNotch; +import mineplex.core.gadget.gadgets.morph.MorphBlock; 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.shop.item.IButton; import mineplex.core.shop.item.ShopItem; @@ -31,33 +34,33 @@ import mineplex.core.shop.page.ShopPageBase; public class GadgetPage extends ShopPageBase { - public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) - { - super(plugin, shop, clientManager, donationManager, name, player, 54); - - buildPage(); - } - - protected void buildPage() - { - int slot = 19; - - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) - { - if (gadget.GetCost(CurrencyType.Coins) == -3) - continue; - - addGadget(gadget, slot); - - if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0) - addGlow(slot); - - slot++; - - if (slot == 26) - slot = 28; - } - + public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 54); + + buildPage(); + } + + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) + { + if (gadget.GetCost(CurrencyType.Coins) == -3) + continue; + + addGadget(gadget, slot); + + if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() { public void onClick(Player player, ClickType clickType) @@ -65,72 +68,245 @@ public class GadgetPage extends ShopPageBase getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); } }); - } - - protected void addGadget(Gadget gadget, int slot) - { - if (gadget instanceof MorphNotch) - { - //setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false)); - //return; - } - else if (gadget instanceof MorphBlock) + } + + protected void addGadget(Gadget gadget, int slot) + { + if (gadget instanceof MorphBlock) { - //Prevent stacker bug if (getPlayer().getPassenger() != null) return; } - List itemLore = new ArrayList(); - - if (gadget.GetCost(CurrencyType.Coins) >= 0) - { - itemLore.add(C.cYellow + gadget.GetCost(CurrencyType.Coins) + " Coins"); - } - else if (gadget.GetCost(CurrencyType.Coins) == -2) - { - itemLore.add(C.cGold + "Found in Treasure Chests."); - } - else if (gadget.GetCost(CurrencyType.Coins) == -3) - { - - } + List itemLore = new ArrayList(); - - itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(gadget.GetDescription())); - - if (gadget instanceof ItemGadget) - { - itemLore.add(C.cBlack); - itemLore.add(C.cGreen + "Right-Click To Purchase:"); - itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins"); - itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); - } - - if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()) || getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()) > 0) - { - if (gadget.GetActive().contains(getPlayer())) - { - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Deactivate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this)); - } - else - { - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Activate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this)); - } - } - else - { - if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins)) - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this)); - else - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); - } - } + itemLore.add(C.cBlack); + itemLore.addAll(Arrays.asList(gadget.GetDescription())); + + if (gadget.getSet() != null) + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhite + gadget.getSet().getName() + " Set;"); + + //Elements + for (Gadget cur : gadget.getSet().getGadgets()) + itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen + '▪' : C.cDRed + '▪' ) + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); + + itemLore.add(C.cBlack); + + //Bonus + itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus;"); + for (String bonus : gadget.getSet().getBonus()) + itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus); + } + + if (!gadget.ownsGadget(getPlayer())) + { + if (gadget.GetCost(CurrencyType.Coins) == -1) + { + //Nothing + } + //Chest Unlocks + else if (gadget.GetCost(CurrencyType.Coins) == -2 || gadget.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Treasure Chests"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -3) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -4) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -5) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); + } + //Rank Unlocks + else if (gadget.GetCost(CurrencyType.Coins) == -10) + { + itemLore.add(C.cBlack); + itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -11) + { + itemLore.add(C.cBlack); + itemLore.add(C.cPurple + "Unlocked with Hero Rank"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -12) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Unlocked with Legend Rank"); + } + else if (gadget.GetCost(CurrencyType.Coins) == -13) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Unlocked with Titan Rank"); + } + } + + //Special case for item gadgets! + if (gadget instanceof ItemGadget) + { + ItemGadget itemGadget = (ItemGadget)gadget; + + itemLore.add(C.cBlack); + itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); + +// boolean canAffordAmmo = true; +// if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) > 0) +// { +// itemLore.add(C.cBlack); +// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins"); +// +// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().GetCost(CurrencyType.Coins)) +// { +// itemLore.add(C.cGreen + "Right-Click To Purchase"); +// } +// else +// { +// itemLore.add(C.cRed + "Not Enough Treasure Shards."); +// canAffordAmmo = false; +// } +// } + + if (itemGadget.hasAmmo(getPlayer())) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Left-Click to Enable"); + + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this)); + } + else + { + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new ActivateGadgetButton(gadget, this)); + } + + return; + } + + if(gadget instanceof HatGadget) + { + ItemStack item = ((HatGadget)gadget).getHelmetItem(); + + ItemMeta im = item.getItemMeta(); + im.setDisplayName(C.cGreen + C.Bold + gadget.GetName()); + + if (gadget.ownsGadget(getPlayer())) + { + if (gadget.GetActive().contains(getPlayer())) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Disable"); + + im.setLore(itemLore); + item.setItemMeta(im); + addButton(slot, new ShopItem(item, false, false), new DeactivateGadgetButton(gadget, this)); + } + else + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Enable"); + + im.setLore(itemLore); + item.setItemMeta(im); + addButton(slot, new ShopItem(item, false, false), new ActivateGadgetButton(gadget, this)); + } + } + else + { + if (gadget.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards"); + } + + if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins)) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Purchase"); + + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this)); + } + else if (gadget.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Not enough Treasure Shards."); + + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + else + { + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + } + + return; + } + + //Standard + if (gadget.ownsGadget(getPlayer())) + { + if (gadget.GetActive().contains(getPlayer())) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Disable"); + + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this)); + } + else + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Enable"); + + addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this)); + } + } + else + { + if (gadget.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards"); + } + + if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins)) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Purchase"); + + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this)); + } + else if (gadget.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Not enough Treasure Shards."); + + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + else + { + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + } + } public void purchaseGadget(final Player player, final Gadget gadget) { + //Dont allow purchase! + if (gadget instanceof ItemGadget) + { + ItemGadget itemGadget = (ItemGadget)gadget; + + if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) < 0) + return; + } + if(getClientManager().Get(player).isDisguised()) { UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!")); @@ -148,27 +324,27 @@ public class GadgetPage extends ShopPageBase public void activateGadget(Player player, Gadget gadget) { - if (gadget instanceof ItemGadget) - { - if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) - { - purchaseGadget(player, gadget); - return; - } - } - + // if (gadget instanceof ItemGadget) + // { + // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) + // { + // purchaseGadget(player, gadget); + // return; + // } + // } + playAcceptSound(player); gadget.Enable(player); - + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); } public void handleRightClick(Player player, Gadget gadget) { - if (gadget instanceof ItemGadget) - { - purchaseGadget(player, gadget); - } + // if (gadget instanceof ItemGadget) + // { + // purchaseGadget(player, gadget); + // } } public void deactivateGadget(Player player, Gadget gadget) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java new file mode 100644 index 000000000..54da91d25 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java @@ -0,0 +1,57 @@ +package mineplex.core.cosmetic.ui.page; + +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class HatPage extends GadgetPage +{ + + + public HatPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, + Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat); + if(list != null) + for (Gadget gadget : list) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index e77751779..76077f8f6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -1,20 +1,34 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; + import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.NautArrayList; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilUI; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.button.OpenArrowTrails; import mineplex.core.cosmetic.ui.button.OpenCostumes; +import mineplex.core.cosmetic.ui.button.OpenDeathAnimations; +import mineplex.core.cosmetic.ui.button.OpenDoubleJump; import mineplex.core.cosmetic.ui.button.OpenGadgets; +import mineplex.core.cosmetic.ui.button.OpenHats; import mineplex.core.cosmetic.ui.button.OpenMorphs; import mineplex.core.cosmetic.ui.button.OpenMounts; import mineplex.core.cosmetic.ui.button.OpenMusic; @@ -25,11 +39,13 @@ import mineplex.core.donation.Donor; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; +import mineplex.core.pet.Pet; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; import mineplex.core.treasure.TreasureKey; +import mineplex.core.treasure.TreasureType; public class Menu extends ShopPageBase { @@ -43,124 +59,182 @@ public class Menu extends ShopPageBase @Override protected void buildPage() { - Donor donor = getDonationManager().Get(getPlayer()); + // Treasure Shards + int treasureShards = getDonationManager().Get(getPlayer()).getCoins(); -// addItem(2, new ShopItem(CurrencyType.Gems.GetDisplayMaterial(), donor.GetGems() + " Gems", new String[] { -// " " -// }, 1, false)); + List shardLore = new ArrayList(); + shardLore.add(" "); + shardLore.add(C.cGray + "This seems like it might come in"); + shardLore.add(C.cGray + "handy. Maybe I can collect more!"); + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); + addItem(4, shards); - addItem(4, new ShopItem(175, getDonationManager().Get(getPlayer().getName()).getCoins() + " Coins", new String[] + // Cosmetic Items +// int[] slots = UtilUI.getIndicesFor(12, 2); + int particleSlot = 10;//slots[0]; + int arrowSlot = 12;//slots[1]; + int jumpSlot = 14;//slots[2]; + int deathSlot = 16;//slots[3]; + int gadgetSlot = 28;//slots[4]; + int morphSlot = 30;//slots[5]; + int mountSlot = 32;//slots[6]; + int petSlot = 34;//slots[7]; + int hatSlot = 46;//slots[8]; + int costumeSlot = 48;//slots[9]; + int musicSlot = 50;//slots[10]; + int tauntSlot = 52;//slots[11]; + + EnumMap ownedCount = new EnumMap(GadgetType.class); + EnumMap maxCount = new EnumMap(GadgetType.class); + EnumMap enabled = new EnumMap(GadgetType.class); + + for(GadgetType type : GadgetType.values()) + { + ownedCount.put(type, 0); + maxCount.put(type, 0); + + List gadgets = getPlugin().getGadgetManager().getGadgets(type); + if (gadgets != null) + { + for (Gadget gadget : gadgets) { - " ", - ChatColor.RESET + C.cYellow + "Purchase Coins", - ChatColor.RESET + "www.mineplex.com/shop", - " ", - ChatColor.RESET + C.cAqua + "Ultra Rank", - ChatColor.RESET + "Receives 7500 Coins per Month", - " ", - ChatColor.RESET + C.cPurple + "Hero Rank", - ChatColor.RESET + "Receives 15000 Coins per Month", - " ", - ChatColor.RESET + C.cGreen + "Legend Rank", - ChatColor.RESET + "Receives 30000 Coins per Month" - }, 1, false)); - -// addItem(6, new ShopItem(Material.GOLD_INGOT, donor.getGold() + " Gold", new String[] { -// " " -// }, 1, false)); - - addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this)); - addButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this)); - addButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this)); - addButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this)); - addButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this)); - // - addButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this)); - addButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this)); - - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) != null) - { - final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle); - - addButton(18 + 9, - new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false), - new IButton() + if (gadget.ownsGadget(getPlayer())) { - public void onClick(Player player, ClickType clickType) - { - playAcceptSound(player); - gadget.Disable(player); - refresh(); - } - }); + ownedCount.put(type, ownedCount.get(type) + 1); + } + + maxCount.put(type, maxCount.get(type) + 1); + } + } + + final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type); + if(gadget != null) enabled.put(type, gadget); } - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item) != null) + int mountOwned = 0; + int mountMax = 0; + Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); + for (Mount mount : getPlugin().getMountManager().getMounts()) { - final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item); + if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.GetName()) || mount.HasMount(getPlayer())) + { + mountOwned++; + } - addButton(20 + 9, - new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false), - new IButton() - { - public void onClick(Player player, ClickType clickType) - { - playAcceptSound(player); - gadget.Disable(player); - refresh(); - } - }); - } - - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) != null) - { - final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph); - - addButton(22 + 9, - new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false), - new IButton() - { - public void onClick(Player player, ClickType clickType) - { - playAcceptSound(player); - gadget.Disable(player); - refresh(); - } - }); + mountMax++; } - if (getPlugin().getMountManager().getActive(getPlayer()) != null) + int petOwned = 0; + int petMax = 0; + for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets()) { - final Mount mount = getPlugin().getMountManager().getActive(getPlayer()); + NautHashMap pets = getPlugin().getPetManager().Get(getPlayer()).GetPets(); + if (pets != null && pets.containsKey(pet.GetPetType())) + { + petOwned++; + } - addButton(24 + 9, - new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[]{}, 1, false, false), - new IButton() - { - public void onClick(Player player, ClickType clickType) - { - playAcceptSound(player); - mount.Disable(player); - refresh(); - } - }); + petMax++; } + Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); - if (getPlugin().getPetManager().hasActivePet(getPlayer().getName())) + GadgetType type = GadgetType.Particle; + String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); + addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(particleSlot); + + type = GadgetType.ArrowTrail; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type)); + addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(arrowSlot); + + type = GadgetType.DoubleJump; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type)); + addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(jumpSlot); + + type = GadgetType.Death; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type)); + addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(deathSlot); + + type = GadgetType.Item; + lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zaney contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); + addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(gadgetSlot); + + type = GadgetType.Morph; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you can’t be a tiger! That’s silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); + addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(morphSlot); + + lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName()); + addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive)); + if (mountActive != null) addGlow(mountSlot); + + lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", "Usable in Lobbies", petActive == null ? null : petActive.getCustomName()); + addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); + if (petActive != null) addGlow(petSlot); + + type = GadgetType.Hat; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type)); + addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(hatSlot); + + type = GadgetType.Costume; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type)); + addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(costumeSlot); + + type = GadgetType.MusicDisc; + lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); + addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(musicSlot); + + addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton() { - Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName()); - String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName(); - addButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[]{}, 1, false, false), - new IButton() - { - public void onClick(Player player, ClickType clickType) - { - playAcceptSound(player); - getPlugin().getPetManager().RemovePet(player, true); - refresh(); - } - }); + @Override + public void onClick(Player player, ClickType clickType) + { + player.sendMessage(F.main("Shop", "Coming soon!")); + } + }); + } + + private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) + { + return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName()); + } + + private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled) + { + if (enabled != null) + { + return UtilText.splitLinesToArray(new String[] { + C.blankLine, + C.cGray + info, + C.cDGray + visibility, + C.blankLine, + C.cWhite + "You own " + ownedCount + "/" + maxCount, + C.blankLine, + C.cWhite + "Active: " + C.cYellow + enabled, + C.cGreen + "Right-Click to Disable", + C.blankLine, + C.cGreen + "Left-Click to View Category" + }, LineFormat.LORE); + } + else + { + return UtilText.splitLinesToArray(new String[] { + C.blankLine, + C.cGray + info, + C.cDGray + visibility, + C.blankLine, + C.cWhite + "You own " + ownedCount + "/" + maxCount, + C.blankLine, + C.cGreen + "Left-Click to View Category" + }, LineFormat.LORE); } } @@ -173,16 +247,4 @@ public class Menu extends ShopPageBase { getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player)); } - - public void attemptPurchaseKey(Player player) - { - getShop().openPageForPlayer(player, new ConfirmationPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable() - { - public void run() - { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1); - refresh(); - } - }, this, new TreasureKey(), CurrencyType.Coins, getPlayer())); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java index 508a58276..fb425172d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java @@ -37,6 +37,8 @@ public class MorphPage extends GadgetPage if (slot == 26) slot = 28; + if (slot == 35) + slot = 37; } addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 2ed930507..356635962 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -24,65 +24,137 @@ import mineplex.core.shop.page.ShopPageBase; public class MountPage extends ShopPageBase { - public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) - { - super(plugin, shop, clientManager, donationManager, name, player, 54); - - buildPage(); - } - - protected void buildPage() - { - int slot = 19; - - for (Mount mount : getPlugin().getMountManager().getMounts()) - { - addMount(mount, slot); - slot++; - - if (slot == 26) - slot = 28; - } - - addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 54); + + buildPage(); + } + + protected void buildPage() + { + int slot = 19; + + for (Mount mount : getPlugin().getMountManager().getMounts()) + { + addMount(mount, slot); + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() { public void onClick(Player player, ClickType clickType) { getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); } }); - } - - protected void addMount(Mount mount, int slot) - { - List itemLore = new ArrayList(); - - if (mount.GetCost(CurrencyType.Coins) != -1) - { - itemLore.add(C.cYellow + mount.GetCost(CurrencyType.Coins) + " Coins"); - } - - itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(mount.GetDescription())); - - if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) - { - if (mount.GetActive().containsKey(getPlayer())) - { - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Deactivate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); - } - else - { - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Activate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); - } - } - else - { - if (mount.GetCost(CurrencyType.Coins) != -1 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins)) - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this)); - else - setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); - } - - } + } + + protected void addMount(Mount mount, int slot) + { + List itemLore = new ArrayList(); + + itemLore.add(C.cBlack); + itemLore.addAll(Arrays.asList(mount.GetDescription())); + + if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + { + if (mount.GetCost(CurrencyType.Coins) == -1) + { + //Nothing + } + //Chest Unlocks + else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Treasure Chests"); + } + else if (mount.GetCost(CurrencyType.Coins) == -3) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); + } + else if (mount.GetCost(CurrencyType.Coins) == -4) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); + } + else if (mount.GetCost(CurrencyType.Coins) == -5) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); + } + //Rank Unlocks + else if (mount.GetCost(CurrencyType.Coins) == -10) + { + itemLore.add(C.cBlack); + itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); + } + else if (mount.GetCost(CurrencyType.Coins) == -11) + { + itemLore.add(C.cBlack); + itemLore.add(C.cPurple + "Unlocked with Hero Rank"); + } + else if (mount.GetCost(CurrencyType.Coins) == -12) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Unlocked with Legend Rank"); + } + else if (mount.GetCost(CurrencyType.Coins) == -13) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Unlocked with Titan Rank"); + } + } + + + if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + { + if (mount.GetActive().containsKey(getPlayer())) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Disable"); + + addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); + } + else + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Enable"); + + addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); + } + } + else + { + if (mount.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.Coins) + " Treasure Shards"); + } + + if (mount.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins)) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Purchase"); + + addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); + } + else if (mount.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Not enough Treasure Shards."); + + setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + else + { + setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } + } + + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java index 97d39abbb..94f34f5eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java @@ -30,7 +30,7 @@ public class ParticlePage extends GadgetPage { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index cd562f903..4e796c47e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -61,27 +61,60 @@ public class PetPage extends ShopPageBase { List itemLore = new ArrayList(); - //Halloween Name - if (pet.GetCost(CurrencyType.Coins) == -1) + itemLore.add(C.cBlack); + itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!"); + + //Chest Unlocks + if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) { - if (pet instanceof Pumpkin) - { - itemLore.add(C.cBlack); - itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King"); - itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Halloween Horror Event."); - } - if (pet instanceof Elf) - { - itemLore.add(C.cBlack); - itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King"); - itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Christmas Chaos Event."); - } - if (pet.GetPetType() == EntityType.WITHER) - { - itemLore.add(C.cBlack); - itemLore.add(ChatColor.RESET + C.cGreen + "Unlocked with Legend Rank"); - } - } + if (pet.GetCost(CurrencyType.Coins) == -1) + { + //Nothing + } + + else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Treasure Chests"); + } + else if (pet.GetCost(CurrencyType.Coins) == -3) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); + } + else if (pet.GetCost(CurrencyType.Coins) == -4) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); + } + else if (pet.GetCost(CurrencyType.Coins) == -5) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); + } + + //Rank Unlocks + else if (pet.GetCost(CurrencyType.Coins) == -10) + { + itemLore.add(C.cBlack); + itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); + } + else if (pet.GetCost(CurrencyType.Coins) == -11) + { + itemLore.add(C.cBlack); + itemLore.add(C.cPurple + "Unlocked with Hero Rank"); + } + else if (pet.GetCost(CurrencyType.Coins) == -12) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Unlocked with Legend Rank"); + } + else if (pet.GetCost(CurrencyType.Coins) == -13) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Unlocked with Titan Rank"); + } + } //Owned if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) @@ -94,35 +127,52 @@ public class PetPage extends ShopPageBase if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType()) { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Disable"); + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - "Deactivate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); addGlow(slot); } else { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Enable"); + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - "Activate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); } } //Not Owned else { - //Cost Lore if (pet.GetCost(CurrencyType.Coins) > 0) - { - itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins"); - itemLore.add(C.cBlack); - } + { + itemLore.add(C.cBlack); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.Coins) + " Treasure Shards"); + } - if (pet.GetCost(CurrencyType.Coins) == -1) + if (pet.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins)) + { + itemLore.add(C.cBlack); + itemLore.add(C.cGreen + "Click to Purchase"); + + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); + } + else if (pet.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cBlack); + itemLore.add(C.cRed + "Not enough Treasure Shards."); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); - else if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins)) - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetButton(pet, this)); + } else - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + { + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + } } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 2ca6490f6..05b1c2d6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -64,7 +64,16 @@ public class PetTagPage extends ShopPageBase { _tagName = ChatColor.stripColor(_tagName); _tagName = _tagName.replaceAll("[^A-Za-z0-9]", ""); - + System.out.println("Pet name: " + _tagName + "."); + if (_tagName.length() == 0) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), new PetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pets", getPlayer())); + return; + } + if (_tagName.length() > 16) { UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java new file mode 100644 index 000000000..93aeac8d5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java @@ -0,0 +1,57 @@ +package mineplex.core.cosmetic.ui.page; + +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; + +public class TauntPage extends GadgetPage +{ + + + public TauntPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, + Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt); + if(list != null) + for (Gadget gadget : list) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 4b39e5a77..ee25da25d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -9,35 +9,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; -import net.minecraft.server.v1_8_R3.Block; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.Chunk; -import net.minecraft.server.v1_8_R3.ChunkSection; -import net.minecraft.server.v1_8_R3.EntityTrackerEntry; -import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PacketPlayOutBed; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; -import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; -import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; -import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; -import net.minecraft.server.v1_8_R3.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -73,11 +44,39 @@ import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketVerifier; import mineplex.core.packethandler.PacketInfo; +import mineplex.core.packethandler.PacketVerifier; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkSection; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; +import net.minecraft.server.v1_8_R3.PacketPlayOutBed; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity; +import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; +import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes; +import net.minecraft.server.v1_8_R3.WorldServer; public class DisguiseManager extends MiniPlugin implements IPacketHandler { @@ -382,9 +381,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler for (Player player : players) addViewerToDisguise(disguise, player, false); - if (disguise.GetEntity() instanceof Player && disguise instanceof DisguisePlayer) + if (disguise.GetEntity() instanceof EntityPlayer && disguise instanceof DisguisePlayer) { - if (!((Player) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) + if (!((EntityPlayer) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) { _blockedNames.add(((Player) disguise.GetEntity()).getName()); } 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 d5f933f83..d81a3086e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -2,29 +2,25 @@ package mineplex.core.disguise.disguises; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; import com.mojang.authlib.GameProfile; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.skin.SkinData; import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PacketPlayInSettings; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R3.WorldSettings; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_8_R3.WorldSettings; public class DisguisePlayer extends DisguiseHuman { private GameProfile _profile; private boolean _sneaking; private BlockFace _sleeping; + private boolean _sendSkinToSelf; public DisguisePlayer(org.bukkit.entity.Entity entity) { @@ -46,6 +42,29 @@ public class DisguisePlayer extends DisguiseHuman _profile = newProfile; } + + public GameProfile getProfile() + { + return _profile; + } + + public void setSkinData(SkinData skin) + { + _profile.getProperties().put("textures", skin.getProperty()); + } + + /** + * Currently not working. + */ + public void setSendSkinDataToSelf(boolean sendToSelf) + { + _sendSkinToSelf = sendToSelf; + } + + public boolean getSendSkinDataToSelf() + { + return _sendSkinToSelf; + } public BlockFace getSleepingDirection() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index bb17d1e2f..449a4e52f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,73 +1,9 @@ package mineplex.core.gadget; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; - -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.achievement.AchievementManager; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.event.GadgetActivateEvent; -import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.gadgets.ItemBatGun; -import mineplex.core.gadget.gadgets.ItemCoinBomb; -import mineplex.core.gadget.gadgets.ItemDuelingSword; -import mineplex.core.gadget.gadgets.ItemEtherealPearl; -import mineplex.core.gadget.gadgets.ItemFirework; -import mineplex.core.gadget.gadgets.ItemFleshHook; -import mineplex.core.gadget.gadgets.ItemMelonLauncher; -import mineplex.core.gadget.gadgets.ItemPaintballGun; -import mineplex.core.gadget.gadgets.ItemPaintbrush; -import mineplex.core.gadget.gadgets.ItemTNT; -import mineplex.core.gadget.gadgets.MorphBat; -import mineplex.core.gadget.gadgets.MorphBlaze; -import mineplex.core.gadget.gadgets.MorphBlock; -import mineplex.core.gadget.gadgets.MorphBunny; -import mineplex.core.gadget.gadgets.MorphChicken; -import mineplex.core.gadget.gadgets.MorphCow; -import mineplex.core.gadget.gadgets.MorphCreeper; -import mineplex.core.gadget.gadgets.MorphEnderman; -import mineplex.core.gadget.gadgets.MorphPig; -import mineplex.core.gadget.gadgets.MorphPumpkinKing; -import mineplex.core.gadget.gadgets.MorphSlime; -import mineplex.core.gadget.gadgets.MorphTitan; -import mineplex.core.gadget.gadgets.MorphVillager; -import mineplex.core.gadget.gadgets.MorphWither; -import mineplex.core.gadget.gadgets.OutfitRaveSuit; -import mineplex.core.gadget.gadgets.OutfitSpaceSuit; -import mineplex.core.gadget.gadgets.OutfitTeam; -import mineplex.core.gadget.gadgets.ParticleBlizzard; -import mineplex.core.gadget.gadgets.ParticleEnchant; -import mineplex.core.gadget.gadgets.ParticleFairy; -import mineplex.core.gadget.gadgets.ParticleFireRings; -import mineplex.core.gadget.gadgets.ParticleFoot; -import mineplex.core.gadget.gadgets.ParticleGreen; -import mineplex.core.gadget.gadgets.ParticleHeart; -import mineplex.core.gadget.gadgets.ParticleHelix; -import mineplex.core.gadget.gadgets.ParticleLegend; -import mineplex.core.gadget.gadgets.ParticleRain; -import mineplex.core.gadget.gadgets.ParticleTitan; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.gadget.types.MusicGadget; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.mount.MountManager; -import mineplex.core.mount.event.MountActivateEvent; -import mineplex.core.pet.PetManager; -import mineplex.core.preferences.PreferencesManager; -import mineplex.core.projectile.ProjectileManager; +import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -82,6 +18,51 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.gadgets.arrowtrail.*; +import mineplex.core.gadget.gadgets.death.*; +import mineplex.core.gadget.gadgets.doublejump.*; +import mineplex.core.gadget.gadgets.hat.*; +import mineplex.core.gadget.gadgets.item.*; +import mineplex.core.gadget.gadgets.morph.*; +import mineplex.core.gadget.gadgets.outfit.*; +import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.set.SetCandyCane; +import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.set.SetRaveSuit; +import mineplex.core.gadget.set.SetSpaceSuit; +import mineplex.core.gadget.set.SetTitan; +import mineplex.core.gadget.types.ArrowEffectGadget; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetSet; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.gadget.types.MusicGadget; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.pet.PetManager; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.projectile.ProjectileManager; + public class GadgetManager extends MiniPlugin { private CoreClientManager _clientManager; @@ -100,6 +81,8 @@ public class GadgetManager extends MiniPlugin private NautHashMap _lastMove = new NautHashMap(); private NautHashMap> _playerActiveGadgetMap = new NautHashMap>(); + private HashSet _sets = new HashSet<>(); + private boolean _hideParticles = false; private int _activeItemSlot = 3; private boolean _gadgetsEnabled = true; @@ -122,6 +105,19 @@ public class GadgetManager extends MiniPlugin _mountManager = mountManager; CreateGadgets(); + createSets(); + } + + private void createSets() + { + //Particles + addSet(new SetFrostLord(this)); + addSet(new SetCandyCane(this)); + addSet(new SetTitan(this)); + + //Costumes + addSet(new SetRaveSuit(this)); + addSet(new SetSpaceSuit(this)); } private void CreateGadgets() @@ -139,17 +135,21 @@ public class GadgetManager extends MiniPlugin addGadget(new ItemCoinBomb(this)); addGadget(new ItemPaintbrush(this)); addGadget(new ItemDuelingSword(this)); + addGadget(new ItemPartyPopper(this)); + addGadget(new ItemCoal(this)); + addGadget(new ItemFreezeCannon(this)); + addGadget(new ItemSnowball(this)); // Costume - addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); - addGadget(new OutfitRaveSuit(this, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); - addGadget(new OutfitRaveSuit(this, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0)); - addGadget(new OutfitRaveSuit(this, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0)); + addGadget(new OutfitRaveSuitHelmet(this)); + addGadget(new OutfitRaveSuitChestplate(this)); + addGadget(new OutfitRaveSuitLeggings(this)); + addGadget(new OutfitRaveSuitBoots(this)); - addGadget(new OutfitSpaceSuit(this, "Space Helmet", -2, ArmorSlot.Helmet, Material.GLASS, (byte)0)); - addGadget(new OutfitSpaceSuit(this, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0)); - addGadget(new OutfitSpaceSuit(this, "Space Pants", -2, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0)); - addGadget(new OutfitSpaceSuit(this, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0)); + addGadget(new OutfitSpaceSuitHelmet(this)); + addGadget(new OutfitSpaceSuitChestplate(this)); + addGadget(new OutfitSpaceSuitLeggings(this)); + addGadget(new OutfitSpaceSuitBoots(this)); addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -171,6 +171,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphBunny(this)); addGadget(new MorphSlime(this, _achievementManager)); addGadget(new MorphTitan(this)); + addGadget(new MorphSnowman(this)); // Particles addGadget(new ParticleFoot(this)); @@ -182,9 +183,33 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleHeart(this)); addGadget(new ParticleFairy(this)); addGadget(new ParticleLegend(this)); - addGadget(new ParticleBlizzard(this)); + addGadget(new ParticleFrostLord(this)); addGadget(new ParticleTitan(this)); - //addGadget(new ParticleKronos(this)); + addGadget(new ParticleCandyCane(this)); + addGadget(new ParticleCoalFumes(this)); + + // Arrow Trails + addGadget(new ArrowTrailFrostLord(this)); + addGadget(new ArrowTrailTitan(this)); + addGadget(new ArrowTrailCandyCane(this)); + + // Death Effect + addGadget(new DeathFrostLord(this)); + addGadget(new DeathTitan(this)); + addGadget(new DeathCandyCane(this)); + + // Double Jump + addGadget(new DoubleJumpFrostLord(this)); + addGadget(new DoubleJumpTitan(this)); + addGadget(new DoubleJumpCandyCane(this)); + + // Hat + addGadget(new HatSanta(this)); + addGadget(new HatSnowman(this)); + addGadget(new HatPresent(this)); + addGadget(new HatCoal(this)); + addGadget(new HatRudolph(this)); + addGadget(new HatGrinch(this)); // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); @@ -200,6 +225,42 @@ public class GadgetManager extends MiniPlugin addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000)); } + public Gadget getGadget(Class c) + { + for(GadgetType type : GadgetType.values()) + { + for(Gadget gadget : getGadgets(type)) + { + if(gadget.getClass().equals(c)) return gadget; + } + } + return null; + } + + public Set getSets(Gadget gadget) + { + HashSet hset = new HashSet<>(); + for(GadgetSet set : _sets) + { + if(set.isPartOfSet(gadget)) hset.add(set); + } + return hset; + } + + public GadgetSet getGadgetSet(Class c) + { + for(GadgetSet set : _sets) + { + if(set.getClass().equals(c)) return set; + } + return null; + } + + private void addSet(GadgetSet set) + { + _sets.add(set); + } + private void addGadget(Gadget gadget) { if (!_gadgets.containsKey(gadget.getGadgetType())) @@ -231,6 +292,7 @@ public class GadgetManager extends MiniPlugin return _gadgets.get(gadgetType); } + // Disallows two armor gadgets in same slot. public void RemoveOutfit(Player player, ArmorSlot slot) { @@ -250,52 +312,14 @@ public class GadgetManager extends MiniPlugin } } } - - public void RemoveItem(Player player) - { - for (GadgetType gadgetType : _gadgets.keySet()) - { - for (Gadget gadget : _gadgets.get(gadgetType)) - { - if (gadget instanceof ItemGadget) - { - ItemGadget item = (ItemGadget) gadget; - - item.RemoveItem(player); - } - } - } - } - - public void RemoveParticle(Player player) - { - for (GadgetType gadgetType : _gadgets.keySet()) - { - for (Gadget gadget : _gadgets.get(gadgetType)) - { - if (gadget instanceof ParticleGadget) - { - ParticleGadget part = (ParticleGadget) gadget; - - part.Disable(player); - } - } - } - } - public void RemoveMorph(Player player) + public void removeGadgetType(Player player, GadgetType type) { - for (GadgetType gadgetType : _gadgets.keySet()) + List gadgets = _gadgets.get(type); + if(gadgets == null) return; + for(Gadget g : gadgets) { - for (Gadget gadget : _gadgets.get(gadgetType)) - { - if (gadget instanceof MorphGadget) - { - MorphGadget part = (MorphGadget) gadget; - - part.Disable(player); - } - } + g.Disable(player); } } @@ -307,6 +331,15 @@ public class GadgetManager extends MiniPlugin { if (gadget instanceof ParticleGadget) continue; + + if (gadget instanceof ArrowEffectGadget) + continue; + + if (gadget instanceof DoubleJumpEffectGadget) + continue; + + if (gadget instanceof DeathEffectGadget) + continue; for (Player player : UtilServer.getPlayers()) gadget.Disable(player); @@ -391,7 +424,7 @@ public class GadgetManager extends MiniPlugin @EventHandler public void setMoving(PlayerMoveEvent event) { - if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0.1) return; _lastMove.put(event.getPlayer(), System.currentTimeMillis()); @@ -399,6 +432,8 @@ public class GadgetManager extends MiniPlugin public boolean isMoving(Player player) { + if (!UtilEnt.isGrounded(player)) return true; + if (!_lastMove.containsKey(player)) return false; @@ -518,7 +553,7 @@ public class GadgetManager extends MiniPlugin } @EventHandler - public void GadgetActivate(GadgetActivateEvent event) + public void GadgetActivate(GadgetEnableEvent event) { if (!_gadgetsEnabled) event.setCancelled(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetDisableEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetDisableEvent.java new file mode 100644 index 000000000..000eace62 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetDisableEvent.java @@ -0,0 +1,43 @@ +package mineplex.core.gadget.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.gadget.types.Gadget; + +public class GadgetDisableEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Gadget _gadget; + + public GadgetDisableEvent(Player player, Gadget gadget) + { + _player = player; + _gadget = gadget; + } + + public Player getPlayer() + { + return _player; + } + + public Gadget getGadget() + { + return _gadget; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public HandlerList getHandlers() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetActivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetActivateEvent.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java index 913d4860a..05112dfbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetActivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java @@ -7,16 +7,17 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -public class GadgetActivateEvent extends Event +public class GadgetEnableEvent extends Event { private static final HandlerList handlers = new HandlerList(); private Player _player; private Gadget _gadget; + private boolean _cancelled = false; - public GadgetActivateEvent(Player player, Gadget gadget) + public GadgetEnableEvent(Player player, Gadget gadget) { _player = player; _gadget = gadget; @@ -41,7 +42,7 @@ public class GadgetActivateEvent extends Event { return _player; } - + public void setCancelled(boolean cancel) { _cancelled = cancel; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java deleted file mode 100644 index 0c2e75b77..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java +++ /dev/null @@ -1,217 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -import mineplex.core.common.CurrencyType; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -public class ItemGemBomb extends ItemGadget -{ - private HashMap _activeBombs = new HashMap(); - private HashSet _gems = new HashSet(); - - public ItemGemBomb(GadgetManager manager) - { - super(manager, "Gem Party Bomb", new String[] - { - C.cWhite + "It's party time! You will be", - C.cWhite + "everyones favourite player", - C.cWhite + "when you use one of these!", - " ", - C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "This uses 2000 Gems" - }, - -1, - Material.EMERALD, (byte)0, - 30000, new Ammo("Gem Party Bomb", "10 Gem Party Bomb", Material.EMERALD, (byte)0, new String[] { C.cWhite + "10 Coin Party Bomb to PARTY!" }, 10, 10)); - } - - @Override - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) - return; - - Player player = event.getPlayer(); - - if (!IsActive(player)) - return; - - event.setCancelled(true); - - //Stock - if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) - { - - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); - - ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); - Bukkit.getServer().getPluginManager().callEvent(ammoEvent); - - return; - } - - //Gems - if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Gems) < 2000) - { - UtilPlayer.message(player, F.main("Inventory", "You do not have the required " + C.cGreen + "2000 Gems") + "."); - return; - } - - //Already In Use - if (!_activeBombs.isEmpty()) - { - UtilPlayer.message(player, F.main("Inventory", "There is already a " + F.elem(C.cGreen + "Gem Bomb")) + " being used."); - return; - } - - //Recharge - if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false)) - { - UtilInv.Update(player); - return; - } - - //Use Stock/Gems - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); - Manager.getDonationManager().RewardGems(null, GetName(), event.getPlayer().getName(), event.getPlayer().getUniqueId(), -2000); - - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName()))); - - ActivateCustom(event.getPlayer()); - } - - @Override - public void ActivateCustom(Player player) - { - Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.EMERALD_BLOCK)); - UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); - _activeBombs.put(item, System.currentTimeMillis()); - - //Inform - for (Player other : UtilServer.getPlayers()) - UtilPlayer.message(other, C.cGreen + C.Bold + player.getName() + C.cWhite + C.Bold + " has thrown a " + C.cGreen + C.Bold + "Gem Party Bomb" + C.cWhite + C.Bold + "!"); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator itemIterator = _activeBombs.keySet().iterator(); - - while (itemIterator.hasNext()) - { - Item item = itemIterator.next(); - long time = _activeBombs.get(item); - - if (UtilTime.elapsed(time, 3000)) - { - if (Math.random() > 0.80) - UtilFirework.playFirework(item.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BURST).trail(false).build()); - else - item.getWorld().playSound(item.getLocation(), Sound.FIREWORK_LAUNCH, 1f, 1f); - - Item gem = item.getWorld().dropItem(item.getLocation().add(0, 1, 0), new ItemStack(Material.EMERALD)); - - //Velocity - long passed = System.currentTimeMillis() - time; - Vector vel = new Vector(Math.sin(passed/300d), 0, Math.cos(passed/300d)); - - UtilAction.velocity(gem, vel, Math.abs(Math.sin(passed/3000d)), false, 0, 0.2 + Math.abs(Math.cos(passed/3000d))*0.8, 1, false); - - gem.setPickupDelay(40); - - _gems.add(gem); - } - - if (UtilTime.elapsed(time, 23000)) - { - item.remove(); - itemIterator.remove(); - } - } - } - - @EventHandler - public void Pickup(PlayerPickupItemEvent event) - { - if (_activeBombs.keySet().contains(event.getItem())) - { - event.setCancelled(true); - } - else if (_gems.contains(event.getItem())) - { - event.setCancelled(true); - event.getItem().remove(); - - Manager.getDonationManager().RewardGemsLater(GetName() + " Pickup", event.getPlayer(), 4); - - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); - } - } - - @EventHandler - public void Clean(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - Iterator gemIterator = _gems.iterator(); - - while (gemIterator.hasNext()) - { - Item gem = gemIterator.next(); - - if (!gem.isValid() || gem.getTicksLived() > 1200) - { - gem.remove(); - gemIterator.remove(); - } - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemKothSword.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemKothSword.java deleted file mode 100644 index 6bb5d66a0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemKothSword.java +++ /dev/null @@ -1,5 +0,0 @@ -package mineplex.core.gadget.gadgets; - -public class ItemKothSword { - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java deleted file mode 100644 index 628531f40..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java +++ /dev/null @@ -1,75 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.*; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.ProfileLoader; -import mineplex.core.common.util.UUIDFetcher; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; - -public class MorphGeno extends MorphGadget -{ - private GameProfile _profile = null; - - public MorphGeno(GadgetManager manager) - { - super(manager, "Genocide604", new String[] - { - "Say goodbye to Genocide604 by burping", - "and eating a lot.", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Burp", - " ", - C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "This is a temporary item!", - }, - 10, - Material.SKULL_ITEM, (byte)3); - - _profile = new ProfileLoader(UUIDFetcher.getUUIDOf("Genocide604").toString(), "Genocide604").loadProfile(); - } - - @Override - public void EnableCustom(final Player player) - { - this.ApplyArmor(player); - - DisguisePlayer disguise = new DisguisePlayer(player, _profile); - Manager.getDisguiseManager().disguise(disguise); - } - - @Override - public void DisableCustom(Player player) - { - this.RemoveArmor(player); - Manager.getDisguiseManager().undisguise(player); - } - - @EventHandler - public void Action(PlayerInteractEvent event) - { - Player player = event.getPlayer(); - - if (!IsActive(player)) - return; - - if (!UtilEvent.isAction(event, ActionType.L)) - return; - - if (!Recharge.Instance.use(player, GetName(), 1500, false, false)) - return; - - player.getWorld().playSound(player.getEyeLocation(), Sound.BURP, 1f, (float) (0.8f + Math.random() * 0.4f)); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java deleted file mode 100644 index a262c149e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java +++ /dev/null @@ -1,70 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.*; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.ProfileLoader; -import mineplex.core.common.util.UUIDFetcher; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; - -public class MorphNotch extends MorphGadget -{ - private GameProfile _notchProfile = null; - - public MorphNotch(GadgetManager manager) - { - super(manager, "Notch", new String[] - { - "Who wouldn't want to be Notch?!", - //C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA", - }, - 50000, - Material.SKULL_ITEM, (byte)3); - - _notchProfile = new ProfileLoader(UUIDFetcher.getUUIDOf("Notch").toString(), "Notch").loadProfile(); - } - - @Override - public void EnableCustom(final Player player) - { - this.ApplyArmor(player); - - DisguisePlayer disguise = new DisguisePlayer(player, _notchProfile); - Manager.getDisguiseManager().disguise(disguise); - } - - @Override - public void DisableCustom(Player player) - { - this.RemoveArmor(player); - Manager.getDisguiseManager().undisguise(player); - } - - //@EventHandler - public void Action(PlayerInteractEvent event) - { - Player player = event.getPlayer(); - - if (!IsActive(player)) - return; - - if (!UtilEvent.isAction(event, ActionType.L)) - return; - - if (!Recharge.Instance.use(player, GetName(), 1500, false, false)) - return; - - player.sendMessage("You have enforced the EULA."); - - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitSpaceSuit.java deleted file mode 100644 index fe25b7843..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitSpaceSuit.java +++ /dev/null @@ -1,29 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.OutfitGadget; - -public class OutfitSpaceSuit extends OutfitGadget -{ - public OutfitSpaceSuit(GadgetManager manager, String name, - int cost, ArmorSlot slot, Material mat, byte data) - { - super(manager, name, new String[] {ChatColor.RESET + "Wear the complete set for",ChatColor.RESET + "awesome bonus effects!", ChatColor.RESET + "Bonus coming soon..."}, cost, slot, mat, data); - } - - @Override - public void EnableCustom(Player player) - { - ApplyArmor(player); - } - - @Override - public void DisableCustom(Player player) - { - RemoveArmor(player); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java deleted file mode 100644 index b6f57d15b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java +++ /dev/null @@ -1,164 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; - -import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; - -public class ParticleBlizzard extends ParticleGadget -{ - private HashSet _arrows = new HashSet(); - - public ParticleBlizzard(GadgetManager manager) - { - super(manager, "Frost Lord", new String[] - { - C.cWhite + "You are a mighty frost lord.", - C.cWhite + "Your double jumps and arrows", - C.cWhite + "are enchanted with snow powers.", - " ", - C.cPurple + "No longer available", - }, - -1, - Material.SNOW_BALL, (byte)0); - } - - @EventHandler - public void playParticle(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : GetActive()) - { - if (!shouldDisplay(player)) - continue; - - if (Manager.isMoving(player)) - { - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - else - { - player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.015f, 0.2f); - - double scale = (double)(player.getTicksLived() % 50) / 50d; - - for (int i = 0 ; i < 8 ; i++) - { - double r = (1d-scale) * Math.PI * 2; - - double x = Math.sin(r + (i * (Math.PI/4))) * (r%(Math.PI * 4)) * 0.4; - double z = Math.cos(r + (i * (Math.PI/4))) * (r%(Math.PI * 4)) * 0.4; - - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - - if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false)) - { - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60, - ViewDist.NORMAL, UtilServer.getPlayers()); - player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 1f, 1.5f); - } - } - } - } - } - - @EventHandler - public void jump(PlayerToggleFlightEvent event) - { - if (!shouldDisplay(event.getPlayer())) - return; - - if (!event.getPlayer().isFlying()) - if (IsActive(event.getPlayer())) - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.6f, 100, - ViewDist.LONGER, UtilServer.getPlayers()); - } - - @EventHandler - public void arrow(ProjectileLaunchEvent event) - { - if (Manager.hideParticles()) - return; - - if (event.getEntity() instanceof Arrow) - { - if (event.getEntity().getShooter() != null) - { - if (GetActive().contains(event.getEntity().getShooter())) - { - _arrows.add((Arrow)event.getEntity()); - } - } - } - } - - @EventHandler - public void arrow(ProjectileHitEvent event) - { - if (!_arrows.remove(event.getEntity())) - return; - - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getEntity().getLocation(), 0f, 0f, 0f, 0.4f, 12, - ViewDist.LONGER, UtilServer.getPlayers()); - } - - @EventHandler - public void arrowClean(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Arrow arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) - { - arrowIterator.remove(); - } - else - { - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, - ViewDist.LONGER, UtilServer.getPlayers()); - } - } - } - - @EventHandler - public void death(BloodEvent event) - { - if (event.getPlayer() == null) - return; - - if (!IsActive(event.getPlayer())) - return; - - if (!shouldDisplay(event.getPlayer())) - return; - - event.setItem(Material.SNOW_BALL, (byte)0); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHelix.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHelix.java deleted file mode 100644 index f573629ee..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHelix.java +++ /dev/null @@ -1,79 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; - -public class ParticleHelix extends ParticleGadget -{ - - public ParticleHelix(GadgetManager manager) - { - super(manager, "Blood Helix", new String[] - { - C.cWhite + "Ancient legend says this magic", - C.cWhite + "empowers the blood of its user,", - C.cWhite + "giving them godly powers.", - }, - -2, - Material.REDSTONE, (byte)0); - } - - @EventHandler - public void playParticle(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : GetActive()) - { - if (!shouldDisplay(player)) - continue; - - if (Manager.isMoving(player)) - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - else - { - for (int height=0 ; height <= 20 ; height++) - { - for (int i=0 ; i < 2 ; i++) - { - double lead = i * ((2d * Math.PI)/2); - - double heightLead = height * ((2d * Math.PI)/20); - - float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f); - float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f); - - float y = 0.15f * height; - - UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f, 0f, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - - - } - } - - //UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f); - } - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java deleted file mode 100644 index 9ed2bbb06..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java +++ /dev/null @@ -1,202 +0,0 @@ -package mineplex.core.gadget.gadgets; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.util.Vector; - -import mineplex.core.blood.BloodEvent; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -public class ParticleTitan extends ParticleGadget -{ - private HashSet _arrows = new HashSet(); - - private int _tick; - - public ParticleTitan(GadgetManager manager) - { - super(manager, "Flame of the Titans", new String[] - { - C.cWhite + "These flames are said to be the", - C.cWhite + "souls of a lost civilisation of", - C.cWhite + "Titans, forgotten by time.", - " ", - C.cRed + "Unlocked with Titan Rank", - }, - -3, - Material.FIREBALL, (byte)0); - } - - @EventHandler - public void onUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - - return; - - _tick++; - _tick = _tick%620; - - for(Player player : GetActive()) - { - if (!shouldDisplay(player)) - continue; - - double total = 3; - double step = (1/total)*Math.PI*2; - double offset1 = (step/20)*_tick%20; - double offset2 = (step/31)*_tick%31; - - double r = 3; - boolean redstone = false; - - if(Manager.isMoving(player)) - r = 0.5; - - for(int i = 0; i < total; i++) - { - double rad = step*i + offset1; - - double x = Math.sin(rad); - double y = 0; - double z = Math.cos(rad); - - - Vector v = new Vector(x,y,z).normalize(); - v.multiply(r); - Location loc = player.getLocation(); - loc.add(0, 0.1, 0); - - loc.add(v); - - - if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); - v.multiply(-1); - UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); - - rad = -(step*i + offset2); - x = Math.sin(rad); - z = Math.cos(rad); - - v = new Vector(x,y,z).normalize(); - v.multiply(r); - loc = player.getLocation(); - loc.add(0, 0.1, 0); - - loc.add(v); - - if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); - v.multiply(-1); - UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); - } - } - } - - @EventHandler - public void jump(PlayerToggleFlightEvent event) - { - if (!shouldDisplay(event.getPlayer())) - return; - - if (!event.getPlayer().isFlying()) - if (IsActive(event.getPlayer())) - { - UtilParticle.PlayParticle(ParticleType.LAVA, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.2f, 40, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - - } - - @EventHandler - public void arrow(ProjectileLaunchEvent event) - { - if (Manager.hideParticles()) - return; - - if (event.getEntity() instanceof Arrow) - { - if (event.getEntity().getShooter() != null) - { - if (GetActive().contains(event.getEntity().getShooter())) - { - _arrows.add((Arrow)event.getEntity()); - } - } - } - } - - @EventHandler - public void arrow(ProjectileHitEvent event) - { - if (!_arrows.remove(event.getEntity())) - return; - - UtilParticle.PlayParticle(ParticleType.LAVA, event.getEntity().getLocation(), 0f, 0f, 0f, 0f, 24, - ViewDist.LONGER, UtilServer.getPlayers()); - } - - @EventHandler - public void arrowClean(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Arrow arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) - { - arrowIterator.remove(); - } - else - { - UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, - ViewDist.LONGER, UtilServer.getPlayers()); - } - } - } - - @EventHandler - public void death(BloodEvent event) - { - if (event.getPlayer() == null) - return; - - if (!IsActive(event.getPlayer())) - return; - - if (!shouldDisplay(event.getPlayer())) - return; - - event.setItem(Material.FIREBALL, (byte)0); - } - - @EventHandler - public void legendOwner(PlayerJoinEvent event) - { - if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) - { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java new file mode 100644 index 000000000..ec6b33ba6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java @@ -0,0 +1,48 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; + +public class ArrowTrailCandyCane extends ArrowEffectGadget +{ + + public ArrowTrailCandyCane(GadgetManager manager) + { + super(manager, "Candy Cane Arrows", + UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santa’s Elves are deadly shots.", LineFormat.LORE), + -3, + Material.INK_SACK, (byte)1); + } + + @Override + public void doTrail(Arrow arrow) + { + int data = 15; + int tick = Math.abs(UtilTime.getServerTick()%3); + if(tick == 1) data = 1; + if(tick == 2) data = 2; + Location loc = arrow.getLocation(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), loc, 0, 0, 0, 0.0f, 1, ViewDist.NORMAL); + } + + @Override + public void doHitEffect(Arrow arrow) + { + Location loc = arrow.getLocation(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java new file mode 100644 index 000000000..171860cd5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java @@ -0,0 +1,39 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.types.ArrowEffectGadget; +import mineplex.core.gadget.GadgetManager; + +public class ArrowTrailFrostLord extends ArrowEffectGadget +{ + public ArrowTrailFrostLord(GadgetManager manager) + { + super(manager, "Arrows of the Frost Lord", + UtilText.splitLineToArray(C.cGray + "The Frost Lord’s arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE), + -3, + Material.SNOW_BALL, (byte)0, "Frost Lord"); + } + + @Override + public void doTrail(Arrow arrow) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, + ViewDist.LONGER, UtilServer.getPlayers()); + } + + @Override + public void doHitEffect(Arrow arrow) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0.4f, 12, + ViewDist.LONGER, UtilServer.getPlayers()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java new file mode 100644 index 000000000..e84e26318 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java @@ -0,0 +1,51 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; + +public class ArrowTrailTitan extends ArrowEffectGadget +{ + public ArrowTrailTitan(GadgetManager manager) + { + super(manager, "Arrows of the Titans", + UtilText.splitLineToArray(C.cGray + "Arrows forged in the Fires of Creation, they leave fiery trails in their wake.", LineFormat.LORE), + -13, + Material.FIREBALL, (byte)0); + } + + @Override + public void doTrail(Arrow arrow) + { + UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, + ViewDist.LONGER, UtilServer.getPlayers()); + } + + @Override + public void doHitEffect(Arrow arrow) + { + UtilParticle.PlayParticle(ParticleType.LAVA, arrow.getLocation(), 0f, 0f, 0f, 0f, 24, + ViewDist.LONGER, UtilServer.getPlayers()); + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java new file mode 100644 index 000000000..a6ccbda55 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java @@ -0,0 +1,48 @@ +package mineplex.core.gadget.gadgets.death; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.gadget.GadgetManager; + +public class DeathCandyCane extends DeathEffectGadget +{ + public DeathCandyCane(GadgetManager manager) + { + super(manager, "Candy Cane Remains", + UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays, is January.", LineFormat.LORE), + -3, + Material.INK_SACK, (byte)1); + } + + @EventHandler + public void death(BloodEvent event) + { + if (event.getPlayer() == null) + return; + + if (!IsActive(event.getPlayer())) + return; + + if (!shouldDisplay(event.getPlayer())) + return; + + event.setCancelled(true); + + event.setItem(Material.INK_SACK, (byte) 15); + + Location loc = event.getLocation(); + int a = event.getParticles(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java new file mode 100644 index 000000000..7e90ac02d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java @@ -0,0 +1,37 @@ +package mineplex.core.gadget.gadgets.death; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.gadget.GadgetManager; + +public class DeathFrostLord extends DeathEffectGadget +{ + public DeathFrostLord(GadgetManager manager) + { + super(manager, "Fall of the Frost Lord", + UtilText.splitLineToArray(C.cGray + "The power of Winter must eventually give way to Spring.", LineFormat.LORE), + -3, + Material.SNOW_BALL, (byte)0, "Frost Lord"); + } + + @EventHandler + public void death(BloodEvent event) + { + if (event.getPlayer() == null) + return; + + if (!IsActive(event.getPlayer())) + return; + + if (!shouldDisplay(event.getPlayer())) + return; + + event.setItem(Material.SNOW_BALL, (byte)0); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java new file mode 100644 index 000000000..cce291dc1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java @@ -0,0 +1,48 @@ +package mineplex.core.gadget.gadgets.death; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; + +public class DeathTitan extends DeathEffectGadget +{ + public DeathTitan(GadgetManager manager) + { + super(manager, "Ashes of the Titans", + UtilText.splitLineToArray(C.cGray + "Even a Titan can fall in combat if their opponent is fierce enough.", LineFormat.LORE), + -13, + Material.FIREBALL, (byte)0); + } + + @EventHandler + public void death(BloodEvent event) + { + if (event.getPlayer() == null) + return; + + if (!IsActive(event.getPlayer())) + return; + + if (!shouldDisplay(event.getPlayer())) + return; + + event.setItem(Material.FIREBALL, (byte)0); + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java new file mode 100644 index 000000000..62f3ad6c4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java @@ -0,0 +1,36 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; + +public class DoubleJumpCandyCane extends DoubleJumpEffectGadget +{ + + public DoubleJumpCandyCane(GadgetManager manager) + { + super(manager, "Candy Cane Blast", + UtilText.splitLineToArray(C.cGray + "It is said every time an elf jumps, bits of Candy Cane fall out of their pockets.", LineFormat.LORE), + -3, + Material.INK_SACK, (byte)1); + } + + @Override + public void doEffect(Player player) + { + Location loc = player.getLocation(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java new file mode 100644 index 000000000..64cc9f962 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java @@ -0,0 +1,32 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; + +public class DoubleJumpFrostLord extends DoubleJumpEffectGadget +{ + public DoubleJumpFrostLord(GadgetManager manager) + { + super(manager, "Gust of the Frost Lord", + UtilText.splitLineToArray(C.cGray + "Listen, the Frost Lord is a very proper individual. Stop making fart jokes!", LineFormat.LORE), + -3, + Material.SNOW_BALL, (byte)0, "Frost Lord"); + } + + @Override + public void doEffect(Player player) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0f, 0f, 0f, 0.6f, 100, + ViewDist.LONGER, UtilServer.getPlayers()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java new file mode 100644 index 000000000..31cf84cce --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java @@ -0,0 +1,46 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; + +public class DoubleJumpTitan extends DoubleJumpEffectGadget +{ + public DoubleJumpTitan(GadgetManager manager) + { + super(manager, "Leap of the Titans", + UtilText.splitLineToArray(C.cGray + "Out of the frying pan and into the fire.", LineFormat.LORE), + -13, + Material.FIREBALL, (byte)0); + } + + @Override + public void doEffect(Player player) + { + UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0f, 0f, 0f, 0.2f, 40, + ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation(), 0, 0, 0, 0.2f, 40, ViewDist.NORMAL); + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java new file mode 100644 index 000000000..7897272a8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java @@ -0,0 +1,23 @@ +package mineplex.core.gadget.gadgets.hat; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatCoal extends HatGadget +{ + + public HatCoal(GadgetManager manager) + { + super(manager, "Lump of Coal Hat", + UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a wierd cube hat out it!", LineFormat.LORE), + -1, + new ItemStack(Material.COAL_BLOCK)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java new file mode 100644 index 000000000..9ef68b04a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java @@ -0,0 +1,21 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatGrinch extends HatGadget +{ + + public HatGrinch(GadgetManager manager) + { + super(manager, "The Grinch", + UtilText.splitLineToArray(C.cGray + "Great! Now where’s the Roast Beast?!", LineFormat.LORE), + -3, + SkinData.THE_GRINCH.getSkull(), "The Grinch Hat"); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java new file mode 100644 index 000000000..e92b2b398 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java @@ -0,0 +1,21 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatPresent extends HatGadget +{ + + public HatPresent(GadgetManager manager) + { + super(manager, "Present", + UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), + -3, + SkinData.PRESENT.getSkull()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java new file mode 100644 index 000000000..1dfd9fa5c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java @@ -0,0 +1,21 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatRudolph extends HatGadget +{ + + public HatRudolph(GadgetManager manager) + { + super(manager, "Rudolph", + UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), + -3, + SkinData.RUDOLPH.getSkull()); + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java new file mode 100644 index 000000000..470b69a46 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java @@ -0,0 +1,21 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatSanta extends HatGadget +{ + + public HatSanta(GadgetManager manager) + { + super(manager, "Santa", + UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), + -3, + SkinData.SANTA.getSkull()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java new file mode 100644 index 000000000..7349759ab --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java @@ -0,0 +1,21 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; + +public class HatSnowman extends HatGadget +{ + + public HatSnowman(GadgetManager manager) + { + super(manager, "Snowman Head", + UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), + -3, + SkinData.SNOWMAN.getSkull()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemBatGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemBatGun.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java index 990221e3c..72af832fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemBatGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.ArrayList; import java.util.HashMap; @@ -13,16 +13,19 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -36,11 +39,8 @@ public class ItemBatGun extends ItemGadget public ItemBatGun(GadgetManager manager) { - super(manager, "Bat Blaster", new String[] - { - C.cWhite + "Launch waves of annoying bats", - C.cWhite + "at people you don't like!", - }, + super(manager, "Bat Blaster", + UtilText.splitLineToArray(C.cGray + "Unleash waves of terrifying bats at people you don't like!", LineFormat.LORE), -1, Material.IRON_BARDING, (byte)0, 5000, new Ammo("Bat Blaster", "50 Bats", Material.IRON_BARDING, (byte)0, new String[] { C.cWhite + "50 Bats for your Bat Blaster!" }, 500, 50)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java new file mode 100644 index 000000000..4ef0da13d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -0,0 +1,256 @@ +package mineplex.core.gadget.gadgets.item; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.gadgets.hat.HatCoal; +import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.rewards.PetReward; + +public class ItemCoal extends ItemGadget +{ + private int _hat = 250; + private int _pet = 500; + private int _particle = 1000; + + public String[] Messages = new String[] + { + "Maybe you could.... eat it?", + "Yep, you're holding some coal...", + "This sure is a nice piece of coal!", + "Na na na na, Na na na na, " + C.cDGray + "BLACK COAL" + C.cGray + "!", + "Did you know that coal can be used for " + C.Scramble + "nothing" + C.mBody + "!", + "Now... if only you had a furnace.", + "I hope you didn’t miss any diamonds.", + "With 9 of these you could make a block!", + "Were you really that naughty this year?", + "With a few more of these you could make a snowman face!", + "Lava is hotter but Coal is quicker.", + "What do you even need Coal for on a Minigame server?", + "Maybe if I got more I could start a really big fire.", + "Maybe you can give this to your siblings next Christmas.", + "Did you know a diamond is formed from coal?", + "Coal is a word that sounds weird if you say it too much.", + "Who do you think mined the first block of coal?", + "Maybe if you get enough, something cool will happen! Or perhaps not...", + }; + + public ItemCoal(GadgetManager manager) + { + super(manager, "Coal", + UtilText.splitLineToArray(C.cGray + "Just a large chunk of coal. Maybe you were naughty or something?", LineFormat.LORE) + , -1, Material.COAL, (byte) 0, 1000, new Ammo("Coal", "1 Piece of Coal", Material.COAL, (byte) 0, new String[] + { + C.cDGray + "Exclusive Coal!", + C.cDGray + "Earned by beeing naughty" + } + , -1, 1)); + } + + @Override + public void ActivateCustom(final Player player) + { + int goal = -1; + + //Coal Hat + if (!Manager.getGadget(HatCoal.class).ownsGadget(player)) + { + goal = _hat; + + if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _hat) + { + Recharge.Instance.recharge(player, GetName()); + Recharge.Instance.use(player, GetName(), 30000, true, true); + + Manager.getInventoryManager().addItemToInventory(new Callback() + { + @Override + public void run(Boolean data) + { + if(data) + { + Bukkit.broadcastMessage(F.main("Treasure", C.cGreen + player.getName() + C.cGray + " crafted " + C.cGreen + "Legendary Coal Hat")); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.1f, 0.5f, 0.1f, 0, 100, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 100, ViewDist.LONG); + player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); + + Manager.getInventoryManager().addItemToInventory(player, GetName(), -_hat); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + + Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat"); + } + else + { + player.sendMessage("Something went wrong..."); + } + } + }, player, "Lump of Coal Hat", 1); + return; + } + } + + //Coal Apparition + if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE)) + { + goal = _pet; + + if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _pet) + { + Recharge.Instance.recharge(player, GetName()); + Recharge.Instance.use(player, GetName(), 30000, true, true); + + PetReward reward = new PetReward( + Manager.getPetManager(), + Manager.getInventoryManager(), + Manager.getDonationManager(), + "Coal Apparition", "Coal Apparition", EntityType.PIG_ZOMBIE, RewardRarity.OTHER, 0, 0); + + if (reward.canGiveReward(player)) + reward.giveReward(null, player, new Callback() + { + @Override + public void run(RewardData data) + { + Bukkit.broadcastMessage(F.main("Treasure", C.cGreen + player.getName() + C.cGray + " crafted " + C.cGreen + "Legendary Coal Apparition Pet")); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.15f, 0.5f, 0.15f, 0, 250, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1f, 0.0f, 1f, 0, 250, ViewDist.LONG); + player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); + + Manager.getInventoryManager().addItemToInventory(player, GetName(), -_pet); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + + Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition"); + } + }); + + return; + } + } + + //Coal Particle + if (!Manager.getGadget(ParticleCoalFumes.class).ownsGadget(player)) + { + goal = _particle; + + if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _particle) + { + Recharge.Instance.recharge(player, GetName()); + Recharge.Instance.use(player, GetName(), 30000, true, true); + + Manager.getInventoryManager().addItemToInventory(new Callback() + { + @Override + public void run(Boolean data) + { + if(data) + { + Bukkit.broadcastMessage(F.main("Treasure", C.cRed + player.getName() + C.cGray + " crafted " + C.cRed + "Mythical Coal Fumes Particles")); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.2f, 0.5f, 0.2f, 0, 500, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG); + player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); + + Manager.getInventoryManager().addItemToInventory(player, GetName(), -_particle); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + + Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes"); + } + else + { + player.sendMessage("Something went wrong..."); + } + } + }, player, "Coal Fumes", 1); + return; + } + } + + goal -= Manager.getInventoryManager().Get(player).getItemCount(GetName()); + + if (goal > 0 && Math.random() > 0.95) + { + player.sendMessage(F.main("Coal", "Only " + goal + " to go...")); + + player.playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 0.2f, 0.5f); + } + else + { + + int i = UtilMath.r(Messages.length); + String msg = Messages[i]; + player.sendMessage(F.main("Coal", msg)); + + player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.2f, 1.5f*(i/(float)Messages.length)); + } + } + + @EventHandler @Override + public void Activate(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + return; + + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + event.setCancelled(true); + + //Stock + if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) + { + + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + + ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); + Bukkit.getServer().getPluginManager().callEvent(ammoEvent); + + return; + } + + //Recharge + if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + { + UtilInv.Update(player); + return; + } + + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + + ActivateCustom(event.getPlayer()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemCoinBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java similarity index 79% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemCoinBomb.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java index ce4f2e781..d0039cd87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemCoinBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.HashMap; import java.util.HashSet; @@ -17,12 +17,15 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -34,27 +37,23 @@ public class ItemCoinBomb extends ItemGadget public ItemCoinBomb(GadgetManager manager) { - super(manager, "Coin Party Bomb", new String[] - { - C.cWhite + "It's party time! You will be", - C.cWhite + "everyones favourite player", - C.cWhite + "when you use one of these!", - }, + super(manager, "Treasure Party Bomb", + UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyones favourite player when you use one of these!", LineFormat.LORE), -1, - Material.getMaterial(175), (byte)0, - 30000, new Ammo("Coin Party Bomb", "1 Coin Party Bomb", Material.getMaterial(175), (byte)0, new String[] { C.cWhite + "1 Coin Party Bomb to PARTY!" }, 2000, 1)); + Material.PRISMARINE, (byte)0, + 30000, new Ammo("Treasure Party Bomb", "1 Coin Party Bomb", Material.PRISMARINE, (byte)0, new String[] { C.cWhite + "1 Treasure Party Bomb" }, 2000, 1)); } @Override public void ActivateCustom(Player player) { - Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.GOLD_BLOCK)); + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.PRISMARINE)); UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); _active.put(item, System.currentTimeMillis()); //Inform for (Player other : UtilServer.getPlayers()) - UtilPlayer.message(other, C.cYellow + C.Bold + player.getName() + C.cWhite + C.Bold + " has thrown a " + C.cYellow + C.Bold + "Coin Party Bomb" + C.cWhite + C.Bold + "!"); + UtilPlayer.message(other, C.cAqua + C.Bold + player.getName() + C.cWhite + C.Bold + " has thrown a " + C.cAqua + C.Bold + "Treasure Party Bomb" + C.cWhite + C.Bold + "!"); } @EventHandler @@ -73,11 +72,11 @@ public class ItemCoinBomb extends ItemGadget if (UtilTime.elapsed(time, 3000)) { if (Math.random() > 0.80) - UtilFirework.playFirework(item.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BURST).trail(false).build()); + UtilFirework.playFirework(item.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.AQUA).with(Type.BURST).trail(false).build()); else item.getWorld().playSound(item.getLocation(), Sound.FIREWORK_LAUNCH, 1f, 1f); - Item coin = item.getWorld().dropItem(item.getLocation().add(0, 1, 0), new ItemStack(Material.getMaterial(175))); + Item coin = item.getWorld().dropItem(item.getLocation().add(0, 1, 0), new ItemStack(Material.PRISMARINE_SHARD)); //Velocity long passed = System.currentTimeMillis() - time; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemDuelingSword.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java similarity index 85% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemDuelingSword.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java index 94d4bfea3..c8ced1f05 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemDuelingSword.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -7,6 +7,8 @@ import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -26,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.RemoveItem(player); + Manager.removeGadgetType(player, GadgetType.Item); _active.add(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java index bb7ef9c8f..7f0b83cba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.ArrayList; import java.util.HashSet; @@ -19,11 +19,14 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -34,11 +37,8 @@ public class ItemEtherealPearl extends ItemGadget public ItemEtherealPearl(GadgetManager manager) { - super(manager, "Ethereal Pearl", new String[] - { - C.cWhite + "Take a ride through the skies", - C.cWhite + "on your very own Ethereal Pearl!", - }, + super(manager, "Ethereal Pearl", + UtilText.splitLineToArray(C.cWhite + "These Pearls are stolen from sleeping Endermen!", LineFormat.LORE), -1, Material.ENDER_PEARL, (byte)0, 500, new Ammo("Ethereal Pearl", "50 Pearls", Material.ENDER_PEARL, (byte)0, new String[] { C.cWhite + "50 Pearls to get around with!" }, 500, 50)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java similarity index 86% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java index 114fbeeff..597dc0a2a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java @@ -1,33 +1,31 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import org.bukkit.Color; import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.recharge.Recharge; public class ItemFirework extends ItemGadget { public ItemFirework(GadgetManager manager) { - super(manager, "Fireworks", new String[] - { - C.cWhite + "Need to celebrate?!", - C.cWhite + "Use some fireworks!", - C.cWhite + "Pew pew pew!", - }, + super(manager, "Fireworks", + UtilText.splitLineToArray(C.cWhite + "Need to celebrate? These fireworks should do the trick!", LineFormat.LORE), -1, Material.FIREWORK, (byte)0, 500, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index a439aca63..a35ab819d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import org.bukkit.EntityEffect; import org.bukkit.Material; @@ -11,11 +11,14 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; 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.UtilParticle.ParticleType; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; @@ -26,12 +29,8 @@ public class ItemFleshHook extends ItemGadget implements IThrown { public ItemFleshHook(GadgetManager manager) { - super(manager, "Flesh Hook", new String[] - { - C.cWhite + "Make new friends by throwing a hook", - C.cWhite + "into their face and pulling them", - C.cWhite + "towards you!", - }, + super(manager, "Flesh Hook", + UtilText.splitLineToArray(C.cWhite + "Make new friends by throwing a hook into their face and pulling them towards you!", LineFormat.LORE), -1, Material.getMaterial(131), (byte)0, 2000, new Ammo("Flesh Hook", "50 Flesh Hooks", Material.getMaterial(131), (byte)0, new String[] { C.cWhite + "50 Flesh Hooks for you to use!" }, 1000, 50)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java index 12537a599..b44dfd504 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.HashSet; @@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java new file mode 100644 index 000000000..79c8635ad --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java @@ -0,0 +1,198 @@ +package mineplex.core.gadget.gadgets.item; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +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.entity.Entity; +import org.bukkit.entity.Item; +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.player.PlayerMoveEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.ItemGadget; +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; + +public class ItemFreezeCannon extends ItemGadget implements IThrown +{ + + private HashMap _playerMap = new HashMap<>(); + + public ItemFreezeCannon(GadgetManager manager) + { + super(manager, "Freeze Cannon", + UtilText.splitLineToArray(C.cWhite + "Let someone cool off inside their very own ice cube!", LineFormat.LORE), + -1, + Material.ICE, (byte) 0, 8000, new Ammo("Freeze Cannon", "100 Ice Blocks", Material.ICE, (byte) 0, new String[] + { + C.cWhite + "100 Ice Blocks for you to launch!" + }, -1, 1)); + } + + @Override + public void ActivateCustom(Player player) + { + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.ICE)); + UtilAction.velocity(item, player.getLocation().getDirection(), + 1, false, 0, 0.2, 10, false); + + Manager.getProjectileManager().AddThrow(item, player, this, 5000, true, true, true, true, + null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); + + //Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + + //Effect + item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target instanceof Player) + { + Player p = (Player) target; + + int ticks = 4 * 20; + if(isClear(p.getLocation())) + { + Manager.getBlockRestore().add(p.getLocation().getBlock(), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50); + Manager.getBlockRestore().add(p.getLocation().getBlock().getRelative(BlockFace.UP), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50); + if(p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) + { + Manager.getBlockRestore().add(p.getLocation().getBlock().getRelative(BlockFace.DOWN), Material.STAINED_GLASS.getId(), (byte)5, 0, (byte)0, ticks*50); + } + p.setWalkSpeed(0); + _playerMap.put(p, System.currentTimeMillis() + (ticks * 50)); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, ticks, 250, true, false)); + p.teleport(target.getLocation().getBlock().getLocation().add(0.5, 0, 0.5)); + Recharge.Instance.useForce(p, "Double Jump", ticks*50); + p.setAllowFlight(false); + p.getWorld().playSound(p.getLocation(), Sound.FIZZ, 0.25f, 0.75f); + } + + //Effect + target.playEffect(EntityEffect.HURT); + } + + smash(data.GetThrown()); + } + + @EventHandler + public void onMove(PlayerMoveEvent event) + { + if(!_playerMap.containsKey(event.getPlayer())) return; + + if(event.getFrom().distanceSquared(event.getTo()) > 0.3) + { + event.setCancelled(true); + } + } + + public boolean isClear(Location loc) + { + Block b = loc.getBlock(); + ArrayList blocks = UtilBlock.getInBoundingBox(b.getLocation().subtract(1, 0, 1), b.getLocation().add(1, 1, 1)); + for(Block test : blocks) + { + if(test.getType() == Material.PORTAL) return false; + } + if(b.getType() != Material.AIR) return false; + if(b.getRelative(BlockFace.UP).getType() != Material.AIR) return false; + + return true; + } + + @EventHandler + public void cleanup(UpdateEvent event) + { + if(event.getType() == UpdateType.FAST) + { + for(Iterator it = _playerMap.keySet().iterator(); it.hasNext();) + { + Player p = it.next(); + Long time = _playerMap.get(p); + if(time == null) + { + p.setWalkSpeed(0.2f); + p.setAllowFlight(false); + it.remove(); + continue; + } + if(time < System.currentTimeMillis()) + { + p.setWalkSpeed(0.2f); + p.setAllowFlight(false); + it.remove(); + continue; + } + } + } + if(event.getType() == UpdateType.TICK) + { + for(Player p : _playerMap.keySet()) + { + Long time = _playerMap.get(p); + if(time <= System.currentTimeMillis()) continue; + + for(Player op : UtilServer.getPlayers()) + { + if(op.equals(p)) continue; + op.sendBlockChange(p.getLocation(), Material.ICE, (byte) 0); + op.sendBlockChange(p.getLocation().add(0, 1, 0), Material.ICE, (byte) 0); + } + } + } + } + + @Override + public void Idle(ProjectileUser data) + { + smash(data.GetThrown()); + } + + @Override + public void Expire(ProjectileUser data) + { + smash(data.GetThrown()); + } + + public void smash(Entity ent) + { + //Effect + ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.ICE); + + //Remove + ent.remove(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java index 0692aa661..78269f173 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.ArrayList; import java.util.Iterator; @@ -20,11 +20,14 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; @@ -38,12 +41,8 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown public ItemMelonLauncher(GadgetManager manager) { - super(manager, "Melon Launcher", new String[] - { - C.cWhite + "Deliciously fun!", - C.cWhite + "Eat the melon slices for a", - C.cWhite + "temporary speed boost!", - }, + super(manager, "Melon Launcher", + UtilText.splitLineToArray(C.cWhite + "Because who doesn't want to shoot watermelons at people?!", LineFormat.LORE), -1, Material.MELON_BLOCK, (byte)0, 1000, new Ammo("Melon Launcher", "100 Melons", Material.MELON_BLOCK, (byte)0, new String[] { C.cWhite + "100 Melons for you to launch!" }, 500, 100)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintballGun.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintballGun.java index 68fba27a0..c6ad69ce8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintballGun.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.ArrayList; import java.util.HashSet; @@ -21,14 +21,17 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -39,10 +42,9 @@ public class ItemPaintballGun extends ItemGadget public ItemPaintballGun(GadgetManager manager) { - super(manager, "Paintball Gun", new String[] - { - C.cWhite + "PEW PEW PEW PEW!", - }, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, + super(manager, "Paintball Gun", + UtilText.splitLineToArray(C.cWhite + "PEW PEW PEW!", LineFormat.LORE), + -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, (byte) 0, new String[] { C.cWhite + "100 Paintballs for you to shoot!" diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java index ba0fd0d76..790a66d44 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.ArrayList; import java.util.Arrays; @@ -18,6 +18,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEvent; @@ -25,8 +26,11 @@ import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; @@ -41,12 +45,8 @@ public class ItemPaintbrush extends ItemGadget public ItemPaintbrush(GadgetManager manager) { - super(manager, "Paintbrush", new String[] - { - C.cWhite + "Unleash your inner creativity!", - C.cWhite + "", - C.cGreen + "Activated at a Painter NPC", - }, + super(manager, "Paintbrush", + UtilText.splitLineToArray(C.cWhite + "Unleash your inner Bob Ross! Happy little trees!", LineFormat.LORE), -3, Material.WOOD_SWORD, (byte)0, 200, new Ammo("Paint", "100 Pixels", Material.INK_SACK, (byte)0, new String[] { C.cWhite + "100 Pixels worth of Paint!" }, 500, 100)); @@ -55,7 +55,7 @@ public class ItemPaintbrush extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.RemoveItem(player); + Manager.removeGadgetType(player, GadgetType.Item); _active.add(player); @@ -200,7 +200,7 @@ public class ItemPaintbrush extends ItemGadget Villager villager = (Villager)event.getRightClicked(); - if (villager.getCustomName() != null && villager.getCustomName().contains("Painter")) + if (villager.getCustomName() != null && villager.getCustomName().contains("Bob Ross")) { Enable(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java new file mode 100644 index 000000000..92da2218c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java @@ -0,0 +1,143 @@ +package mineplex.core.gadget.gadgets.item; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ItemPartyPopper extends ItemGadget implements IThrown +{ + HashSet _items = new HashSet<>(); + + public ItemPartyPopper(GadgetManager manager) + { + super(manager, "Party Popper", + UtilText.splitLineToArray(C.cWhite + "Celebrate by blasting confetti into peoples eyes!", LineFormat.LORE), + 1, Material.GOLDEN_CARROT, (byte) 0, 1000, new Ammo("Party Popper", "1 Party Popper", Material.GOLDEN_CARROT, + (byte) 0, new String[] + { + C.cWhite + "100 Party Poppers for you to shoot!" + }, -2, 1)); + } + + @Override + public void ActivateCustom(Player player) + { + /* +// Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), +// ItemStackFactory.Instance.CreateStack(Material.REDSTONE_LAMP_OFF, (byte)0, 1, "Lamp" + Math.random())); +// +// UtilAction.velocity(ent, player.getLocation().getDirection().normalize().multiply(0.1), 1, false, 0, 0.2, 10, false); +// +// Manager.getProjectileManager().AddThrow(ent, player, this, 3000, false, false, true, true, 0.5f); + + */ + + + for(int data : new int[]{1,2,4,5,6,9,10,11,12,13,14,15}) + { +// UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), player.getEyeLocation(), null, 0.4f, 50, ViewDist.LONG); + + for(int i = 0; i < 10; i++) + { + Vector v = new Vector(Math.random() - 0.5, Math.random() - 0.3, Math.random() - 0.5); + v.normalize(); + v.multiply(0.2); + v.add(player.getLocation().getDirection()); + v.normalize().multiply(Math.random()*0.4 + 0.4); + + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), player.getEyeLocation(), v, 1, 0, ViewDist.LONG); + } + + /* + Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), + ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)data, 1, "Ink" + Math.random())); + _items.add(ent); + + Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.3, Math.random() - 0.5); + random.normalize(); + random.multiply(0.05); + + UtilAction.velocity(ent, player.getLocation().getDirection().normalize().multiply(0.3).add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); + + Manager.getProjectileManager().AddThrow(ent, player, this, 3000, false, false, true, true, 0.5f); + */ + } + // Sound + for(int i = 0; i < 3; i++) + { + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 2.0f, 0.8f); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + @EventHandler + public void particleTrail(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + for(Item item : _items) + { + byte data = item.getItemStack().getData().getData(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), item.getLocation(), 0, 0, 0, 0.0f, 3, ViewDist.LONG); + } + } + + public void Explode(ProjectileUser data) + { + for(int type : new int[]{1,2,4,5,6,9,10,11,12,13,14,15}) + { + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.GetThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG); + } + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.GetThrown().remove(); + /* + if (data.GetThrown() instanceof Item) + { + Item item = (Item) data.GetThrown(); + byte b = item.getItemStack().getData().getData(); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, b), item.getLocation(), 0, 0, 0, 0.2f, 80, ViewDist.LONG); + _items.remove(item); + } + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.GetThrown().remove(); + */ + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java new file mode 100644 index 000000000..5e8a9734a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java @@ -0,0 +1,60 @@ +package mineplex.core.gadget.gadgets.item; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.gadgets.Ammo; +import mineplex.core.gadget.types.ItemGadget; + +public class ItemSnowball extends ItemGadget +{ + + private HashSet _snowballs = new HashSet<>(); + + public ItemSnowball(GadgetManager manager) + { + super(manager, "Snowball", + UtilText.splitLineToArray(C.cWhite + "Join in on the festive fun by throwing snow at people!", LineFormat.LORE), + -1, Material.SNOW_BALL, (byte) 0, 1, new Ammo("Snowball", "1 Snowball", Material.SNOW_BALL, (byte) 0, new String[] + { + C.cWhite + "50 Snowballs for you to throw!" + } + , -3, 1)); + + } + + @Override + public void ActivateCustom(Player player) + { + Snowball ball = player.launchProjectile(Snowball.class); + _snowballs.add(ball); + ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f); + } + + @EventHandler + public void onHit(EntityDamageByEntityEvent event) + { + if(!_snowballs.contains(event.getDamager())) return; + + GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); + + if(gevent.isCancelled()) return; + + UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5)); + event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java index 0bf3531b7..e3b5f01f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.item; import java.util.HashMap; import java.util.HashSet; @@ -12,14 +12,17 @@ import org.bukkit.event.entity.EntityExplodeEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -30,11 +33,8 @@ public class ItemTNT extends ItemGadget public ItemTNT(GadgetManager manager) { - super(manager, "TNT", new String[] - { - C.cWhite + "Blow some people up!", - C.cWhite + "KABOOM!", - }, + super(manager, "TNT", + UtilText.splitLineToArray(C.cWhite + "Throwing TNT at Mineplex Staff is highly encouraged.", LineFormat.LORE), -1, Material.TNT, (byte)0, 1000, new Ammo("TNT", "20 TNT", Material.TNT, (byte)0, new String[] { C.cWhite + "20 TNT for you to explode!" }, 500, 20)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java similarity index 99% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java index 7fb434ae2..4a4be4ccd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.ArrayList; import java.util.List; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index 22cf5855e..c6a61b789 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.EntityEffect; import org.bukkit.GameMode; @@ -19,12 +19,14 @@ import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.projectile.IThrown; @@ -40,15 +42,15 @@ public class MorphBat extends MorphGadget implements IThrown { public MorphBat(GadgetManager manager) { - super(manager, "Bat Morph", new String[] + super(manager, "Bat Morph", + UtilText.splitLinesToArray(new String[] { - C.cWhite + "Flap around and annoy people by", - C.cWhite + "screeching loudly into their ears!", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Screech", - C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", - C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop", - }, + C.cGray + "Flap around and annoy people by screeching loudly into their ears!", + C.blankLine, + "#" + C.cWhite + "Left-Click to use Screech", + "#" + C.cWhite + "Double Jump to use Flap", + "#" + C.cWhite + "Sneak to use Poop", + }, LineFormat.LORE), 40000, Material.SKULL_ITEM, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java similarity index 86% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index d7b73309d..1ea72b7e4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -9,9 +9,11 @@ import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBlaze; @@ -24,15 +26,14 @@ public class MorphBlaze extends MorphGadget { public MorphBlaze(GadgetManager manager) { - super(manager, "Blaze Morph", new String[] + super(manager, "Blaze Morph", + UtilText.splitLinesToArray(new String[] { - C.cWhite + "Transforms the wearer into a fiery Blaze!", - " ", - C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Firefly", - " ", - C.cPurple + "Unlocked with Hero Rank", - }, - -1, + C.cGray + "Transform into a fiery Blaze, straight from the Nether!", + C.blankLine, + "#" + C.cWhite + "Crouch to use Firefly", + }, LineFormat.LORE), + -11, Material.BLAZE_POWDER, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java index dd5e22071..dea95636a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; @@ -14,9 +14,11 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.event.StackerEvent; import mineplex.core.gadget.GadgetManager; @@ -32,13 +34,13 @@ public class MorphBlock extends MorphGadget public MorphBlock(GadgetManager manager) { - super(manager, "Block Morph", new String[] + super(manager, "Block Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "The blockiest block that ever blocked.", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block", - C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify", - }, + C.cGray + "The blockiest block that ever blocked.", + C.blankLine, + "#" + C.cWhite + "Left Click to use Change Block", + "#" + C.cWhite + "Stay Still to use Solidify", + }, LineFormat.LORE), 30000, Material.EMERALD_BLOCK, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 78e502bc5..55f67dc0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; import java.util.HashSet; @@ -24,12 +24,14 @@ import org.bukkit.potion.PotionEffectType; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; @@ -50,18 +52,16 @@ public class MorphBunny extends MorphGadget public MorphBunny(GadgetManager manager) { - super(manager, "Easter Bunny Morph", new String[] + super(manager, "Easter Bunny Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Happy Easter!", - " ", - C.cYellow + "Charge Crouch" + C.cGray + " to use " + C.cGreen + "Super Jump", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Hide Easter Egg", - " ", - C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , - " ", - C.cPurple + "No longer available", - }, - -1, + C.cGray + "Happy Easter!", + C.blankLine, + "#" + C.cWhite + "Charge Crouch to use Super Jump", + "#" + C.cWhite + "Left Click to use Hide Easter Egg", + C.blankLine, + "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , + }, LineFormat.LORE), + -5, Material.MONSTER_EGG, (byte)98); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index 6e3be5fce..5d989f5e0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.ChatColor; import org.bukkit.EntityEffect; @@ -17,10 +17,12 @@ import org.bukkit.util.Vector; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.recharge.Recharge; @@ -33,13 +35,13 @@ public class MorphChicken extends MorphGadget { public MorphChicken(GadgetManager manager) { - super(manager, "Chicken Morph", new String[] + super(manager, "Chicken Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Soar through the air like a fat Chicken!", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot", - C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", - }, + C.cGray + "Soar through the air like a fat Chicken!", + C.blankLine, + "#" + C.cWhite + "Left Click to use Egg Shot", + "#" + C.cWhite + "Double Jump to use Flap", + }, LineFormat.LORE), 20000, Material.FEATHER, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index 96dcda738..95ce07b35 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.Material; import org.bukkit.Sound; @@ -7,7 +7,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.*; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.recharge.Recharge; @@ -18,12 +20,12 @@ public class MorphCow extends MorphGadget { public MorphCow(GadgetManager manager) { - super(manager, "Cow Morph", new String[] + super(manager, "Cow Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "How now brown cow?", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo", - }, + C.cGray + "How now brown cow?", + C.blankLine, + "#" + C.cWhite + "Left Click to use Moo", + }, LineFormat.LORE), 6000, Material.LEATHER, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index 8c9419476..ee5a33290 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; @@ -13,11 +13,13 @@ import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; @@ -33,15 +35,13 @@ public class MorphCreeper extends MorphGadget public MorphCreeper(GadgetManager manager) { - super(manager, "Creeper Morph", new String[] + super(manager, "Creeper Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Transforms the wearer into a creepy Creeper!", - " ", - C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Detonate", - " ", - C.cPurple + "Unlocked with Hero Rank", - }, - -1, + C.cGray + "Become the creepiest of Creepers that ever creeped!", + C.blankLine, + C.cWhite + "Crouch to use Detonate", + }, LineFormat.LORE), + -11, Material.SKULL_ITEM, (byte)4); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index 72c6518d6..b833b52bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.Color; import org.bukkit.Effect; @@ -16,8 +16,10 @@ import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.MorphGadget; @@ -29,12 +31,12 @@ public class MorphEnderman extends MorphGadget { public MorphEnderman(GadgetManager manager) { - super(manager, "Enderman Morph", new String[] + super(manager, "Enderman Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Transforms the wearer into an Enderman!", - " ", - C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Blink", - }, + C.cGray + "Using this morph is the ultimate diet! Guaranteed instant results!", + C.blankLine, + "#" + C.cWhite + "Double Jump to use Blink", + }, LineFormat.LORE), 30000, Material.ENDER_PEARL, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index d42b43023..59ed09fa0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; @@ -11,11 +11,13 @@ import org.bukkit.event.player.*; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguisePig; @@ -31,16 +33,14 @@ public class MorphPig extends MorphGadget public MorphPig(GadgetManager manager) { - super(manager, "Pig Morph", new String[] + super(manager, "Pig Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Oink. Oink. Oink.... Oink?", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Oink", - C.cYellow + "Collide" + C.cGray + " to use " + C.cGreen + "Pig Bounce", - " ", - C.cAqua + "Unlocked with Ultra Rank", - }, - -1, + C.cGray + "Oink. Oink. Oink.... Oink?", + C.blankLine, + "#" + C.cWhite + "Left Click to use Oink", + "#" + C.cWhite + "Collide to use Pig Bounce", + }, LineFormat.LORE), + -10, Material.PORK, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java similarity index 82% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index 13c83e5d9..ed425a5de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -7,7 +7,9 @@ import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.MorphGadget; @@ -17,15 +19,11 @@ public class MorphPumpkinKing extends MorphGadget { public MorphPumpkinKing(GadgetManager manager) { - super(manager, "Pumpkin Kings Head", new String[] + super(manager, "Pumpkin Kings Head", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Transforms the wearer into", - C.cWhite + "the dreaded Pumpkin King!", - "", - C.cYellow + "Earned by defeating the Pumpkin King", - C.cYellow + "in the 2013 Halloween Horror Event.", - }, - -1, + C.cGray + "Transforms the wearer into the dreaded Pumpkin King!", + }, LineFormat.LORE), + -4, Material.PUMPKIN, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java similarity index 82% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 4737cf7ad..7a8430173 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import org.bukkit.Material; import org.bukkit.Sound; @@ -9,9 +9,11 @@ import org.bukkit.event.player.*; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.recharge.Recharge; @@ -25,14 +27,14 @@ public class MorphSlime extends MorphGadget public MorphSlime(GadgetManager manager, AchievementManager achievements) { - super(manager, "Big Larry Morph", new String[] + super(manager, "Big Larry Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Become a slime like Big Larry!", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Bounce", - " ", - C.cWhite + "+1 Slime Size for every 10 Mineplex Levels", - }, + C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy!\'? Well, today is your lucky day!", + C.blankLine, + "#" + C.cWhite + "Left Click to use Bounce", + C.blankLine, + "#" + C.cWhite + "+1 Size per 10 Mineplex Levels", + }, LineFormat.LORE), 80000, Material.SLIME_BALL, (byte)0); 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 new file mode 100644 index 000000000..75e5ad743 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -0,0 +1,154 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilEvent.ActionType; +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.disguise.disguises.DisguiseSnowman; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargeData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphSnowman extends MorphGadget +{ + + private WeakHashMap _snowball = new WeakHashMap(); + + public MorphSnowman(GadgetManager manager) + { + super(manager, "Olaf Morph", + UtilText.splitLinesToArray(new String[] + { + C.cGray + "Do you wanna build a snowman?", + C.cGray + "It doesn't have to be a snowman...", + C.cGray + "Or... it kind of does...", + C.blankLine, + "#" + C.cWhite + "Left-Click to use Blizzard", + "#" + C.cWhite + "Sneak to use Snow Slide", + }, LineFormat.LORE), + -3, Material.SNOW_BALL, (byte) 0); + } + + @Override + public void EnableCustom(Player player) + { + this.ApplyArmor(player); + + DisguiseSnowman disguise = new DisguiseSnowman(player); + disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); + disguise.setCustomNameVisible(true); + Manager.getDisguiseManager().disguise(disguise); + } + + @Override + public void DisableCustom(Player player) + { + this.RemoveArmor(player); + Manager.getDisguiseManager().undisguise(player); + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if(!IsActive(event.getPlayer())) return; + + if(!UtilEvent.isAction(event, ActionType.L)) return; + + if(event.getItem() != null && event.getItem().getType() != Material.AIR) return; + + if(Recharge.Instance.use(event.getPlayer(), "Blizzard", 12000, true, true)) + { + event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Blizzard") + ".")); + } + } + + @EventHandler + public void Snow(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTEST) + { + + for (Player player : GetActive()) + { + NautHashMap map = Recharge.Instance.Get(player); + if(map == null) continue; + + RechargeData data = map.get("Blizzard"); + if(data == null) continue; + if(data.GetRemaining() < 10000) continue; + + for (int i=0 ; i<4 ; i++) + { + Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class); + double x = 0.1 - (UtilMath.r(20)/100d); + double y = UtilMath.r(20)/100d; + double z = 0.1 - (UtilMath.r(20)/100d); + snow.setShooter(player); + snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); + _snowball.put(snow, player); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f); + } + } + + if(event.getType() == UpdateType.TICK) + { + for (Player player : GetActive()) + { + if(player.isSneaking() && UtilEnt.isGrounded(player)) + { + player.setVelocity(player.getLocation().getDirection().setY(0).normalize()); + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0.3f, 0.1f, 0.3f, 0, 10, ViewDist.NORMAL); + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.3f, 0.3f); + } + } + } + } + + @EventHandler + public void Snowball(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Snowball)) + return; + + Snowball proj = (Snowball) event.getDamager(); + + if (!_snowball.containsKey(proj)) + return; + + GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); + + if(gevent.isCancelled()) return; + + UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); + } + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index ed61f6511..13fe0ee14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; import java.util.HashSet; @@ -9,9 +9,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; @@ -19,12 +17,13 @@ import org.bukkit.util.Vector; import mineplex.core.common.Rank; import mineplex.core.common.util.C; -import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; @@ -45,16 +44,14 @@ public class MorphTitan extends MorphGadget public MorphTitan(GadgetManager manager) { - super(manager, "Elder Guardian Morph", new String[] + super(manager, "Elder Guardian Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "From the depths of the sea, the", - C.cWhite + "Elder Guardian posseses powers", - C.cWhite + "more amazing than any seen before!", - " ", - C.cRed + "Unlocked with Titan Rank", - }, - -1, - Material.PRISMARINE_SHARD, (byte)0); + C.cGray + "From the depths of the sea, the Elder Guardian posseses powers more amazing than any seen before!", + C.blankLine, + "#" + C.cWhite + "Left-Click to use Guardians Laser", + }, LineFormat.LORE), + -13, + Material.PRISMARINE_CRYSTALS, (byte)0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index 985247b53..f327f0551 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; import java.util.Iterator; @@ -19,10 +19,12 @@ import org.bukkit.util.Vector; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.disguise.disguises.DisguiseVillager; @@ -40,14 +42,14 @@ public class MorphVillager extends MorphGadget implements IThrown public MorphVillager(GadgetManager manager) { - super(manager, "Villager Morph", new String[] + super(manager, "Villager Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "HURRRR! MURR HURRR!", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Gem Throw", - " ", - C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems" - }, + C.cGray + "HURRRR! MURR HURRR!", + C.blankLine, + "#" + C.cWhite + "Left Click to use Gem Throw", + C.blankLine, + "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems" + }, LineFormat.LORE), 12000, Material.EMERALD, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index 506ffc717..a2d68070f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.morph; import java.util.ArrayList; import java.util.HashMap; @@ -6,10 +6,12 @@ import java.util.Iterator; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -43,15 +45,13 @@ public class MorphWither extends MorphGadget public MorphWither(GadgetManager manager) { - super(manager, "Wither Morph", new String[] + super(manager, "Wither Morph", UtilText.splitLinesToArray(new String[] { - C.cWhite + "Become a legendary Wither!", - " ", - C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull", - " ", - C.cGreen + "Unlocked with Legend Rank", - }, - -1, + C.cGray + "Legends have foretold the coming of a powerful Wither...", + C.blankLine, + "#" + C.cWhite + "Left Click to use Wither Skull", + }, LineFormat.LORE), + -12, Material.SKULL_ITEM, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitRaveSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuit.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitRaveSuit.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuit.java index 2834498a4..bc1656359 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitRaveSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuit.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.outfit; import java.util.HashMap; @@ -11,9 +11,14 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.updater.UpdateType; @@ -27,7 +32,9 @@ public class OutfitRaveSuit extends OutfitGadget public OutfitRaveSuit(GadgetManager manager, String name, int cost, ArmorSlot slot, Material mat, byte data) { - super(manager, name, new String[] {ChatColor.RESET + "Wear the complete set for",ChatColor.RESET + "awesome bonus effects!", ChatColor.RESET + "Bonus coming soon..."}, cost, slot, mat, data); + super(manager, name, + UtilText.splitLineToArray(C.cGray + "There's nothing more suitable for celebration than this high tech flashing outfit!", LineFormat.LORE), + cost, slot, mat, data); } @Override @@ -155,4 +162,18 @@ public class OutfitRaveSuit extends OutfitGadget { _colorPhase.remove(event.getPlayer().getName()); } + + @EventHandler + public void setBonus(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetSlot() != ArmorSlot.Helmet) + return; + + for (Player player : UtilServer.getPlayers()) + if (getSet() != null && getSet().isActive(player)) + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 39, 4, true, false), true); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitBoots.java new file mode 100644 index 000000000..b74eda769 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitBoots.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitRaveSuitBoots extends OutfitRaveSuit +{ + + public OutfitRaveSuitBoots(GadgetManager manager) + { + super(manager, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitChestplate.java new file mode 100644 index 000000000..df3b5577e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitChestplate.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitRaveSuitChestplate extends OutfitRaveSuit +{ + + public OutfitRaveSuitChestplate(GadgetManager manager) + { + super(manager, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitHelmet.java new file mode 100644 index 000000000..122ea157d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitHelmet.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitRaveSuitHelmet extends OutfitRaveSuit +{ + + public OutfitRaveSuitHelmet(GadgetManager manager) + { + super(manager, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitLeggings.java new file mode 100644 index 000000000..b4b14df9d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitRaveSuitLeggings.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitRaveSuitLeggings extends OutfitRaveSuit +{ + + public OutfitRaveSuitLeggings(GadgetManager manager) + { + super(manager, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuit.java new file mode 100644 index 000000000..9d29e4e43 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuit.java @@ -0,0 +1,55 @@ +package mineplex.core.gadget.gadgets.outfit; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class OutfitSpaceSuit extends OutfitGadget +{ + public OutfitSpaceSuit(GadgetManager manager, String name, + int cost, ArmorSlot slot, Material mat, byte data) + { + super(manager, name, + UtilText.splitLineToArray(C.cGray + "Designed specifically for combat in deep space for a sport known as \'Gravity\'", LineFormat.LORE), + cost, slot, mat, data); + } + + @Override + public void EnableCustom(Player player) + { + ApplyArmor(player); + } + + @Override + public void DisableCustom(Player player) + { + RemoveArmor(player); + } + + @EventHandler + public void setBonus(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetSlot() != ArmorSlot.Helmet) + return; + + for (Player player : UtilServer.getPlayers()) + if (getSet() != null && getSet().isActive(player)) + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 39, 7, true, false), true); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitBoots.java new file mode 100644 index 000000000..46b242283 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitBoots.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitSpaceSuitBoots extends OutfitSpaceSuit +{ + + public OutfitSpaceSuitBoots(GadgetManager manager) + { + super(manager, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitChestplate.java new file mode 100644 index 000000000..f2da731f0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitChestplate.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitSpaceSuitChestplate extends OutfitSpaceSuit +{ + + public OutfitSpaceSuitChestplate(GadgetManager manager) + { + super(manager, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitHelmet.java new file mode 100644 index 000000000..2d5dabb70 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitHelmet.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitSpaceSuitHelmet extends OutfitSpaceSuit +{ + + public OutfitSpaceSuitHelmet(GadgetManager manager) + { + super(manager, "Space Helmet", -2, ArmorSlot.Helmet, Material.GLASS, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitLeggings.java new file mode 100644 index 000000000..3f29bced9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitSpaceSuitLeggings.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit; + +import mineplex.core.gadget.GadgetManager; + +import org.bukkit.Material; + +public class OutfitSpaceSuitLeggings extends OutfitSpaceSuit +{ + + public OutfitSpaceSuitLeggings(GadgetManager manager) + { + super(manager, "Space Pants", -2, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitTeam.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java index 9090eb81e..8abec4a35 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/OutfitTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.outfit; import java.util.HashMap; @@ -19,7 +19,8 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.itemstack.ItemStackFactory; @@ -40,7 +41,7 @@ public class OutfitTeam extends OutfitGadget @Override public void Enable(Player player) { - GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this); + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) @@ -55,7 +56,7 @@ public class OutfitTeam extends OutfitGadget @Override public void ApplyArmor(Player player) { - Manager.RemoveMorph(player); + Manager.removeGadgetType(player, GadgetType.Morph); Manager.RemoveOutfit(player, _slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java new file mode 100644 index 000000000..d36ca5021 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java @@ -0,0 +1,98 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleCandyCane extends ParticleGadget +{ + + private HashMap _map = new HashMap(); + + public ParticleCandyCane(GadgetManager manager) + { + super(manager, "Crushed Candy Cane", + UtilText.splitLineToArray(C.cGray + "There’s no such thing as too much Christmas Candy. Don’t listen to your dentist.", LineFormat.LORE), + -3, Material.INK_SACK, (byte)1); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for(Player player : GetActive()) + { + if (!shouldDisplay(player)) + continue; + + boolean moving = Manager.isMoving(player); + Location loc = player.getLocation(); + float y = moving? 0.2f : 0.15f; + double yadd = getY(player); + if(!moving && yadd < 2.1) + { + yadd += 0.05; + setY(player, yadd); + } + if(moving && yadd > 0.7) + { + yadd = 0.7; + setY(player, yadd); + } + loc.add(0, yadd, 0); + + float w = 0.2f; + int a = moving? 2 : 6; + + if(!moving) + { + double d = Math.PI*2 * (event.getTick()/50.0); + Vector v = new Vector(Math.sin(d), 0, Math.cos(d)); + loc.add(v); + } + + + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL); + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _map.remove(event.getPlayer().getUniqueId()); + } + + private void setY(Player p, double y) + { + _map.put(p.getUniqueId(), y); + } + + private double getY(Player p) + { + Double y = _map.get(p.getUniqueId()); + if(y == null) return 3; + return y.doubleValue(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java new file mode 100644 index 000000000..2ccb3701e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java @@ -0,0 +1,40 @@ +package mineplex.core.gadget.gadgets.particle; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleCoalFumes extends ParticleGadget +{ + + public ParticleCoalFumes(GadgetManager manager) + { + super(manager, "Coal Fumes", + UtilText.splitLineToArray(C.cGray + "Being on the Naughty List does have some perks... if you love coal, that is...", LineFormat.LORE), + -1, Material.COAL, (byte) 0); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + for(Player p : GetActive()) + { + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, p.getLocation(), 0.8f, 0, 0.8f, 0, 12, ViewDist.NORMAL); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java similarity index 80% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java index 1225728a4..230705505 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import org.bukkit.GameMode; import org.bukkit.Material; @@ -6,8 +6,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.types.ParticleGadget; @@ -19,13 +21,8 @@ public class ParticleEnchant extends ParticleGadget { public ParticleEnchant(GadgetManager manager) { - super(manager, "Enchanted", new String[] - { - C.cWhite + "The wisdom of the universe", - C.cWhite + "suddenly finds you extremely", - C.cWhite + "attractive, and wants to", - C.cWhite + "\'enchant\' you.", - }, + super(manager, "Enchanted", + UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly find you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE), -2, Material.BOOK, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairy.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairy.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java index 2c6c70091..5bc8b9381 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import java.util.HashMap; @@ -23,9 +23,9 @@ public class ParticleFairy extends ParticleGadget { super(manager, "Flame Fairy", new String[] { - C.cWhite + "HEY! LISTEN!", - C.cWhite + "HEY! LISTEN!", - C.cWhite + "HEY! LISTEN!", + C.cGray + "HEY! LISTEN!", + C.cGray + "HEY! LISTEN!", + C.cGray + "HEY! LISTEN!", }, -2, Material.BLAZE_POWDER, (byte)0); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairyData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairyData.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairyData.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairyData.java index 00d4cd895..424f61382 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFairyData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairyData.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFireRings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFireRings.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java index 3537558d2..99a79c36d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFireRings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import org.bukkit.GameMode; import org.bukkit.Material; @@ -7,8 +7,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.types.ParticleGadget; @@ -21,12 +23,8 @@ public class ParticleFireRings extends ParticleGadget public ParticleFireRings(GadgetManager manager) { - super(manager, "Flame Rings", new String[] - { - C.cWhite + "Forged from the burning ashes", - C.cWhite + "of 1000 Blazes by the infamous", - C.cWhite + "Flame King of the Nether realm.", - }, + super(manager, "Flame Rings", + UtilText.splitLineToArray(C.cGray + "Forged from the blazing rods of 1000 Blazes by the infamous Nether King.", LineFormat.LORE), -2, Material.BLAZE_POWDER, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFoot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFoot.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java index 1e68a3d93..44448a375 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleFoot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import java.util.HashMap; import java.util.Iterator; @@ -14,11 +14,13 @@ import org.bukkit.event.EventHandler; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -35,13 +37,8 @@ public class ParticleFoot extends ParticleGadget public ParticleFoot(GadgetManager manager) { - super(manager, "Shadow Walk", new String[] - { - C.cWhite + "In a world where footprints", - C.cWhite + "do not exist, leaving your", - C.cWhite + "shadow behind is the next", - C.cWhite + "best thing.", - }, + super(manager, "Shadow Walk", + UtilText.splitLineToArray(C.cGray + "In a world where footprints do not exist, leaving your shadow behind is the next best thing!", LineFormat.LORE), -2, Material.LEATHER_BOOTS, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java new file mode 100644 index 000000000..035615c59 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java @@ -0,0 +1,85 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.types.GadgetSet; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleFrostLord extends ParticleGadget +{ + public ParticleFrostLord(GadgetManager manager) + { + super(manager, "Wind of the Frost Lord", + UtilText.splitLineToArray(C.cGray + "He’s not passing wind okay? HE HAS A CONDITION!", LineFormat.LORE), + -3, + Material.SNOW_BALL, (byte)0, "Frost Lord"); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (!shouldDisplay(player)) + continue; + + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.015f, 0.2f); + + double scale = (double)(player.getTicksLived() % 50) / 50d; + + int amount = 4; + + if(getSet() != null && getSet().isActive(player)) + amount = 6; + + double ang = Math.PI*2/amount; + + for (int i = 0 ; i < amount ; i++) + { + double r = (1d-scale) * Math.PI * 2; + + double x = Math.sin(r + (i * ang)) * (r%(Math.PI * 4)) * 0.4; + double z = Math.cos(r + (i * ang)) * (r%(Math.PI * 4)) * 0.4; + + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + + if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false)) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60, + ViewDist.NORMAL, UtilServer.getPlayers()); + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 1f, 1.5f); + } + } + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java index 9a370fad1..a9bd2739d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import org.bukkit.GameMode; import org.bukkit.Material; @@ -7,8 +7,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.types.ParticleGadget; @@ -21,12 +23,8 @@ public class ParticleGreen extends ParticleGadget public ParticleGreen(GadgetManager manager) { - super(manager, "Green Ring", new String[] - { - C.cWhite + "With these sparkles, you", - C.cWhite + "can now sparkle while you", - C.cWhite + "sparkle with CaptainSparklez.", - }, + super(manager, "Green Ring", + UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkle with CaptainSparklez!", LineFormat.LORE), -2, Material.EMERALD, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHeart.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java index 61d602440..d07a2b01a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import java.util.HashMap; import java.util.Iterator; @@ -13,11 +13,13 @@ import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.types.ParticleGadget; @@ -31,12 +33,8 @@ public class ParticleHeart extends ParticleGadget { public ParticleHeart(GadgetManager manager) { - super(manager, "I Heart You", new String[] - { - C.cWhite + "With these particles, you can", - C.cWhite + "show off how much you heart", - C.cWhite + "everyone on Mineplex!", - }, + super(manager, "I Heart You", + UtilText.splitLineToArray(C.cGray + "Show off how much you love Mineplex and everyone on it!", LineFormat.LORE), -2, Material.APPLE, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java new file mode 100644 index 000000000..a9336927b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java @@ -0,0 +1,128 @@ +package mineplex.core.gadget.gadgets.particle; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleHelix extends ParticleGadget +{ + + public ParticleHelix(GadgetManager manager) + { + super(manager, "Blood Helix", + UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous... but also very cool!", LineFormat.LORE), + -2, + Material.REDSTONE, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (!shouldDisplay(player)) + continue; + + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + + int ticks = 10; + int hticks = 40; + boolean up = player.getTicksLived()%(hticks*2) < hticks; + int tick = player.getTicksLived()%ticks; + double htick = player.getTicksLived()%hticks; + int splits = 4; + + Location loc = player.getLocation().add(0, 2, 0); + + for(double d = tick*(Math.PI*2/splits)/ticks; d < Math.PI*2; d += Math.PI*2/splits) + { + Vector v = new Vector(Math.sin(d), 0, Math.cos(d)); + v.normalize().multiply(Math.max(0.2, Math.sin((htick/hticks)*Math.PI)*1.0)); + v.setY((htick/hticks) * -2); + if(up) v.setY(-2 + 2*(htick/hticks)); + + +// v.multiply(2).subtract(v.clone().multiply(htick/hticks)); +// v.multiply(2*(htick/hticks)); + + Location lloc = loc.clone().add(v); + + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, lloc, null, 0f, 2, ViewDist.NORMAL); + } + +// UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20, +// ViewDist.NORMAL, UtilServer.getPlayers()); + + /* + * With Flame + int ticks = 10; + int tick = player.getTicksLived()%ticks; + int splits = 3; + + Location loc = player.getLocation().add(0, 3, 0); + + for(double d = tick*(Math.PI*2/splits)/ticks; d < Math.PI*2; d += Math.PI*2/splits) + { + Vector v = new Vector(Math.sin(d), 0, Math.cos(d)); + + v.setY(-1.5); + + UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.1f, 0, ViewDist.NORMAL); + } + + UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20, + ViewDist.NORMAL, UtilServer.getPlayers()); + */ + /* + for (int height=0 ; height <= 20 ; height++) + { + for (int i=0 ; i < 2 ; i++) + { + double lead = i * ((2d * Math.PI)/2); + + double heightLead = height * ((2d * Math.PI)/20); + + float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f); + float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f); + + float y = 0.15f * height; + + UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f, 0f, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + + + } + } + + //UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f); + */ + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java index dd74addb9..733424255 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import java.util.HashMap; @@ -25,9 +25,9 @@ public class ParticleKronos extends ParticleGadget { super(manager, "Titanic Aura", new String[] { - C.cWhite + "A symbol of Titan power", - C.cWhite + "whos ancestry traces back to Kronos,", - C.cWhite + "Titan Lord of Time.", + C.cGray + "A symbol of Titan power", + C.cGray + "whos ancestry traces back to Kronos,", + C.cGray + "Titan Lord of Time.", " ", C.cRed + "???" //When purchasable: C.cRed + "Unlocked with Titan Rank" diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronosData.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronosData.java index 5d78b2b3d..289a60099 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronosData.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java similarity index 82% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java index 76e4d277f..45e74b3b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import org.bukkit.Effect; import org.bukkit.Material; @@ -8,6 +8,8 @@ import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.data.Item; @@ -19,14 +21,9 @@ public class ParticleLegend extends ParticleGadget { public ParticleLegend(GadgetManager manager) { - super(manager, "Legendary Aura", new String[] - { - C.cWhite + "These mystic particle attach to", - C.cWhite + "only the most legendary of players!", - " ", - C.cGreen + "Unlocked with Legend Rank", - }, - -3, + super(manager, "Legendary Aura", + UtilText.splitLineToArray(C.cGray + "This particle will be updated soon! Yay!", LineFormat.LORE), + -1, Material.ENDER_PORTAL_FRAME, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleRain.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java similarity index 85% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleRain.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java index 4300b5369..0e0b43109 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleRain.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets; +package mineplex.core.gadget.gadgets.particle; import org.bukkit.GameMode; import org.bukkit.Material; @@ -7,8 +7,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.types.ParticleGadget; @@ -21,12 +23,8 @@ public class ParticleRain extends ParticleGadget public ParticleRain(GadgetManager manager) { - super(manager, "Rain Cloud", new String[] - { - C.cWhite + "Your very own rain cloud!", - C.cWhite + "Now you never have to worry", - C.cWhite + "about not being wet. Woo...", - }, + super(manager, "Rain Cloud", + UtilText.splitLineToArray(C.cGray + "Bring your sadness wherever you go, with your very own portable rain cloud!", LineFormat.LORE), -2, Material.INK_SACK, (byte)4); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java new file mode 100644 index 000000000..b751709ac --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java @@ -0,0 +1,115 @@ +package mineplex.core.gadget.gadgets.particle; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleTitan extends ParticleGadget +{ + + private int _tick; + + public ParticleTitan(GadgetManager manager) + { + super(manager, "Flame of the Titans", + UtilText.splitLineToArray(C.cGray + "These flames are said to be the spirit of a Titan.", LineFormat.LORE), + -1, + Material.FIREBALL, (byte)0); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + + return; + + _tick++; + _tick = _tick%620; + + for(Player player : GetActive()) + { + if (!shouldDisplay(player)) + continue; + + double total = 3; + + if(getSet() != null && getSet().isActive(player)) + total = 4; + + double step = (1/total)*Math.PI*2; + double offset1 = (step/20)*_tick%20; + double offset2 = (step/31)*_tick%31; + + double r = 3; + boolean redstone = false; + + if(Manager.isMoving(player)) + { + UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 0.1, 0), 0.2f, 0.1f, 0.2f, 0.015f, 3, ViewDist.NORMAL); + continue; + } + + for(int i = 0; i < total; i++) + { + double rad = step*i + offset1; + + double x = Math.sin(rad); + double y = 0; + double z = Math.cos(rad); + + + Vector v = new Vector(x,y,z).normalize(); + v.multiply(r); + Location loc = player.getLocation(); + loc.add(0, 0.1, 0); + + loc.add(v); + + + if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); + v.multiply(-1); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); + + rad = -(step*i + offset2); + x = Math.sin(rad); + z = Math.cos(rad); + + v = new Vector(x,y,z).normalize(); + v.multiply(r); + loc = player.getLocation(); + loc.add(0, 0.1, 0); + + loc.add(v); + + if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); + v.multiply(-1); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); + } + } + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java new file mode 100644 index 000000000..8a1acaf71 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java @@ -0,0 +1,24 @@ +package mineplex.core.gadget.set; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.death.DeathCandyCane; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; +import mineplex.core.gadget.types.GadgetSet; + +public class SetCandyCane extends GadgetSet +{ + + public SetCandyCane(GadgetManager manager) + { + super(manager, "Candy Cane", "Coming Soon...", + manager.getGadget(ArrowTrailCandyCane.class), + manager.getGadget(DeathCandyCane.class), + manager.getGadget(DoubleJumpCandyCane.class), + manager.getGadget(ParticleCandyCane.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java new file mode 100644 index 000000000..fec0b8950 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java @@ -0,0 +1,24 @@ +package mineplex.core.gadget.set; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.death.DeathFrostLord; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; +import mineplex.core.gadget.types.GadgetSet; + +public class SetFrostLord extends GadgetSet +{ + + public SetFrostLord(GadgetManager manager) + { + super(manager, "Frost Lord", "Improved Wind of the Frost Lord", + manager.getGadget(ArrowTrailFrostLord.class), + manager.getGadget(DeathFrostLord.class), + manager.getGadget(DoubleJumpFrostLord.class), + manager.getGadget(ParticleFrostLord.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetRaveSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetRaveSuit.java new file mode 100644 index 000000000..ea01fa10a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetRaveSuit.java @@ -0,0 +1,17 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.outfit.*; +import mineplex.core.gadget.types.GadgetSet; + +public class SetRaveSuit extends GadgetSet +{ + public SetRaveSuit(GadgetManager manager) + { + super(manager, "Rave Suit", "Hyper Speed", + manager.getGadget(OutfitRaveSuitHelmet.class), + manager.getGadget(OutfitRaveSuitChestplate.class), + manager.getGadget(OutfitRaveSuitLeggings.class), + manager.getGadget(OutfitRaveSuitBoots.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpaceSuit.java new file mode 100644 index 000000000..492b7a11f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpaceSuit.java @@ -0,0 +1,17 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.outfit.*; +import mineplex.core.gadget.types.GadgetSet; + +public class SetSpaceSuit extends GadgetSet +{ + public SetSpaceSuit(GadgetManager manager) + { + super(manager, "Space Suit", "Low Gravity", + manager.getGadget(OutfitSpaceSuitHelmet.class), + manager.getGadget(OutfitSpaceSuitChestplate.class), + manager.getGadget(OutfitSpaceSuitLeggings.class), + manager.getGadget(OutfitSpaceSuitBoots.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java new file mode 100644 index 000000000..f2012131b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java @@ -0,0 +1,24 @@ +package mineplex.core.gadget.set; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.particle.ParticleTitan; +import mineplex.core.gadget.types.GadgetSet; + +public class SetTitan extends GadgetSet +{ + + public SetTitan(GadgetManager manager) + { + super(manager, "The Titans", "Improved Flame of the Titans", + manager.getGadget(ArrowTrailTitan.class), + manager.getGadget(DeathTitan.class), + manager.getGadget(DoubleJumpTitan.class), + manager.getGadget(ParticleTitan.class)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java new file mode 100644 index 000000000..a32e05163 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java @@ -0,0 +1,106 @@ +package mineplex.core.gadget.types; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public abstract class ArrowEffectGadget extends Gadget +{ + protected HashSet _arrows = new HashSet(); + + public ArrowEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) + { + super(manager, GadgetType.ArrowTrail, name, desc, cost, mat, data, 1, altNames); + } + + @Override + public void EnableCustom(Player player) + { + Manager.removeGadgetType(player, GadgetType.ArrowTrail); + + _active.add(player); + + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); + } + + @Override + public void DisableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); + } + + public boolean shouldDisplay(Player player) + { + if (UtilPlayer.isSpectator(player)) + return false; + + if (Manager.hideParticles()) + return false; + + return true; + } + + @EventHandler + public void arrowLaunch(ProjectileLaunchEvent event) + { + if (Manager.hideParticles()) + return; + + if (event.getEntity() instanceof Arrow) + { + if (event.getEntity().getShooter() != null) + { + if (GetActive().contains(event.getEntity().getShooter())) + { + _arrows.add((Arrow)event.getEntity()); + } + } + } + } + + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) + { + arrowIterator.remove(); + } + else + { + doTrail(arrow); + } + } + } + + @EventHandler + public void arrowHit(ProjectileHitEvent event) + { + if (!_arrows.remove(event.getEntity())) + return; + + doHitEffect((Arrow)event.getEntity()); + } + + public abstract void doTrail(Arrow arrow); + public abstract void doHitEffect(Arrow arrow); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java new file mode 100644 index 000000000..5e337586c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java @@ -0,0 +1,44 @@ +package mineplex.core.gadget.types; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; + +public abstract class DeathEffectGadget extends Gadget +{ + public DeathEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) + { + super(manager, GadgetType.Death, name, desc, cost, mat, data, 1, altNames); + } + + @Override + public void EnableCustom(Player player) + { + Manager.removeGadgetType(player, GadgetType.Death); + + _active.add(player); + + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); + } + + @Override + public void DisableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); + } + + public boolean shouldDisplay(Player player) + { + if (UtilPlayer.isSpectator(player)) + return false; + + if (Manager.hideParticles()) + return false; + + return true; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java new file mode 100644 index 000000000..f59c0ed50 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java @@ -0,0 +1,61 @@ +package mineplex.core.gadget.types; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; + +public abstract class DoubleJumpEffectGadget extends Gadget +{ + public DoubleJumpEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) + { + super(manager, GadgetType.DoubleJump, name, desc, cost, mat, data, 1, altNames); + } + + @Override + public void EnableCustom(Player player) + { + Manager.removeGadgetType(player, GadgetType.DoubleJump); + + _active.add(player); + + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); + } + + @Override + public void DisableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); + } + + public boolean shouldDisplay(Player player) + { + if (UtilPlayer.isSpectator(player)) + return false; + + if (Manager.hideParticles()) + return false; + + return true; + } + + @EventHandler + public void jump(PlayerToggleFlightEvent event) + { + if (!shouldDisplay(event.getPlayer())) + return; + + if (!event.getPlayer().isFlying()) + if (IsActive(event.getPlayer())) + { + doEffect(event.getPlayer()); + } + } + + public abstract void doEffect(Player player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index 063495f54..6998e2a51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import java.util.ArrayList; import java.util.HashSet; import mineplex.core.common.CurrencyType; @@ -7,7 +8,8 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.GadgetDisableEvent; import mineplex.core.shop.item.SalesPackageBase; import org.bukkit.Bukkit; @@ -25,18 +27,25 @@ public abstract class Gadget extends SalesPackageBase implements Listener protected HashSet _active = new HashSet(); + protected GadgetSet _set = null; + + private String[] _alternativePackageNames; + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data) { this(manager, gadgetType, name, desc, cost, mat, data, 1); } - public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity) + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames) { super(name, mat, data, desc, cost, quantity); - + _gadgetType = gadgetType; KnownPackage = false; + _alternativePackageNames = alternativesalepackageNames; + if(_alternativePackageNames == null) _alternativePackageNames = new String[0]; + Manager = manager; Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); @@ -65,7 +74,7 @@ public abstract class Gadget extends SalesPackageBase implements Listener public void Enable(Player player) { - GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this); + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) @@ -89,7 +98,11 @@ public abstract class Gadget extends SalesPackageBase implements Listener public void Disable(Player player) { if (IsActive(player)) + { Manager.removeActive(player, this); + GadgetDisableEvent event = new GadgetDisableEvent(player, this); + Bukkit.getServer().getPluginManager().callEvent(event); + } DisableCustom(player); } @@ -102,6 +115,29 @@ public abstract class Gadget extends SalesPackageBase implements Listener { } - + public boolean ownsGadget(Player player) + { + if(IsFree()) return true; + if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(GetName())) return true; + if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0) return true; + + for(String alt : _alternativePackageNames) + { + if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(alt)) return true; + if(Manager.getInventoryManager().Get(player).getItemCount(alt) > 0) return true; + } + + return false; + } + + public void setSet(GadgetSet set) + { + _set = set; + } + + public GadgetSet getSet() + { + return _set; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java new file mode 100644 index 000000000..234bbc2dd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java @@ -0,0 +1,122 @@ +package mineplex.core.gadget.types; + +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.GadgetDisableEvent; + +public abstract class GadgetSet implements Listener +{ + private String _name; + private String[] _bonus; + + private Gadget[] _gadgets; + + protected GadgetManager Manager; + + HashSet _active = new HashSet<>(); + + public GadgetSet(GadgetManager manager, String name, String bonus, Gadget... gadgets) + { + Manager = manager; + _gadgets = gadgets; + + _name = name; + _bonus = UtilText.splitLineToArray(bonus, LineFormat.LORE); + + for (Gadget gadget : gadgets) + gadget.setSet(this); + + Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); + } + + public void checkPlayer(Player player, Gadget gadget, boolean enable) + { + boolean wasActive = isActive(player); + + for(Gadget g : _gadgets) + { + if(!g.IsActive(player) || g.equals(gadget)) + { + if(enable && g.equals(gadget)) continue; + + _active.remove(player); + if(wasActive) + customDisable(player); + return; + } + } + _active.add(player); + if(!wasActive) + { + customEnable(player); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onActivate(GadgetEnableEvent event) + { + checkPlayer(event.getPlayer(), event.getGadget(), true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onDeativate(GadgetDisableEvent event) + { + checkPlayer(event.getPlayer(), event.getGadget(), false); + } + + public boolean isActive(Player player) + { + return _active.contains(player); + } + + public void customEnable(Player player) + { + player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName()))); + } + + public void customDisable(Player player) + { + player.sendMessage(F.main("Gadget", "Set Disabled: " + F.elem(C.cRed + getName()))); + + } + + public Gadget[] getGadgets() + { + Gadget[] array = new Gadget[_gadgets.length]; + System.arraycopy(_gadgets, 0, array, 0, array.length); + return array; + } + + public boolean isPartOfSet(Gadget gadget) + { + for(Gadget g : _gadgets) + { + if(g.equals(gadget)) return true; + } + return false; + } + + public String getName() + { + return _name; + } + + public String[] getBonus() + { + return _bonus; + } + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java index 11b014b32..5daff04b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java @@ -7,4 +7,9 @@ public enum GadgetType Particle, MusicDisc, Costume, + DoubleJump, + ArrowTrail, + Death, + Hat, + Taunt } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java new file mode 100644 index 000000000..d61339bf8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -0,0 +1,98 @@ +package mineplex.core.gadget.types; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; + +public abstract class HatGadget extends OutfitGadget +{ + + private ItemStack _hat; + + public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item, String... altNames) + { + super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData(), altNames); + _hat = item; + + ItemMeta im = _hat.getItemMeta(); + im.setDisplayName(C.cGreen + C.Bold + name); + _hat.setItemMeta(im); + } + + public HatGadget(GadgetManager manager, String name, String[] desc, int cost, String playerName) + { + this(manager, name, desc, cost, getSkull(playerName)); + } + + public ItemStack getHelmetItem() + { + return _hat.clone(); + } + + public void ApplyArmor(Player player) + { + Manager.removeGadgetType(player, GadgetType.Morph); + + Manager.RemoveOutfit(player, _slot); + + _active.add(player); + + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + ".")); + + player.getInventory().setHelmet(getHelmetItem()); + } + + public void RemoveArmor(Player player) + { + if (!_active.remove(player)) + return; + + UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + ".")); + + player.getInventory().setHelmet(null); + } + + public static ItemStack getSkull(String playerName) + { + SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM); + + meta.setOwner(playerName); + + ItemStack stack = new ItemStack(Material.SKULL_ITEM,1 , (byte)3); + + stack.setItemMeta(meta); + + return stack; + } + + @Override + public GadgetType getGadgetType() + { + return GadgetType.Hat; + } + + + @Override + public void EnableCustom(Player player) + { + ApplyArmor(player); + } + + @Override + public void DisableCustom(Player player) + { + RemoveArmor(player); + } + + + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 232abb0eb..b0d7bdae6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -64,7 +64,7 @@ public abstract class ItemGadget extends Gadget public void ApplyItem(Player player, boolean inform) { - Manager.RemoveItem(player); + Manager.removeGadgetType(player, GadgetType.Item); _active.add(player); @@ -141,7 +141,7 @@ public abstract class ItemGadget extends Gadget event.setCancelled(true); //Stock - if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) + if (!hasAmmo(player)) { UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); @@ -157,7 +157,7 @@ public abstract class ItemGadget extends Gadget { UtilInv.Update(player); return; - } + } Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); @@ -165,6 +165,11 @@ public abstract class ItemGadget extends Gadget ActivateCustom(event.getPlayer()); } + + public boolean hasAmmo(Player player) + { + return Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0; + } public abstract void ActivateCustom(Player player); } 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 47e121979..96c19d0ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -19,7 +19,7 @@ public abstract class MorphGadget extends Gadget public void ApplyArmor(Player player) { - Manager.RemoveMorph(player); + Manager.removeGadgetType(player, GadgetType.Morph); _active.add(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java index 7dd175be3..c139e85c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java @@ -8,7 +8,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.gadgets.SongData; import mineplex.core.recharge.Recharge; @@ -41,7 +41,7 @@ public class MusicGadget extends Gadget @Override public void Enable(Player player) { - GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this); + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index fabae966d..cc9b7fd39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -20,9 +20,9 @@ public abstract class OutfitGadget extends Gadget protected ArmorSlot _slot; - public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data) + public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames) { - super(manager, GadgetType.Costume, name, desc, cost, mat, data); + super(manager, GadgetType.Costume, name, desc, cost, mat, data, 1, altNames); _slot = slot; } @@ -34,7 +34,7 @@ public abstract class OutfitGadget extends Gadget public void ApplyArmor(Player player) { - Manager.RemoveMorph(player); + Manager.removeGadgetType(player, GadgetType.Morph); Manager.RemoveOutfit(player, _slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index 3dadb6995..bc807eb48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.types; -import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -10,15 +9,15 @@ import mineplex.core.gadget.GadgetManager; public abstract class ParticleGadget extends Gadget { - public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data) + public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { - super(manager, GadgetType.Particle, name, desc, cost, mat, data); + super(manager, GadgetType.Particle, name, desc, cost, mat, data, 1, altNames); } @Override public void EnableCustom(Player player) { - Manager.RemoveParticle(player); + Manager.removeGadgetType(player, GadgetType.Particle); _active.add(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java index 97257bd98..4825a97e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java @@ -14,10 +14,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.command.GlobalPacketCommand; -import mineplex.core.globalpacket.listeners.GlobalGiveCoins; -import mineplex.core.globalpacket.listeners.GlobalGiveGems; -import mineplex.core.globalpacket.listeners.GlobalGiveItem; -import mineplex.core.globalpacket.listeners.GlobalRawr; +// import mineplex.core.globalpacket.listeners.GlobalGiveCoins; +// import mineplex.core.globalpacket.listeners.GlobalGiveGems; +// import mineplex.core.globalpacket.listeners.GlobalGiveItem; +// import mineplex.core.globalpacket.listeners.GlobalRawr; import mineplex.core.globalpacket.redis.GlobalPacketHandler; import mineplex.core.globalpacket.redis.GlobalPacketMessage; import mineplex.core.inventory.InventoryManager; @@ -53,10 +53,10 @@ public class GlobalPacketManager extends MiniPlugin ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager)); - getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin()); - getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin()); - getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin()); - getPluginManager().registerEvents(new GlobalRawr(), getPlugin()); + // getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin()); + // getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin()); + // getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin()); + // getPluginManager().registerEvents(new GlobalRawr(), getPlugin()); } public void callGlobalCommand(Player caller, String[] args) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/command/Ignore.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/command/Ignore.java index 40c975cc6..48bf63e65 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/command/Ignore.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/command/Ignore.java @@ -17,7 +17,7 @@ public class Ignore extends CommandBase @Override public void Execute(final Player caller, final String[] args) { - if (args == null) + if (args == null || args.length < 1) { Plugin.showIgnores(caller); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 7df564134..a10dd5e73 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -93,6 +93,7 @@ public class InventoryManager extends MiniDbClientPlugin public void addItemToInventory(final Callback callback, final Player player, final String item, final int count) { + int accountId = getClientManager().getAccountId(player); addItemToInventoryForOffline(new Callback() { public void run(Boolean success) @@ -105,7 +106,7 @@ public class InventoryManager extends MiniDbClientPlugin if (callback != null) callback.run(success); } - }, player.getUniqueId(), item, count); + }, accountId, item, count); } public boolean validItem(String item) @@ -137,7 +138,18 @@ public class InventoryManager extends MiniDbClientPlugin { public void run() { - addItemToInventoryForOffline(callback, PlayerCache.getInstance().getPlayer(uuid).getAccountId(), item, count); + try + { + addItemToInventoryForOffline(callback, PlayerCache.getInstance().getPlayer(uuid).getAccountId(), item, count); + } + catch (Exception e) + { + e.printStackTrace(); + + System.out.println("-----DEBUG-----"); + System.out.println("PlayerCache Instance: " + (PlayerCache.getInstance() == null)); + System.out.println("PlayerCache Player Object: " + (PlayerCache.getInstance().getPlayer(uuid) == null)); + } } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java index c1d486795..8ea88cc70 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java @@ -2,7 +2,9 @@ package mineplex.core.itemstack; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -12,6 +14,7 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkEffectMeta; import org.bukkit.inventory.meta.ItemMeta; @@ -19,6 +22,8 @@ import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.Potion; +import mineplex.core.common.util.C; + public class ItemBuilder { @@ -48,20 +53,17 @@ public class ItemBuilder private final HashMap _enchants = new HashMap(); private final List _lore = new ArrayList(); private Material _mat; - // private Potion potion; private String _title = null; private boolean _unbreakable; private String _playerHeadName = null; + private HashSet _itemFlags = new HashSet(); public ItemBuilder(ItemStack item) { this(item.getType(), item.getDurability()); _amount = item.getAmount(); _enchants.putAll(item.getEnchantments()); - if (item.getType() == Material.POTION) - { - // setPotion(Potion.fromItemStack(item)); - } + if (item.hasItemMeta()) { ItemMeta meta = item.getItemMeta(); @@ -81,6 +83,8 @@ public class ItemBuilder setColor(((LeatherArmorMeta) meta).getColor()); } + _itemFlags.addAll(meta.getItemFlags()); + _unbreakable = meta.spigot().isUnbreakable(); } } @@ -107,13 +111,60 @@ public class ItemBuilder this(mat, 1, data); } + public HashSet getItemFlags() + { + return _itemFlags; + } + + public ItemBuilder addItemFlags(ItemFlag... flags) + { + getItemFlags().addAll(Arrays.asList(flags)); + + return this; + } + + public ItemBuilder setItemFlags(ItemFlag... flags) + { + getItemFlags().clear(); + addItemFlags(flags); + + return this; + } + + public ItemBuilder setItemFlags(Collection flags) + { + getItemFlags().clear(); + addItemFlags(flags.toArray(new ItemFlag[0])); + + return this; + } + + public ItemBuilder setHideInfo(boolean hideInfo) + { + if (hideInfo) + { + for (ItemFlag flag : ItemFlag.values()) + { + getItemFlags().add(flag); + } + } + else + { + getItemFlags().clear(); + } + + return this; + } + public ItemBuilder addEnchantment(Enchantment enchant, int level) { if (_enchants.containsKey(enchant)) { _enchants.remove(enchant); } + _enchants.put(enchant, level); + return this; } @@ -121,20 +172,31 @@ public class ItemBuilder { for (String lore : lores) { - _lore.add(ChatColor.GRAY + lore); + _lore.add(C.cGray + lore); } + + return this; + } + + public ItemBuilder setLore(String... lores) + { + _lore.clear(); + _lore.addAll(Arrays.asList(lores)); + return this; } public ItemBuilder addLore(String lore, int maxLength) { _lore.addAll(split(lore, maxLength)); + return this; } public ItemBuilder addLores(List lores) { _lore.addAll(lores); + return this; } @@ -144,6 +206,7 @@ public class ItemBuilder { addLore(lore, maxLength); } + return this; } @@ -155,6 +218,7 @@ public class ItemBuilder public ItemStack build() { Material mat = _mat; + if (mat == null) { mat = Material.AIR; @@ -164,8 +228,10 @@ public class ItemBuilder { Bukkit.getLogger().warning("Air material!"); } + ItemStack item = new ItemStack(mat, _amount, _data); ItemMeta meta = item.getItemMeta(); + if (meta != null) { if (_title != null) @@ -189,14 +255,13 @@ public class ItemBuilder ((FireworkEffectMeta) meta).setEffect(FireworkEffect.builder().withColor(_color).build()); } + meta.addItemFlags(getItemFlags().toArray(new ItemFlag[0])); meta.spigot().setUnbreakable(isUnbreakable()); item.setItemMeta(meta); } item.addUnsafeEnchantments(_enchants); - // if (potion != null) { - // potion.apply(item); - // } + return item; } @@ -263,52 +328,6 @@ public class ItemBuilder return _enchants.containsKey(enchant); } - public boolean isItem(ItemStack item) - { - ItemMeta meta = item.getItemMeta(); - - if (item.getType() != getType()) - { - return false; - } - - if (!meta.hasDisplayName() && getTitle() != null) - { - return false; - } - - if (!meta.getDisplayName().equals(getTitle())) - { - return false; - } - - if (!meta.hasLore() && !getLore().isEmpty()) - { - return false; - } - - if (meta.hasLore()) - { - for (String lore : meta.getLore()) - { - if (!getLore().contains(lore)) - { - return false; - } - } - } - - for (Enchantment enchant : item.getEnchantments().keySet()) - { - if (!hasEnchantment(enchant)) - { - return false; - } - } - - return true; - } - public boolean isUnbreakable() { return _unbreakable; @@ -317,17 +336,14 @@ public class ItemBuilder public ItemBuilder setAmount(int amount) { _amount = amount; + return this; } public ItemBuilder setColor(Color color) { - /* (!_mat.name().contains("LEATHER_")) - { - throw new IllegalArgumentException("Can only dye leather armor!"); - }*/ - _color = color; + return this; } @@ -338,19 +354,10 @@ public class ItemBuilder return this; } - public ItemBuilder setPotion(Potion potion) - { - if (_mat != Material.POTION) - { - _mat = Material.POTION; - } - - return this; - } - public ItemBuilder setRawTitle(String title) { _title = title; + return this; } @@ -378,24 +385,28 @@ public class ItemBuilder } setTitle(title); + return this; } public ItemBuilder setType(Material mat) { _mat = mat; + return this; } public ItemBuilder setUnbreakable(boolean setUnbreakable) { _unbreakable = setUnbreakable; + return this; } public ItemBuilder setPlayerHead(String playerName) { _playerHeadName = playerName; + return this; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 4de2d6666..814280180 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; +import mineplex.core.mount.types.MountBabyReindeer; import mineplex.core.mount.types.MountCart; import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountFrost; @@ -68,6 +69,7 @@ public class MountManager extends MiniPlugin _types.add(new MountSpider(this)); _types.add(new MountZombie(this)); _types.add(new MountTitan(this)); + _types.add(new MountBabyReindeer(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java new file mode 100644 index 000000000..64e56f971 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java @@ -0,0 +1,92 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.HorseJumpEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MountBabyReindeer extends HorseMount +{ + + public MountBabyReindeer(MountManager manager) + { + super(manager, "Baby Reindeer", + UtilText.splitLineToArray(C.cGray + "One of Santas baby reindeers. He's still learning how to fly...", LineFormat.LORE), + Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null); + } + + @EventHandler + public void EnableCustom(Player player) { + super.EnableCustom(player); + Horse horse = GetActive().get(player).getEntity(); + horse.setBaby(); + horse.setMaxHealth(20); + } + + @EventHandler + public void fly(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + for(SingleEntityMountData horse : GetActive().values()) + { + if(horse.getEntity().getPassenger() != horse.getOwner()) continue; + + if(Recharge.Instance.usable(horse.getOwner(), "Reindeer Fly")) continue; + + horse.getEntity().setVelocity(horse.getOwner().getLocation().getDirection().normalize().add(new Vector(0,0.4,0))); + + horse.getEntity().getWorld().playSound(horse.getEntity().getLocation(), Sound.HORSE_BREATHE, 0.3f, 0.5f); + + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, horse.getEntity().getLocation(), 0.2f,0.0f,0.2f, 0.0f, 10, ViewDist.NORMAL); + } + } + + @EventHandler + public void onClick(PlayerInteractEntityEvent event) + { + if(!IsActive(event.getPlayer())) return; + SingleEntityMountDatadata = getMountData(event.getRightClicked()); + if(data == null) return; + if(data.getOwner() != event.getPlayer()) return; + data.getEntity().setPassenger(data.getOwner()); + } + + @EventHandler + public void onJump(HorseJumpEvent event) + { + SingleEntityMountData data = getMountData(event.getEntity()); + if(data == null) return; + + event.setCancelled(true); + if(UtilEnt.isGrounded(event.getEntity())) + { + if(Recharge.Instance.use(data.getOwner(), "Reindeer Fly", 1000, false, false)) + { + event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.HORSE_ANGRY, 1f, 1f); + } + } + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index f5aa7f809..3af133864 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -11,12 +11,15 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.mount.Mount; import mineplex.core.mount.MountManager; import mineplex.core.mount.SingleEntityMountData; @@ -28,11 +31,8 @@ public class MountCart extends Mount> { public MountCart(MountManager manager) { - super(manager, "Minecart", Material.MINECART, (byte)0, new String[] - { - ChatColor.RESET + "Cruise around town in your", - ChatColor.RESET + "new Minecart VX Turbo!", - }, + super(manager, "Minecart", Material.MINECART, (byte)0, + UtilText.splitLineToArray(C.cGray + "Cruise around town in your shiny new Minecart RX Turbo!", LineFormat.LORE), 15000); KnownPackage = false; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java index efb19dcf5..918585528 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java @@ -10,7 +10,9 @@ import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -24,17 +26,11 @@ public class MountDragon extends DragonMount { public MountDragon(MountManager manager) { - super(manager, "Ethereal Dragon", new String[] - { - C.cWhite + "From the distant ether realm,", - C.cWhite + "this prized dragon is said to", - C.cWhite + "obey only true Heroes!", - " ", - C.cPurple + "Unlocked with Hero Rank", - }, + super(manager, "Ethereal Dragon", + UtilText.splitLineToArray(C.cGray + "From the distant Ether Realm, this prized dragon is said to only obey true Heroes!", LineFormat.LORE), Material.DRAGON_EGG, (byte)0, - -1); + -11); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java index e948ca9e3..5a8617699 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java @@ -8,7 +8,9 @@ import org.bukkit.entity.Horse.Variant; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.mount.HorseMount; @@ -21,12 +23,8 @@ public class MountFrost extends HorseMount { public MountFrost(MountManager manager) { - super(manager, "Glacial Steed", new String[] - { - C.cWhite + "Born in the North Pole,", - C.cWhite + "it leaves a trail of frost", - C.cWhite + "as it moves!", - }, + super(manager, "Glacial Steed", + UtilText.splitLineToArray(C.cGray + "Born in the North Pole, it leaves a trail of frost as it moves!", LineFormat.LORE), Material.SNOW_BALL, (byte)0, 15000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountMule.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountMule.java index be87f0fd1..cecedd632 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountMule.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountMule.java @@ -6,6 +6,9 @@ import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Variant; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; @@ -13,10 +16,8 @@ public class MountMule extends HorseMount { public MountMule(MountManager manager) { - super(manager, "Mount Mule", new String[] - { - ChatColor.RESET + "Muley muley!" - }, + super(manager, "Mount Mule", + UtilText.splitLineToArray(C.cGray + "Your very own trusty pack mule!", LineFormat.LORE), Material.HAY_BLOCK, (byte)0, 3000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java index c2697c771..7cecd08b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java @@ -11,8 +11,11 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.mount.HorseMount; @@ -25,10 +28,8 @@ public class MountSheep extends HorseMount { public MountSheep(MountManager manager) { - super(manager, "Techno Sheep", new String[] - { - ChatColor.RESET + "Muley muley!" - }, + super(manager, "Techno Sheep", + UtilText.splitLineToArray(C.cGray + "Baaaaa with all the colors of the rainbow!", LineFormat.LORE), Material.WOOL, (byte)14, 3000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index e8a1bd649..92e90a12b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -11,12 +11,15 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.mount.Mount; import mineplex.core.mount.MountManager; import mineplex.core.mount.SingleEntityMountData; @@ -28,11 +31,8 @@ public class MountSlime extends Mount> { public MountSlime(MountManager manager) { - super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[] - { - ChatColor.RESET + "Bounce around on your very", - ChatColor.RESET + "own personal slime friend!", - }, + super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, + UtilText.splitLineToArray(C.cGray + "Bounce around on your very own slime friend!", LineFormat.LORE), 15000); KnownPackage = false; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 57ca4045b..25884d4b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -19,11 +19,13 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; @@ -41,17 +43,15 @@ public class MountSpider extends HorseMount public MountSpider(MountManager manager) { - super(manager, "Spider Mount", new String[] + super(manager, "Spider Mount", + UtilText.splitLinesToArray(new String[] { - C.cWhite + "Why ride a horse when you can", - C.cWhite + "ride a cute and cuddly spider!", - C.cBlack, - C.cYellow + "Look Up" + C.cGray + " to use " + C.cGreen + "Wall Climb", - C.cYellow + "Jump" + C.cGray + " to use " + C.cGreen + "Leap", - C.cBlack, - C.cPurple + "Only available during " + C.Line + "Halloween 2015", - C.cPurple + "Purchase at " + C.Line + "www.mineplex.com/shop" - }, Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); + C.cGray + "Why ride a horse when you can ride a cute and cuddly spider!", + C.blankLine, + "#" + C.cWhite + "Look Up to use Wall Climb", + "#" + C.cWhite + "Jump to use Leap", + }, LineFormat.LORE), + Material.WEB, (byte) 0, -4, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index 4001f5184..5e9747e8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -13,7 +13,9 @@ import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.mount.Mount; import mineplex.core.mount.MountManager; import mineplex.core.updater.UpdateType; @@ -23,19 +25,20 @@ public class MountTitan extends Mount { public MountTitan(MountManager manager) { - super(manager, "Molten Snake", Material.MAGMA_CREAM, (byte)0, new String[] - { - C.cWhite + "Deep under the earths surface, there", - C.cWhite + "exists a mythical species of Molten", - C.cWhite + "Snakes. This one will serve you eternally.", - " ", - C.cRed + "Unlocked with Titan Rank", - }, -1); + super(manager, "Molten Snake", Material.MAGMA_CREAM, (byte)0, + UtilText.splitLineToArray(C.cGray + "Deep under the earths surface, there exists a mythical species of Molten Snakes. This one will serve you eternally.", LineFormat.LORE), + -13); } @Override public void EnableCustom(Player player) { + if(GetActive().size() >= 3) + { + UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(GetName()) + " in this lobby has been reached.")); + return; + } + player.leaveVehicle(); player.eject(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java index 3bf4bb80e..fead4b102 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java @@ -8,7 +8,9 @@ import org.bukkit.entity.Horse.Variant; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.mount.HorseMount; @@ -21,12 +23,8 @@ public class MountUndead extends HorseMount { public MountUndead(MountManager manager) { - super(manager, "Infernal Horror", new String[] - { - C.cWhite + "The most ghastly horse in", - C.cWhite + "existance, from the pits of", - C.cWhite + "the Nether.", - }, + super(manager, "Infernal Horror", + UtilText.splitLineToArray(C.cGray + "The most ghastly horse in existance, from the pits of the Nether.", LineFormat.LORE), Material.BONE, (byte)0, 20000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java index 9b396f6b5..949a50f23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java @@ -6,6 +6,8 @@ import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Variant; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; @@ -13,18 +15,11 @@ public class MountZombie extends HorseMount { public MountZombie(MountManager manager) { - super(manager, "Decrepit Warhorse", new String[] - { - C.cWhite + "Once a fierce warhorse, this", - C.cWhite + "undead beast will send fear", - C.cWhite + "into the hearts of your enemies.", - " ", - C.cYellow + "Earned by defeating the Pumpkin King", - C.cYellow + "in the 2015 Halloween Horror Event.", - }, + super(manager, "Decrepit Warhorse", + UtilText.splitLineToArray(C.cGray + "Once a fierce warhorse, this undead beast will send fear into the hearts of your enemies.", LineFormat.LORE), Material.ROTTEN_FLESH, (byte)0, - -1, + -4, Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java index 56cab2079..71048a36c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -1,19 +1,16 @@ package mineplex.core.pet; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; - -import mineplex.core.common.util.NautHashMap; -import mineplex.core.pet.repository.PetRepository; -import mineplex.core.pet.repository.token.PetExtraToken; -import mineplex.core.pet.repository.token.PetSalesToken; -import mineplex.core.pet.types.Elf; -import mineplex.core.pet.types.Pumpkin; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.types.Elf; +import mineplex.core.pet.types.PetCoalApparition; +import mineplex.core.pet.types.Pumpkin; + public class PetFactory { private PetRepository _repository; @@ -33,6 +30,7 @@ public class PetFactory private void CreatePets() { _pets.put(EntityType.ZOMBIE, new Pumpkin()); + _pets.put(EntityType.PIG_ZOMBIE, new PetCoalApparition()); _pets.put(EntityType.VILLAGER, new Elf()); _pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000)); _pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000)); @@ -41,8 +39,8 @@ public class PetFactory _pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 8000)); _pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000)); _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); - _pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1)); - _pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -1)); + _pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -12)); + _pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -13)); } private void CreatePetExtras() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index d111bc6a7..4e609930f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -4,11 +4,38 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map.Entry; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Creature; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.PigZombie; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Zombie; +import org.bukkit.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; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import com.google.gson.Gson; + import mineplex.core.MiniClientPlugin; -import mineplex.core.pet.repository.PetRepository; -import mineplex.core.pet.repository.token.ClientPetTokenWrapper; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.blockrestore.BlockRestore; @@ -17,50 +44,22 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.EntityWither; -import net.minecraft.server.v1_8_R3.Navigation; import net.minecraft.server.v1_8_R3.NavigationAbstract; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; - -import com.google.gson.Gson; - -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Guardian; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Villager; -import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - public class PetManager extends MiniClientPlugin { private static Object _petOwnerSynch = new Object(); @@ -228,6 +227,12 @@ public class PetManager extends MiniClientPlugin pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); UtilEnt.silence(pet, true); } + if (pet instanceof PigZombie) + { + ((PigZombie)pet).setBaby(true); + pet.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); + pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + } else if (pet instanceof Villager) { ((Villager) pet).setBaby(); @@ -342,6 +347,22 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onUpdate(UpdateEvent event) { + if (event.getType() == UpdateType.TICK) + { + for(Creature pet : _activePetOwners.values()) + { + if(pet instanceof PigZombie) + { + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie)pet).getHandle().isSilent()) + { + ((CraftPigZombie)pet).getHandle().setSilent(true); + } + } + } + } + if (event.getType() != UpdateType.FAST) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Elf.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Elf.java index 6a67a37ea..9f3e3c3ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Elf.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Elf.java @@ -8,7 +8,7 @@ public class Elf extends Pet { public Elf() { - super("Christmas Elf", EntityType.VILLAGER, -1); + super("Christmas Elf", EntityType.VILLAGER, -4); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/PetCoalApparition.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/PetCoalApparition.java new file mode 100644 index 000000000..7d787f744 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/PetCoalApparition.java @@ -0,0 +1,14 @@ +package mineplex.core.pet.types; + +import org.bukkit.entity.EntityType; + +import mineplex.core.pet.Pet; + +public class PetCoalApparition extends Pet +{ + public PetCoalApparition() + { + super("Coal Apparition", EntityType.PIG_ZOMBIE, -1); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java index 71b561f2c..a2f3acc17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java @@ -8,6 +8,6 @@ public class Pumpkin extends Pet { public Pumpkin() { - super("Pumpling", EntityType.ZOMBIE, -1); + super("Pumpling", EntityType.ZOMBIE, -5); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java index c73f87d00..71595c42a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java @@ -19,7 +19,7 @@ public class PlayerCountManager extends MiniPlugin private DataRepository _repository; private DataRepository _secondRepository; - private volatile int _playerCount; + private volatile int _playerCount = 0; public PlayerCountManager(JavaPlugin plugin) { @@ -37,7 +37,7 @@ public class PlayerCountManager extends MiniPlugin _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"), Region.ALL, BungeeServer.class, "bungeeServers"); - updatePlayerCount(); + //updatePlayerCount(); } private void updatePlayerCount() @@ -64,7 +64,7 @@ public class PlayerCountManager extends MiniPlugin @EventHandler public void refresh(UpdateEvent event) { - if (event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.SLOW) return; runAsync(this::updatePlayerCount); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java index 47648f55b..995175533 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java @@ -10,7 +10,7 @@ public class RankRewardData extends RewardData public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, Rank rank) { - super(friendlyName, displayItem, rarity); + super(null, friendlyName, displayItem, rarity); _rank = rank; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java index 8e5ab89e1..ef209276e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java @@ -15,17 +15,19 @@ public abstract class Reward private RewardRarity _rarity; private int _weight; + private int _shardValue; private boolean _requiresCallback; - public Reward(RewardRarity rarity, int weight) + public Reward(RewardRarity rarity, int weight, int shardValue) { - this(rarity, weight, false); + this(rarity, weight, shardValue, false); } - public Reward(RewardRarity rarity, int weight, boolean requiresCallback) + public Reward(RewardRarity rarity, int weight, int shardValue, boolean requiresCallback) { _rarity = rarity; _weight = weight; + _shardValue = shardValue; _requiresCallback = requiresCallback; } @@ -58,6 +60,11 @@ public abstract class Reward return _weight; } + public int getShardValue() + { + return _shardValue; + } + public boolean isRequiresCallback() { return _requiresCallback; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardData.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardData.java index 0a20e5ccf..b23f91c85 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardData.java @@ -7,15 +7,36 @@ import org.bukkit.inventory.ItemStack; */ public class RewardData { + private final String _header; private final String _friendlyName; private final ItemStack _displayItem; private final RewardRarity _rarity; + private final boolean _rewardedShards; + private final int _shards; - public RewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity) + public RewardData(String header, String friendlyName, ItemStack displayItem, RewardRarity rarity, int shards) { + _header = header; _friendlyName = friendlyName; _displayItem = displayItem; _rarity = rarity; + _rewardedShards = true; + _shards = shards; + } + + public RewardData(String header, String friendlyName, ItemStack displayItem, RewardRarity rarity) + { + _header = header; + _friendlyName = friendlyName; + _displayItem = displayItem; + _rarity = rarity; + _rewardedShards = false; + _shards = 0; + } + + public String getHeader() + { + return _header; } public String getFriendlyName() @@ -33,4 +54,13 @@ public class RewardData return _rarity; } + public boolean isRewardedShards() + { + return _rewardedShards; + } + + public int getShards() + { + return _shards; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 8c282a545..b5a69e120 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -1,11 +1,10 @@ package mineplex.core.reward; import java.util.ArrayList; -import java.util.HashMap; +import java.util.EnumMap; import java.util.List; import java.util.Random; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -14,28 +13,26 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.giveaway.GiveawayManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.pet.PetManager; -import mineplex.core.reward.rewards.CoinReward; import mineplex.core.reward.rewards.ExperienceReward; import mineplex.core.reward.rewards.GemReward; -import mineplex.core.reward.rewards.GiveawayReward; import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.PetReward; import mineplex.core.reward.rewards.RankReward; +import mineplex.core.reward.rewards.TreasureShardReward; import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; -import mineplex.core.timing.TimingManager; -import mineplex.serverdata.Region; public class RewardManager { private JavaPlugin _plugin; - private HashMap> _treasureMap; + private EnumMap _rewardPools; private Random _random; private boolean _carlSpinner; @@ -46,6 +43,11 @@ public class RewardManager private boolean _doubleGadgetValue; + private int _uncommonShards = 100; + private int _rareShards = 500; + private int _legendaryShards = 5000; + + public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager, int commonValueMin, int commonValueMax, int uncommonValueMin, int uncommonValueMax, @@ -54,12 +56,12 @@ public class RewardManager boolean doubleGadgetValue, boolean carlSpinner) { _plugin = donationManager.getPlugin(); - _treasureMap = new HashMap>(); + _rewardPools = new EnumMap(RewardPool.Type.class); _random = new Random(); - for (RewardRarity rarity : RewardRarity.values()) + for (RewardPool.Type type : RewardPool.Type.values()) { - _treasureMap.put(rarity, new ArrayList()); + _rewardPools.put(type, new RewardPool()); } _clientManager = clientManager; @@ -83,13 +85,13 @@ public class RewardManager // Coins if (_carlSpinner) { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); - addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 25, rarity)); + 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)); +// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 5, rarity)); } //Increase Value @@ -99,34 +101,40 @@ public class RewardManager maxValue *= 2; } + 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)); + 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)); + 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)); + 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)); + 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)); + 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)); + 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)); + new ItemStack(Material.TNT), rarity, 10, 0)); } @@ -138,13 +146,13 @@ public class RewardManager // Coins if (_carlSpinner) { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity)); - addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 1200, rarity)); + 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)); +// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON)); } //Increase Value @@ -154,76 +162,83 @@ public class RewardManager maxValue *= 2; } + 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)); + 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)); + 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)); + 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)); + 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)); + 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)); + 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)); + new ItemStack(Material.TNT), rarity, 250, 0)); // Pets addReward(new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow", - EntityType.COW, rarity, 500)); + EntityType.COW, rarity, 500, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep", - EntityType.SHEEP, rarity, 333)); + EntityType.SHEEP, rarity, 333, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom", - EntityType.MUSHROOM_COW, rarity, 200)); + EntityType.MUSHROOM_COW, rarity, 200, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig", - EntityType.PIG, rarity, 200)); + EntityType.PIG, rarity, 200, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat", - EntityType.OCELOT, rarity, 167)); + EntityType.OCELOT, rarity, 167, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken", - EntityType.CHICKEN, rarity, 143)); + EntityType.CHICKEN, rarity, 143, _uncommonShards)); addReward(new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog", - EntityType.WOLF, rarity, 125)); + EntityType.WOLF, rarity, 125, _uncommonShards)); // Music Discs - addReward(new UnknownPackageReward(donationManager, "13 Disc", "13 Disc", - new ItemStack(2256), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Cat Disc", "Cat Disc", - new ItemStack(2257), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Blocks Disc", "Blocks Disc", - new ItemStack(2258), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Chirp Disc", "Chirp Disc", - new ItemStack(2259), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Far Disc", "Far Disc", - new ItemStack(2260), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Mall Disc", "Mall Disc", - new ItemStack(2261), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Mellohi Disc", "Mellohi Disc", - new ItemStack(2262), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Stal Disc", "Stal Disc", - new ItemStack(2263), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Strad Disc", "Strad Disc", - new ItemStack(2264), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Ward Disc", "Ward Disc", - new ItemStack(2265), rarity, 25)); -// addReward(new UnknownPackageReward(donationManager, "11 Disc", "11 Disc", -// new ItemStack(2266), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Wait Disc", "Wait Disc", - new ItemStack(2267), rarity, 25)); + 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) @@ -233,58 +248,66 @@ public class RewardManager // Coins if (_carlSpinner) { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 150, rarity)); - addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 150, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 150, rarity)); + 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)); +// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE)); } - + + 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)); - addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart", - new ItemStack(Material.MINECART), rarity, 100)); - addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount", - new ItemStack(Material.SLIME_BALL), rarity, 67)); - addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed", - new ItemStack(Material.SNOW_BALL), rarity, 50)); + 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, "Cow Morph", "Cow Morph", - new ItemStack(Material.LEATHER), rarity, 167)); - addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph", - new ItemStack(Material.EMERALD), rarity, 83)); - addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph", - new ItemStack(Material.FEATHER), rarity, 50)); - addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph", - new ItemStack(Material.ENDER_PEARL), rarity, 33)); + 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)); - // Gadgets - addReward(new InventoryReward(inventoryManager, "Coin Party Bomb", "Coin Party Bomb", 1, 1, - new ItemStack(Material.getMaterial(175)), rarity, 100)); - // Costumes - addReward(new UnknownPackageReward(donationManager, "Rave Hat", "Rave Hat", - new ItemStack(Material.LEATHER_HELMET), rarity, 30)); - addReward(new UnknownPackageReward(donationManager, "Rave Shirt", "Rave Shirt", - new ItemStack(Material.LEATHER_CHESTPLATE), rarity, 30)); - addReward(new UnknownPackageReward(donationManager, "Rave Pants", "Rave Pants", - new ItemStack(Material.LEATHER_LEGGINGS), rarity, 30)); - addReward(new UnknownPackageReward(donationManager, "Rave Boots", "Rave Boots", - new ItemStack(Material.LEATHER_BOOTS), rarity, 30)); - addReward(new UnknownPackageReward(donationManager, "Space Helmet", "Space Helmet", - new ItemStack(Material.GLASS), rarity, 50)); - addReward(new UnknownPackageReward(donationManager, "Space Jacket", "Space Jacket", - new ItemStack(Material.GOLD_CHESTPLATE), rarity, 50)); - addReward(new UnknownPackageReward(donationManager, "Space Pants", "Space Pants", - new ItemStack(Material.GOLD_LEGGINGS), rarity, 50)); - addReward(new UnknownPackageReward(donationManager, "Space Boots", "Space Boots", - new ItemStack(Material.GOLD_BOOTS), rarity, 50)); + 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) @@ -294,57 +317,75 @@ public class RewardManager // Coins if (_carlSpinner) { - addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 10, rarity)); - addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 10, rarity)); - addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 10, rarity)); + 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)); +// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); } + 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, "Infernal Horror", "Infernal Horror", - new ItemStack(Material.BONE), rarity, 33)); + addReward(new UnknownPackageReward(donationManager, "Mount", "Infernal Horror", "Infernal Horror", + new ItemStack(Material.BONE), rarity, 33, _legendaryShards)); // Morphs - addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph", - new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph", - new ItemStack(Material.EMERALD_BLOCK), rarity, 20)); - addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph", - new ItemStack(Material.SLIME_BALL), rarity, 10)); + 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, "Shadow Walk Particles", "Shadow Walk", - new ItemStack(Material.LEATHER_BOOTS), rarity, 33)); - addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted", - new ItemStack(Material.BOOK), rarity, 25)); - addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings", - new ItemStack(Material.BLAZE_POWDER), rarity, 17)); - addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud", - new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), rarity, 13)); - addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix", - new ItemStack(Material.REDSTONE), rarity, 10)); - addReward(new UnknownPackageReward(donationManager, "Green Rings Particles", "Green Ring", - new ItemStack(Material.EMERALD), rarity, 8)); - addReward(new UnknownPackageReward(donationManager, "Flame Fairy Particles", "Flame Fairy", - new ItemStack(Material.APPLE), rarity, 4)); - addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You", - new ItemStack(Material.BLAZE_POWDER), rarity, 2)); + 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 addReward(Reward reward) { - RewardRarity rarity = reward.getRarity(); - - List treasureList = _treasureMap.get(rarity); - - treasureList.add(reward); + addReward(RewardPool.Type.NORMAL, reward); } - public Reward[] getRewards(Player player, RewardType type) + public void addReward(RewardPool.Type pool, Reward reward) + { + _rewardPools.get(pool).add(reward); + } + + public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int currentReward = 0; Reward[] rewards = new Reward[4]; @@ -353,7 +394,7 @@ public class RewardManager while (currentReward < 4) { - Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical); + Reward reward = nextReward(player, pool, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical); if (reward == null) { @@ -395,19 +436,20 @@ public class RewardManager // } public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical) + { + return nextReward(player, RewardPool.Type.NORMAL, excludedRewards, requiresUncommon, type, canGiveMythical); + } + + public Reward nextReward(Player player, RewardPool.Type pool, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical) { RewardRarity rarity = type.generateRarity(requiresUncommon); //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { - if (_statusManager.getRegion() == Region.US && canGiveMythical && type == RewardType.MythicalChest && Math.random() <= 0.1) - { - return getLogitechPrize(); - } if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { - return new RankReward(_clientManager, 0, rarity); + return new RankReward(_clientManager, 0, 0, rarity); } else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND)) { @@ -415,11 +457,11 @@ public class RewardManager } else { - return new RankReward(_clientManager, 0, rarity); + return new RankReward(_clientManager, 0, 0, rarity); } } - List treasureList = _treasureMap.get(rarity); + List treasureList = _rewardPools.get(pool).getRewards(rarity); int totalWeight = 0; ArrayList possibleRewards = new ArrayList(); @@ -438,7 +480,7 @@ public class RewardManager } } - if ((player == null || treasure.canGiveReward(player)) && !isExcluded) + if (!isExcluded) { possibleRewards.add(treasure); totalWeight += treasure.getWeight(); @@ -447,14 +489,13 @@ public class RewardManager if (possibleRewards.size() == 0) { + totalWeight = 0; + // go again, ignore excluded for (Reward treasure : treasureList) { - if ((player == null || treasure.canGiveReward(player))) - { - possibleRewards.add(treasure); - totalWeight += treasure.getWeight(); - } + possibleRewards.add(treasure); + totalWeight += treasure.getWeight(); } } @@ -468,43 +509,15 @@ public class RewardManager currentWeight += reward.getWeight(); if (weight <= currentWeight) - return reward; + { + if (reward.canGiveReward(player)) + return reward; + else + return new TreasureShardReward(_donationManager, reward, 1, reward.getRarity()); + } } } return null; } - - private Reward getLogitechPrize() - { - double rand = Math.random(); - - String name; - String cooldown = "logitech"; - Material mat = Material.DIAMOND; - String displayName; - - if (rand < 0.2) - { - name = "logitechKeyboard"; - displayName = C.cRed + "Logitech G910 RGB Keyboard"; - } - else if (rand < 0.4) - { - name = "logitechMouse"; - displayName = C.cRed + "Logitech G303 Gaming Mouse"; - } - else if (rand < 0.6) - { - name = "logitechHeadset"; - displayName = C.cRed + "Logitech G430 Gaming Headset"; - } - else - { - name = "logitechMousePad"; - displayName = C.cRed + "Logitech G240 Gaming Mousepad"; - } - - return new GiveawayReward(_giveawayManager, _clientManager, _donationManager, _statusManager, name, cooldown, displayName , mat, (byte) 0, RewardRarity.MYTHICAL, 0); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java new file mode 100644 index 000000000..72c38535f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -0,0 +1,40 @@ +package mineplex.core.reward; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; + +/** + * Used to separate different "Reward Pools". This allows us to have treasure chests with different loot. + * + */ +public class RewardPool +{ + private EnumMap> _rewardMap; + + public RewardPool() + { + _rewardMap = new EnumMap>(RewardRarity.class); + + for (RewardRarity rarity : RewardRarity.values()) + { + _rewardMap.put(rarity, new ArrayList()); + } + } + + public void add(Reward reward) + { + _rewardMap.get(reward.getRarity()).add(reward); + } + + public List getRewards(RewardRarity rarity) + { + return _rewardMap.get(rarity); + } + + public static enum Type + { + NORMAL, + WINTER_HOLIDAY; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardRarity.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardRarity.java index 1f56de46a..759769234 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardRarity.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardRarity.java @@ -18,24 +18,26 @@ public enum RewardRarity * (Fireworks, sounds, etc) */ - OTHER("Other", cWhite, Material.STAINED_GLASS_PANE, (byte) 0), - COMMON("Common", cWhite, Material.STAINED_GLASS_PANE, (byte) 0), - GAME("Game", cYellow, Material.STAINED_GLASS_PANE, (byte) 4), - UNCOMMON("Uncommon", cAqua, Material.STAINED_GLASS_PANE, (byte) 3), - RARE("Rare", cPurple, Material.STAINED_GLASS_PANE, (byte) 10), - LEGENDARY("Legendary", cGreen, Material.STAINED_GLASS_PANE, (byte) 5), - MYTHICAL("Mythical", cRed, Material.STAINED_GLASS_PANE, (byte) 14); + OTHER("Other", cWhite, C.cGray, Material.STAINED_GLASS_PANE, (byte) 0), + COMMON("Common", cWhite, C.cGray, Material.STAINED_GLASS_PANE, (byte) 0), + GAME("Game", cYellow, C.cYellow, Material.STAINED_GLASS_PANE, (byte) 4), + UNCOMMON("Uncommon", cAqua, C.cDAqua, Material.STAINED_GLASS_PANE, (byte) 3), + RARE("Rare", cPurple, C.cDPurple, Material.STAINED_GLASS_PANE, (byte) 10), + LEGENDARY("Legendary", cGreen, C.cDGreen, Material.STAINED_GLASS_PANE, (byte) 5), + MYTHICAL("Mythical", cRed, C.cDRed, Material.STAINED_GLASS_PANE, (byte) 14); private String _name; private String _color; + private String _darkColor; private Material _material; private byte _data; private ItemStack _stack; - RewardRarity(String name, String color, Material material, byte data) + RewardRarity(String name, String color, String darkColor, Material material, byte data) { _name = name; _color = color; + _darkColor = darkColor; _material = material; _data = data; @@ -50,6 +52,11 @@ public enum RewardRarity return _color; } + public String getDarkColor() + { + return _darkColor; + } + public String getName() { return _name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 8c548df93..a26c177a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -7,9 +7,10 @@ public enum RewardType //% Chances Mythic Legend Rare Uncommon GameLoot( 0.000001, 0.00001, 0.0001, 3), - OldChest( 0, 0.05, 0.4, 5), - AncientChest( 0, 1, 4, 25), - MythicalChest( 0.3, 3, 12, 75), + OldChest( 0, 0.06, 0.8, 16), + AncientChest( 0, 2, 8, 32), + MythicalChest( 0.1, 4, 16, 72), + WinterChest( 0, 5, 18, 32), SpinnerFiller( 0.1, 1, 4, 20), SpinnerReal( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java deleted file mode 100644 index dbfce1d9b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java +++ /dev/null @@ -1,74 +0,0 @@ -package mineplex.core.reward.rewards; - -import java.util.Random; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.Callback; -import mineplex.core.donation.DonationManager; -import mineplex.core.reward.Reward; -import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardRarity; -import mineplex.core.reward.RewardType; - -public class CoinReward extends Reward -{ - private DonationManager _donationManager; - private Random _random; - private int _minCoinCount; - private int _maxCoinCount; - - public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity) - { - this(donationManager, minCoinCount, maxCoinCount, weight, rarity, RANDOM); - } - - public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity, Random random) - { - super(rarity, weight); - _donationManager = donationManager; - _minCoinCount = minCoinCount; - _maxCoinCount = maxCoinCount; - - _random = random; - } - - @Override - public RewardData giveRewardCustom(Player player, RewardType rewardType) - { - int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount; - - _donationManager.RewardCoins(new Callback() - { - @Override - public void run(Boolean data) - { - - } - }, "Treasure Chest", player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), coinsToReward); - - return new RewardData(getRarity().getColor() + coinsToReward + " Coins", new ItemStack(175), getRarity()); - } - - @Override - public RewardData getFakeRewardData(Player player) - { - return new RewardData(getRarity().getColor() + "Coins", new ItemStack(175), getRarity()); - } - - @Override - public boolean canGiveReward(Player player) - { - return true; - } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof CoinReward) - return true; - - return false; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java index 3ead33459..b40171381 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java @@ -19,9 +19,9 @@ public class ExperienceReward extends Reward private int _minExperience; private int _maxExperience; - public ExperienceReward(StatsManager statsManager, int minExperience, int maxExperience, int weight, RewardRarity rarity) + public ExperienceReward(StatsManager statsManager, int minExperience, int maxExperience, int weight, int shardValue, RewardRarity rarity) { - super(rarity, weight); + super(rarity, weight, shardValue); _statsManager = statsManager; _random = new Random(); @@ -36,13 +36,13 @@ public class ExperienceReward extends Reward _statsManager.incrementStat(player, "Global.ExpEarned", experience); - return new RewardData(getRarity().getColor() + experience + " Experience", new ItemStack(Material.EXP_BOTTLE), getRarity()); + return new RewardData(null, getRarity().getColor() + experience + " Experience", new ItemStack(Material.EXP_BOTTLE), getRarity()); } @Override public RewardData getFakeRewardData(Player player) { - return new RewardData(getRarity().getColor() + "Experience", new ItemStack(Material.EXP_BOTTLE), getRarity()); + return new RewardData(null, getRarity().getColor() + "Experience", new ItemStack(Material.EXP_BOTTLE), getRarity()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java index 1e4e2fb78..cae7f75e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java @@ -20,14 +20,14 @@ public class GemReward extends Reward private int _minGemCount; private int _maxGemCount; - public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity) + public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, int shardValue, RewardRarity rarity) { - this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM); + this(donationManager, minGemCount, maxGemCount, weight, shardValue, rarity, RANDOM); } - public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity, Random random) + public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, int shardValue, RewardRarity rarity, Random random) { - super(rarity, weight); + super(rarity, weight, shardValue); _donationManager = donationManager; _minGemCount = minGemCount; _maxGemCount = maxGemCount; @@ -49,13 +49,13 @@ public class GemReward extends Reward } }, "Treasure Chest", player.getName(), player.getUniqueId(), GemsToReward); - return new RewardData(getRarity().getColor() + GemsToReward + " Gems", new ItemStack(Material.EMERALD), getRarity()); + return new RewardData(null, getRarity().getColor() + GemsToReward + " Gems", new ItemStack(Material.EMERALD), getRarity()); } @Override public RewardData getFakeRewardData(Player player) { - return new RewardData(getRarity().getColor() + "Gems", new ItemStack(Material.EMERALD), getRarity()); + return new RewardData(null, getRarity().getColor() + "Gems", new ItemStack(Material.EMERALD), getRarity()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java deleted file mode 100644 index 89412121d..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java +++ /dev/null @@ -1,97 +0,0 @@ -package mineplex.core.reward.rewards; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.Rank; -import mineplex.core.common.util.Callback; -import mineplex.core.donation.DonationManager; -import mineplex.core.giveaway.GiveawayManager; -import mineplex.core.giveaway.GiveawayResponse; -import mineplex.core.reward.Reward; -import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardRarity; -import mineplex.core.reward.RewardType; -import mineplex.core.status.ServerStatusManager; - -public class GiveawayReward extends Reward -{ - private GiveawayManager _giveawayManager; - private CoreClientManager _clientManager; - private DonationManager _donationManager; - private ServerStatusManager _serverStatusManager; - private String _giveawayName; - private String _cooldownName; - private String _displayName; - private Material _icon; - private byte _data; - - public GiveawayReward(GiveawayManager giveawayManager, CoreClientManager clientManager, DonationManager donationManager, ServerStatusManager serverStatusManager, String giveawayName, String cooldownName, String displayName, Material icon, byte data, RewardRarity rarity, int weight) - { - super(rarity, weight, true); - _giveawayManager = giveawayManager; - _clientManager = clientManager; - _donationManager = donationManager; - _serverStatusManager = serverStatusManager; - _giveawayName = giveawayName; - _cooldownName = cooldownName; - _displayName = displayName; - _icon = icon; - _data = data; - } - - @Override - protected void giveRewardCallback(final RewardType rewardType, final Player player, final Callback rewardDataCallback) - { - _giveawayManager.attemptToGiveaway(_giveawayName, _cooldownName, player, new Callback() - { - @Override - public void run(GiveawayResponse data) - { - if (data.isSuccess()) - { - RewardData rewardData = new RewardData(_displayName, new ItemStack(_icon, 1, (short) 0, _data), getRarity()); - if (rewardDataCallback != null) rewardDataCallback.run(rewardData); - } - else - { - System.out.println("GIVEAWAY FAILED: " + data.getFailReason().name()); - - // Dang, I guess we failed! - if (!_clientManager.hasRank(player, Rank.TITAN)) - { - Reward reward = new RankReward(_clientManager, 0, getRarity()); - reward.giveReward(rewardType, player, rewardDataCallback); - } - else - { - Reward reward = new CoinReward(_donationManager, 20000, 30000, 0, getRarity()); - reward.giveReward(rewardType, player, rewardDataCallback); - } - } - } - }); - } - - @Override - protected RewardData giveRewardCustom(Player player, RewardType rewardType) - { - // This is a little hacky, this should never be called! - return null; - } - - @Override - public RewardData getFakeRewardData(Player player) - { - // Let's pretend we are coins! - return new RewardData(getRarity().getColor() + "Coins", new ItemStack(175), getRarity()); - } - - @Override - public boolean canGiveReward(Player player) - { - return true; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java index 407d60593..6cff231dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java @@ -25,14 +25,14 @@ public class InventoryReward extends Reward private int _minAmount; private int _maxAmount; - public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight) + public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) { - this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight); + this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight, shardValue); } - public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight) + public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) { - super(rarity, weight); + super(rarity, weight, shardValue); _random = random; _name = name; @@ -59,13 +59,13 @@ public class InventoryReward extends Reward _inventoryManager.addItemToInventory(player, _packageName, amountToGive); - return new RewardData(getRarity().getColor() + amountToGive + " " + _name, _itemStack, getRarity()); + return new RewardData(getRarity().getDarkColor() + "Gadget", getRarity().getColor() + amountToGive + " " + _name, _itemStack, getRarity()); } @Override public RewardData getFakeRewardData(Player player) { - return new RewardData(getRarity().getColor() + _name, _itemStack, getRarity()); + return new RewardData(getRarity().getDarkColor() + "Gadget", getRarity().getColor() + _name, _itemStack, getRarity()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index c683c100f..d3dba4662 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -24,9 +24,9 @@ public class PetReward extends UnknownPackageReward private PetManager _petManager; private EntityType _petEntity; - public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, EntityType petEntity, RewardRarity rarity, int weight) + public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, EntityType petEntity, RewardRarity rarity, int weight, int shardValue) { - super(donationManager, name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petEntity.getTypeId()), rarity, weight); + super(donationManager, "Pet", name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petEntity.getTypeId()), rarity, weight, shardValue); _petManager = petManager; _inventoryManager = inventoryManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index 234fb2215..ac08ef75a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -19,9 +19,9 @@ public class RankReward extends Reward private Random _random; private CoreClientManager _clientManager; - public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity) + public RankReward(CoreClientManager clientManager, int weight, int shardValue, RewardRarity rarity) { - super(rarity, weight); + super(rarity, weight, shardValue); _clientManager = clientManager; _random = new Random(); @@ -40,7 +40,7 @@ public class RankReward extends Reward rank = Rank.TITAN; if (rank == null) - return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); + return new RewardData(null, getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); _clientManager.Get(player).SetRank(rank, false); _clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true); @@ -57,7 +57,7 @@ public class RankReward extends Reward else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; if (rank == null) - return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); + return new RewardData(null, getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java new file mode 100644 index 000000000..a931d2311 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java @@ -0,0 +1,68 @@ +package mineplex.core.reward.rewards; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.Callback; +import mineplex.core.donation.DonationManager; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; + +public class TreasureShardReward extends Reward +{ + private DonationManager _donationManager; + private Reward _otherReward; + private int _shards; + + public TreasureShardReward(DonationManager donationManager, Reward otherReward, int weight, RewardRarity rarity) + { + super(rarity, weight, 0); + + _donationManager = donationManager; + _otherReward = otherReward; + + _shards = (int) (otherReward.getShardValue() + (Math.random() * otherReward.getShardValue() / 2.0)); + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + RewardData fakeData = _otherReward.getFakeRewardData(player); + RewardData rewardData = new RewardData(fakeData.getHeader(), fakeData.getFriendlyName(), fakeData.getDisplayItem(), fakeData.getRarity(), _shards); + + _donationManager.RewardCoins(new Callback() + { + @Override + public void run(Boolean data) + { + + } + }, "Treasure Chest", player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _shards); + + return rewardData; + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(null, getRarity().getColor() + "Treasure Shards", new ItemStack(Material.PRISMARINE_SHARD), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof TreasureShardReward) + return true; + + return false; + } +} 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 a4012e21b..01a28d57d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java @@ -18,13 +18,15 @@ public class UnknownPackageReward extends Reward { protected DonationManager _donationManager; private ItemStack _itemStack; + private String _header; private String _name; private String _packageName; - public UnknownPackageReward(DonationManager donationManager, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight) + public UnknownPackageReward(DonationManager donationManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) { - super(rarity, weight); + super(rarity, weight, shardValue); _donationManager = donationManager; + _header = header; _name = name; _packageName = packageName; _itemStack = itemStack; @@ -35,7 +37,7 @@ public class UnknownPackageReward extends Reward { _donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _packageName, CurrencyType.Coins, 0, true); - return new RewardData(getRarity().getColor() + _name, _itemStack, getRarity()); + return new RewardData(getRarity().getDarkColor() + _header, getRarity().getColor() + _name, _itemStack, getRarity()); } @Override @@ -53,7 +55,7 @@ public class UnknownPackageReward extends Reward @Override public RewardData getFakeRewardData(Player player) { - return new RewardData(getRarity().getColor() + _name, _itemStack, getRarity()); + return new RewardData(getRarity().getDarkColor() + _header, getRarity().getColor() + _name, _itemStack, getRarity()); } protected String getPackageName() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java index b253a4ea7..c52c84e2b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -79,7 +79,7 @@ public class ConfirmationPage= ANIMATION_DURATION) 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 f1426accf..a0ad48354 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -6,10 +6,13 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilSkull; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.shop.item.ShopItem; @@ -25,7 +28,7 @@ public class TreasurePage extends ShopPageBase public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 9); + super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 54); _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; @@ -36,9 +39,17 @@ public class TreasurePage extends ShopPageBase @Override protected void buildPage() { + int treasureShards = getDonationManager().Get(getPlayer()).getCoins(); + int basicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OLD.getItemName()); int heroicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ANCIENT.getItemName()); int legendaryCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MYTHICAL.getItemName()); + int christmasCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.CHRISTMAS.getItemName()); + + List shardLore = new ArrayList(); + shardLore.add(" "); + shardLore.add(C.cGray + "This seems like it might come in"); + shardLore.add(C.cGray + "handy. Maybe I can collect more!"); List basicLore = new ArrayList(); basicLore.add(" "); @@ -55,7 +66,7 @@ public class TreasurePage extends ShopPageBase basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); else { - basicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "1000 Coins"); + basicLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "1000 Treasure Shards"); basicLore.add(" "); basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } @@ -72,7 +83,7 @@ public class TreasurePage extends ShopPageBase heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); else { - heroicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "5000 Coins"); + heroicLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "5000 Treasure Shards"); heroicLore.add(" "); heroicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } @@ -92,22 +103,58 @@ public class TreasurePage extends ShopPageBase legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); else { - legendaryLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "10000 Coins"); + legendaryLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "10000 Treasure Shards"); legendaryLore.add(" "); legendaryLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } - ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false); - ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false); - ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false); + List christmasLore = new ArrayList(); + christmasLore.add(" "); + christmasLore.add(F.value("Winter Holiday Chests Owned", "" + christmasCount)); + christmasLore.add(" "); + christmasLore.add(C.cGray + "Legend tells of the Winter Lord's"); + christmasLore.add(C.cGray + "vast treasure horde, locked away in"); + christmasLore.add(C.cGray + "in a vault of ice, deep beneath the"); + christmasLore.add(C.cGray + "Frozen Sea. It is said it can only be"); + christmasLore.add(C.cGray + "accessed in the deepest parts of Winter..."); + christmasLore.add(" "); + if (christmasCount > 0) + christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + else + { + christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards"); + christmasLore.add(" "); + christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } - if (basicCount > 0) addButton(2, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD)); - else addButton(2, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000)); + List cosmicLore = new ArrayList(); + cosmicLore.add(" "); + cosmicLore.add(C.cWhite + "Cannot be purchased in Shop"); + cosmicLore.add(C.cWhite + "Coming Soon"); + cosmicLore.add(" "); + cosmicLore.add(C.cAqua + "20000 Treasure Shards"); + + 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 cosmic = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "??? Treasure", cosmicLore.toArray(new String[0]), 0, false, false); + + addItem(40, shards); + + if (basicCount > 0) addButton(20, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD)); + else addButton(20, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000)); - if (heroicCount > 0) addButton(4, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT)); - else addButton(4, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000)); + if (heroicCount > 0) addButton(22, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT)); + else addButton(22, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000)); - if (legendaryCount > 0) addButton(6, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL)); - else addButton(6, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000)); + if (legendaryCount > 0) addButton(24, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL)); + else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000)); + + if (christmasCount > 0) addButton(12, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS)); + else addButton(12, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, TreasureType.CHRISTMAS.getItemName(), Material.SNOW_BALL, 15000)); + + addItem(14, cosmic); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java index 0b6c89cfb..52d63e2a1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java @@ -4,27 +4,93 @@ import mineplex.core.common.util.UtilTime; public enum UpdateType { + /** + * Once every 64 minutes + */ MIN_64(3840000), + /** + * Once every 60 minutes + */ HOUR_01(3600000), + /** + * Once every 32 minutes + */ MIN_32(1920000), + /** + * Once every 30 minutes + */ MIN_30(1800000), + /** + * Once every 16 minutes + */ MIN_16(960000), + /** + * Once every 10 minutes + */ MIN_10(600000), + /** + * Once every 8 minutes + */ MIN_08(480000), + /** + * Once every 5 minutes + */ MIN_05(300000), + /** + * Once every 4 minutes + */ MIN_04(240000), + /** + * Once every 2 minutes + */ MIN_02(120000), + /** + * Once every minute + */ MIN_01(60000), + /** + * Once every 32 seconds + */ SLOWEST(32000), + /** + * ONce every 30 seconds + */ SEC_30(30000), + /** + * Once every 16 seconds + */ SLOWER(16000), + /** + * Once every 8 seconds + */ SEC_08(8000), + /** + * Once every 4 seconds + */ SLOW(4000), + /** + * Once every 40 ticks + */ TWOSEC(2000), + /** + * Once every 20 ticks + */ SEC(1000), + /** + * Once every 10 ticks + */ FAST(500), + /** + * Once every 5 ticks + */ FASTER(250), + /** + * Once every 3 ticks + */ FASTEST(125), + /** + * Once every tick + */ TICK(49); private long _time; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java index 59400f196..60c7f0bb8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/event/UpdateEvent.java @@ -1,6 +1,7 @@ package mineplex.core.updater.event; import mineplex.core.updater.UpdateType; +import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; @@ -19,6 +20,11 @@ public class UpdateEvent extends Event { return _type; } + + public int getTick() + { + return MinecraftServer.currentTick; + } public HandlerList getHandlers() { diff --git a/Plugins/Mineplex.DDoSProtectionSwitcher/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.DDoSProtectionSwitcher/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.DDoSProtectionSwitcher/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.EnjinTranslator/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.EnjinTranslator/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.EnjinTranslator/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index ce3ff1b86..d27dab663 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; public class Clans extends JavaPlugin { - public static final String VERSION = "0.17b"; + public static final String VERSION = "0.17d"; private String WEB_CONFIG = "webServer"; // Modules diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index d97ad7c78..d51bb3f24 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -10,7 +10,6 @@ import java.util.TimeZone; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -66,7 +65,6 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClansUtility.ClanRelation; -import mineplex.game.clans.clans.claimview.ClaimVisualizer; import mineplex.game.clans.clans.commands.ClanManagementCommand; import mineplex.game.clans.clans.commands.ClansAllyChatCommand; import mineplex.game.clans.clans.commands.ClansChatCommand; @@ -81,7 +79,9 @@ import mineplex.game.clans.clans.gui.ClanShop; import mineplex.game.clans.clans.loot.LootManager; import mineplex.game.clans.clans.map.ItemMapManager; import mineplex.game.clans.clans.observer.ObserverManager; +import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.clans.potato.PotatoManager; +import mineplex.game.clans.clans.pvptimer.PvpTimer; import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler; import mineplex.game.clans.clans.redis.ClanLoadCommandHandler; import mineplex.game.clans.clans.regions.ClansRegions; @@ -155,6 +155,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati private LootManager _lootManager; private DonationManager _donationManager; + private Playtime _playTracker; + private TutorialManager _tutorialManager; private ClassManager _classManager; @@ -228,18 +230,12 @@ public class ClansManager extends MiniClientPluginimplements IRelati TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress); - _tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler); - ClanTips = new ClanTips(plugin, this, preferencesManager); - new StuckManager(this); - - _scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager); // new MurderManager(plugin, this); _clanAdmin = new ClansAdmin(this); _clanBlocks = new ClansBlocks(); - _clanDataAccess = new ClansDataAccessLayer(this, _scoreboard); _clanDisplay = new ClansDisplay(plugin, this); _clanGame = new ClansGame(plugin, this); _clanUtility = new ClansUtility(this); @@ -266,11 +262,12 @@ public class ClansManager extends MiniClientPluginimplements IRelati new ObserverManager(plugin, _condition, this); new ClanEnergyTracker(plugin, this); + new StuckManager(this); new ClansAlphaManager(this, taskManager); - + new PotatoManager(plugin, this); - + new Weapon(plugin, energy); new Gameplay(plugin, this, blockRestore, damageManager); _projectileManager = new ProjectileManager(plugin); @@ -298,7 +295,15 @@ public class ClansManager extends MiniClientPluginimplements IRelati ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager); _classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop"); - ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager); + new ClanEnergyManager(plugin, this, clientManager, donationManager); + + _playTracker = new Playtime(this, statsManager); + new PvpTimer(this, _playTracker, statsManager); + + _tutorialManager = new TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler); + + _scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, clientManager, donationManager); + _clanDataAccess = new ClansDataAccessLayer(this, _scoreboard); for (ClanToken token : _clanDataAccess.getRepository().retrieveClans()) { @@ -377,7 +382,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati @Override public void addCommands() { - addCommand(new ClansCommand(this, _tutorialManager)); + addCommand(new ClansCommand(this)); addCommand(new RegionsCommand(this)); addCommand(new ClansChatCommand(this)); addCommand(new ClansAllyChatCommand(this)); @@ -460,7 +465,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati int x = Math.abs(location.getBlockX()); int z = Math.abs(location.getBlockZ()); - return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS) && !Spawn.getInstance().isInSpawn(location); + return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS) && !Spawn.getInstance().isSafe(location); } public boolean isFields(Location location) @@ -624,7 +629,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati String rank = _clientManager.Get(event.getPlayer()).GetRank().getTag(true, true) + " "; - if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MEDIA)) + if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.TWITCH)) rank = ""; if (client.isClanChat() && clan != null) @@ -957,6 +962,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _blockRestore.onDisable(); _worldEvent.onDisable(); _goldManager.onDisable(); + _playTracker.onDisable(); } @EventHandler(priority = EventPriority.HIGHEST) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerStats.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerStats.java new file mode 100644 index 000000000..6b8d45429 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerStats.java @@ -0,0 +1,18 @@ +package mineplex.game.clans.clans; + +public enum ClansPlayerStats +{ + PLAY_TIME("Clans.TimePlaying"); + + private String _id; + + ClansPlayerStats(String id) + { + _id = id; + } + + public String id() + { + return _id; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java index c27bcf57a..6a1356d8c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -24,6 +24,7 @@ import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent; import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent; import mineplex.game.clans.core.repository.ClanTerritory; +import mineplex.game.clans.spawn.Spawn; public class ClansUtility { @@ -238,7 +239,7 @@ public class ClansUtility public boolean isSafe(Player player) { - if (!UtilTime.elapsed(Clans.getCombatManager().Get(player).GetLastDamaged(), 15000)) return false; + if (!UtilTime.elapsed(Clans.getCombatManager().Get(player).GetLastDamaged(), Spawn.COMBAT_TAG_DURATION)) return false; return isSafe(player.getLocation()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java index f9bab36a5..3fda15789 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java @@ -35,7 +35,7 @@ public class ClansCommand extends CommandBase { private ClansManager _manager; - public ClansCommand(ClansManager plugin, TutorialManager tutorialManager) + public ClansCommand(ClansManager plugin) { super(plugin, Rank.ALL, "c", "clan", "clans", "factions"); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/PlayingClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/PlayingClient.java new file mode 100644 index 000000000..fd68d2949 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/PlayingClient.java @@ -0,0 +1,13 @@ +package mineplex.game.clans.clans.playtime; + +public class PlayingClient +{ + public long StartTime; + public boolean FirstSession; + + public PlayingClient(boolean first) + { + StartTime = System.currentTimeMillis(); + FirstSession = first; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java new file mode 100644 index 000000000..0a433efb7 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java @@ -0,0 +1,86 @@ +package mineplex.game.clans.clans.playtime; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.stats.StatsManager; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.ClansPlayerStats; +import mineplex.game.clans.clans.playtime.command.PlayTimeCommand; +import mineplex.game.clans.clans.playtime.command.cemde; + +public class Playtime extends MiniClientPlugin +{ + private StatsManager _statsManager; + + public Playtime(ClansManager clans, StatsManager statsManager) + { + super("Clans Play Time Tracker", clans.getPlugin()); + + _statsManager = statsManager; + + addCommand(new PlayTimeCommand(_statsManager, this)); + } + + @Override + public void disable() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + save(player); + } + } + + // Seconds + public long getPlaytime(Player player) + { + return _statsManager.Get(player).getStat(ClansPlayerStats.PLAY_TIME.id()); + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + Set(event.getPlayer(), AddPlayer(event.getPlayer().getName())); + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + save(event.getPlayer()); + } + + @EventHandler + public void onPlayerKicked(PlayerKickEvent event) + { + save(event.getPlayer()); + } + + private void save(Player player) + { + long timePlaying = getUnsavedPlaytime(player); + + _statsManager.incrementStat(player, ClansPlayerStats.PLAY_TIME.id(), timePlaying); + + // Increment main time in game as well + _statsManager.incrementStat(player, "Global.TimeInGame", timePlaying); + + Get(player).StartTime = System.currentTimeMillis(); + } + + @Override + protected PlayingClient AddPlayer(String player) + { + return new PlayingClient(_statsManager.Get(player).getStat(ClansPlayerStats.PLAY_TIME.id()) == 0); + } + + // Seconds + public long getUnsavedPlaytime(Player player) + { + return (System.currentTimeMillis() - Get(player).StartTime) / 1000; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java new file mode 100644 index 000000000..30b82b248 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java @@ -0,0 +1,81 @@ +package mineplex.game.clans.clans.playtime.command; + +import java.sql.SQLException; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.stats.PlayerStats; +import mineplex.core.stats.StatsManager; +import mineplex.game.clans.clans.ClansPlayerStats; +import mineplex.game.clans.clans.playtime.Playtime; + +public class PlayTimeCommand extends CommandBase +{ + private Playtime _playTracker; + + public PlayTimeCommand(StatsManager plugin, Playtime tracker) + { + super(plugin, Rank.MODERATOR, "clanstime"); + + _playTracker = tracker; + } + + @Override + public void Execute(final Player caller, final String[] args) + { + if (args == null || args.length == 0) + { + UtilPlayer.message(caller, F.main("Clans", "Usage: /clanstime ")); + } + else + { + final Player target = UtilPlayer.searchOnline(caller, args[0], false); + + if (target == null) + { + Plugin.getPlugin().getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable() + { + @Override + public void run() + { + try + { + final PlayerStats stats = Plugin.getOfflinePlayerStats(args[0]); + + Plugin.getPlugin().getServer().getScheduler().runTask(Plugin.getPlugin(), new Runnable() + { + @Override + public void run() + { + if (stats == null) + { + UtilPlayer.message(caller, F.main("Clans", "Player " + F.elem(args[0]) + " not found!")); + } + else + { + long time = stats.getStat(ClansPlayerStats.PLAY_TIME.id()); + UtilPlayer.message(caller, F.main("Clans", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " playing Clans.")); + } + } + }); + } + catch (SQLException e) + { + UtilPlayer.message(caller, F.main("Clans", F.name(target.getName()) + " does not have any play time in Clans.")); + } + } + }); + } + else + { + long time = Plugin.Get(target).getStat(ClansPlayerStats.PLAY_TIME.id()); + UtilPlayer.message(caller, F.main("Clans", F.name(target.getName()) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT) + " (+" + UtilTime.MakeStr(_playTracker.getUnsavedPlaytime(target) * 1000) + ")") + " playing Clans.")); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/cemde.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/cemde.java new file mode 100644 index 000000000..9dc1c22fe --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/cemde.java @@ -0,0 +1,30 @@ +package mineplex.game.clans.clans.playtime.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.stats.StatsManager; +import mineplex.game.clans.clans.ClansPlayerStats; +import mineplex.game.clans.clans.pvptimer.PvpTimer; + +public class cemde extends CommandBase +{ + PvpTimer _timer; + public cemde(StatsManager plugin, PvpTimer timer) + { + super(plugin, Rank.ALL, "rstime"); + _timer = timer; + } + + @Override + public void Execute(final Player caller, final String[] args) + { + Plugin.Get(caller).setStat(ClansPlayerStats.PLAY_TIME.id(), 0); + _timer.Get(caller).Skipped = false; + _timer.Get(caller).InformedTimes.clear(); + + UtilPlayer.message(caller, "Reset time."); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java new file mode 100644 index 000000000..c2eccc0d4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java @@ -0,0 +1,217 @@ +package mineplex.game.clans.clans.pvptimer; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.stats.StatsManager; +import mineplex.core.task.TaskManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.playtime.Playtime; +import mineplex.game.clans.clans.playtime.command.cemde; +import mineplex.game.clans.clans.pvptimer.command.PvPTimerCommand; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class PvpTimer extends MiniClientPlugin +{ + private Playtime _tracker; + + public static final String SKIPPED_TASK = "PvpTimer.Skipped"; + + private static long TIMER_LENGTH = 30 * 60; + + public PvpTimer(ClansManager clans, Playtime playtime, StatsManager statsManager) + { + super("PvP Timer", clans.getPlugin()); + _tracker = playtime; + + addCommand(new cemde(statsManager, this)); + } + + @Override + public void addCommands() + { + addCommand(new PvPTimerCommand(this)); + } + + public void disableFor(final Player caller) + { + TaskManager.Instance.completedTask(new Callback() { + @Override + public void run(Boolean data) + { + Get(caller).Skipped = true; + caller.playSound(caller.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 0.75f); + } + }, caller, "PvpTimer.Skipped"); + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + final Player player = event.getPlayer(); + + if (hasTimer(player)) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { + public void run() + { + UtilTextMiddle.display(C.cGold + "PvP Timer", "will end in " + UtilTime.MakeStr(getPvPTimerLeft(player) * 1000), 40, 70, 40, player); + } + }, 10); + + UtilPlayer.message(player, F.main("Clans", "You are currently on your PvP timer. It will end in " + F.elem(UtilTime.MakeStr(getPvPTimerLeft(player) * 1000)))); + UtilPlayer.message(player, F.main("Clans", "Until it ends, you are immune to, and unable to deal PvP damage.")); + UtilPlayer.message(player, F.main("Clans", "If you would like to disable the PvP timer permanently, then type " + F.elem("/pvptimer") + ", and follow the instructions given.")); + } + } + + @EventHandler + public void inform(UpdateEvent event) + { + if (event.getType() == UpdateType.TWOSEC) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (hasTimer(player)) + { + long time = getPvPTimerLeft(player); + PvpTimerClient client = Get(player); + + // end + if (time <= 2) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " has ended!")); + UtilPlayer.message(player, F.main("Clans", "You are now completely open to attacks, and you can also attack others.")); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 0.75f); + } + // 5 secs + else if (time <= 5 && !client.InformedTimes.contains(5)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("5.0 Seconds"))); + UtilTextMiddle.display("Pvp Timer", "ending in 5 Seconds"); + client.InformedTimes.add(5); + } + // 10 secs + else if (time <= 10 && !client.InformedTimes.contains(10)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("10.0 Seconds"))); + UtilTextMiddle.display("Pvp Timer", "ending in 10 Seconds"); + client.InformedTimes.add(10); + } + // 30 secs + else if (time <= 30 && !client.InformedTimes.contains(30)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("30.0 Seconds"))); + UtilTextMiddle.display("Pvp Timer", "ending in 30 Seconds"); + client.InformedTimes.add(30); + } + // 1 minute + else if (time <= 1 * 60 && !client.InformedTimes.contains(1 * 60)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("1.0 Minute"))); + UtilTextMiddle.display("Pvp Timer", "ending in 1 Minute"); + client.InformedTimes.add(5); + } + // 5 minutes + else if (time <= 5 * 60 && !client.InformedTimes.contains(5 * 60)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("5.0 Minutes"))); + UtilTextMiddle.display("Pvp Timer", "ending in 5 Minutes"); + client.InformedTimes.add(5 * 60); + } + // 10 minutes + else if (time <= 10 * 60 && !client.InformedTimes.contains(10 * 60)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("10.0 Minutes"))); + UtilTextMiddle.display("Pvp Timer", "ending in 10 Minutes"); + client.InformedTimes.add(10 * 60); + } + // 20 minutes + else if (time <= 20 * 60 && !client.InformedTimes.contains(20 * 60)) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("20.0 Minutes"))); + UtilTextMiddle.display("Pvp Timer", "ending in 20 Minutes"); + client.InformedTimes.add(20 * 60); + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerAttack(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) + { + return; + } + + Player victim = event.GetDamageePlayer(); + Player damager = event.GetDamagerPlayer(true); + + boolean victimTimer = victim != null && hasTimer(victim); + boolean damagerTimer = damager != null && hasTimer(damager); + boolean bothMsg = false; + + if (victimTimer) + { + if (damagerTimer) + { + UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still on your PvP timer. Type " + F.elem("/pvptimer") + " to disable.")); + bothMsg = true; + } + else if (damager != null) + { + UtilPlayer.message(damager, F.main("Clans", F.name(victim.getName()) + " is still on their Pvp timer.")); + } + + event.SetCancelled("Pvp Timer"); + } + + if (damagerTimer) + { + if (victimTimer) + { + if (!bothMsg) UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still on your PvP timer. Type " + F.elem("/pvptimer") + " to disable.")); + } + else if (damager != null) + { + UtilPlayer.message(damager, F.main("Clans", "You are still on your PvP timer.")); + } + + event.SetCancelled("PvP Timer"); + } + + } + + public long getPvPTimerLeft(Player player) + { + long time = (_tracker.getPlaytime(player) + _tracker.getUnsavedPlaytime(player)); + + return (TIMER_LENGTH <= time ? 0 : TIMER_LENGTH - time); + } + + private boolean hasTimer(Player victim) + { + return victim != null && getPvPTimerLeft(victim) > 0 && !Get(victim).Skipped; + } + + @Override + protected PvpTimerClient AddPlayer(String player) + { + return new PvpTimerClient(Bukkit.getPlayer(player)); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimerClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimerClient.java new file mode 100644 index 000000000..82df2bd55 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimerClient.java @@ -0,0 +1,20 @@ +package mineplex.game.clans.clans.pvptimer; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; + +import mineplex.core.task.TaskManager; + +public class PvpTimerClient +{ + public boolean Skipped; + public List InformedTimes; + + public PvpTimerClient(Player player) + { + Skipped = TaskManager.Instance.hasCompletedTask(player, PvpTimer.SKIPPED_TASK); + InformedTimes = new ArrayList<>(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java new file mode 100644 index 000000000..b8c04949e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.clans.pvptimer.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.pvptimer.PvpTimer; + +public class PvPTimerCommand extends CommandBase +{ + public PvPTimerCommand(PvpTimer plugin) + { + super(plugin, Rank.ALL, "pvptimer", "timer", "pvp"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + if (Plugin.Get(caller).Skipped) + { + UtilPlayer.message(caller, F.main("Clans", "You have skipped your PvP timer.")); + return; + } + + long pvpTimerLeft = Plugin.getPvPTimerLeft(caller); + + if (pvpTimerLeft == 0) + { + UtilPlayer.message(caller, F.main("Clans", "Your PvP timer has ended.")); + } + else + { + UtilPlayer.message(caller, F.main("Clans", "You have " + F.elem(UtilTime.MakeStr(pvpTimerLeft * 1000)) + " before your PvP timer runs out.")); + new JsonMessage(F.main("Clans", "If you would like to permanently disable Pvp timer, click ")) + .extra("here") + .color("green") + .click(ClickEvent.RUN_COMMAND, "/pvptimer yesiconfirmthatiwouldliketodisablemypvptimerforever") + .extra(".") + .color("gray") + + .sendToPlayer(caller); + } + } + else + { + if (args[0].equalsIgnoreCase("yesiconfirmthatiwouldliketodisablemypvptimerforever")) + { + Plugin.disableFor(caller); + UtilPlayer.message(caller, F.main("Clans", "You have disabled your Pvp timer.")); + } + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java index c337f063f..47457a05b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java @@ -1,10 +1,13 @@ package mineplex.game.clans.clans.scoreboard; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.OnlineRankUpdateEvent; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.scoreboard.PlayerScoreboard; @@ -29,7 +32,7 @@ public class ClansScoreboardManager extends ScoreboardManager private WarManager _warManager; private WorldEventManager _worldEvent; - public ClansScoreboardManager(JavaPlugin plugin, TutorialManager tutorialManager, ClansManager clansManager, WarManager warManager, WorldEventManager worldEvent, CoreClientManager clientManager, DonationManager donationManager) + public ClansScoreboardManager(JavaPlugin plugin, ClansManager clansManager, WarManager warManager, WorldEventManager worldEvent, CoreClientManager clientManager, DonationManager donationManager) { super(plugin, clientManager, donationManager); @@ -37,10 +40,10 @@ public class ClansScoreboardManager extends ScoreboardManager _warManager = warManager; _worldEvent = worldEvent; - init(tutorialManager); + init(); } - private void init(TutorialManager tutorialManager) + private void init() { setTitle("Clans Alpha " + Clans.VERSION); @@ -53,12 +56,40 @@ public class ClansScoreboardManager extends ScoreboardManager data.writeElement(_warManager); data.writeElement(_worldEvent); - for (Tutorial tutorial : tutorialManager.getTutorials().values()) + for (Tutorial tutorial : TutorialManager.Instance.getTutorials().values()) { data.writeElement(tutorial); } } + @EventHandler + public void onGamemodeChanged(PlayerGameModeChangeEvent event) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(_clansManager.getPlugin(), new Runnable() { + public void run() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + refresh(player); + } + } + }, 20); + } + + @EventHandler + public void onRankUpdate(OnlineRankUpdateEvent event) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(_clansManager.getPlugin(), new Runnable() { + public void run() + { + for (Player player : Bukkit.getOnlinePlayers()) + { + refresh(player); + } + } + }, 20); + } + @EventHandler public void drawUpdate(UpdateEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java index 6cb5196a7..fb578a210 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -39,7 +39,6 @@ import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent.State; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; @@ -47,7 +46,6 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; @@ -94,14 +92,14 @@ public class Gameplay extends MiniPlugin Bukkit.getPluginManager().registerEvents(new CustomCreatures(), plugin); } - @EventHandler(priority = EventPriority.LOWEST) - public void spawnDamage(CustomDamageEvent event) - { - if (_clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()) != null && _clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()).isSafe(event.GetDamageeEntity().getLocation())) - { - event.SetCancelled("Safe Zone"); - } - } +// @EventHandler(priority = EventPriority.LOWEST) +// public void spawnDamage(CustomDamageEvent event) +// { +// if (_clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()) != null && _clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()).isSafe(event.GetDamageeEntity().getLocation())) +// { +// event.SetCancelled("Safe Zone"); +// } +// } @EventHandler public void onPlayerFishing(PlayerFishEvent event) @@ -436,6 +434,11 @@ public class Gameplay extends MiniPlugin { final Block block = event.getBlock(); + if (_clansManager.getClanUtility().isSafe(block.getLocation())) + { + return; + } + if (!UtilItem.isLog(block.getType())) { return; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java index 50a251707..118c483ea 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java @@ -16,23 +16,24 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; @@ -45,7 +46,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.items.generation.WeightSet; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; -import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.classcombat.item.event.WebTossEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -102,7 +102,7 @@ public class Spawn extends MiniPlugin { Block block = event.getToBlock(); - if (block.isLiquid() && isInSpawn(block.getLocation())) + if (block.isLiquid() && isSafe(block.getLocation())) { event.setCancelled(true); } @@ -115,7 +115,7 @@ public class Spawn extends MiniPlugin @EventHandler public void onWebToss(WebTossEvent event) { - if (isInSpawn(event.getLocation())) + if (isSafe(event.getLocation())) { event.setCancelled(true); } @@ -138,7 +138,7 @@ public class Spawn extends MiniPlugin @EventHandler public void onBlockBurn(BlockBurnEvent event) { - if (isInSpawn(event.getBlock().getLocation())) + if (isSafe(event.getBlock().getLocation())) { event.setCancelled(true); } @@ -153,7 +153,7 @@ public class Spawn extends MiniPlugin { if (event.getEntity() instanceof ItemFrame) { - if (isInSpawn(event.getEntity().getLocation())) + if (isSafe(event.getEntity().getLocation())) { event.setCancelled(true); } @@ -165,7 +165,7 @@ public class Spawn extends MiniPlugin { if (event.GetDamageeEntity() instanceof ItemFrame) { - if (isInSpawn(event.GetDamageeEntity().getLocation())) + if (isSafe(event.GetDamageeEntity().getLocation())) { event.SetCancelled("Item Frame Cancel"); } @@ -177,7 +177,7 @@ public class Spawn extends MiniPlugin { if (event.getEntity() instanceof ItemFrame) { - if (isInSpawn(event.getEntity().getLocation())) + if (isSafe(event.getEntity().getLocation())) { event.setCancelled(true); } @@ -192,9 +192,9 @@ public class Spawn extends MiniPlugin for (Player cur : UtilServer.getPlayers()) { - if (isInSpawn(cur.getLocation())) + if (isSafe(cur.getLocation())) { - long lastDamager = _clansManager.getCombatManager().Get(cur).GetLastCombat(); + long lastDamager = _clansManager.getCombatManager().Get(cur).GetLastCombatEngaged(); long duration = System.currentTimeMillis() - lastDamager; if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION)) @@ -203,7 +203,7 @@ public class Spawn extends MiniPlugin + ChatColor.YELLOW + F.time(UtilTime.convertString(COMBAT_TAG_DURATION - duration, 1, TimeUnit.FIT)); UtilTextMiddle.display(null, message, 0, 20, 0, cur); - _clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true); + _clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1.d, 0, false, Material.FIRE, (byte)0, true); playUnsafeParticles(cur); } else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 600)) @@ -214,6 +214,25 @@ public class Spawn extends MiniPlugin } } + @EventHandler + public void ignoreVelocity(PlayerVelocityEvent event) + { + if (_clansManager.getClanUtility().isSafe(event.getPlayer())) + { + event.setCancelled(true); + System.out.println("cancelled"); + } + } + + @EventHandler + public void onSkill(SkillTriggerEvent event) + { + if (!isSafe(event.GetPlayer().getLocation())) + { + _clansManager.getCombatManager().Get(event.GetPlayer()).SetLastCombatEngaged(System.currentTimeMillis()); + } + } + private void playUnsafeParticles(Player player) { UtilParticle.PlayParticle(UtilParticle.ParticleType.CRIT, player.getEyeLocation().add(0, 0.75d, 0), 0, 0, 0, 0.2f, 35, UtilParticle.ViewDist.NORMAL); @@ -283,7 +302,7 @@ public class Spawn extends MiniPlugin @EventHandler public void onEntitySpawn(CreatureSpawnEvent event) { - if (event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM && isInSpawn(event.getLocation())) + if (event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM && isSafe(event.getLocation())) { event.setCancelled(true); } @@ -325,7 +344,7 @@ public class Spawn extends MiniPlugin if (isInSpawn(monster)) { - int size = event.getDrops().size(); +// int size = event.getDrops().size(); event.getDrops().clear(); } } @@ -338,7 +357,7 @@ public class Spawn extends MiniPlugin @EventHandler public void onEntityTarget(EntityTargetEvent event) { - if (event.getTarget() != null && isInSpawn(event.getTarget().getLocation())) + if (event.getTarget() != null && isSafe(event.getTarget().getLocation())) { event.setCancelled(true); } @@ -353,7 +372,7 @@ public class Spawn extends MiniPlugin { if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return; - if (isInSpawn(event.getBlock().getLocation()) || isInSpawn(event.getPlayer())) + if (isSafe(event.getBlock().getLocation()) || isInSpawn(event.getPlayer())) { event.setCancelled(true); } @@ -366,22 +385,37 @@ public class Spawn extends MiniPlugin @EventHandler public void onPlayerAttack(CustomDamageEvent event) { - Player defender = event.GetDamageePlayer(); + Player victim = event.GetDamageePlayer(); Player attacker = event.GetDamagerPlayer(true); // Get (potentially ranged) attacker - if (defender != null && !isCombatTagged(defender)) + // wat + if (victim == null) { - if (isInSpawn(defender)) + return; + } + + if (attacker == null) + { + return; + } + + if (!isCombatTagged(victim)) + { + if (isInSpawn(victim)) { event.SetCancelled("Safe Zone"); attemptNotify(attacker, "You cannot attack players who are in spawn!"); + return; } - else if (isInSpawn(attacker)) + else if (isInSpawn(attacker) && !isCombatTagged(attacker)) { event.SetCancelled("Safe Zone"); attemptNotify(attacker, "You cannot attack untagged players while in spawn!"); - } + return; + } } + + System.out.println(event.GetCancellers()); } public Location getSpawnLocation() @@ -401,7 +435,7 @@ public class Spawn extends MiniPlugin return _shops.elements(); } - public boolean isInSpawn(Location location) + public boolean isSafe(Location location) { return _clansManager.getClanUtility().isSafe(location); // Check to see if location is in a SafeZone chunk } @@ -414,9 +448,10 @@ public class Spawn extends MiniPlugin return xOffset <= radius && zOffset <= radius; } + // this is basically just isSafe(); public boolean isInSpawn(Entity entity) { - return entity != null && isInSpawn(entity.getLocation()); + return entity != null && isSafe(entity.getLocation()); } public static World getSpawnWorld() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index 4d6ae6cc3..cc785d827 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -46,6 +46,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClanTipEvent; +import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.economy.GoldManager; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; @@ -89,7 +90,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener protected int _gemReward = -1; protected int _coinReward = -1; - public Tutorial(final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler) + protected Playtime _playtime; + + public Tutorial(final GoldManager goldManager, final Playtime playtime, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler) { _clansManager = clansManager; _goldManager = goldManager; @@ -99,6 +102,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener _tasks = new ArrayList>(); _inTutorial = new LinkedHashMap<>(); _nameToTask = new LinkedHashMap<>(); + _playtime = playtime; _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); } @@ -499,6 +503,12 @@ public abstract class Tutorial implements ScoreboardElement, Listener { public void run(Boolean data) { + if (_playtime.Get(player).FirstSession) + { + _playtime.Get(player).StartTime = System.currentTimeMillis(); + _playtime.Get(player).FirstSession = false; + } + cancelFor(player); } }, player, String.format(SKIPPED_TASK, _technicalName)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java index 7468ff139..02bcc6899 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java @@ -11,7 +11,6 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; @@ -20,12 +19,12 @@ import mineplex.core.preferences.PreferencesManager; import mineplex.core.task.TaskManager; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.commands.RestartTutCommand; +import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand; import mineplex.game.clans.tutorials.commands.SkipTutorialCommand; import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted; import net.md_5.bungee.api.ChatColor; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; public class TutorialManager extends MiniPlugin @@ -37,7 +36,7 @@ public class TutorialManager extends MiniPlugin private final TaskManager _taskManager; - public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager, final PacketHandler packetHandler) + public TutorialManager(final JavaPlugin plugin, final Playtime playtime, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager, final PacketHandler packetHandler) { super("Tutorials", plugin); @@ -45,7 +44,7 @@ public class TutorialManager extends MiniPlugin _taskManager = taskManager; - _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager, taskManager, packetHandler)); +// _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, playtime, clansManager, donationManager, goldManager, taskManager, packetHandler)); packetHandler.addPacketHandler(new IPacketHandler() { public void handle(PacketInfo packet) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java index fe2dde3df..c91e87436 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java @@ -12,6 +12,7 @@ import mineplex.core.task.TaskManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.tutorials.Tutorial; @@ -19,9 +20,9 @@ import mineplex.game.clans.tutorials.TutorialManager; public class TutorialGettingStarted extends Tutorial { - public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager, final PacketHandler packetHandler) + public TutorialGettingStarted(final TutorialManager manager, final Playtime playtime, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager, final PacketHandler packetHandler) { - super(goldManager, taskManager, clansManager, donationManager, manager, packetHandler); + super(goldManager, playtime, taskManager, clansManager, donationManager, manager, packetHandler); // addTask(new TaskWelcome(this, 1)); @@ -52,8 +53,14 @@ public class TutorialGettingStarted extends Tutorial { player.resetPlayerTime(); player.teleport(Spawn.getEastSpawn()); + + if (_playtime.Get(player).FirstSession) + { + _playtime.Get(player).StartTime = System.currentTimeMillis(); + _playtime.Get(player).FirstSession = false; + } } - + @Override protected void onFinishedDelay(Player player) { diff --git a/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Hub/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 2dd2823cb..a5f59ac1c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -35,7 +35,7 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.types.GadgetType; import mineplex.core.giveaway.GiveawayManager; @@ -55,6 +55,7 @@ import mineplex.core.party.Party; import mineplex.core.party.PartyManager; import mineplex.core.personalServer.PersonalServerManager; import mineplex.core.pet.PetManager; +import mineplex.core.playerCount.PlayerCountManager; import mineplex.core.poll.PollManager; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; @@ -157,6 +158,7 @@ public class HubManager extends MiniClientPlugin private PetManager _petManager; private PacketHandler _packetHandler; private PersonalServerManager _personalServerManager; + private PlayerCountManager _playerCountManager; // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; @@ -234,7 +236,7 @@ public class HubManager extends MiniClientPlugin _achievementManager.setGiveInterfaceItem(true); _packetHandler = packetHandler; - new NotificationManager(getPlugin(), clientManager, preferences); + new NotificationManager(getPlugin(), clientManager, _preferences); new BotSpamManager(plugin, clientManager, punish); ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; @@ -246,6 +248,8 @@ public class HubManager extends MiniClientPlugin // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); + _playerCountManager = new PlayerCountManager(plugin); + _songs = new ArrayList(); try @@ -449,8 +453,8 @@ public class HubManager extends MiniClientPlugin String playerName = player.getName(); // April Fools - if (AprilFoolsManager.Instance.isActive()) - playerName = AprilFoolsManager.Instance.getName(player); +// if (AprilFoolsManager.Instance.isActive()) +// playerName = AprilFoolsManager.Instance.getName(player); //Public Message event.setJoinMessage(null); @@ -693,6 +697,8 @@ public class HubManager extends MiniClientPlugin if (_scoreboardTick != 0) return; + int playerCount = _playerCountManager.getPlayerCount(); + for (Player player : UtilServer.getPlayers()) { //Dont Waste Time @@ -730,13 +736,9 @@ public class HubManager extends MiniClientPlugin //Players obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--); - player.getScoreboard().resetScores(_lastPlayerCount + ""); + obj.getScore(playerCount + "").setScore(line--); - _lastPlayerCount++; - - obj.getScore(_lastPlayerCount + "").setScore(line--); - //Space obj.getScore(" ").setScore(line--); @@ -769,6 +771,8 @@ public class HubManager extends MiniClientPlugin obj.getScore("www.mineplex.com").setScore(line--); obj.getScore("----------------").setScore(line--); } + + _lastPlayerCount = playerCount; } @Override @@ -852,11 +856,14 @@ public class HubManager extends MiniClientPlugin return _visibilityManager; } +// <<<<<<< HEAD +// ======= // public HalloweenSpookinessManager getHalloweenManager() // { // return _halloweenManager; // } +// >>>>>>> 1c1184d58ea4230a6b4a57eaef685192207f3c77 @EventHandler(priority = EventPriority.MONITOR) public void gadgetCollide(GadgetCollideEntityEvent event) { @@ -1007,7 +1014,7 @@ public class HubManager extends MiniClientPlugin } @EventHandler - public void disableMusicChristmas(GadgetActivateEvent event) + public void disableMusicChristmas(GadgetEnableEvent event) { if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java index d76e0db30..bb078b3bb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java @@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.donation.Donor; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.treasure.event.TreasureStartEvent; @@ -111,6 +111,8 @@ public class DisguiseCommand extends CommandBase implements Listener return; } + final Rank rank = Plugin.GetClients().Get(caller).GetRank(); + Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable() { @Override @@ -162,7 +164,7 @@ public class DisguiseCommand extends CommandBase implements Listener otherRank = other.GetRank(); } catch(NullPointerException exception) {} - if(otherRank.has(Rank.TWITCH)) + if(otherRank.has(Rank.TWITCH) && !rank.has(Rank.OWNER)) { UtilPlayer.message(caller, C.cRed + C.Bold + "You can't disguise as staff!"); return; @@ -176,7 +178,7 @@ public class DisguiseCommand extends CommandBase implements Listener changeName(caller, args[0]); - Plugin.GetGadget().RemoveItem(caller); + Plugin.GetGadget().removeGadgetType(caller, GadgetType.Item); UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]); } catch(Exception e) @@ -285,7 +287,7 @@ public class DisguiseCommand extends CommandBase implements Listener } @EventHandler - public void gadget(GadgetActivateEvent event) + public void gadget(GadgetEnableEvent event) { if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) return; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java index 373bb1e5d..d45cb3c8d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java @@ -22,9 +22,9 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; -import mineplex.core.gadget.gadgets.ItemDuelingSword; -import mineplex.core.gadget.gadgets.OutfitTeam; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.gadgets.item.ItemDuelingSword; +import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.event.MountActivateEvent; @@ -214,7 +214,7 @@ public class KothManager extends MiniPlugin } @EventHandler - public void disableGadgets(GadgetActivateEvent event) + public void disableGadgets(GadgetEnableEvent event) { if (isKothMode(event.getPlayer())) event.setCancelled(true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 5287b1d76..424a582a1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -15,7 +15,7 @@ import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.gadget.gadgets.MorphWither; +import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java index 2b4b198d3..b5d86f0d6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java @@ -36,7 +36,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.types.MusicGadget; import mineplex.core.mount.event.MountActivateEvent; @@ -138,7 +138,7 @@ public class ParkourManager extends MiniPlugin } @EventHandler - public void disableGadgets(GadgetActivateEvent event) + public void disableGadgets(GadgetEnableEvent event) { if (isParkourMode(event.getPlayer())) event.setCancelled(true); @@ -460,7 +460,7 @@ public class ParkourManager extends MiniPlugin } @EventHandler - public void musicDisable(GadgetActivateEvent event) + public void musicDisable(GadgetEnableEvent event) { if (event.getGadget() instanceof MusicGadget) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 6fbe6ccec..fd9d7e397 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -41,8 +41,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; -import mineplex.core.gadget.gadgets.OutfitTeam; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.event.MountActivateEvent; @@ -490,7 +490,7 @@ public class SoccerManager extends MiniPlugin } @EventHandler - public void disableGadgets(GadgetActivateEvent event) + public void disableGadgets(GadgetEnableEvent event) { if (isSoccerMode(event.getPlayer())) event.setCancelled(true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index bf5b654ea..0fa87552c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -28,7 +28,7 @@ import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.event.StackerEvent; -import mineplex.core.gadget.gadgets.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.types.GadgetType; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileManager; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/profile/buttons/ButtonPrefs.java b/Plugins/Mineplex.Hub/src/mineplex/hub/profile/buttons/ButtonPrefs.java index 38652a7c7..1b9c38395 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/profile/buttons/ButtonPrefs.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/profile/buttons/ButtonPrefs.java @@ -2,6 +2,7 @@ package mineplex.hub.profile.buttons; import mineplex.core.common.util.C; import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import mineplex.hub.profile.gui.GUIProfile; @@ -17,7 +18,7 @@ public class ButtonPrefs implements GuiItem private GUIProfile _profile; private Player _player; - + public ButtonPrefs(GUIProfile profile, Player player) { _profile = profile; @@ -33,29 +34,27 @@ public class ButtonPrefs implements GuiItem @Override public ItemStack getObject() { - return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_COMPARATOR.getId(), (byte)0, 1, - ChatColor.RESET + C.cYellow + "Preferences", - new String[] - { - "", - C.cWhite + "Set your preferences to your liking", - C.cWhite + "so you can enjoy the game more!", - - "", - C.cWhite + "Type " + C.cGreen + "/prefs" + C.cWhite + " to access this anywhere!" - }); + return new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.Reset + C.cYellow + "Preferences").addLore(new String[] + { + "", + C.cWhite + "Set your preferences to your liking", + C.cWhite + "so you can enjoy the game more!", + + "", + C.cWhite + "Type " + C.cGreen + "/prefs" + C.cWhite + " to access this anywhere!" + }).build(); } @Override - public void setup() + public void setup() { - + } @Override public void close() { - + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 4e3bc8320..6b1411ecd 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -4,13 +4,14 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.ChatColor; -import org.bukkit.entity.Player; import org.bukkit.Material; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; @@ -34,17 +35,18 @@ public class ServerGameMenu extends ShopPageBase { private List _superSmashCycle = new ArrayList(); private List _minigameCycle = new ArrayList(); - + private int _ssmIndex; private int _minigameIndex; - - public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + + public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, + DonationManager donationManager, String name, Player player) { super(plugin, quickShop, clientManager, donationManager, name, player, 47); - + createSuperSmashCycle(); createMinigameCycle(); - + buildPage(); } @@ -52,82 +54,93 @@ public class ServerGameMenu extends ShopPageBase @Override protected void buildPage() { - setItem(0, ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "The Bridges " + C.cGray + "4 Team Survival", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "4 Teams get 10 minutes to prepare.", - ChatColor.RESET + "Then the bridges drop, and all hell", - ChatColor.RESET + "breaks loose as you battle to the", - ChatColor.RESET + "death with the other teams.", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BR") + ChatColor.RESET + " other players!", - })); - - setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Solo/Team Survival", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Search for chests to find loot and ", - ChatColor.RESET + "fight others to be the last man standing. ", - ChatColor.RESET + "Stay away from the borders!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + ChatColor.RESET + " other players!", - })); + setItem(0, new ItemBuilder(Material.IRON_PICKAXE) + .setTitle(C.Reset + C.Bold + C.cYellow + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "4 Teams get 10 minutes to prepare.", + C.Reset + "Then the bridges drop, and all hell", + C.Reset + "breaks loose as you battle to the", + C.Reset + "death with the other teams.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BR") + C.Reset + " other players!" + }).setHideInfo(true).build()); - setItem(4, ItemStackFactory.Instance.CreateStack(Material.FEATHER.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Skywars " + C.cGray + "Solo/Team Survival", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "16 contenders fight for the right to rule the skies!", - ChatColor.RESET + "Spawn on a sky island and build your path!", - ChatColor.RESET + "Find weapons to take your enemies down!", - ChatColor.RESET + "Way up there, death ever looming if you fall..", - ChatColor.RESET + "Can you fight? Can you live? Can you win Skywars?", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + ChatColor.RESET + " other players!", - })); + setItem(2, new ItemBuilder(Material.DIAMOND_SWORD) + .setTitle(C.Reset + C.Bold + C.cYellow + "Survival Games " + C.cGray + "Solo/Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "Search for chests to find loot and ", + C.Reset + "fight others to be the last man standing. ", + C.Reset + "Stay away from the borders!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + C.Reset + + " other players!" + }).setHideInfo(true).build()); - setItem(6, ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Extremely hard team-based survival ", - ChatColor.RESET + "Gather materials and fight your way", - ChatColor.RESET + "to become the last team standing!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("UHC") + ChatColor.RESET + " other players!", - })); + setItem(4, new ItemBuilder(Material.FEATHER) + .setTitle(C.Reset + C.Bold + C.cYellow + "Skywars " + C.cGray + "Solo/Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "16 contenders fight to rule the skies!", + C.Reset + "Spawn on a sky island and build your path!", + C.Reset + "Find weapons to take your enemies down!", + C.Reset + "Up in the skies, death looming if you fall..", + C.Reset + "Win! Fight! Send enemies flying in Skywars!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + C.Reset + + " other players!", + }).setHideInfo(true).build()); - setItem(8, ItemStackFactory.Instance.CreateStack(Material.BLAZE_ROD.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Wizards " + C.cGray + "Last Man Standing", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Wield powerful spells to fight", - ChatColor.RESET + "against other players in this", - ChatColor.RESET + "exciting free-for-all brawl!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("WIZ") + ChatColor.RESET + " other players!", - })); + setItem(6, new ItemBuilder(Material.GOLDEN_APPLE) + .setTitle(C.Reset + C.Bold + C.cYellow + "UHC " + C.cGray + "Ultra Hardcore Mode").addLore(new String[] + { + C.Reset + "", + C.Reset + "Extremely hard team-based survival ", + C.Reset + "Gather materials and fight your way", + C.Reset + "to become the last team standing!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("UHC") + C.Reset + " other players!", + }).setHideInfo(true).build()); - setItem(18, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Castle Siege " + C.cGray + "Team Game", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Defenders must protect King Sparklez", - ChatColor.RESET + "from the endless waves of Undead", - ChatColor.RESET + "until the sun rises!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("CS") + ChatColor.RESET + " other players!", - })); + setItem(8, new ItemBuilder(Material.BLAZE_ROD) + .setTitle(C.Reset + C.Bold + C.cYellow + "Wizards " + C.cGray + "Last Man Standing").addLore(new String[] + { + C.Reset + "", + C.Reset + "Wield powerful spells to fight", + C.Reset + "against other players in this", + C.Reset + "exciting free-for-all brawl!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("WIZ") + C.Reset + " other players!", + }).setHideInfo(true).build()); - setItem(20, ItemStackFactory.Instance.CreateStack(Material.GRASS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Hide as blocks/animals, upgrade your ", - ChatColor.RESET + "weapon and fight to survive against", - ChatColor.RESET + "the Hunters!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BH") + ChatColor.RESET + " other players!", - })); + setItem(18, new ItemBuilder(Material.DIAMOND_CHESTPLATE) + .setTitle(C.Reset + C.Bold + C.cYellow + "Castle Siege " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Defenders must protect King Sparklez", + C.Reset + "from the endless waves of Undead", + C.Reset + "until the sun rises!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CS") + C.Reset + " other players!", + }).setHideInfo(true).build()); + + setItem(20, new ItemBuilder(Material.GRASS) + .setTitle(C.Reset + C.Bold + C.cYellow + "Block Hunt " + C.cGray + "Cat and Mouse").addLore(new String[] + { + C.Reset + "", + C.Reset + "Hide as blocks/animals, upgrade your ", + C.Reset + "weapon and fight to survive against", + C.Reset + "the Hunters!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!", + }).setHideInfo(true).build()); setItem(22, _superSmashCycle.get(_ssmIndex)); - setItem(24, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike " + C.cGray + "Team Survival", new String[] + setItem(24, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike" + C.cGray + "Team Survival", new String[] { ChatColor.RESET + "", ChatColor.RESET + "One team must defend two bomb sites from", @@ -177,23 +190,79 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + ChatColor.RESET + " other players!", })); + setItem(24, new ItemBuilder(Material.TNT) + .setTitle(C.Reset + C.Bold + C.cYellow + "Mine-Strike " + C.cGray + "Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "One team must defend two bomb sites from", + C.Reset + "the other team, who are trying to plant a bomb", + C.Reset + "and blow them up!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!", + }).setHideInfo(true).build()); + + setItem(26, new ItemBuilder(Material.BOOK_AND_QUILL) + .setTitle(C.Reset + C.Bold + C.cYellow + "Draw My Thing " + C.cGray + "Pictionary!").addLore(new String[] + { + C.Reset + "", + C.Reset + "Players take turns at drawing a random", + C.Reset + "word. Whoever guesses it within the time", + C.Reset + "limit gets some points!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!", + }).setHideInfo(true).build()); + + setItem(36, new ItemBuilder(Material.BEACON).setTitle(C.Reset + C.Bold + C.cYellow + "Dominate " + C.cGray + "Team Game") + .addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team for the", + C.Reset + "control points on the map.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DOM") + C.Reset + " other players!", + }).setHideInfo(true).build()); + + setItem(38, new ItemBuilder(Material.GOLD_SWORD) + .setTitle(C.Reset + C.Bold + C.cYellow + "Team Deathmatch " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team to the", + C.Reset + "last man standing.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("TDM") + C.Reset + " other players!", + }).setHideInfo(true).build()); + + setItem(40, new ItemBuilder(Material.WOOD) + .setTitle(C.Reset + C.Bold + C.cYellow + "Master Builders " + C.cGray + "Creative Build").addLore(new String[] + { + C.Reset + "", + C.Reset + "Players are given a Build Theme and ", + C.Reset + "must use blocks, monsters and more", + C.Reset + "to create a masterpiece!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!", + }).setHideInfo(true).build()); + setItem(42, _minigameCycle.get(_minigameIndex)); - setItem(44, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Player Servers " + C.cGray + "Player Hosted Games", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Join your friends in their own ", - ChatColor.RESET + "Mineplex Player Server. You can play", - ChatColor.RESET + "the games you want, when you want.", - ChatColor.RESET + "", - })); + setItem(44, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3) + .setTitle(C.Reset + C.Bold + C.cYellow + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Join your friends in their own ", + C.Reset + "Mineplex Player Server. You can play", + C.Reset + "the games you want, when you want.", + C.Reset + "", + }).setHideInfo(true).build()); getButtonMap().put(0, new SelectBRButton(this)); getButtonMap().put(2, new SelectSGButton(this)); getButtonMap().put(4, new SelectSKYButton(this)); getButtonMap().put(6, new SelectUHCButton(this)); getButtonMap().put(8, new SelectWIZButton(this)); - + getButtonMap().put(18, new SelectCSButton(this)); getButtonMap().put(20, new SelectBHButton(this)); getButtonMap().put(22, new SelectSSMButton(this)); @@ -204,271 +273,280 @@ public class ServerGameMenu extends ShopPageBase getButtonMap().put(40, new SelectBLDButton(this)); getButtonMap().put(42, new SelectMINButton(this)); getButtonMap().put(44, new SelectPLAYERButton(this)); -// getButtonMap().put(44, new SelectBETAButton(this)); + // getButtonMap().put(44, new SelectBETAButton(this)); } @SuppressWarnings("deprecation") private void createMinigameCycle() { - int playerCount = getPlugin().getGroupTagPlayerCount("MIN") + - getPlugin().getGroupTagPlayerCount("DR") + - getPlugin().getGroupTagPlayerCount("DE") + - getPlugin().getGroupTagPlayerCount("PB") + - getPlugin().getGroupTagPlayerCount("TF") + - getPlugin().getGroupTagPlayerCount("RUN") + - getPlugin().getGroupTagPlayerCount("SN") + - getPlugin().getGroupTagPlayerCount("DT") + - getPlugin().getGroupTagPlayerCount("SQ") + - getPlugin().getGroupTagPlayerCount("SA") + - getPlugin().getGroupTagPlayerCount("SS") + - getPlugin().getGroupTagPlayerCount("OITQ"); - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(98, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(122, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.MILK_BUCKET.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.MILK_BUCKET.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(159, (byte)14, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(309, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); - - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(319, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] - { - ChatColor.RESET + "", - ChatColor.RESET + "Play all of these fun minigames:", - ChatColor.RESET + "", - ChatColor.RESET + "Super Spleef", - ChatColor.RESET + "Runner", - ChatColor.RESET + "Dragons", - ChatColor.RESET + "One in the Quiver", - ChatColor.RESET + "Dragon Escape", - ChatColor.RESET + "Sneaky Assassins", - ChatColor.RESET + "Micro Battle", - ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Wars", - ChatColor.RESET + "Death Tag", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "Bacon Brawl", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + playerCount + ChatColor.RESET + " other players!", - })); + int playerCount = getPlugin().getGroupTagPlayerCount("MIN") + getPlugin().getGroupTagPlayerCount("DR") + + getPlugin().getGroupTagPlayerCount("DE") + getPlugin().getGroupTagPlayerCount("PB") + + getPlugin().getGroupTagPlayerCount("TF") + getPlugin().getGroupTagPlayerCount("RUN") + + getPlugin().getGroupTagPlayerCount("SN") + getPlugin().getGroupTagPlayerCount("DT") + + getPlugin().getGroupTagPlayerCount("SQ") + getPlugin().getGroupTagPlayerCount("SA") + + getPlugin().getGroupTagPlayerCount("SS") + getPlugin().getGroupTagPlayerCount("OITQ"); + _minigameCycle.add(new ItemBuilder(Material.SMOOTH_BRICK) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + C.Bold + C.cGreen + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.GOLD_BOOTS) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + C.Bold + C.cGreen + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.DRAGON_EGG) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + C.Bold + C.cGreen + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.BOW) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + C.Bold + C.cGreen + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.LEATHER_BOOTS) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + C.Bold + C.cGreen + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.MILK_BUCKET) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + C.Bold + C.cGreen + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.MILK_BUCKET) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + C.Bold + C.cGreen + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.DIAMOND_BARDING) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + C.Bold + C.cGreen + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.STAINED_CLAY, 1, (byte) 14) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + C.Bold + C.cGreen + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.IRON_BOOTS) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + C.Bold + C.cGreen + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); + + _minigameCycle.add(new ItemBuilder(Material.PORK) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Play all of these fun minigames:", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + C.Bold + C.cGreen + "Bacon Brawl", + C.Reset + "", + C.Reset + "Join " + C.cGreen + playerCount + C.Reset + " other players!", + }).setHideInfo(true).build()); } private void createSuperSmashCycle() { - String[] desc = new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Pick from a selection of monsters,", - ChatColor.RESET + "then battle other players to the ", - ChatColor.RESET + "death with your monsters skills!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("SSM") + getPlugin().getGroupTagPlayerCount("SSM2")) + ChatColor.RESET + " other players!", - }; - - _superSmashCycle.add(ItemStackFactory.Instance.CreateStack(397, (byte)4, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch", desc)); + String[] desc = new String[] + { + C.Reset + "", + C.Reset + "Pick from a selection of monsters,", + C.Reset + "then battle other players to the ", + C.Reset + "death with your monsters skills!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + + (getPlugin().getGroupTagPlayerCount("SSM") + getPlugin().getGroupTagPlayerCount("SSM2")) + C.Reset + + " other players!", + }; + + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 4) + .setTitle(C.Reset + C.Bold + C.cYellow + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc) + .setHideInfo(true).build()); } public void Update() { _ssmIndex++; _minigameIndex++; - + if (_ssmIndex >= _superSmashCycle.size()) _ssmIndex = 0; - + if (_minigameIndex >= _minigameCycle.size()) _minigameIndex = 0; - + buildPage(); } @@ -491,12 +569,12 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getCastleSiegeShop().attemptShopOpen(player); } - + public void OpenBR(Player player) { getPlugin().getBridgesShop().attemptShopOpen(player); } - + public void OpenBH(Player player) { getPlugin().getBlockHuntShop().attemptShopOpen(player); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 8208dcba5..5bc9aa8fa 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -15,7 +15,9 @@ import org.bukkit.inventory.meta.SkullMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.game.GameDisplay; @@ -78,17 +80,8 @@ public class ServerNpcPage extends ShopPageInventory 64 ? 64 : yellowCount, false), new IButton() - { - @Override - public void onClick(Player player, ClickType clickType) + if(showGreen) { + addButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 64 : yellowCount, false), new IButton() { - _onMainPage = false; - } - }); - + @Override + public void onClick(Player player, ClickType clickType) + { + _onMainPage = false; + } + }); + + addButton(4, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BLOCK, (byte) 0, 1, C.cGreen + "Click to join instantly!"), new IButton() { + + @Override + public void onClick(Player player, ClickType clickType) { + getPlugin().selectServer(player, _serverGroupName); + } + }); + } + // Clear empty slots if (showGreen) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java index b1828d0d5..fac62c62b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.game.GameDisplay; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; @@ -34,10 +35,12 @@ public class ServerTypePage extends ShopPageBase private ServerGroup _serverGroup; - public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, - ServerGroup serverGroup) - { - super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27); + public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, + DonationManager donationManager, Player player, ServerGroup serverGroup) + { + super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27); + + _serverGroup = serverGroup; _serverGroup = serverGroup; @@ -71,10 +74,28 @@ public class ServerTypePage extends ShopPageBase { if(team) { - getShop().openPageForPlayer( - player, - new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName() + " Teams", - player, _serverGroup.getTeamServerKey())); + String friendlyName = _serverGroup.getServerNpcName(); + + setItem(12, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.Reset + C.cYellow + "Solo " + friendlyName) + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cRed + C.Bold + "WARNING: " + C.Reset + "Teaming in Solo Mode is bannable!", + C.Reset + "", + C.Reset + C.cGreen + "Click to Play", + }).build()); + + setItem(14, new ItemBuilder(Material.SKULL_ITEM, 2, (byte) 3).setTitle(C.Reset + C.cYellow + "Team " + friendlyName) + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGray + "2 Player Teams", + C.Reset + "", + C.Reset + C.cGreen + "Click to Play" + }).build()); + + getButtonMap().put(12, new SelectTypeButton(this, false)); + getButtonMap().put(14, new SelectTypeButton(this, true)); } else { diff --git a/Plugins/Mineplex.MapParser/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.MapParser/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.MapParser/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java index 0496fe670..3ce6e3a7a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java @@ -134,9 +134,30 @@ public class Flash extends SkillActive while (curRange <= maxRange) { Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); - - if (!UtilBlock.airFoliage(newTarget.getBlock()) || - !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + Location aboveTarget = newTarget.getBlock().getRelative(BlockFace.UP).getLocation(); + + // half-slab + boolean newTargetIsSlab = newTarget.getBlock().getType() == Material.STEP || newTarget.getBlock().getType() == Material.WOOD_STEP; + boolean aboveTargetIsSlab = aboveTarget.getBlock().getType() == Material.STEP || aboveTarget.getBlock().getType() == Material.WOOD_STEP; + + boolean newTargetSlabIsBottom = false; + boolean aboveTargetSlabIsBottom = false; + + if(newTargetIsSlab && curRange < 0.5) + { + int newTargetData = (int) newTarget.getBlock().getData(); + + if(newTargetData <= 7) newTargetSlabIsBottom = true; + } + + if(aboveTargetIsSlab && curRange < 0.25) + { + int aboveTargetData = (int) aboveTarget.getBlock().getData(); + + if(aboveTargetData <= 7) aboveTargetSlabIsBottom = true; + } + + if ((!newTargetSlabIsBottom && UtilBlock.fullSolid(newTarget.getBlock())) || (!aboveTargetSlabIsBottom && UtilBlock.fullSolid(aboveTarget.getBlock()))) break; //Progress Forwards diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/ShieldSmash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/ShieldSmash.java index 74c32eca4..8a2a4875b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/ShieldSmash.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/ShieldSmash.java @@ -84,6 +84,9 @@ public class ShieldSmash extends SkillActive if (cur.equals(player)) continue; + + if (UtilPlayer.isSpectator(cur)) + continue; if (UtilMath.offset(loc, cur.getLocation()) > 2.5) continue; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java index 2ab969bac..45833b8d1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java @@ -94,13 +94,16 @@ public class FissureData _loc.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); //Slow - for (Player cur : block.getWorld().getPlayers()) + for (Player cur : block.getWorld().getPlayers()) { + if(UtilPlayer.isSpectator(cur)) continue; + if (!cur.equals(_player)) if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5) { //Condition Host.Factory.Condition().Factory().Slow("Fissure", cur, _player, 1 + _level, 1, false, true, true, true); } + } } } @@ -146,7 +149,10 @@ public class FissureData up.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, block.getTypeId()); //Damage - for (Player cur : up.getWorld().getPlayers()) + for (Player cur : up.getWorld().getPlayers()) { + if (UtilPlayer.isSpectator(cur)) + continue; + if (!cur.equals(_player)) { //Teleport @@ -172,7 +178,7 @@ public class FissureData UtilPlayer.message(cur, F.main(Host.GetClassType().name(), F.name(_player.getName()) +" hit you with " + F.skill(Host.GetName(_level)) + ".")); } } - + } //Next Column if (_height >= Math.min(3, _handled/2 + 1)) { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.Minecraft.Game.Core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java index 752b71fa6..879fc3c30 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java @@ -28,6 +28,7 @@ public class CombatLog protected CombatComponent LastDamager; protected long _lastDamaged; protected long _lastCombat; + protected long _lastCombatEngaged; public CombatLog(Player player, long expireTime) { @@ -185,6 +186,16 @@ public class CombatLog return _lastCombat; } + public long GetLastCombatEngaged() + { + return _lastCombatEngaged; + } + + public void SetLastCombatEngaged(long time) + { + _lastCombatEngaged = time; + } + public void SetLastCombat(long time) { _lastCombat = time; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index a255415e5..b42ae087d 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -3,8 +3,6 @@ package mineplex.minecraft.game.core.combat; import java.util.HashSet; import java.util.Iterator; -import net.minecraft.server.v1_8_R3.ItemStack; - import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Arrow; import org.bukkit.entity.Fireball; @@ -18,8 +16,6 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -30,9 +26,12 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.ClearCombatEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import net.minecraft.server.v1_8_R3.ItemStack; public class CombatManager extends MiniPlugin { @@ -201,7 +200,7 @@ public class CombatManager extends MiniPlugin // Not Player > No Log if (event.GetDamageePlayer() == null) return; - + // Damager is ENTITY if (event.GetDamagerEntity(true) != null) { @@ -256,8 +255,12 @@ public class CombatManager extends MiniPlugin } if (event.GetDamagerEntity(true) instanceof Player) + { Get((Player)event.GetDamagerEntity(true)).SetLastCombat(System.currentTimeMillis()); - + Get((Player)event.GetDamagerEntity(true)).SetLastCombatEngaged(System.currentTimeMillis()); + Get(event.GetDamageePlayer()).SetLastCombatEngaged(System.currentTimeMillis()); + } + Get(event.GetDamageePlayer()).Attacked( UtilEnt.getName(event.GetDamagerEntity(true)), (int) event.GetDamage(), event.GetDamagerEntity(true), diff --git a/Plugins/Mineplex.PlayerCache/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.PlayerCache/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.PlayerCache/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Plugins/Mineplex.Queuer/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Queuer/.settings/org.eclipse.jdt.core.prefs index 7341ab168..a698e5967 100644 --- a/Plugins/Mineplex.Queuer/.settings/org.eclipse.jdt.core.prefs +++ b/Plugins/Mineplex.Queuer/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Plugins/Nautilus.Game.Arcade/.classpath b/Plugins/Nautilus.Game.Arcade/.classpath index 315ba497a..0c832983c 100644 --- a/Plugins/Nautilus.Game.Arcade/.classpath +++ b/Plugins/Nautilus.Game.Arcade/.classpath @@ -1,7 +1,7 @@ - + diff --git a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs index 258ba4736..ffba01386 100644 --- a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs +++ b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,6 @@ -=\=\=\=\=\=\= -<<<<<<<=HEAD ->>>>>>>=6983af944fff04c5910f789266ae46b9eca4cc8d eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -<<<<<<< HEAD org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -======= ->>>>>>> 1a922da1c39379beebab0abe3df78c9b8f66d64e org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 @@ -16,6 +10,50 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line @@ -26,7 +64,7 @@ org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true @@ -52,8 +90,8 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert @@ -71,7 +109,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=i org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert @@ -162,7 +200,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do no org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert @@ -207,20 +245,20 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_refe org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert @@ -243,7 +281,7 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=150 +org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 @@ -256,3 +294,4 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.ui.prefs b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.ui.prefs index b1de4c19e..472a681b7 100644 --- a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.ui.prefs +++ b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.ui.prefs @@ -1,6 +1,3 @@ eclipse.preferences.version=1 -<<<<<<< HEAD -formatter_profile=_Morten -======= ->>>>>>> 6983af944fff04c5910f789266ae46b9eca4cc8d +formatter_profile=_Thanos formatter_settings_version=12 diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index fbf22d621..7e9d4a156 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -921,6 +921,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation ((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); + player.setCustomName(""); + player.setCustomNameVisible(false); + player.setSprinting(false); player.setSneaking(false); @@ -1343,7 +1346,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (!player.isOnline()) return; - PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0); + PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0, 0); if (reward.canGiveReward(player)) reward.giveReward(null, player, new Callback() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java index c35fc9ab5..7111ae370 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java @@ -15,7 +15,7 @@ import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; @@ -169,7 +169,7 @@ public class DisguiseCommand extends CommandBase implements Liste changeName(caller, args[0], true); - Plugin.getCosmeticManager().getGadgetManager().RemoveItem(caller); + Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.Item); Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]); @@ -291,7 +291,7 @@ public class DisguiseCommand extends CommandBase implements Liste } @EventHandler - public void gadget(GadgetActivateEvent event) + public void gadget(GadgetEnableEvent event) { if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 832053604..1d6947f06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -36,7 +35,6 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingPlaceEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.WorldLoadEvent; @@ -54,8 +52,8 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTabTitle; -import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; @@ -72,18 +70,24 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.gametutorial.GameTutorial; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.scoreboard.GameScoreboard; -import nautilus.game.arcade.stats.*; +import nautilus.game.arcade.stats.AssistsStatTracker; +import nautilus.game.arcade.stats.DamageDealtStatTracker; +import nautilus.game.arcade.stats.DamageTakenStatTracker; +import nautilus.game.arcade.stats.DeathsStatTracker; +import nautilus.game.arcade.stats.ExperienceStatTracker; +import nautilus.game.arcade.stats.GamesPlayedStatTracker; +import nautilus.game.arcade.stats.KillsStatTracker; +import nautilus.game.arcade.stats.LoseStatTracker; +import nautilus.game.arcade.stats.StatTracker; +import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.world.WorldData; import net.minecraft.server.v1_8_R3.EntityItem; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; -import net.minecraft.server.v1_8_R3.ScoreboardTeam; import net.minecraft.server.v1_8_R3.WorldServer; public abstract class Game implements Listener @@ -124,6 +128,7 @@ public abstract class Game implements Listener private boolean _countdownForce = false; private String _customWinLine = ""; + private NautHashMap _customWinMessages = new NautHashMap(); // Kits private Kit[] _kits; @@ -492,6 +497,11 @@ public abstract class Game implements Listener { _customWinLine = line; } + + public void SetCustomWinMessage(Player player, String message) + { + _customWinMessages.put(player, message); + } public GameScoreboard GetScoreboard() { @@ -1156,7 +1166,20 @@ public abstract class Game implements Listener UtilPlayer.message(player, "Nobody won the game!"); } - UtilPlayer.message(player, _customWinLine); + if (_customWinMessages.containsKey(player)) + { + if (!_customWinLine.trim().equalsIgnoreCase("")) + { + UtilPlayer.message(player, _customWinLine); + } + + UtilPlayer.message(player, _customWinMessages.get(player)); + } + else + { + UtilPlayer.message(player, _customWinLine); + } + UtilPlayer.message(player, ""); UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java index 7384a3cc6..3d5ca5cf0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java @@ -1,8 +1,9 @@ package nautilus.game.arcade.game; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -13,8 +14,6 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerStateChangeEvent; -import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.kit.Kit; public abstract class SoloGame extends Game @@ -36,6 +35,11 @@ public abstract class SoloGame extends Game _players.SetColor(ChatColor.YELLOW); _players.SetName("Players"); } + + public GameTeam getPlayersTeam() + { + return _players; + } @Override public void EndCheck() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index a508ff1cd..23b3ec1b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.christmas; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; @@ -8,9 +7,8 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.EntityType; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; @@ -18,13 +16,16 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; @@ -34,7 +35,6 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; -import mineplex.core.reward.rewards.PetReward; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -45,14 +45,22 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.christmas.kits.KitPlayer; -import nautilus.game.arcade.game.games.christmas.parts.*; +import nautilus.game.arcade.game.games.christmas.parts.Part; +import nautilus.game.arcade.game.games.christmas.parts.Part1; +import nautilus.game.arcade.game.games.christmas.parts.Part2; +import nautilus.game.arcade.game.games.christmas.parts.Part3; +import nautilus.game.arcade.game.games.christmas.parts.Part4; +import nautilus.game.arcade.game.games.christmas.parts.Part5; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; public class Christmas extends SoloGame { + private GameTeam _badGuys; + private Sleigh _sleigh; private Location _sleighSpawn; @@ -201,7 +209,7 @@ public class Christmas extends SoloGame for (Location loc : WorldData.GetCustomLocs("129")) { _barrier.add(loc.getBlock().getLocation()); - MapUtil.QuickChangeBlockAt(loc, 65, (byte)3); + MapUtil.QuickChangeBlockAt(loc, 166, (byte)0); } //Parts @@ -250,7 +258,8 @@ public class Christmas extends SoloGame if (event.GetState() != GameState.Live) return; - GetTeamList().add(new GameTeam(this, "Christmas Thieves", ChatColor.RED, WorldData.GetDataLocs("RED"))); + _badGuys = new GameTeam(this, "Christmas Thieves", ChatColor.RED, WorldData.GetDataLocs("RED")); + AddTeam(_badGuys); } @EventHandler @@ -366,7 +375,7 @@ public class Christmas extends SoloGame for (Location loc : _barrier) { - if (UtilMath.offset(GetSleigh().GetLocation(), loc) > 15) + if (UtilMath.offset(GetSleigh().GetLocation(), loc) > 20) continue; breakAt = loc; @@ -458,14 +467,42 @@ public class Christmas extends SoloGame for (Player player : GetPlayers(false)) { - Manager.rewardPet(player, "Christmas Elf", EntityType.VILLAGER); + if (Manager.IsRewardItems()) + { + if (!player.isOnline()) + continue; + + if (Manager.GetTaskManager().hasCompletedTask(player, "CC Reward 2015")) + { + SetCustomWinMessage(player, "You already earned your reward"); + } + else + { + SetCustomWinMessage(player, "You earned " + C.cYellow + "2x Winter Holiday Treasure"); + + Manager.GetTaskManager().completedTask(new Callback() + { + @Override + public void run(Boolean data) + { + if (data) + { + Manager.getInventoryManager().addItemToInventory(player, "Winter Chest", 2); + } + else + { + UtilPlayer.message(player, F.main("Inventory", "An error occured while giving you " + C.cRed + "2x Winter Holiday Treasure" + C.cGray + ".")); + } + } + }, player, "CC Reward 2015"); + } + } Manager.GetGame().AddGems(player, 30, "Slaying the Pumpkin King", false, false); Manager.GetGame().AddGems(player, 10, "Participation", false, false); } - SetCustomWinLine("You earned Christmas Elf Pet!"); - AnnounceEnd(this.GetTeamList().get(0)); + AnnounceEnd(getPlayersTeam()); SetState(GameState.End); } else if (GetPlayers(true).size() == 0) @@ -476,7 +513,7 @@ public class Christmas extends SoloGame } SetCustomWinLine("You all died..."); - AnnounceEnd(this.GetTeamList().get(1)); + AnnounceEnd(_badGuys); SetState(GameState.End); } else if (UtilTime.elapsed(GetStateTime(), _gameTime)) @@ -487,7 +524,7 @@ public class Christmas extends SoloGame } SetCustomWinLine("You did not save Christmas in time."); - AnnounceEnd(this.GetTeamList().get(1)); + AnnounceEnd(_badGuys); SetState(GameState.End); } @@ -504,7 +541,7 @@ public class Christmas extends SoloGame } SetCustomWinLine("Santa Claus was killed by the Giant!"); - AnnounceEnd(this.GetTeamList().get(1)); + AnnounceEnd(_badGuys); SetState(GameState.End); } @@ -572,30 +609,60 @@ public class Christmas extends SoloGame return; if (!IsLive()) + { + Scoreboard.Reset(); + + String line = ""; + for (int i = 0 ; i < 20 ; i++) + line += ((i % 2 == 0 ? C.cRed : C.cDGreen) + "█"); + + Scoreboard.WriteBlank(); + Scoreboard.Write(line); + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cWhiteB + "May your winter"); + Scoreboard.Write(C.cWhiteB + "be filled with"); + Scoreboard.Write(C.cYellowB + "joy" + C.cWhiteB + " and " + C.cYellowB + "cheer."); + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cAquaB + "Happy Holidays!"); + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cWhiteB + "- Your friends at"); + Scoreboard.Write(C.cGoldB + "MINEPLEX"); + + Scoreboard.WriteBlank(); + Scoreboard.Write(line); + + Scoreboard.Draw(); return; + } //Wipe Last Scoreboard.Reset(); //Rounds Scoreboard.WriteBlank(); - Scoreboard.Write(C.cWhite + "Challenge:"); - Scoreboard.Write(C.cYellow + (5 - _parts.size()) + " of " + 5); + Scoreboard.Write(C.cGoldB + "Challenge"); + Scoreboard.Write(C.cWhite + (5 - _parts.size()) + " of " + 5); //Presents Scoreboard.WriteBlank(); - Scoreboard.Write(C.cWhite + "Presents:"); - Scoreboard.Write(C.cYellow + GetSleigh().GetPresents().size() + " of " + 10); + Scoreboard.Write(C.cGreenB + "Presents"); + Scoreboard.Write(C.cWhite + GetSleigh().GetPresents().size() + " of " + 10); //Players Scoreboard.WriteBlank(); - Scoreboard.Write(C.cWhite + "Players:"); - Scoreboard.Write(C.cYellow + GetPlayers(true).size()); + Scoreboard.Write(C.cYellowB + "Players"); + Scoreboard.Write(C.cWhite + GetPlayers(true).size()); //Time Scoreboard.WriteBlank(); - Scoreboard.Write(C.cWhite + "Time Left:"); - Scoreboard.Write(C.cYellow + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()))); + Scoreboard.Write(C.cYellowB + "Time Left"); + Scoreboard.Write(C.cWhite + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()))); Scoreboard.Draw(); } @@ -679,4 +746,37 @@ public class Christmas extends SoloGame UtilPlayer.sendPacket(player, packet); } } + + @EventHandler + public void updateReigns(UpdateEvent event) + { + if (!InProgress()) + return; + + if (event.getType() != UpdateType.FASTER) + return; + + if (_sleigh == null) + return; + + if (_sleigh.getSanta() == null) + return; + + for (SleighHorse horse : _sleigh.getHorses()) + { + if (horse.Ent == null || !horse.Ent.isValid()) + continue; + + PacketPlayOutAttachEntity packet = new PacketPlayOutAttachEntity(1, ((CraftHorse) horse.Ent).getHandle(), (((CraftEntity) _sleigh.getSanta()).getHandle())); + + for (Player player : UtilServer.getPlayers()) + UtilPlayer.sendPacket(player, packet); + } + } + + @EventHandler + public void preventStand(PlayerInteractAtEntityEvent event) + { + event.setCancelled(true); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index c4c5e0950..26ef62540 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -2,30 +2,28 @@ package nautilus.game.arcade.game.games.christmas; import java.util.ArrayList; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.christmas.parts.Part; - -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.Effect; -import org.bukkit.FireworkEffect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Entity; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; public class Sleigh { @@ -41,6 +39,8 @@ public class Sleigh private ArrayList PresentsCollected = new ArrayList();; private Location Target; + + private Entity Santa; public void setupSleigh(Christmas host, Location loc) { @@ -52,24 +52,25 @@ public class Sleigh CentralEntity = loc.getWorld().spawn(loc, Chicken.class); UtilEnt.Vegetate(CentralEntity, true); - UtilEnt.ghost(CentralEntity, true, true); + UtilEnt.ghost(CentralEntity, true, false); + Host.Manager.GetCondition().Factory().Invisible("Sleigh", (LivingEntity) CentralEntity, null, Double.MAX_VALUE, 3, false, false, true); //Presents PresentSlots = new ArrayList(); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), -1, -2)); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 0, -2)); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 1, -2)); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), -1, -1)); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 0, -1)); - PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 1, -1)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), -1, -2)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 0, -2)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 1, -2)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), -1, -1)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 0, -1)); + PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 1, -1)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), -1, -2)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 0, -2)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 1, -2)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), -1, -1)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 0, -1)); - PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 1, -1)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), -1, -2)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 0, -2)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -2)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), -1, -1)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 0, -1)); + PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -1)); //Sleigh SleighEnts = new ArrayList(); @@ -77,65 +78,71 @@ public class Sleigh for (SleighPart part : PresentSlots) SleighEnts.add(part); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, -3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, -3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, -3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, -3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, -3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, -3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, -2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, -2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, -2)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -2)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, -2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, -2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, -2)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -2)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, -1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, -1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, -1)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -1)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -1)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, -1)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, -1)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, -1)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -1)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 0)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, 0)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, 0)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, 0)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 0)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 0)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, 0)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, 0)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, 0)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 0)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, 1)); - SleighEnts.add(new SleighPart(0, 159, 15, loc.clone(), 0, 1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, 1)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 1)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 1)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, 1)); + SleighEnts.add(new SleighPart(this, 0, 159, 15, loc.clone(), 0, 1)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, 1)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 1)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -2, 2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, 2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, 2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, 2)); - SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 2, 2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -2, 2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, 2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, 2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, 2)); + SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 2, 2)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, 3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, 3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, 3)); - SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, 3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, 3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, 3)); + SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 3)); //Santa - SleighPart santa = new SleighPart(3, 0, 0, loc.clone(), 0, 1); - santa.AddSanta(); + SleighPart santa = new SleighPart(this, 3, 0, 0, loc.clone(), 0, 1); + Santa = santa.AddSanta(); SleighEnts.add(santa); - SleighHorses.add(new SleighHorse(loc.clone(), -1.5, 8)); - SleighHorses.add(new SleighHorse(loc.clone(), 1.5, 8)); + SleighHorses.add(new SleighHorse(loc.clone(), "Dasher", -1.5, 8)); + SleighHorses.add(new SleighHorse(loc.clone(), "Dancer", 1.5, 8)); + + SleighHorses.add(new SleighHorse(loc.clone(), "Prancer", -1.5, 11)); + SleighHorses.add(new SleighHorse(loc.clone(), "Vixen", 1.5, 11)); + + SleighHorses.add(new SleighHorse(loc.clone(), "Comet", -1.5, 14)); + SleighHorses.add(new SleighHorse(loc.clone(), "Cupid", 1.5, 14)); - SleighHorses.add(new SleighHorse(loc.clone(), -1.5, 11)); - SleighHorses.add(new SleighHorse(loc.clone(), 1.5, 11)); + SleighHorses.add(new SleighHorse(loc.clone(), "Donner", -1.5, 17)); + SleighHorses.add(new SleighHorse(loc.clone(), "Blitzen", 1.5, 17)); for (SleighHorse horse : SleighHorses) horse.spawnHorse(); - for (SleighHorse horse : SleighHorses) - UtilEnt.Leash(horse.Ent, santa.GetTop(), false, false); +// for (SleighHorse horse : SleighHorses) +// UtilEnt.Leash(horse.Ent, santa.GetTop(), true, false); } public Location GetLocation() @@ -157,6 +164,8 @@ public class Sleigh Move(CentralEntity, Target, 1); + Santa.setTicksLived(1); + //Move Sleigh for (SleighPart part : SleighEnts) { @@ -184,24 +193,6 @@ public class Sleigh { for (Player player : Host.GetPlayers(true)) { - if (!Recharge.Instance.usable(player, "Sleigh Bump")) - continue; - - for (SleighPart part : SleighEnts) - if (UtilMath.offset(player, part.Ent) < 1) - { - UtilAction.velocity(player, UtilAlg.getTrajectory2d(CentralEntity, player), 0.4, true, 0.2, 0, 0, true); - Recharge.Instance.useForce(player, "Sleigh Bump", 400); - } - - - for (SleighHorse part : SleighHorses) - if (UtilMath.offset(player, part.Ent) < 1) - { - UtilAction.velocity(player, UtilAlg.getTrajectory2d(CentralEntity, player), 0.4, true, 0.2, 0, 0, true); - Recharge.Instance.useForce(player, "Sleigh Bump", 400); - } - if (player.getLocation().getZ() < CentralEntity.getLocation().getZ() - 24) { player.damage(1); @@ -211,6 +202,44 @@ public class Sleigh Recharge.Instance.useForce(player, "Sleigh Bump", 400); } } + + for (SleighPart part : SleighEnts) + { + for (Entity ent : UtilEnt.getInRadius(part.Ent.getLocation(), 1).keySet()) + { + if (isPart(ent)) + continue; + + if (ent instanceof Player) + { + if (!Recharge.Instance.usable((Player) ent, "Sleigh Bump")) + continue; + + Recharge.Instance.useForce((Player) ent, "Sleigh Bump", 400); + } + + UtilAction.velocity(ent, UtilAlg.getTrajectory2d(CentralEntity, ent), 0.4, true, 0.2, 0, 0, true); + } + } + + for (SleighHorse part : SleighHorses) + { + for (Entity ent : UtilEnt.getInRadius(part.Ent.getLocation(), 1).keySet()) + { + if (isPart(ent)) + continue; + + if (ent instanceof Player) + { + if (!Recharge.Instance.usable((Player) ent, "Sleigh Bump")) + continue; + + Recharge.Instance.useForce((Player) ent, "Sleigh Bump", 400); + } + + UtilAction.velocity(ent, UtilAlg.getTrajectory2d(CentralEntity, ent), 0.4, true, 0.2, 0, 0, true); + } + } } public boolean HasPresent(Location loc) @@ -222,6 +251,7 @@ public class Sleigh { PresentsCollected.add(loc); loc.getBlock().setType(Material.AIR); + loc.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK); loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); UtilFirework.launchFirework(loc.clone().add(0.5, 0.5, 0.5), FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL).trail(true).build(), new Vector(0,1,0), 0); @@ -267,4 +297,35 @@ public class Sleigh { return SleighHorses; } + + public Entity getSanta() + { + return Santa; + } + + public boolean isPart(Entity ent) + { + if (ent == null) + return false; + + if (ent == CentralEntity) + return true; + + if (ent == Santa) + return true; + + for (SleighPart part : SleighEnts) + if (part.Block == ent || part.Ent == ent || (ent instanceof LivingEntity && part.HasEntity((LivingEntity) ent))) + return true; + + for (SleighHorse horse : SleighHorses) + if (horse.Ent == ent || (ent instanceof LivingEntity && horse.HasEntity((LivingEntity) ent))) + return true; + + for (SleighPart part : PresentSlots) + if (part.Block == ent || part.Ent == ent || (ent instanceof LivingEntity && part.HasEntity((LivingEntity) ent))) + return true; + + return false; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java index 10a772184..0f0e5ed2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java @@ -2,6 +2,19 @@ package nautilus.game.arcade.game.games.christmas; import java.util.HashSet; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_8_R3.DataWatcher; @@ -14,19 +27,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_8_R3.Vector3f; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.entity.Horse; -import org.bukkit.entity.Player; -import org.bukkit.entity.Horse.Color; -import org.bukkit.entity.Horse.Style; -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - public class SleighHorse { private Location _lastFacing; @@ -40,9 +40,11 @@ public class SleighHorse public int horseId; public double OffsetX; public double OffsetZ; + public String Name; - public SleighHorse(Location loc, double x, double z) + public SleighHorse(Location loc, String name, double x, double z) { + Name = name; OffsetX = x; OffsetZ = z; _lastFacing = loc.add(x, 0.5, z); @@ -182,6 +184,10 @@ public class SleighHorse Ent = _lastFacing.getWorld().spawn(_lastFacing.subtract(0, 0.5, 0), Horse.class); UtilEnt.Vegetate(Ent); UtilEnt.ghost(Ent, true, false); + Ent.setRemoveWhenFarAway(false); + + Ent.setCustomName(C.cWhiteB + Name); + Ent.setCustomNameVisible(true); Ent.setStyle(Style.BLACK_DOTS); Ent.setColor(Color.BROWN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java index 2c0406f27..877d36049 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java @@ -1,9 +1,5 @@ package nautilus.game.arcade.game.games.christmas; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; - import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; @@ -16,6 +12,10 @@ import org.bukkit.entity.Skeleton; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.LeatherArmorMeta; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; + public class SleighPart { public Chicken Ent; @@ -23,38 +23,32 @@ public class SleighPart public double OffsetX; public double OffsetZ; - public SleighPart(int rise, int id, int data, Location loc, double x, double z) + public int Rise; + public int Id; + public int Data; + public Location Location; + + public SleighPart(Sleigh sleigh, int rise, int id, int data, Location loc, double x, double z) { //Base Ent = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class); Ent.setBaby(); Ent.setAgeLock(true); + Ent.setRemoveWhenFarAway(false); + UtilEnt.Vegetate(Ent, true); - UtilEnt.ghost(Ent, true, true); - + UtilEnt.ghost(Ent, true, false); + sleigh.Host.Manager.GetCondition().Factory().Invisible("Sleigh", Ent, null, Double.MAX_VALUE, 3, false, false, true); + //Height - Chicken top = Ent; - for (int i=0 ; i _heightComparator = new Comparator() + { + @Override + public int compare(Block o1, Block o2) + { + if (o1.getLocation().getBlockY() == o2.getLocation().getBlockY()) + return 0; + + return o1.getLocation().getBlockY() > o2.getLocation().getBlockY() ? 1 : -1; + } + }; + public IceMaze(Christmas host, ArrayList mazeCorners, ArrayList mazeExits, Location[] presents) { Host = host; @@ -71,6 +84,8 @@ public class IceMaze if (_blocks.isEmpty()) return; + Collections.sort(_blocks, _heightComparator); + for (int i=0 ; i<20 ; i++) { if (_blocks.isEmpty()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index cae20e196..82b334134 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -1,17 +1,15 @@ package nautilus.game.arcade.game.games.christmas.content; import java.util.ArrayList; +import java.util.List; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.IronGolem; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.IronGolem; import org.bukkit.entity.Player; -import org.bukkit.entity.Slime; import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -51,8 +49,8 @@ public class SnowmanBoss _minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class))); _heart = _spawn.getWorld().spawn(_spawn, IronGolem.class); - _heart.setMaxHealth(1000); - _heart.setHealth(1000); + _heart.setMaxHealth(1400); + _heart.setHealth(1400); UtilEnt.Vegetate(_heart); Host.CreatureAllowOverride = false; @@ -147,7 +145,17 @@ public class SnowmanBoss else { if ((minion.Target == null || !minion.Target.isValid() || !Host.IsAlive(minion.Target)) && !Host.GetPlayers(true).isEmpty()) - minion.Target = UtilAlg.Random(Host.GetPlayers(true)); + { + List valid = new ArrayList(); + for (Player player : Host.GetPlayers(true)) + if (UtilMath.offset(player, minion.Ent) <= 25 && player.getLocation().getBlockY() >= minion.Ent.getLocation().getBlockY()) + valid.add(player); + + minion.Target = UtilAlg.Random(valid); + } + + if (minion.Target == null) + continue; //Move UtilEnt.CreatureMoveFast(minion.Ent, minion.Target.getLocation(), 1.6f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java index 5aeecaa3b..e65212177 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java @@ -6,17 +6,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.christmas.Christmas; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -28,6 +17,16 @@ import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.util.Vector; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.christmas.Christmas; +import nautilus.game.arcade.game.games.christmas.content.SnowmanWaypoint.CardinalDirection; + public class SnowmanMaze { private Christmas Host; @@ -163,48 +162,90 @@ public class SnowmanMaze if (south != null) nextBlock.add(south); if (east != null) nextBlock.add(east); if (west != null) nextBlock.add(west); - - //Random Direction - if (!nextBlock.isEmpty()) + + if(nextBlock.isEmpty()) { - data.getValue().Target = UtilAlg.Random(nextBlock).getLocation().add(0.5, 0, 0.5); - UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); + entIterator.remove(); + data.getKey().remove(); + continue; + } + + if(nextBlock.size() > 1 && data.getValue().Direction != CardinalDirection.NULL) // they can do a uturn if they're stuck + { + if(data.getValue().Direction == CardinalDirection.NORTH) + { + nextBlock.remove(south); + } + else if(data.getValue().Direction == CardinalDirection.SOUTH) + { + nextBlock.remove(north); + } + else if(data.getValue().Direction == CardinalDirection.WEST) + { + nextBlock.remove(east); + } + else if(data.getValue().Direction == CardinalDirection.EAST) + { + nextBlock.remove(west); + } + } + + if (nextBlock.isEmpty()) + { + entIterator.remove(); + data.getKey().remove(); + continue; + } + + //Random Direction + Location nextLoc = UtilAlg.Random(nextBlock).getLocation(); + data.getValue().Target = nextLoc.clone().add(0.5, 0, 0.5); + if(north != null && nextLoc.equals(north.getLocation())) + { + data.getValue().Direction = CardinalDirection.NORTH; + } + else if(south != null && nextLoc.equals(south.getLocation())) + { + data.getValue().Direction = CardinalDirection.SOUTH; + } + else if(east != null && nextLoc.equals(east.getLocation())) + { + data.getValue().Direction = CardinalDirection.EAST; + } + else if(west != null && nextLoc.equals(west.getLocation())) + { + data.getValue().Direction = CardinalDirection.WEST; } } - - //Timeout Move - if (UtilMath.offset(data.getKey().getLocation(), data.getValue().Last) > 0.1) - data.getValue().Time = System.currentTimeMillis(); - - if (UtilTime.elapsed(data.getValue().Time, 2000)) - UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); + + UtilEnt.CreatureMoveFast(data.getKey(), data.getValue().Target, 1.4f); } } - + private Block getTarget(Block start, Block cur, BlockFace face) { if (cur == null) cur = start; - + while (_waypoints.contains(cur.getRelative(face))) { cur = cur.getRelative(face); - + //Stop at intersection int count = 0; - + if (face != BlockFace.NORTH && _waypoints.contains(cur.getRelative(BlockFace.NORTH))) count++; if (face != BlockFace.SOUTH && _waypoints.contains(cur.getRelative(BlockFace.SOUTH))) count++; if (face != BlockFace.EAST && _waypoints.contains(cur.getRelative(BlockFace.EAST))) count++; if (face != BlockFace.WEST && _waypoints.contains(cur.getRelative(BlockFace.WEST))) count++; - + if (count > 1) break; } - + if (cur.equals(start)) return null; - + return cur; } @@ -213,7 +254,7 @@ public class SnowmanMaze //Spawn if (!Host.GetSleigh().HasPresent(_present)) { - while (_ents.size() < 36) + while (_ents.size() < 44) { Location loc = UtilAlg.Random(_spawns); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaypoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaypoint.java index 78e197277..22c0deabf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaypoint.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaypoint.java @@ -6,6 +6,7 @@ public class SnowmanWaypoint { public Location Last; public Location Target; + public CardinalDirection Direction = CardinalDirection.NULL; public long Time; public SnowmanWaypoint(Location last) @@ -14,4 +15,9 @@ public class SnowmanWaypoint Target = null; Time = System.currentTimeMillis(); } + + public static enum CardinalDirection + { + NORTH, SOUTH, EAST, WEST, NULL // such order much not care + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/kits/KitPlayer.java index 9af09d62b..3c3efcee3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/kits/KitPlayer.java @@ -1,12 +1,15 @@ package nautilus.game.arcade.game.games.christmas.kits; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; @@ -21,15 +24,23 @@ public class KitPlayer extends Kit new String[] { - "Help Santa retreive the lost presents!" + "Help Santa retrieve the lost presents!" }, new Perk[] { }, - EntityType.ZOMBIE, + EntityType.SKELETON, new ItemStack(Material.IRON_SWORD)); - + } + + @Override + public void SpawnCustom(LivingEntity ent) + { + ent.getEquipment().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.RED).setUnbreakable(true).build()); + ent.getEquipment().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.RED).build()); + ent.getEquipment().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.RED).build()); + ent.getEquipment().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLACK).build()); } @Override @@ -43,7 +54,7 @@ public class KitPlayer extends Kit item = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cGreen + C.Bold + "Toy Bow"); item.addEnchantment(Enchantment.ARROW_INFINITE, 1); player.getInventory().setItem(1, item); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); + player.getInventory().setItem(9, ItemStackFactory.Instance.CreateStack(Material.ARROW)); //Axe item = ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE, (byte)0, 1, C.cGreen + C.Bold + "Coal Digger"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index 7a96132c4..ea8e171cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -1,35 +1,42 @@ package nautilus.game.arcade.game.games.christmas.parts; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.entity.Ageable; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; + import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; 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.UtilTextTop; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.ChristmasAudio; import net.minecraft.server.v1_8_R3.EntityCreature; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.SkullType; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.Skull; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; - public abstract class Part implements Listener { public Christmas Host; @@ -42,6 +49,7 @@ public abstract class Part implements Listener protected double _objectiveHealth = 1; protected HashMap _creatures = new HashMap(); + protected NautHashMap _spawnedPresents = new NautHashMap(); public Part(Christmas host, Location sleigh, Location[] presents) { @@ -53,38 +61,63 @@ public abstract class Part implements Listener loc.getBlock().setType(Material.AIR); } + @SuppressWarnings("deprecation") public void Prepare() { Activate(); for (Location loc : _presents) - { - Block present = loc.getBlock(); - present.setTypeIdAndData(Material.SKULL.getId(), (byte)1, true); - - Skull skull = (Skull) present.getState(); - skull.setSkullType(SkullType.PLAYER); + { + Location standLoc = loc.clone().add(0, -1.45, 0); + standLoc.setYaw(UtilMath.r(100)); - //Present Type - double r = Math.random(); - if (r > 0.75) skull.setOwner("CruXXx"); - else if (r > 0.5) skull.setOwner("CruXXx"); - else if (r > 0.25) skull.setOwner("CruXXx"); - else skull.setOwner("CruXXx"); + Host.CreatureAllowOverride = true; + ArmorStand stand = loc.getWorld().spawn(standLoc, ArmorStand.class); + Host.CreatureAllowOverride = false; - //Angle - BlockFace face = BlockFace.UP; - while (face == BlockFace.UP || face == BlockFace.DOWN || face == BlockFace.SELF) - face = BlockFace.values()[UtilMath.r(BlockFace.values().length)]; - skull.setRotation(face); - - skull.update(); + stand.setVisible(false); + stand.setGravity(false); + + ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3); + SkullMeta meta = (SkullMeta) stack.getItemMeta(); + meta.setOwner("CruXXx"); + stack.setItemMeta(meta); + + stand.setHelmet(stack); +// +// present.setTypeIdAndData(Material.SKULL.getId(), (byte)1, true); +// +// Skull skull = (Skull) present.getState(); +// skull.setSkullType(SkullType.PLAYER); +// +// //Present Type +// double r = Math.random(); +// if (r > 0.75) skull.setOwner("CruXXx"); +// else if (r > 0.5) skull.setOwner("CruXXx"); +// else if (r > 0.25) skull.setOwner("CruXXx"); +// else skull.setOwner("CruXXx"); +// +// //Angle +// BlockFace face = BlockFace.UP; +// while (face == BlockFace.UP || face == BlockFace.DOWN || face == BlockFace.SELF) +// face = BlockFace.values()[UtilMath.r(BlockFace.values().length)]; +// skull.setRotation(face); +// +// skull.update(); + + _spawnedPresents.put(stand, loc); //Beacon - present.getRelative(BlockFace.DOWN).setType(Material.BEACON); for (int x=-1 ; x<=1 ; x++) for (int z=-1 ; z<=1 ; z++) - present.getRelative(x, -2, z).setType(Material.IRON_BLOCK); + { + loc.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK); + loc.getBlock().getRelative(x, -3, z).setType(Material.IRON_BLOCK); + } + + loc.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.BEACON); + loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.STAINED_GLASS); + loc.getBlock().getRelative(BlockFace.DOWN).setData(UtilMath.randomElement(new Byte[]{14, 5, 13})); } } @@ -157,35 +190,38 @@ public abstract class Part implements Listener return true; } - @EventHandler - public void PresentCollect(PlayerInteractEvent event) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = false) + public void PresentCollect(PlayerInteractAtEntityEvent event) { - if (event.getClickedBlock() == null) + Location present = _spawnedPresents.get(event.getRightClicked()); + if (present == null) return; - + boolean contains = false; for (Location loc : _presents) - if (loc.getBlock().equals(event.getClickedBlock())) + if (loc.getBlock().equals(present.getBlock())) contains = true; if (!contains) return; - event.setCancelled(true); - if (!Host.IsLive()) return; if (!Host.IsAlive(event.getPlayer())) return; - if (Host.GetSleigh().HasPresent(event.getClickedBlock().getLocation())) + if (Host.GetSleigh().HasPresent(present.getBlock().getLocation())) return; - if (UtilMath.offset(event.getPlayer().getLocation(), event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5)) > 2) + if (UtilMath.offset(event.getPlayer().getLocation(), present.clone().add(0.5, 0.5, 0.5)) > 2) return; - Host.GetSleigh().AddPresent(event.getClickedBlock().getLocation()); + _spawnedPresents.remove(event.getRightClicked()); + + event.getRightClicked().remove(); + + Host.GetSleigh().AddPresent(present.getBlock().getLocation()); Host.SantaSay("Well done " + event.getPlayer().getName() + "! You collected a present!", null); } @@ -276,4 +312,21 @@ public abstract class Part implements Listener _creatures.clear(); } + @EventHandler + public void onDamagePresent(EntityDamageEvent event) + { + event.setCancelled(_spawnedPresents.containsKey(event.getEntity())); + } + + @EventHandler + public void PresentParticles(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Entity ent : _spawnedPresents.keySet()) + { + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, ent.getLocation().clone().add(0, 1.5, 0), .3F, .3F, .3F, 0F, 1, ViewDist.LONG, UtilServer.getPlayers()); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java index c37047bce..6839ff135 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java @@ -1,41 +1,33 @@ package nautilus.game.arcade.game.games.christmas.parts; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.christmas.Christmas; -import nautilus.game.arcade.game.games.christmas.ChristmasAudio; - 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.entity.Entity; -import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.UtilAlg; +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.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.christmas.Christmas; +import nautilus.game.arcade.game.games.christmas.ChristmasAudio; + public class Part1 extends Part { private ArrayList _skeletons; @@ -145,7 +137,7 @@ public class Part1 extends Part _presents = System.currentTimeMillis(); - Host.SantaSay("Theres some of the presents up ahead!", ChristmasAudio.P1_B); + Host.SantaSay("There are some of the presents up ahead!", ChristmasAudio.P1_B); SetObjectivePresents(); } @@ -189,7 +181,7 @@ public class Part1 extends Part } Host.SantaSay("Clear the path! Watch out for the undead!", ChristmasAudio.P1_D); - SetObjectiveText("Clear a path for Santas Sleigh!", 1); + SetObjectiveText("Clear a path for Santa's Sleigh!", 1); } private void UpdateClear() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java index 7286d1512..26b282b57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java @@ -3,10 +3,22 @@ package nautilus.game.arcade.game.games.christmas.parts; import java.util.ArrayList; import java.util.Iterator; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Giant; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.updater.UpdateType; @@ -17,24 +29,6 @@ import nautilus.game.arcade.game.games.christmas.ChristmasAudio; import nautilus.game.arcade.game.games.christmas.content.CaveGiant; import nautilus.game.arcade.game.games.christmas.content.Snake; -import org.bukkit.ChatColor; -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.entity.FallingBlock; -import org.bukkit.entity.Giant; -import org.bukkit.entity.Spider; -import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; - public class Part4 extends Part { private ArrayList _roofIce; @@ -51,6 +45,13 @@ public class Part4 extends Part private boolean _b = false; private HologramManager _holoManager; + private String[] _evilElfNames = new String[] + { "Bing", "Bling", "Blitz", "Larry", "Buddy", "Buster", "Cedar", "Dash", "Eggnog", "Elfie", "Elm", "Elvis", + "Evergreen", "Figgy", "Flake", "Frank", "Frost", "Gabriel", "George", "Henry", "Hermey", "Ice", "Jangle", + "Jingle", "Jinx", "Kringle", "Kris", "Louie", "Max", "Mistletoe", "Nat", "Nick", "Noel", "Pax", "Peppermin", + "Pine", "Ralphie", "Rudy", "Snow", "Snowball", "Star", "Tinsel", "Tiny", "Topper", "Trinket", "Wayne", + "Wink", "Yule", "Zippy" }; + public Part4(HologramManager holoManager, Christmas host, Location sleigh, Location[] presents, ArrayList roofIce, ArrayList mobs, ArrayList snakeHead, ArrayList snakeTrail, ArrayList gate, ArrayList checkpoints, Location giant) { @@ -85,7 +86,7 @@ public class Part4 extends Part @EventHandler public void GateUpdate(UpdateEvent event) { - if (event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.FAST) return; if (_gate.isEmpty()) @@ -187,6 +188,8 @@ public class Part4 extends Part ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); ent.setVillager(true); + + ent.setCustomName("Evil Elf " + UtilMath.randomElement(_evilElfNames)); ent.setHealth(9); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java index 741b7f3ac..2dceaca60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java @@ -2,41 +2,37 @@ package nautilus.game.arcade.game.games.christmas.parts; import java.util.ArrayList; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -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.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.christmas.Christmas; -import nautilus.game.arcade.game.games.christmas.ChristmasAudio; -import nautilus.game.arcade.game.games.christmas.content.*; -import net.minecraft.server.v1_8_R3.EntityCreature; - import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.EntityEffect; 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.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.christmas.Christmas; +import nautilus.game.arcade.game.games.christmas.ChristmasAudio; +import nautilus.game.arcade.game.games.christmas.content.BossFloor; +import nautilus.game.arcade.game.games.christmas.content.BossMobs; +import nautilus.game.arcade.game.games.christmas.content.BossSnowmanPattern; +import nautilus.game.arcade.game.games.christmas.content.PumpkinKing; + public class Part5 extends Part { private ArrayList _spawn; @@ -385,6 +381,9 @@ public class Part5 extends Part @EventHandler public void Damage(CustomDamageEvent event) { + if (event.isCancelled()) + return; + if (_boss == null) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 03499db01..f90b48ed1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -25,7 +25,7 @@ import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.give.Give; @@ -296,7 +296,7 @@ public class EventGame extends Game } @EventHandler - public void gadgetActivate(GadgetActivateEvent event) + public void gadgetActivate(GadgetEnableEvent event) { if (!_gadgetsEnabled) event.setCancelled(true); @@ -457,7 +457,7 @@ public class EventGame extends Game } @EventHandler - public void gadgetDisable(GadgetActivateEvent event) + public void gadgetDisable(GadgetEnableEvent event) { if (_allowAllGadgets) return; @@ -929,7 +929,7 @@ public class EventGame extends Game } @EventHandler - public void activateGadget(GadgetActivateEvent event) + public void activateGadget(GadgetEnableEvent event) { for(EventArea area : _customAreas.values()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index dd31d4703..b38a8f6af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -20,7 +20,7 @@ import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.creature.event.CreatureKillEntitiesEvent; import mineplex.core.event.StackerEvent; -import mineplex.core.gadget.gadgets.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.give.Give; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java index a4dca2dcc..45e707110 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java @@ -42,7 +42,7 @@ public class Arena private ArenaState _state; private long _stateTime; - private boolean _alertedAlready; + private ArrayList _alreadyAlertedPleaseWait; private boolean _alertedAlready2; private HashMap> _particles; @@ -62,7 +62,7 @@ public class Arena _stateTime = System.currentTimeMillis(); _particles = new HashMap<>(); _doBye = false; - _alertedAlready = false; + _alreadyAlertedPleaseWait = new ArrayList<>(); _alertedAlready2 = false; setupSpawns(); @@ -174,16 +174,6 @@ public class Arena return null; } - public boolean isAlertedAlready() - { - return _alertedAlready; - } - - public void setAlertedAlready(boolean alertedAlready) - { - _alertedAlready = alertedAlready; - } - private void setupSpawns() { ArrayList possible = (ArrayList) _host.WorldData.GetDataLocs("BLACK").clone(); @@ -258,8 +248,23 @@ public class Arena public void closeDoor() { - for (Location loc : _doorBlocks) - loc.getBlock().setType(Material.OBSIDIAN); + _host.Manager.getScheduler().scheduleSyncDelayedTask(_host.Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + for (Location loc : _doorBlocks) + loc.getBlock().setType(Material.OBSIDIAN); + + // Lag exploit check + for (Player p : getPastPlayers()) + { + Arena closest = _host.getArenaByMid(UtilAlg.findClosest(p.getLocation(), _host.getAllArenaMids())); + if (closest != _host.getPlayerArenas().get(p)) + p.teleport(UtilAlg.findClosest(p.getLocation(), getSpawns())); + } + } + }, 5L); } public boolean isOpenDoor() @@ -294,15 +299,15 @@ public class Arena if (_host.getRoundState() != RoundState.FIGHTING) return; - if (_alertedAlready) - return; - for (Player p : getPastPlayers()) { - UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20 * 100, 0, p); - } + if (_alreadyAlertedPleaseWait.contains(p)) + continue; - _alertedAlready = true; + UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20 * 120, 0, p); // 2 min + + _alreadyAlertedPleaseWait.add(p); + } } else if (_state.equals(ArenaState.FIGHTING)) { @@ -331,7 +336,7 @@ public class Arena if (_alertedAlready2) continue; - UtilTextMiddle.display(C.cGreen + "Next Battle", "Follow the particles", 0, 20 * 100, 0, p); + UtilTextMiddle.display(C.cGreen + "Next Battle", "Follow the particles", 0, 20 * 120, 0, p); // 2 min } _alertedAlready2 = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 9fa85f642..ddb562ae1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.gladiators; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -23,7 +24,6 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; @@ -107,10 +107,14 @@ public class Gladiators extends SoloGame DontAllowOverfill = true; EnableTutorials = false; + BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId()); + BlockBreakAllow.add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.add(Material.LONG_GRASS.getId()); + registerStatTrackers( new BrawlerTracker(this), - //new UntouchableTracker(this), - //new FlawlessTracker(this), + new UntouchableTracker(this), + new FlawlessTracker(this), new PrecisionTracker(this), new SwiftKillTracker(this) ); @@ -464,6 +468,11 @@ public class Gladiators extends SoloGame return mids; } + public HashMap getPlayerArenas() + { + return _playerArenas; + } + public ArrayList getAllArenaMids() { ArrayList mids = new ArrayList<>(); @@ -519,8 +528,6 @@ public class Gladiators extends SoloGame a.setState(ArenaState.WAITING); } - UtilTextMiddle.display(C.cGreen + "Gladiators!", C.cGreen + "Defeat your opponent to advance", 20, 60, 20); - return; } @@ -531,6 +538,12 @@ public class Gladiators extends SoloGame //closeUnusedArenas(); } + @EventHandler + public void helpMessage(PlayerPrepareTeleportEvent e) + { + UtilTextMiddle.display(C.cGreen + "Gladiators!", C.cGreen + "Defeat your opponent to advance", 20, 20 * 7, 20); + } + /** *------------------- * MAIN UPDATE METHOD @@ -549,9 +562,6 @@ public class Gladiators extends SoloGame { _roundState = RoundState.STARTING_5; - if (_firstRound) - return; - UtilTextMiddle.display("", C.cGreen + C.Bold + getRoundNotation(), 0, 80 , 0); _furthestOutCurrent = getFurthestOut(); // Find furthest out for fight. @@ -666,17 +676,43 @@ public class Gladiators extends SoloGame { //p.sendMessage("bounce. closest = " + closest.toString() + " player arena = " + _playerArenas.get(p).toString()); UtilAction.velocity(p, UtilAlg.getTrajectory2d(e.getTo(), p.getLocation()), 1.7, true, 0.2, 0, 3, true); + sendPlayerArenaBounceCheck(p); } return; } + if (!_playerArenas.get(p).isOpenDoor()) + return; + //p.sendMessage("ARENA MOVE CHECK METHOD!"); Manager.getPluginManager().callEvent(new PlayerChangeArenaEvent(e.getPlayer(), closest, _playerArenas.get(p))); _playerArenas.put(p, closest); + + // Push player a little + UtilAction.velocity(p, UtilAlg.getTrajectory2d(p.getLocation(), closest.getMid()), 1.7, false, 0.2, 0, 3, false); } } + private void sendPlayerArenaBounceCheck(final Player p) + { + Manager.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + if (!GetPlayers(true).contains(p)) + return; + + Arena closest = getArenaByMid(UtilAlg.findClosest(p.getLocation(), getAllArenaMids())); + if (closest != _playerArenas.get(p)) + { + p.teleport(UtilAlg.findClosest(p.getLocation(), _playerArenas.get(p).getSpawns())); + } + } + }, 20L); + } + @EventHandler public void arenaChange(PlayerChangeArenaEvent e) { @@ -803,9 +839,6 @@ public class Gladiators extends SoloGame { _roundState = RoundState.STARTING_2; - if (_firstRound) - return; - UtilTextMiddle.display(C.cGreen + "3", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0); for (Player p : UtilServer.getPlayers()) @@ -816,9 +849,6 @@ public class Gladiators extends SoloGame { _roundState = RoundState.STARTING_1; - if (_firstRound) - return; - UtilTextMiddle.display(C.cYellow + "2", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0); for (Player p : UtilServer.getPlayers()) @@ -829,9 +859,6 @@ public class Gladiators extends SoloGame { _roundState = RoundState.STARTED; - if (_firstRound) - return; - UtilTextMiddle.display(C.cGold + "1", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0); for (Player p : UtilServer.getPlayers()) @@ -842,11 +869,11 @@ public class Gladiators extends SoloGame { _roundState = RoundState.FIGHTING; - if (_firstRound) - { - _firstRound = false; - return; - } +// if (_firstRound) +// { +// _firstRound = false; +// return; +// } UtilTextMiddle.display(C.cRed + "FIGHT", C.cGreen + C.Bold + getRoundNotation(), 0, 40, 0); @@ -892,8 +919,8 @@ public class Gladiators extends SoloGame if (e.getEntity() instanceof Player) { - ((Player)e.getEntity()).getInventory().addItem(new ItemStack(Material.ARROW, 1)); // Arrow fix. - ((Player)e.getEntity()).updateInventory(); +// ((Player)e.getEntity()).getInventory().addItem(new ItemStack(Material.ARROW, 1)); // Arrow fix. +// ((Player)e.getEntity()).updateInventory(); } } @@ -1007,6 +1034,9 @@ public class Gladiators extends SoloGame { if (_playerArenas.containsKey(e.getPlayer())) { + if (_playerArenas.get(e.getPlayer()).getState() != ArenaState.FIGHTING) + return; + for (Player p : _playerArenas.get(e.getPlayer()).getPastPlayers()) { if (p.equals(e.getPlayer())) @@ -1019,4 +1049,39 @@ public class Gladiators extends SoloGame } } } + + @EventHandler + public void deathHealth(CombatDeathEvent e) + { + if (!(e.GetEvent().getEntity() instanceof Player)) + return; + + if (e.GetLog().GetKiller().IsPlayer()) + { + Player killer = UtilPlayer.searchExact(e.GetLog().GetKiller().GetName()); + ((Player)e.GetEvent().getEntity()).sendMessage(F.main("Game", "Your killer had " + C.cRed + (new DecimalFormat("#.#").format((killer.getHealth() / 2))) + "❤" + C.cGray + " left.")); + } + } + + @EventHandler + public void scoreboardEnd(GameStateChangeEvent e) + { + if (e.GetState() != GameState.End) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cGreen + C.Bold + "Status"); + Scoreboard.Write(C.cWhite + "Ended"); + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cAqua + C.Bold + "Matches Left"); + Scoreboard.Write(C.cWhite + "0"); + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cYellow + C.Bold + "Players"); + if (getWinners() != null && !getWinners().isEmpty()) + Scoreboard.Write(C.cWhite + getWinners().get(0).getName()); + + Scoreboard.Draw(); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/FlawlessTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/FlawlessTracker.java index ebdbad1cf..1d772bbc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/FlawlessTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/FlawlessTracker.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.gladiators.Gladiators; @@ -29,16 +30,16 @@ public class FlawlessTracker extends StatTracker } @EventHandler - public void onDmg(EntityDamageEvent e) + public void onDmg(CustomDamageEvent e) { if (e.isCancelled()) return; - System.out.println(e.getEventName() + " took damage by " + e.getCause().toString()); + //System.out.println(e.getEventName() + " took damage by " + e.GetCause().toString()); - if (e.getEntity() instanceof Player) + if (e.GetDamageeEntity() instanceof Player) { - _noWin.add(((Player)e.getEntity()).getName()); + _noWin.add(((Player)e.GetDamageeEntity()).getName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/UntouchableTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/UntouchableTracker.java index 44115ca72..ef357d6a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/UntouchableTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/trackers/UntouchableTracker.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.gladiators.Gladiators; import nautilus.game.arcade.game.games.gladiators.events.RoundStartEvent; import nautilus.game.arcade.stats.StatTracker; @@ -27,14 +28,14 @@ public class UntouchableTracker extends StatTracker } @EventHandler - public void onDmg(EntityDamageEvent e) + public void onDmg(CustomDamageEvent e) { if (e.isCancelled()) return; - if (e.getEntity() instanceof Player) + if (e.GetDamageeEntity() instanceof Player) { - _noWin.add(((Player)e.getEntity()).getName()); + _noWin.add(((Player)e.GetDamageeEntity()).getName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/AntiHackFix.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/AntiHackFix.java new file mode 100644 index 000000000..e3085c54e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/AntiHackFix.java @@ -0,0 +1,92 @@ +package nautilus.game.arcade.game.games.mineware; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.potion.PotionEffectType; + +import net.minecraft.server.v1_8_R3.EntityPlayer; + +public class AntiHackFix implements Listener +{ + private MineWare _host; + private Challenge _challenge; + + public AntiHackFix(Challenge challenge) + { + _host = challenge.Host; + _challenge = challenge; + + Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin()); + System.out.println("Anti-Hack jump fix registered for " + _challenge.getChallengeName() + " challenge."); + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) + { + if (!_host.IsLive() || !_host.isChallengeStarted()) + return; + + Player player = event.getPlayer(); + + if (_challenge.isDone(player)) + return; + + if (!player.hasPotionEffect(PotionEffectType.JUMP)) + return; + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + Location loc = player.getLocation(); + Block blockBelow = loc.getBlock().getRelative(BlockFace.DOWN); + EntityPlayer nms = ((CraftPlayer) player).getHandle(); + + if ((isLandingNearBlocks(blockBelow) || loc.getY() < 1) && nms.spectating) + { + nms.spectating = false; + } + else if (blockBelow.isEmpty() && loc.getY() > 1 && !nms.spectating) + { + nms.spectating = true; + } + } + + private boolean isLandingNearBlocks(Block block) + { + Block blockNorth = block.getRelative(BlockFace.NORTH); + Block blockSouth = block.getRelative(BlockFace.SOUTH); + Block blockEast = block.getRelative(BlockFace.EAST); + Block blockWest = block.getRelative(BlockFace.WEST); + + Block blockNorthEast = block.getRelative(BlockFace.NORTH_EAST); + Block blockNorthWest = block.getRelative(BlockFace.NORTH_WEST); + Block blockSouthEast = block.getRelative(BlockFace.SOUTH_EAST); + Block blockSouthWest = block.getRelative(BlockFace.SOUTH_WEST); + + return !block.isEmpty() || !blockNorth.isEmpty() || !blockSouth.isEmpty() || !blockEast.isEmpty() + || !blockWest.isEmpty() || !blockNorthEast.isEmpty() || !blockNorthWest.isEmpty() + || !blockSouthEast.isEmpty() || !blockSouthWest.isEmpty(); + } + + public void clear() + { + for (Player player : _host.GetPlayers(true)) + { + EntityPlayer nms = ((CraftPlayer) player).getHandle(); + + if (nms.spectating) + nms.spectating = false; + } + + HandlerList.unregisterAll(this); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java index 3c9e20705..6cdfd05bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java @@ -16,9 +16,7 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index 71ac55080..8b5a105b8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -8,6 +8,29 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; + import mineplex.core.account.CoreClient; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -35,7 +58,6 @@ import nautilus.game.arcade.game.games.holeinwall.KitNormal; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeArrowRampage; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockLobbers; -import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockRunner; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBouncingBlock; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeChestLoot; @@ -63,6 +85,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChicken import nautilus.game.arcade.game.games.mineware.challenges.ChallengeSmashOff; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeStandOnColor; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTntLauncher; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTreasureDigger; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeVolleyPig; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeWaveCrush; import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; @@ -76,28 +99,6 @@ import nautilus.game.arcade.game.games.mineware.stats.MinewareTagMasterTracker; import nautilus.game.arcade.game.games.mineware.stats.MinewareVeteranTracker; import nautilus.game.arcade.kit.Kit; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.InventoryHolder; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitRunnable; - public class MineWare extends SoloGame implements IThrown { private HashMap _lives = new HashMap(); @@ -119,12 +120,10 @@ public class MineWare extends SoloGame implements IThrown { super(manager, GameType.MineWare, - new Kit[] - { new KitNormal(manager), }, + new Kit[] { new KitNormal(manager), }, - new String[] - { "Follow the orders given in chat!", "First half to follow it win the round.", "Other players lose one life.", - "Last player with lives wins!" }); + new String[] { "Follow the orders given in chat!", "First half to follow it win the round.", + "Other players lose one life.", "Last player with lives wins!" }); DamageTeamSelf = true; DamagePvP = false; @@ -141,34 +140,44 @@ public class MineWare extends SoloGame implements IThrown Manager.GetCreature().SetDisableCustomDrops(true); PopulateOrders(); - - registerStatTrackers( - new MinewareVeteranTracker(this), - new MinewareSurfUpTracker(this), - new MinewareLauraCraftTracker(this), - new MinewareMilkManTracker(this), - new MinewarePinataMasterTracker(this), - new MinewareTagMasterTracker(this), + + registerStatTrackers(new MinewareVeteranTracker(this), new MinewareSurfUpTracker(this), + new MinewareLauraCraftTracker(this), new MinewareMilkManTracker(this), + new MinewarePinataMasterTracker(this), new MinewareTagMasterTracker(this), new MinewareKangarooAtHeart(this)); } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() < 2) + { + UtilServer.broadcast(F.main("MineWare", C.cRed + "This game requires at least 2 players to start.")); + SetCountdown(-1); + Manager.GetLobby().DisplayWaiting(); + } + } @Override public void EndCheck() { - if(!IsLive()) + if (!IsLive()) return; int living = 0; - for(Player player : GetPlayers(false)) + for (Player player : GetPlayers(false)) { - if(GetLives(player) > 0) + if (GetLives(player) > 0) { living++; } } - if(living <= 1) + if (living <= 1) { SetState(GameState.End); AnnounceEnd(getWinners()); @@ -178,7 +187,7 @@ public class MineWare extends SoloGame implements IThrown @Override public boolean isInsideMap(Player player) { - if(_challenge != null && !_waitingChallenge) + if (_challenge != null && !_waitingChallenge) { return _challenge.isInsideMap(player); } @@ -189,52 +198,53 @@ public class MineWare extends SoloGame implements IThrown @EventHandler public void onLive(GameStateChangeEvent event) { - if(event.GetState() != GameState.Live) + if (event.GetState() != GameState.Live) { return; } - + _challengeTime = System.currentTimeMillis(); } public void PopulateOrders() { - _challenges.add(ChallengeAnvilDance.class); - _challenges.add(ChallengeFallingBlocks.class); - _challenges.add(ChallengeWaveCrush.class); - _challenges.add(ChallengePickASide.class);// - _challenges.add(ChallengeKOTL.class); - _challenges.add(ChallengePunchThePig.class); - _challenges.add(ChallengeDogvsCat.class); - _challenges.add(ChallengeShootChickens.class); - _challenges.add(ChallengeReverseTag.class); - _challenges.add(ChallengeKangarooJump.class); - _challenges.add(ChallengeMiniOITQ.class); - _challenges.add(ChallengeMineADiamond.class); - _challenges.add(ChallengeRushPush.class); - _challenges.add(ChallengeBlockLobbers.class); - _challenges.add(ChallengeStandOnColor.class); - _challenges.add(ChallengeMilkACow.class); - _challenges.add(ChallengeDragonEgg.class); - _challenges.add(ChallengeChestLoot.class); - _challenges.add(ChallengeLavaRun.class); - _challenges.add(ChallengeNavigateMaze.class); - _challenges.add(ChallengeVolleyPig.class); - _challenges.add(ChallengeSmashOff.class); - _challenges.add(ChallengeTntLauncher.class); - _challenges.add(ChallengeArrowRampage.class); - _challenges.add(ChallengeCloudFall.class); - _challenges.add(ChallengeInfestation.class); - _challenges.add(ChallengeBouncingBlock.class); - _challenges.add(ChallengeBuildRace.class); - _challenges.add(ChallengeFastFood.class); - _challenges.add(ChallengeMinecartDance.class); - _challenges.add(ChallengeRedLightGreenLight.class); - _challenges.add(ChallengeFishingDay.class); + _challenges.add(ChallengeAnvilDance.class); + _challenges.add(ChallengeArrowRampage.class); + _challenges.add(ChallengeBlockLobbers.class); + _challenges.add(ChallengeBouncingBlock.class); + _challenges.add(ChallengeBuildRace.class); + _challenges.add(ChallengeChestLoot.class); + _challenges.add(ChallengeCloudFall.class); + _challenges.add(ChallengeDogvsCat.class); + _challenges.add(ChallengeDragonEgg.class); + _challenges.add(ChallengeFallingBlocks.class); + _challenges.add(ChallengeFastFood.class); + _challenges.add(ChallengeFishingDay.class); + _challenges.add(ChallengeInfestation.class); + _challenges.add(ChallengeKangarooJump.class); + _challenges.add(ChallengeKOTL.class); + _challenges.add(ChallengeLavaRun.class); + _challenges.add(ChallengeMilkACow.class); + _challenges.add(ChallengeMineADiamond.class); + _challenges.add(ChallengeMinecartDance.class); + _challenges.add(ChallengeMiniOITQ.class); + _challenges.add(ChallengeNavigateMaze.class); + _challenges.add(ChallengePickASide.class); + _challenges.add(ChallengePunchThePig.class); + _challenges.add(ChallengeRedLightGreenLight.class); + _challenges.add(ChallengeReverseTag.class); + _challenges.add(ChallengeRushPush.class); + _challenges.add(ChallengeShootChickens.class); + _challenges.add(ChallengeSmashOff.class); + _challenges.add(ChallengeStandOnColor.class); + _challenges.add(ChallengeTntLauncher.class); + _challenges.add(ChallengeTreasureDigger.class); + _challenges.add(ChallengeVolleyPig.class); + _challenges.add(ChallengeWaveCrush.class); // ============== trashed ============== // _challenges.add(ChallengeSimonSays.class); - // _challenges.add(ChallengeHitTargets.class); + // _challenges.add(ChallengeHitTargets.class); // _challenges.add(ChallengeTameTheWolf.class); // _challenges.add(ChallengeBlockShot.class); // _challenges.add(ChallengeNameThatSound.class); @@ -244,27 +254,29 @@ public class MineWare extends SoloGame implements IThrown public Challenge GetOrder() { - for(int i = 0; i < _challenges.size() * 4; i++) + for (int i = 0; i < _challenges.size() * 4; i++) { try { - if(_challengesCopy.isEmpty()) + if (_challengesCopy.isEmpty()) { _challengesCopy.addAll(_challenges); } - Challenge challenge = _challengesCopy.remove(UtilMath.r(_challengesCopy.size())).getConstructor(MineWare.class).newInstance(this); + Challenge challenge = _challengesCopy.remove(UtilMath.r(_challengesCopy.size())) + .getConstructor(MineWare.class).newInstance(this); - if(getChallengers().size() >= challenge.getMinPlayers()) + if (getChallengers().size() >= challenge.getMinPlayers()) { - if(getChallengers().size() >= challenge.getMaxPlayers()) + if (getChallengers().size() >= challenge.getMaxPlayers()) { - System.out.print("Cannot use challenge " + challenge.getClass().getSimpleName() + ", too many players"); + System.out.print( + "Cannot use challenge " + challenge.getClass().getSimpleName() + ", too many players"); continue; } - if(challenge.getTeamBased() == true) + if (challenge.getTeamBased() == true) { - if(!(getChallengers().size() % 2 == 0)) + if (!(getChallengers().size() % 2 == 0)) { System.out.print("Cannot use Challege: " + challenge.getClass().getSimpleName() + ". The game is a teamgame with unequal amount of living players"); @@ -276,14 +288,15 @@ public class MineWare extends SoloGame implements IThrown } else { - System.out.print("Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players"); + System.out.print( + "Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players"); } } - catch(InvocationTargetException ex) + catch (InvocationTargetException ex) { ex.getCause().printStackTrace(); } - catch(Exception e) + catch (Exception e) { e.printStackTrace(); } @@ -300,38 +313,41 @@ public class MineWare extends SoloGame implements IThrown List messages = Arrays.asList(challenge.getGameMessages()); - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { - player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2f, 1f); UtilPlayer.message(player, F.count(ArcadeFormat.Line)); - for(String currentMessage : messages) + UtilPlayer.message(player, " " + C.cYellow + challenge.getChallengeName()); + UtilPlayer.message(player, ""); + + for (String currentMessage : messages) { - if(messages.get(messages.size() - 1) != currentMessage) + if (messages.get(messages.size() - 1) != currentMessage) { - UtilPlayer.message(player, C.cGreen + "ChallengeRule - " + C.cYellow + C.Bold + currentMessage); + UtilPlayer.message(player, C.cGray + " - " + C.cWhite + currentMessage); } } + + UtilPlayer.message(player, ""); UtilPlayer.message(player, F.count(ArcadeFormat.Line)); } - while(true) + while (true) { - - if(!IsLive()) + if (!IsLive()) { break; } - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { - String message = C.cYellow + C.Bold + messages.get(looped); + String message = C.cYellow + messages.get(looped); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); UtilTextMiddle.display(challenge.getChallengeName(), message, 0, 60, 20); } - if(looped == messages.size() - 1) + if (looped == messages.size() - 1) { gamePrepareMessages(); break; @@ -340,7 +356,7 @@ public class MineWare extends SoloGame implements IThrown { Thread.sleep(1000 + (55 * messages.get(looped).length())); } - catch(InterruptedException e) + catch (InterruptedException e) { e.printStackTrace(); } @@ -353,13 +369,13 @@ public class MineWare extends SoloGame implements IThrown new BukkitRunnable() { int looped = 0; - List messages = Arrays - .asList(C.cRed + C.Bold + "3", C.cYellow + C.Bold + "2", C.cGreen + C.Bold + "1", C.cGreen + C.Bold + "GO!"); + List messages = Arrays.asList(C.cRed + C.Bold + "3", C.cYellow + C.Bold + "2", + C.cGreen + C.Bold + "1", C.cGreen + C.Bold + "GO!"); @Override public void run() { - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { String message = messages.get(looped); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); @@ -367,7 +383,7 @@ public class MineWare extends SoloGame implements IThrown UtilTextMiddle.display(message, null); } - if(looped == messages.size() - 1) + if (looped == messages.size() - 1) { _allMessageSent = true; _sendingMessages = false; @@ -381,10 +397,10 @@ public class MineWare extends SoloGame implements IThrown @EventHandler(priority = EventPriority.HIGH) public void GameStateChange(GameStateChangeEvent event) { - if(event.GetState() != GameState.Prepare) + if (event.GetState() != GameState.Prepare) return; - for(Player player : GetPlayers(true)) + for (Player player : GetPlayers(true)) _lives.put(player, 5); _challenge = GetOrder(); @@ -397,13 +413,13 @@ public class MineWare extends SoloGame implements IThrown @EventHandler public void CancelOrder(GameStateChangeEvent event) { - if(_challenge == null) + if (_challenge == null) return; - if(_waitingChallenge) + if (_waitingChallenge) return; - if(event.GetState() == GameState.Live) + if (event.GetState() == GameState.Live) return; // Deregister @@ -423,7 +439,7 @@ public class MineWare extends SoloGame implements IThrown @EventHandler public void onDeath(PlayerDeathEvent event) { - if(_challenge == null) + if (_challenge == null) return; _challenge.getLost().add(event.getEntity()); @@ -434,8 +450,8 @@ public class MineWare extends SoloGame implements IThrown public void onQuit(PlayerQuitEvent event) { _lives.remove(event.getPlayer()); - - if(_challenge != null) + + if (_challenge != null) { _challenge.CurrentPlaying.remove(event.getPlayer()); } @@ -445,9 +461,9 @@ public class MineWare extends SoloGame implements IThrown { ArrayList challengers = new ArrayList(); - for(Player player : GetPlayers(true)) + for (Player player : GetPlayers(true)) { - if(!UtilPlayer.isSpectator(player)) + if (!UtilPlayer.isSpectator(player)) { challengers.add(player); } @@ -459,7 +475,7 @@ public class MineWare extends SoloGame implements IThrown @EventHandler public void onInteract(PlayerInteractEvent event) { - if(!_waitingChallenge) + if (!_waitingChallenge) { return; } @@ -468,46 +484,47 @@ public class MineWare extends SoloGame implements IThrown } @EventHandler - public void onMortenSkip(AsyncPlayerChatEvent event) // Remember to remove on release + public void onMortenSkip(AsyncPlayerChatEvent event) // Remember to remove + // on release { - if(!IsLive()) + if (!IsLive()) { return; } - if(!event.getMessage().equalsIgnoreCase("skip current challenge")) + if (!event.getMessage().equalsIgnoreCase("skip current challenge")) { return; } - if(!getArcadeManager().GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV)) + if (!getArcadeManager().GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV)) { event.getPlayer().sendMessage(F.main("Skip Challenge", "Only Morten can skip challenges you nub <3")); return; } endCurrentChallenge(); - if(_currentCrumble) + if (_currentCrumble) { _currentCrumble = false; } - Bukkit.broadcastMessage(F.main("Skip Challenge", event.getPlayer().getName() + " has decided to skip the current challenge!")); - + Bukkit.broadcastMessage( + F.main("Skip Challenge", event.getPlayer().getName() + " has decided to skip the current challenge!")); } @EventHandler public void PlayerMoveCancel(PlayerMoveEvent event) { - if(!PrepareFreeze) + if (!PrepareFreeze) return; - if(!_waitingChallenge) + if (!_waitingChallenge) return; - if(!IsLive()) + if (!IsLive()) return; - if(!IsAlive(event.getPlayer())) + if (!IsAlive(event.getPlayer())) return; - if(UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0) + if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0) return; event.getFrom().setPitch(event.getTo().getPitch()); @@ -516,24 +533,39 @@ public class MineWare extends SoloGame implements IThrown event.setTo(event.getFrom()); } + @SuppressWarnings("deprecation") @EventHandler public void UpdateOrder(UpdateEvent event) { - if(event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FASTER) return; - if(!IsLive()) + if (!IsLive()) return; + // Anti-Cheat Ignore Check + // Don't end the challenge if a player is safely jumping. + + if (_challenge != null) + { + for (Player player : GetPlayers(true)) + { + if (!_challenge.isDone(player) && ((CraftPlayer) player).getHandle().spectating) + { + return; + } + } + } + // New Order - if(_challenge == null) + if (_challenge == null) { - if(!UtilTime.elapsed(_challengeTime, 1500)) + if (!UtilTime.elapsed(_challengeTime, 1500)) return; - for(Player player : GetPlayers(false)) + for (Player player : GetPlayers(false)) { - if(_lives.containsKey(player) && _lives.get(player) > 0) + if (_lives.containsKey(player) && _lives.get(player) > 0) { Manager.Clear(player); } @@ -541,23 +573,23 @@ public class MineWare extends SoloGame implements IThrown _challenge = GetOrder(); - if(_challenge == null) + if (_challenge == null) { System.out.println("No challenge suitable"); SetState(GameState.Dead); return; } - for(Block block : _lastOrderBlocks) + for (Block block : _lastOrderBlocks) { - if(block.getState() instanceof InventoryHolder) + if (block.getState() instanceof InventoryHolder) { ((InventoryHolder) block.getState()).getInventory().clear(); } block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); } - if(_currentCrumble == true) + if (_currentCrumble == true) { _currentCrumble = false; } @@ -570,24 +602,24 @@ public class MineWare extends SoloGame implements IThrown ArrayList toTeleport = new ArrayList(); - for(int i = 0; i < spawns.size(); i++) + for (int i = 0; i < spawns.size(); i++) { Location furthest = null; double furthestDist = 0; - for(Location spawn : spawns) + for (Location spawn : spawns) { - if(toTeleport.contains(spawn)) + if (toTeleport.contains(spawn)) continue; double dist = 0; - for(Location loc : toTeleport) + for (Location loc : toTeleport) { dist += loc.distance(spawn); } - if(furthest == null || furthestDist < dist) + if (furthest == null || furthestDist < dist) { furthest = spawn; furthestDist = dist; @@ -599,25 +631,25 @@ public class MineWare extends SoloGame implements IThrown int i = 0; - for(Player player : getChallengers()) + for (Player player : getChallengers()) { player.teleport(toTeleport.get(i++)); - if(i >= toTeleport.size()) + if (i >= toTeleport.size()) { i = 0; } } - for(Player player : GetPlayers(false)) + for (Player player : GetPlayers(false)) { - if(!IsAlive(player)) + if (!IsAlive(player)) { player.teleport(SpectatorSpawn); } } - if(_challenge instanceof ChallengeSeperateRooms) + if (_challenge instanceof ChallengeSeperateRooms) { ((ChallengeSeperateRooms) _challenge).assignRooms(); } @@ -629,35 +661,35 @@ public class MineWare extends SoloGame implements IThrown * "§lMineWare " + C.cGreen + "§l" + "Round " + _orderCount); */ } - else if(_waitingChallenge) + else if (_waitingChallenge) { - if(!UtilTime.elapsed(_challengeTime, 1000)) + if (!UtilTime.elapsed(_challengeTime, 1000)) return; - if(_sendingMessages == false && _allMessageSent == false) + if (_sendingMessages == false && _allMessageSent == false) { - for(Player player : GetPlayers(true)) + for (Player player : GetPlayers(true)) { player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integer.MAX_VALUE, 1)); player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1)); } Thread newThread = new Thread(new Runnable() // TODO - { - @Override - public void run() - { - sayChallenge(_challenge); - } - }); + { + @Override + public void run() + { + sayChallenge(_challenge); + } + }); newThread.start(); return; } - if(_allMessageSent == true) + if (_allMessageSent == true) { - for(Player player : GetPlayers(true)) + for (Player player : GetPlayers(true)) { - if(player.hasPotionEffect(PotionEffectType.BLINDNESS)) + if (player.hasPotionEffect(PotionEffectType.BLINDNESS)) { player.removePotionEffect(PotionEffectType.BLINDNESS); player.removePotionEffect(PotionEffectType.NIGHT_VISION); @@ -678,25 +710,27 @@ public class MineWare extends SoloGame implements IThrown // Update Order TODO else { - if(_challenge.Finish()) + if (_challenge.Finish()) { - if(_challenge.getCrumble() && !_challenge.getModifiedBlocks().isEmpty()) + if (_challenge.getCrumble() && !_challenge.getModifiedBlocks().isEmpty()) { - if(_currentCrumble == false && _challenge.Lost.size() >= _challenge.CurrentPlaying.size() / 2) + if (_currentCrumble == false && _challenge.Lost.size() >= _challenge.CurrentPlaying.size() / 2) { _currentCrumble = true; - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { - UtilPlayer.message(player, F.main("Map Crumble", "The challenge has ended! The map will crumble away!")); - if(IsAlive(player)) + UtilPlayer.message(player, + F.main("Map Crumble", "The challenge has ended! The map will crumble away!")); + if (IsAlive(player)) { - UtilPlayer.message(player, F.main("Map Crumble", "The challenge will end when there's 1 player left.")); + UtilPlayer.message(player, + F.main("Map Crumble", "The challenge will end when there's 1 player left.")); } } } else { - if((_challenge.CurrentPlaying.size() - _challenge.Lost.size()) <= 1 && _currentCrumble) + if ((_challenge.CurrentPlaying.size() - _challenge.Lost.size()) <= 1 && _currentCrumble) { endCurrentChallenge(); _currentCrumble = false; @@ -711,9 +745,9 @@ public class MineWare extends SoloGame implements IThrown else { // Set Level - for(Player player : UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { - if(_challenge instanceof ChallengeSeperateRooms) + if (_challenge instanceof ChallengeSeperateRooms) { UtilTextTop.display(C.cYellow + C.Bold + _challenge.getGameMessages()[0], player); player.setLevel(_challenge.GetRemainingPlaces()); @@ -721,7 +755,8 @@ public class MineWare extends SoloGame implements IThrown } else { - UtilTextTop.displayTextBar(player, _challenge.GetTimeLeftPercent(), C.cYellow + C.Bold + _challenge.getChallengeName()); + UtilTextTop.displayTextBar(player, _challenge.GetTimeLeftPercent(), + C.cYellow + C.Bold + _challenge.getChallengeName()); player.setLevel(_challenge.GetRemainingPlaces()); player.setExp(_challenge.GetTimeLeftPercent()); } @@ -738,27 +773,28 @@ public class MineWare extends SoloGame implements IThrown private int GetLives(Player player) { - if(!_lives.containsKey(player)) + if (!_lives.containsKey(player)) return 0; return _lives.get(player); } + @EventHandler public void onModeratorTeleport(PlayerCommandPreprocessEvent event) { - if(!IsLive()) + if (!IsLive()) { return; } - if(event.getMessage().contains("/tp") || event.getMessage().contains("/teleport")) + + if (event.getMessage().contains("/tp") || event.getMessage().contains("/teleport")) { CoreClient staff = getArcadeManager().GetClients().Get(event.getPlayer()); - if(staff.GetRank().has(Rank.MODERATOR)) + if (staff.GetRank().has(Rank.MODERATOR)) { Player player = event.getPlayer(); - UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); - player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + gameLostMessage(player); Scoreboard.ResetScore(player.getName()); SetPlayerState(player, PlayerState.OUT); @@ -768,14 +804,27 @@ public class MineWare extends SoloGame implements IThrown } } + private void gameLostMessage(Player player) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + } + + private void taskFailedMessage(Player player, int lives) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); + player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); + } + public void LoseLife(Player player, boolean isDeath) { - if(!isDeath) + if (!isDeath) { Manager.addSpectator(player, true); } - if(_challenge == null || _challenge.IsCompleted(player)) + if (_challenge == null || _challenge.IsCompleted(player)) return; int lives = GetLives(player); @@ -783,23 +832,18 @@ public class MineWare extends SoloGame implements IThrown lives -= 1; _lives.put(player, lives); - if(lives > 0) + if (lives > 0) { - UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!"); - UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); - player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); - + taskFailedMessage(player, lives); } else { - UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); - player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + gameLostMessage(player); Scoreboard.ResetScore(player.getName()); - SetPlayerState(player, PlayerState.OUT); - if(isDeath) + if (isDeath) { Manager.addSpectator(player, true); } @@ -810,12 +854,12 @@ public class MineWare extends SoloGame implements IThrown { _challengeTime = System.currentTimeMillis(); - for(Player player : getChallengers()) + for (Player player : getChallengers()) { getArcadeManager().GetDisguise().undisguise(player); UtilInv.Clear(player); - if(_challenge.hasWinner() && !_challenge.IsCompleted(player)) + if (_challenge.hasWinner() && !_challenge.IsCompleted(player)) { LoseLife(player, true); } @@ -850,23 +894,23 @@ public class MineWare extends SoloGame implements IThrown @EventHandler public void ScoreboardUpdate(UpdateEvent event) { - if(event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.FAST) { return; } Scoreboard.Reset(); - if(GetPlayers(true).size() > 14) + if (GetPlayers(true).size() > 14) { int alive = 0; - for(Player cAlive : _lives.keySet()) + for (Player cAlive : _lives.keySet()) { - if(GetLives(cAlive) != 0) + if (GetLives(cAlive) != 0) { alive++; } } - if(_challenge != null && _isChallengeStarted) + if (_challenge != null && _isChallengeStarted) { Scoreboard.Write(C.cGreen + "Players Currently Alive"); Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size()); @@ -885,45 +929,45 @@ public class MineWare extends SoloGame implements IThrown else { Scoreboard.WriteBlank(); - for(Player player : GetPlayers(true)) + for (Player player : GetPlayers(true)) { int currentLives = GetLives(player); String status; String currentlyOut = ""; - if(_challenge != null) + if (_challenge != null) { - if(_challenge.isLost(player)) + if (_challenge.isLost(player)) { currentlyOut = C.cRed + "X "; } - else if(_challenge.IsCompleted(player)) + else if (_challenge.IsCompleted(player)) { currentlyOut = C.cGreen + "✔ "; } } - switch(currentLives) + switch (currentLives) { - case 5: - status = currentlyOut + C.cGreen + player.getName(); - break; - case 4: - status = currentlyOut + C.cYellow + player.getName(); - break; - case 3: - status = currentlyOut + C.cGold + player.getName(); - break; - case 2: - status = currentlyOut + C.cRed + player.getName(); - break; - case 1: - status = currentlyOut + C.cRed + player.getName(); - break; - default: - status = C.cGray + C.Strike + player.getName(); - break; + case 5: + status = currentlyOut + C.cGreen + player.getName(); + break; + case 4: + status = currentlyOut + C.cYellow + player.getName(); + break; + case 3: + status = currentlyOut + C.cGold + player.getName(); + break; + case 2: + status = currentlyOut + C.cRed + player.getName(); + break; + case 1: + status = currentlyOut + C.cRed + player.getName(); + break; + default: + status = C.cGray + C.Strike + player.getName(); + break; } Scoreboard.WriteOrdered("Lives Left", status, currentLives, true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java index 1f78c73af..a69cada60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java @@ -108,7 +108,9 @@ public class ChallengeAnvilDance extends Challenge @Override public void cleanupRoom() { - _fireworkTask.cancel(); + if (_fireworkTask != null) + _fireworkTask.cancel(); + _paused = false; for(Block block : _landedAnvils) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java index 767a649ed..130dad44a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java @@ -5,19 +5,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -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.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.Challenge; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -36,14 +23,25 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.BlockIterator; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.game.games.mineware.AntiHackFix; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; + public class ChallengeArrowRampage extends Challenge { - - HashSet _arrows = new HashSet(); + private AntiHackFix _antiHackFix; + private HashSet _arrows = new HashSet(); public ChallengeArrowRampage(MineWare host) { - super(host, ChallengeType.LastStanding, "Arrow Rampage", false, true, "Equipped with explosive arrows", "Force your enemy into the void"); + super(host, ChallengeType.LastStanding, "Arrow Rampage", false, true, "You are equipped with explosive arrows.", + "Force your enemy into the void!"); + + _antiHackFix = new AntiHackFix(this); } @Override @@ -51,11 +49,11 @@ public class ChallengeArrowRampage extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -(getArenaSize(9) - 1); x < getArenaSize(9) - 1; x++) + for (int x = -(getArenaSize(9) - 1); x < getArenaSize(9) - 1; x++) { - for(int z = -(getArenaSize(9) - 1); z < getArenaSize(9) - 1; z++) + for (int z = -(getArenaSize(9) - 1); z < getArenaSize(9) - 1; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x, 4.1, z)); } @@ -67,20 +65,23 @@ public class ChallengeArrowRampage extends Challenge @Override public void cleanupRoom() { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { player.getInventory().clear(); player.removePotionEffect(PotionEffectType.JUMP); } + + _antiHackFix.clear(); Host.StrictAntiHack = true; } @Override public void setupPlayers() { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - player.getInventory().addItem(new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); + player.getInventory() + .addItem(new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); player.getInventory().addItem(new ItemStack(Material.ARROW)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 2)); @@ -91,37 +92,37 @@ public class ChallengeArrowRampage extends Challenge @Override public void generateRoom() { - for(int x = -getArenaSize(9); x <= getArenaSize(9); x++) + for (int x = -getArenaSize(9); x <= getArenaSize(9); x++) { - for(int z = -getArenaSize(9); z <= getArenaSize(9); z++) + for (int z = -getArenaSize(9); z <= getArenaSize(9); z++) { - for(int y = 0; y <= 3; y++) + for (int y = 0; y <= 3; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - //RIP the DRY rule :( - if(y == 0) + // RIP the DRY rule :( + if (y == 0) { b.setType(Material.WOOL); b.setData((byte) 14); } - if(y == 1) + if (y == 1) { b.setType(Material.WOOL); b.setData((byte) 4); } - if(y == 2) + if (y == 2) { b.setType(Material.WOOL); b.setData((byte) 5); } - if(y == 3) + if (y == 3) { b.setType(Material.WOOL); b.setData((byte) UtilMath.r(16)); } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -129,45 +130,31 @@ public class ChallengeArrowRampage extends Challenge } } } - + @EventHandler public void onChallengeEnd(ChallengeEndEvent event) { - for(Entity fBlocks: Host.WorldData.World.getEntities()) + for (Entity fBlocks : Host.WorldData.World.getEntities()) { - if(fBlocks instanceof FallingBlock || fBlocks instanceof FallingSand) + if (fBlocks instanceof FallingBlock || fBlocks instanceof FallingSand) { fBlocks.remove(); } } } - @EventHandler - public void arrowEffect(UpdateEvent event) - { - if(event.getType() != UpdateType.TICK) - { - return; - } - - for(Arrow arrow : _arrows) - { - UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, arrow.getLocation(), .15f, .15f, 0.15f, 0, 5, ViewDist.MAX, UtilServer.getPlayers()); - } - } - @EventHandler public void onEntityBowShot(EntityShootBowEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!(event.getEntity() instanceof Player)) + if (!(event.getEntity() instanceof Player)) { return; } - if(!(event.getProjectile() instanceof Arrow)) + if (!(event.getProjectile() instanceof Arrow)) { return; } @@ -177,31 +164,33 @@ public class ChallengeArrowRampage extends Challenge @EventHandler public void onArrowHit(ProjectileHitEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!(event.getEntity() instanceof Arrow)) + + if (!(event.getEntity() instanceof Arrow)) { return; } + Arrow theArrow = (Arrow) event.getEntity(); Set blocks = UtilBlock.getInRadius(theArrow.getLocation(), 3d).keySet(); Iterator blockIterator = blocks.iterator(); - if(theArrow.getShooter() == null || !(theArrow.getShooter() instanceof Player)) + if (theArrow.getShooter() == null || !(theArrow.getShooter() instanceof Player)) { return; } - while(blockIterator.hasNext()) + while (blockIterator.hasNext()) { Block block = blockIterator.next(); - if(block.isLiquid()) + if (block.isLiquid()) blockIterator.remove(); - else if(block.getRelative(BlockFace.UP).isLiquid()) + else if (block.getRelative(BlockFace.UP).isLiquid()) blockIterator.remove(); } Host.Manager.GetExplosion().BlockExplosion(blocks, theArrow.getLocation(), false); @@ -212,12 +201,12 @@ public class ChallengeArrowRampage extends Challenge public Block getHitBlock(Arrow arrow) { Block hit = null; - BlockIterator iterator = new BlockIterator(arrow.getLocation().getWorld(), arrow.getLocation().toVector(), arrow.getVelocity().normalize(), - 0.0D, 4); - while(iterator.hasNext()) + BlockIterator iterator = new BlockIterator(arrow.getLocation().getWorld(), arrow.getLocation().toVector(), + arrow.getVelocity().normalize(), 0.0D, 4); + while (iterator.hasNext()) { hit = iterator.next(); - if(hit.getType() != Material.AIR) + if (hit.getType() != Material.AIR) break; } return hit; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java index 0e76744a3..29836db38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java @@ -38,7 +38,7 @@ public class ChallengeBlockLobbers extends Challenge public ChallengeBlockLobbers(MineWare host) { - super(host, ChallengeType.LastStanding, "Block Lobbers", "Hit players off the platform", "by throwing with the blocks"); + super(host, ChallengeType.LastStanding, "Block Lobbers", "Throw blocks to other players.", "Try to knock them off the platform!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java deleted file mode 100644 index 85f8fc01a..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java +++ /dev/null @@ -1,221 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.challenges; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -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.UtilShapes; -import mineplex.core.common.util.UtilTextMiddle; -import nautilus.game.arcade.game.games.mineware.Challenge; -import nautilus.game.arcade.game.games.mineware.MineWare; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.inventory.ItemStack; - -public class ChallengeBlockRunner extends Challenge -{ - // The amount of blocks for every hotbar slot. - private static final int InventoryBlockAmount = 5; - - private static Material[] _materials = - { Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.WOOL, Material.BRICK, Material.SMOOTH_BRICK, - Material.GLASS }; - - public ChallengeBlockRunner(MineWare host) - { - super(host, ChallengeType.FirstComplete, "Block Runner", "Your inventory is filled with blocks.", - "Be the first to place them all in the ground!"); - } - - @Override - public ArrayList getSpawns() - { - ArrayList spawns = new ArrayList(); - Location center = new Location(Host.WorldData.World, 0, 0, 0); - - for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3)) - { - double x = location.getX() + 0.5; - double y = 1.1; - double z = location.getZ() + 0.5; - - spawns.add(getCenter().add(x, y, z)); - } - - return spawns; - } - - @Override - public void generateRoom() - { - Location center = new Location(Host.WorldData.World, 0, 0, 0); - - for(Location location : UtilShapes.getCircle(center, false, getArenaSize())) - { - Block block = location.getBlock(); - block.setType(Material.GRASS); - - addBlock(location.getBlock()); - } - } - - @SuppressWarnings("deprecation") - @Override - public void setupPlayers() - { - for(Material allowed : _materials) - { - Host.BlockPlaceAllow.add(allowed.getId()); - } - - for(Player player : Host.GetPlayers(true)) - { - setupInventoryContents(player); - } - } - - private void setupInventoryContents(Player player) - { - ArrayList shuffledMaterials = new ArrayList(Arrays.asList(_materials)); - Collections.shuffle(shuffledMaterials); - - for(Material material : shuffledMaterials) - { - ItemStack itemStack = new ItemStack(material, InventoryBlockAmount); - player.getInventory().addItem(itemStack); - } - } - - @SuppressWarnings("deprecation") - @Override - public void cleanupRoom() - { - for(Material allowed : _materials) - { - Host.BlockPlaceAllow.remove(allowed.getId()); - } - } - - @SuppressWarnings("deprecation") - @EventHandler - public void onBlockPlace(BlockPlaceEvent event) - { - if(!Host.IsLive() || !Host.isChallengeStarted()) - return; - - Player player = event.getPlayer(); - - if(IsCompleted(player)) - { - event.setCancelled(true); - return; - } - - Block block = event.getBlock(); - addBlock(block); - - // First Check - // Checking if the player is trying to get off the map. - - Block bottomVoid1 = block.getRelative(BlockFace.DOWN); - Block bottomVoid2 = bottomVoid1.getRelative(BlockFace.DOWN); - Block bottomVoid3 = bottomVoid2.getRelative(BlockFace.DOWN); - - if(bottomVoid1.isEmpty() && bottomVoid2.isEmpty() && bottomVoid3.isEmpty()) - { - UtilTextMiddle.display("", C.cRed + "You can't place blocks that far from the ground.", 5, 40, 5, player); - blockBreakEffect(block); - event.setCancelled(true); - return; - } - - // Second Check - // Checking if the player is trying to trap another player. - - for(Player others : Host.GetPlayers(true)) - { - if(others.equals(player)) - continue; - - if(block.getLocation().add(0.5, 0.5, 0.5).distanceSquared(others.getLocation()) <= 1.5) - { - UtilTextMiddle.display("", C.cRed + "You can't place blocks near other players.", 5, 40, 5, player); - blockBreakEffect(block); - event.setCancelled(true); - return; - } - } - - // Third Check - // Checking if the player is trying to make a tower up to the sky. - - Block bottom1 = player.getLocation().getBlock().getRelative(BlockFace.DOWN); - Block bottom2 = bottom1.getRelative(BlockFace.DOWN); - Block bottom3 = bottom2.getRelative(BlockFace.DOWN); - - if(!bottom1.isEmpty() && !bottom2.isEmpty() && !bottom3.isEmpty() && block.getY() < player.getLocation().getY()) - { - // Adding broken blocks back to inventory even if he didn't placed them. - // This is so we can prevent quick block farming. - - ItemStack handItem = player.getItemInHand(); - UtilInv.remove(player, handItem.getType(), handItem.getData().getData(), 1); - - if(bottom1.getType() != Material.GRASS) - { - UtilInv.insert(player, new ItemStack(bottom1.getType())); - blockBreakEffect(bottom1); - } - - if(bottom2.getType() != Material.GRASS) - { - UtilInv.insert(player, new ItemStack(bottom2.getType())); - blockBreakEffect(bottom2); - } - - if(bottom3.getType() != Material.GRASS && bottom3.getType() != Material.DIRT) - { - UtilInv.insert(player, new ItemStack(bottom3.getType())); - blockBreakEffect(bottom3); - } - - UtilTextMiddle.display("", C.cRed + "You can't build a tower that high.", 5, 40, 5, player); - return; - } - - // Last Check - // Checking if the player has successfully placed all blocks. - - ArrayList items = UtilInv.getItems(player); - - if((items.size() - 1) == 0) - { - if(items.get(0).getAmount() == 1) - { - SetCompleted(player); - } - } - } - - @SuppressWarnings("deprecation") - private void blockBreakEffect(Block block) - { - UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(block.getType(), block.getData()), block.getLocation(), 0.0F, 0.0F, 0.0F, 0, - 10, ViewDist.NORMAL, UtilServer.getPlayers()); - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); - block.setType(Material.AIR); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java index 48d1a6b4d..f3b4f9a1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java @@ -3,214 +3,229 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.HashMap; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.Challenge; -import nautilus.game.arcade.game.games.mineware.MineWare; - -import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.FireworkEffect.Type; 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.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.material.Wool; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.mineware.AntiHackFix; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; public class ChallengeBouncingBlock extends Challenge { - + private AntiHackFix _antiHackFix; private ArrayList _scoreBlocks = new ArrayList(); private HashMap _playerScore = new HashMap(); public ChallengeBouncingBlock(MineWare host) { - super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Avoid landing on red wool!", "First to 10 wins!"); + super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch floating wool blocks.", + "Avoid landing on red wool.", "First to 10 wins!"); + + _antiHackFix = new AntiHackFix(this); } @Override public ArrayList getSpawns() { ArrayList spawns = new ArrayList(); - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), true, getArenaSize(9) - 2)) + + for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), true, + getArenaSize(9) - 2)) { spawns.add(getCenter().clone().add(locs.getX() + 0.5, 1.1, locs.getZ() + 0.5)); } + return spawns; } @Override public void cleanupRoom() { - for(Player player : Host.GetPlayers(true)) - { + for (Player player : Host.GetPlayers(true)) player.removePotionEffect(PotionEffectType.JUMP); - } - for(Block woolBlocks : _scoreBlocks) - { + + for (Block woolBlocks : _scoreBlocks) woolBlocks.setType(Material.AIR); - } + _scoreBlocks.clear(); _playerScore.clear(); + + _antiHackFix.clear(); Host.StrictAntiHack = true; } @Override public void setupPlayers() { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 6)); - _playerScore.put(player, 0); } + Host.StrictAntiHack = false; } + @SuppressWarnings("deprecation") @Override public void generateRoom() { - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), false, getArenaSize(9))) + for (Location location : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), false, + getArenaSize(9))) { - locs.getBlock().setType(Material.WOOL); - if(UtilMath.r(16) == 1) + Block block = location.getBlock(); + block.setType(Material.WOOL); + + if (Math.random() * 100 < 20.0) { - locs.getBlock().setData((byte)14); + block.setData((byte) 14); } else { - locs.getBlock().setData((byte)0); + block.setData((byte) 0); } - addBlock(locs.getBlock()); + + addBlock(block); } + spawnStartingWool(); } @EventHandler public void onPlayerPunchWool(PlayerInteractEvent event) { - if(!Host.IsLive()) - { + if (!Host.IsLive()) return; - } - if(!Host.IsAlive(event.getPlayer())) - { - return; - } - if(isDone(event.getPlayer())) - { - return; - } - if(event.getClickedBlock() == null || event.getClickedBlock().getType() == Material.AIR) - { - return; - } - if(!_scoreBlocks.contains(event.getClickedBlock())) - { - return; - } - _playerScore.put(event.getPlayer(), _playerScore.get(event.getPlayer()) + 1); - event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.SUCCESSFUL_HIT, 0.2f, 0.2f); + if (!Host.IsAlive(event.getPlayer())) + return; + + if (isDone(event.getPlayer())) + return; + + if (event.getClickedBlock() == null || event.getClickedBlock().getType() == Material.AIR) + return; + + if (!_scoreBlocks.contains(event.getClickedBlock())) + return; + + Player player = event.getPlayer(); + + increment(player, 1); + player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 0.2f, 0.2f); + event.getClickedBlock().setType(Material.AIR); spawnRandomWool(getArenaSize(9), (UtilMath.r(6) + 5)); - if(_playerScore.get(event.getPlayer()) >= 10) + if (_playerScore.get(player) >= 10) { - SetCompleted(event.getPlayer()); + SetCompleted(player); + UtilTextBottom.display(C.cGreen + C.Bold + "Completed!", player); } } @EventHandler public void scoreHandler(UpdateEvent event) { - if(!Host.IsLive()) - { + if (!Host.IsLive()) return; - } - if(event.getType() != UpdateType.FASTEST) - { + + if (event.getType() != UpdateType.TICK) return; - } - for(Player player : Host.GetPlayers(true)) + + for (Player player : Host.GetPlayers(true)) { - if(isDone(player)) - { + if (isDone(player)) continue; - } - if(_playerScore.get(player) < 0) - { - _playerScore.put(player, 0); - } - UtilTextBottom.display(ChatColor.YELLOW + "Your Score: " + ChatColor.GREEN + _playerScore.get(player), player); + + UtilTextBottom.display(C.Bold + "Score: " + C.Reset + C.cYellow + C.Bold + _playerScore.get(player), + player); } } - + @EventHandler - public void redWoolHandler(UpdateEvent event) + public void redWoolHandler(PlayerMoveEvent event) { - if(!Host.IsLive()) - { + if (!Host.IsLive()) return; - } - if(event.getType() != UpdateType.FAST) - { + + Player player = event.getPlayer(); + + if (isDone(player)) return; - } - - for(Player player: Host.GetPlayers(true)) + + if (event.getFrom().getX() == event.getTo().getX() || event.getFrom().getZ() == event.getTo().getZ()) + return; + + Location loc = player.getLocation(); + Block blockBelow = loc.getBlock().getRelative(BlockFace.DOWN); + + if (blockBelow.getType() == Material.WOOL) { - if(isDone(player)) + Wool woolBelow = (Wool) blockBelow.getState().getData(); + + if (woolBelow.getColor() == DyeColor.RED) { - return; - } - Block blockUnderPlayer = player.getWorld().getBlockAt(player.getLocation().getBlockX(), player.getLocation().getBlockY()-1, player.getLocation().getBlockZ()); - - if(blockUnderPlayer.getType() == Material.WOOL) - { - Wool woolUnderPlayer = (Wool)blockUnderPlayer.getState().getData(); - - if(woolUnderPlayer.getColor() == DyeColor.RED) + if (Recharge.Instance.use(player, "Red Wool", 300, false, false) && _playerScore.get(player) > 0) { - if(_playerScore.get(player) != 0) - { - UtilPlayer.message(player, "" + ChatColor.BOLD + ChatColor.RED + "Red Wool > " + ChatColor.YELLOW + "You stood on a red wool. Score decreased with 2!"); - _playerScore.put(player, _playerScore.get(player)-2); - } + int subtract = 2; + + if (_playerScore.get(player) == 1) + subtract = 1; + + subtract(player, subtract); + + UtilTextMiddle.display("", "Score decreased by " + C.cRed + subtract + C.Reset + "!", 5, 40, 5, + player); + player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0F, 1.0F); } } } } - + + @SuppressWarnings("deprecation") private void spawnStartingWool() { - whileLoop: while(_scoreBlocks.size() <= Math.ceil(Host.GetPlayers(true).size() / 2)+1) // Could make this while(true) + whileLoop: while (_scoreBlocks.size() <= Math.ceil(Host.GetPlayers(true).size() / 2) + 1) // Could + // make + // this + // while(true) { - for(int x = -getArenaSize(); x <= getArenaSize(); x++) + for (int x = -getArenaSize(); x <= getArenaSize(); x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 5; y <= 11; y++) + for (int y = 5; y <= 11; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(b.getType() == Material.AIR || b.getType() == null) + if (b.getType() == Material.AIR || b.getType() == null) { - if(UtilMath.r(50) == 0) + if (UtilMath.r(50) == 0) { Byte color = (byte) UtilMath.r(16); - while(color == 14) + while (color == 14) { color = (byte) UtilMath.r(16); } @@ -219,7 +234,7 @@ public class ChallengeBouncingBlock extends Challenge b.setData((byte) UtilMath.r(16)); _scoreBlocks.add(b); - if(_scoreBlocks.size() >= Math.ceil(Host.GetPlayers(true).size() / 2)+1) + if (_scoreBlocks.size() >= Math.ceil(Host.GetPlayers(true).size() / 2) + 1) { break whileLoop; } @@ -231,27 +246,48 @@ public class ChallengeBouncingBlock extends Challenge } } + @SuppressWarnings("deprecation") private void spawnRandomWool(int size, int height) { - size = size -2; + size = size - 2; int x = UtilMath.r(size * 2) - size; int y = height; int z = UtilMath.r(size * 2) - size; Block b = getCenter().getBlock().getRelative(x, y, z); - Byte color = (byte) UtilMath.r(16); - while(color == 14) // prevent RED + + while (color == 14) // prevent RED { color = (byte) UtilMath.r(16); } b.setType(Material.WOOL); - Wool wool = (Wool)b.getState().getData(); b.setData(color); - UtilFirework.playFirework(b.getLocation(), Type.BALL, DyeColor.getByWoolData(b.getData()).getColor(), false, false); - + UtilFirework.playFirework(b.getLocation().add(0.5, 0.5, 0.5), Type.BALL, + DyeColor.getByWoolData(b.getData()).getColor(), false, false); + _scoreBlocks.add(b); } + + private void increment(Player player, int amount) + { + int score = _playerScore.get(player); + int updatedScore = score + amount; + + if (updatedScore <= 10) + _playerScore.put(player, updatedScore); + } + + private void subtract(Player player, int amount) + { + int score = _playerScore.get(player); + int updatedScore = score - amount; + + if (updatedScore > 0) + _playerScore.put(player, updatedScore); + else + _playerScore.put(player, 0); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java index 92c24951d..5d351c2fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java @@ -22,7 +22,7 @@ public class ChallengeChestLoot extends Challenge { public ChallengeChestLoot(MineWare host) { - super(host, ChallengeType.FirstComplete,"Diamond Seeker", "Find a diamond in the chests"); + super(host, ChallengeType.FirstComplete,"Diamond Seeker", "Find a diamond in the chests."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java index 60ea79cd9..e5006d36a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java @@ -23,7 +23,7 @@ public class ChallengeCloudFall extends Challenge public ChallengeCloudFall(MineWare host) { - super(host, ChallengeType.FirstComplete, "Cloud Fall", "First to the buttom wins!", "Avoid the clouds!", "Land on the lime wool"); + super(host, ChallengeType.FirstComplete, "Cloud Fall", "Jump and land on the green wool.", "Make sure to avoid the clouds.", "First to the bottom wins!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java index d8b99b24f..1075e8774 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogvsCat.java @@ -44,7 +44,7 @@ public class ChallengeDogvsCat extends Challenge public ChallengeDogvsCat(MineWare host) { - super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "Look up and Bark/Meow!", "First team to the end number wins!"); + super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark.", "If you are a cat, meow.", "Look up and punch to bark or meow.", "First team to the end number wins!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java index 9483621ff..4e5388f3e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -35,7 +35,7 @@ public class ChallengeDragonEgg extends Challenge public ChallengeDragonEgg(MineWare host) { - super(host, ChallengeType.FirstComplete, "Dragon egg", "Whack a dragon egg 10 times"); + super(host, ChallengeType.FirstComplete, "Dragon egg", "Whack a dragon egg 10 times."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java index fef075912..36bf9ccd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java @@ -43,7 +43,7 @@ public class ChallengeFastFood extends Challenge public ChallengeFastFood(MineWare host) { - super(host, ChallengeType.FirstComplete, "Fast Food", "Your inventory is full of food!", "Punch to throw them in the ground.", + super(host, ChallengeType.FirstComplete, "Fast Food", "Your inventory is full of food!", "Punch to throw it in the ground.", "First player to drop them all wins."); } @@ -124,7 +124,7 @@ public class ChallengeFastFood extends Challenge } else { - chanceItemSlot(player); + changeItemSlot(player); } } } @@ -177,7 +177,7 @@ public class ChallengeFastFood extends Challenge return itemStack; } - private void chanceItemSlot(Player player) + private void changeItemSlot(Player player) { for(int i = 0; i < 9; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java index 5912ecee3..ad0813a7b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java @@ -3,21 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.HashMap; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilInv; -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.itemstack.ItemBuilder; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.mineware.Challenge; -import nautilus.game.arcade.game.games.mineware.MineWare; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -40,6 +25,21 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilInv; +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.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + @SuppressWarnings("deprecation") public class ChallengeFishingDay extends Challenge { @@ -53,7 +53,8 @@ public class ChallengeFishingDay extends Challenge public ChallengeFishingDay(MineWare host) { - super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", "Watch out for TNT if you miss the fish!"); + super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", + "Watch out for TNT if you miss the fish!"); } @Override @@ -62,15 +63,15 @@ public class ChallengeFishingDay extends Challenge int size = getArenaSize(); ArrayList spawns = new ArrayList(); - for(int x = -(size); x <= size; x++) + for (int x = -(size); x <= size; x++) { - for(int z = -(size); z <= size; z++) + for (int z = -(size); z <= size; z++) { double absX = Math.abs(x); double absZ = Math.abs(z); int platform = size - 2; - if((absX == platform || absZ == platform) && !(absX > platform || absZ > platform)) + if ((absX == platform || absZ == platform) && !(absX > platform || absZ > platform)) { spawns.add(getCenter().clone().add(x + 0.5, 6.1, z + 0.5)); } @@ -85,11 +86,11 @@ public class ChallengeFishingDay extends Challenge { int size = getArenaSize(); - for(int x = -size; x <= size; x++) + for (int x = -size; x <= size; x++) { - for(int z = -size; z <= size; z++) + for (int z = -size; z <= size; z++) { - for(int y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { Block block = getCenter().getBlock().getRelative(x, y, z); @@ -98,38 +99,38 @@ public class ChallengeFishingDay extends Challenge // Bottom Layer - if(y == 0) + if (y == 0) { block.setType(Material.BEDROCK); } // Ground Layer - else if(y == 1) + else if (y == 1) { block.setType(Material.SAND); } else { - if(y < 6) + if (y < 6) { // Fishing Platform - if((absX >= size - 3 && absX <= size) || (absZ >= size - 3 && absZ <= size)) + if ((absX >= size - 3 && absX <= size) || (absZ >= size - 3 && absZ <= size)) { double chance = Math.random() * 100; - if(chance < 25) + if (chance < 25) { block.setType(Material.GRAVEL); } else { - if(y == 5 && !getSpawns().contains(block.getLocation())) + if (y == 5 && !getSpawns().contains(block.getLocation())) { block.setType(Material.GRASS); - if(chance > 25 && chance < 30) + if (chance > 25 && chance < 30) { Block above = block.getRelative(BlockFace.UP); above.setType(Material.LONG_GRASS); @@ -146,7 +147,7 @@ public class ChallengeFishingDay extends Challenge // Water Container - else if(absX <= size - 4 || absZ <= size - 4) + else if (absX <= size - 4 || absZ <= size - 4) { block.setType(Material.WATER); } @@ -154,7 +155,7 @@ public class ChallengeFishingDay extends Challenge // Border Walls - else if(y > 4 && (absX == size || absZ == size)) + else if (y > 4 && (absX == size || absZ == size)) { block.setType(Material.FENCE); } @@ -171,6 +172,7 @@ public class ChallengeFishingDay extends Challenge { Host.DamageEvP = false; Host.ItemPickup = true; + Host.WorldWaterDamage = 1; ItemBuilder item = new ItemBuilder(Material.FISHING_ROD); item.addEnchantment(Enchantment.LURE, _startingLureLevel); @@ -181,9 +183,9 @@ public class ChallengeFishingDay extends Challenge meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); itemStack.setItemMeta(meta); - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(isDone(player)) + if (isDone(player)) continue; player.getInventory().setItem(_fishingRodSlot, itemStack); @@ -197,10 +199,11 @@ public class ChallengeFishingDay extends Challenge Host.DamageEvP = false; Host.ItemPickup = false; Host.InventoryClick = false; + Host.WorldWaterDamage = 0; - for(Entity entity : Host.WorldData.World.getEntities()) + for (Entity entity : Host.WorldData.World.getEntities()) { - if(entity instanceof TNTPrimed) + if (entity instanceof TNTPrimed) { entity.remove(); } @@ -215,31 +218,32 @@ public class ChallengeFishingDay extends Challenge { Player fisher = event.getPlayer(); - if(isDone(fisher) || !Host.IsLive() || !Host.isChallengeStarted()) + if (isDone(fisher) || !Host.IsLive() || !Host.isChallengeStarted()) return; Fish hook = event.getHook(); - if(!_fishing.containsKey(fisher)) + if (!_fishing.containsKey(fisher)) { _fishing.put(fisher, false); } else { - if(!_fishing.get(fisher)) + if (!_fishing.get(fisher)) { _fishing.put(fisher, true); } } - if(event.getCaught() != null) + if (event.getCaught() != null) { Entity entity = event.getCaught(); ItemStack item = new ItemStack(Material.RAW_FISH, 1, (byte) UtilMath.r(3)); fisher.getInventory().addItem(item); - UtilTextBottom.display("You caught a " + C.cGreen + getFishType(item.getData().getData()) + C.cWhite + "!", fisher); + UtilTextBottom.display("You caught a " + C.cGreen + getFishType(item.getData().getData()) + C.cWhite + "!", + fisher); fisher.playSound(fisher.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F); waterSplashEffect(fisher.getLocation().add(0, 0.5, 0), true, true); @@ -253,7 +257,7 @@ public class ChallengeFishingDay extends Challenge } else { - if(isFishingHookEmpty(fisher, hook)) + if (isFishingHookEmpty(fisher, hook)) { createExplosion(fisher, hook.getLocation()); } @@ -263,22 +267,20 @@ public class ChallengeFishingDay extends Challenge @EventHandler public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; - if(event.getEntity() instanceof Player && event.getDamager() instanceof FishHook) - { + if (event.getEntity() instanceof Player && event.getDamager() instanceof FishHook) event.setCancelled(true); - } } @EventHandler public void onItemHeld(PlayerItemHeldEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; - if(!isDone(event.getPlayer())) + if (!isDone(event.getPlayer())) { event.setCancelled(true); } @@ -287,12 +289,12 @@ public class ChallengeFishingDay extends Challenge @EventHandler public void onPlayerMove(PlayerMoveEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; - if(!isDone(event.getPlayer())) + if (!isDone(event.getPlayer())) { - if(Math.random() * 100 < 20) + if (Math.random() * 100 < 20) { Player player = event.getPlayer(); Location from = event.getFrom(); @@ -303,7 +305,7 @@ public class ChallengeFishingDay extends Challenge double toX = to.getX(); double toZ = to.getZ(); - if(fromX != toX || fromZ != toZ) + if (fromX != toX || fromZ != toZ) { waterSplashEffect(player.getLocation().add(0, 0.1, 0), false, false); } @@ -314,7 +316,7 @@ public class ChallengeFishingDay extends Challenge @EventHandler public void onEntityExplode(EntityExplodeEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; Location dropsite = event.getLocation(); @@ -322,12 +324,14 @@ public class ChallengeFishingDay extends Challenge world.playSound(dropsite, Sound.ZOMBIE_WOODBREAK, 0.5F, 1.0F); world.playSound(dropsite, Sound.EXPLODE, 1.0F, 1.0F); - UtilParticle.PlayParticle(ParticleType.CLOUD, dropsite, 0.6F, 0.6F, 0.6F, 0.0F, 50, ViewDist.NORMAL, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.SMOKE, dropsite, 0.3F, 0.3F, 0.3F, 0.5F, 50, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.CLOUD, dropsite, 0.6F, 0.6F, 0.6F, 0.0F, 50, ViewDist.NORMAL, + UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.SMOKE, dropsite, 0.3F, 0.3F, 0.3F, 0.5F, 50, ViewDist.NORMAL, + UtilServer.getPlayers()); Player target = _explosives.get(event.getEntity()); - if(UtilMath.offset(dropsite, target.getLocation()) <= 6.0) + if (UtilMath.offset(dropsite, target.getLocation()) <= 6.0) { setLost(target); } @@ -337,15 +341,15 @@ public class ChallengeFishingDay extends Challenge private String getFishType(byte data) { - if(data == 1) + if (data == 1) { return "Salmon"; } - else if(data == 2) + else if (data == 2) { return "Clownfish"; } - else if(data == 3) + else if (data == 3) { return "Pufferfish"; } @@ -360,15 +364,15 @@ public class ChallengeFishingDay extends Challenge ArrayList contents = UtilInv.getItems(fisher); int caughtFish = 0; - for(ItemStack item : contents) + for (ItemStack item : contents) { - if(item.getType() == Material.RAW_FISH) + if (item.getType() == Material.RAW_FISH) { caughtFish = caughtFish + item.getAmount(); } } - if(caughtFish == 5) + if (caughtFish == 5) { SetCompleted(fisher); } @@ -382,12 +386,13 @@ public class ChallengeFishingDay extends Challenge Location droppedHook = hook.getLocation(); Block below = droppedHook.getBlock().getRelative(BlockFace.DOWN); - return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround() && below.getType() == Material.STATIONARY_WATER; + return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround() + && below.getType() == Material.STATIONARY_WATER; } private void createExplosion(Player target, Location dropsite) { - if(Recharge.Instance.use(target, "TNT Spawn", 700, false, false)) + if (Recharge.Instance.use(target, "TNT Spawn", 700, false, false)) { World world = dropsite.getWorld(); @@ -397,7 +402,8 @@ public class ChallengeFishingDay extends Challenge explosive.setFuseTicks(40); explosive.setYield(0.0F); - UtilAction.velocity(explosive, UtilAlg.getTrajectory(dropsite, target.getLocation()), 1.2D, false, 0.0D, 0.3D, 0.6D, false); + UtilAction.velocity(explosive, UtilAlg.getTrajectory(dropsite, target.getLocation()), 1.2D, false, 0.0D, + 0.3D, 0.6D, false); _explosives.put(explosive, target); } @@ -407,12 +413,13 @@ public class ChallengeFishingDay extends Challenge { int amount = 5; - if(randomAmount) + if (randomAmount) amount += UtilMath.r(10); - UtilParticle.PlayParticle(ParticleType.WATER_WAKE, location, 0.2F, 0.1F, 0.2F, 0.0F, amount, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.WATER_WAKE, location, 0.2F, 0.1F, 0.2F, 0.0F, amount, ViewDist.NORMAL, + UtilServer.getPlayers()); - if(sound) + if (sound) location.getWorld().playSound(location, Sound.WATER, 0.3F, 1.0F); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java index d1e292c12..0081abe98 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java @@ -40,7 +40,7 @@ public class ChallengeInfestation extends Challenge public ChallengeInfestation(MineWare host) { - super(host, ChallengeType.LastStanding, "Infestation", "Avoid the deadly zombie!", "Infected kills humans"); + super(host, ChallengeType.LastStanding, "Infestation", "Avoid the deadly zombie!", "Watch out, the infected can kill humans."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java index cf9e0e00d..33fb962ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java @@ -32,7 +32,7 @@ public class ChallengeKOTL extends Challenge public ChallengeKOTL(MineWare host) { - super(host, ChallengeType.FirstComplete, "King Of The Ladder", "Reach the top of the ladder"); + super(host, ChallengeType.FirstComplete, "King Of The Ladder", "Reach the top of the ladder."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java index b5b303d0b..42052db06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java @@ -29,7 +29,7 @@ public class ChallengeKangarooJump extends Challenge public ChallengeKangarooJump(MineWare host) { - super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Jump from block to block", "Highest players win!"); + super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Jump from block to block.", "Player with the highest height wins!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java index b0727c24a..72ab86b52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java @@ -33,7 +33,7 @@ public class ChallengeLavaRun extends Challenge public ChallengeLavaRun(MineWare host) { - super(host, ChallengeType.LastStanding, "Lava run", "The lava is coming!", "Stand on the obsidian!", "Run! Run! Run!"); + super(host, ChallengeType.LastStanding, "Lava run", "The lava is coming!", "Stand on the obsidian.", "Run! Run! Run!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java index 5d35f83fe..a5629e98f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -41,7 +41,7 @@ public class ChallengeMilkACow extends Challenge public ChallengeMilkACow(MineWare host) { - super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows", "Deliver the milk to the vilager"); + super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows.", "Deliver the milk to the villager!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java index cc0de8839..d5d9b49a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java @@ -24,7 +24,7 @@ public class ChallengeMineADiamond extends Challenge public ChallengeMineADiamond(MineWare host) { - super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find the diamonds", "And mine them!"); + super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find a diamond around the map.", "Be the first to mine one!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java index cdd290756..f3015156a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java @@ -47,7 +47,7 @@ public class ChallengeMinecartDance extends Challenge public ChallengeMinecartDance(MineWare host) { - super(host, ChallengeType.LastStanding, "Minecart Dance", "Whenever the firework turns green", "Get inside a minecart"); + super(host, ChallengeType.LastStanding, "Minecart Dance", "Get ready when the fireworks change color.", "Once they're green, get inside a minecart!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOITQ.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOITQ.java index 430537f91..e8ea35962 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOITQ.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOITQ.java @@ -35,7 +35,7 @@ public class ChallengeMiniOITQ extends Challenge public ChallengeMiniOITQ(MineWare host) { - super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Do not get hit!", "Get new arrow every 4 second", "Last man standing wins!"); + super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Do not get hit!", "You receive a new arrow every 4 seconds.", "Last man standing wins!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java index d11d848c6..03f507dd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java @@ -21,7 +21,7 @@ public class ChallengeNavigateMaze extends Challenge private HashMap _playerCompletionTime = new HashMap(); public ChallengeNavigateMaze(MineWare host) { - super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze"); + super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java index fd835105f..0c0e838b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java @@ -28,7 +28,7 @@ public class ChallengePickASide extends Challenge public ChallengePickASide(MineWare host) { - super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the least players win!"); + super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the least players wins!"); } public int getMinPlayers() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java index a202dd847..bee85a38a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java @@ -30,7 +30,7 @@ public class ChallengePunchThePig extends Challenge public ChallengePunchThePig(MineWare host) { - super(host, ChallengeType.FirstComplete, "Punch the Pig", "Kill 5 pigs!!"); + super(host, ChallengeType.FirstComplete, "Punch the Pig", "Kill 5 pigs!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java index 7a673f8d1..2f4a27bcf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java @@ -48,7 +48,7 @@ public class ChallengeRedLightGreenLight extends Challenge public ChallengeRedLightGreenLight(MineWare host) { - super(host, ChallengeType.FirstComplete, "Red Light, Green Light", false, false, "Reach the end as the first", "Don't move after RED firework"); + super(host, ChallengeType.FirstComplete, "Red Light, Green Light", false, false, "Be the first to reach the end.", "Don't move while the fireworks are red!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java index de0a59fcf..7c0b62f7e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java @@ -43,7 +43,7 @@ public class ChallengeReverseTag extends Challenge public ChallengeReverseTag(MineWare Host) { - super(Host, ChallengeType.FirstComplete, "Reverse Tag", "Be a sparkling person", "Punch the sparking people to become sparking!"); + super(Host, ChallengeType.FirstComplete, "Reverse Tag", "Be a sparkling person until the end.", "Punch the sparking people to become one!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java index 2d41db074..9fa73f340 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java @@ -25,7 +25,7 @@ public class ChallengeRushPush extends Challenge public ChallengeRushPush(MineWare host) { - super(host, ChallengeType.LastStanding, "Rush push", true, true, "Rush your enemy", "And push them off the platform", "Remember you have no teammates!"); + super(host, ChallengeType.LastStanding, "Rush push", true, true, "Rush to your enemy.", "Push them off the platform.", "Remember you have no teammates!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java index b37348c8d..f90b86bb9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -39,7 +39,7 @@ public class ChallengeShootChickens extends Challenge public ChallengeShootChickens(MineWare host) { - super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens"); + super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java index af406592f..beff3fb2a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java @@ -17,7 +17,7 @@ public class ChallengeSmashOff extends Challenge public ChallengeSmashOff(MineWare host) { - super(host, ChallengeType.LastStanding, "Smash off", false, true, "Knock the other players off!"); + super(host, ChallengeType.LastStanding, "Smash off", false, true, "Knock other players off the platform!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java index c69c26445..c6f5f9ea4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java @@ -33,7 +33,7 @@ public class ChallengeStandOnColor extends Challenge public ChallengeStandOnColor(MineWare host) { - super(host, ChallengeType.LastStanding, "Color Change", "Stand on the correct color"); + super(host, ChallengeType.LastStanding, "Color Change", "Stand on the correct color."); for (int i = 0; i <= 15; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java index 5d0c13593..42df264c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java @@ -34,7 +34,7 @@ public class ChallengeTntLauncher extends Challenge public ChallengeTntLauncher(MineWare host) { - super(host, ChallengeType.LastStanding, "Deadly TNT", false, true, "Throw TNT, don't get knocked off!"); + super(host, ChallengeType.LastStanding, "Deadly TNT", false, true, "Throw TNT to other players.", "Don't get knocked off!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java index a52f3d01a..590bd5b1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java @@ -51,7 +51,7 @@ public class ChallengeVolleyPig extends Challenge public ChallengeVolleyPig(MineWare host) { - super(host, ChallengeType.FirstComplete, "Volley Pig", "Punch the pig on the enemy's side", "Do NOT cross the middle!"); + super(host, ChallengeType.FirstComplete, "Volley Pig", "Punch the pig on the enemy side.", "Do not cross the middle!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/ChallengeEndEvent.java similarity index 100% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/ChallengeEndEvent.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index 550c5a669..1a7128081 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -358,27 +358,6 @@ public class MonsterMaze extends SoloGame } } - private boolean _announced = false; - @EventHandler - public void sendF5Message(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTEST) - return; - - if (GetState() != GameState.Prepare) - return; - - if (_announced) - return; - - if (!UtilTime.elapsed(GetStateTime(), 4000)) - return; - - _announced = true; - UtilTextMiddle.display(C.cYellow + C.Bold + "Press F5", C.cAqua + C.Bold + "Monster Maze is best in 3rd person!"); - Announce(C.cYellow + C.Scramble + "@@" + C.cAqua + C.Bold + " Monster Maze is best played in 3rd Person! (Push F5) " + C.cYellow + C.Scramble + "@@"); - } - @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index b73d68ad3..444b0aaeb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -61,7 +61,7 @@ public class KitCreeper extends SmashKit })); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explosive Leap", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explode", new String[] { ChatColor.RESET + "You freeze in location and charge up", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java index c55aa293f..7a0bf6059 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java @@ -13,10 +13,10 @@ import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextMiddle; 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.UtilTextMiddle; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -37,10 +37,13 @@ public class PerkEndermanTeleport extends SmashPerk @EventHandler public void update(UpdateEvent event) - { + { if (event.getType() != UpdateType.TICK) return; + if(!Manager.GetGame().IsLive()) + return; + for (Player player : UtilServer.getPlayers()) { if (!Kit.HasKit(player)) @@ -88,7 +91,7 @@ public class PerkEndermanTeleport extends SmashPerk } player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); - player.teleport(block.getLocation().add(0.5, 1, 0.5)); + player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection())); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 5722d92a4..b0c034a8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -941,7 +941,7 @@ public abstract class SurvivalGames extends Game for (Player alive : GetPlayers(true)) { - if (alive != player) + if (alive != player && getArcadeManager().canHurt(player, alive)) { double distance = alive.getLocation().distance( player.getLocation()); @@ -1838,6 +1838,9 @@ public abstract class SurvivalGames extends Game if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) return; + + if(!IsAlive(player)) + return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GiveAdminPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GiveAdminPage.java index 46dda25d4..75e6cbfb2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GiveAdminPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GiveAdminPage.java @@ -11,7 +11,7 @@ public class GiveAdminPage extends PlayerPage { public GiveAdminPage(ArcadeManager plugin, PrivateServerShop shop, Player player) { - super(plugin, shop, "Give Admin", player); + super(plugin, shop, "Give Co-Host", player); buildPage(); } @@ -26,12 +26,12 @@ public class GiveAdminPage extends PlayerPage { removeButton(slot); _manager.giveAdmin(player); - UtilPlayer.message(getPlayer(), F.main("Server", "You gave " + F.name(player.getName()) + " admin power.")); + UtilPlayer.message(getPlayer(), F.main("Server", "You gave " + F.name(player.getName()) + " Co-Host power.")); } @Override public String getDisplayString(Player player) { - return "Click to Make Admin"; + return "Click to Make Co-Host"; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/RemoveAdminPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/RemoveAdminPage.java index f96f4198c..34730259e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/RemoveAdminPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/RemoveAdminPage.java @@ -19,7 +19,7 @@ public class RemoveAdminPage extends BasePage { public RemoveAdminPage(ArcadeManager plugin, PrivateServerShop shop, Player player) { - super(plugin, shop, "Remove Admin", player); + super(plugin, shop, "Remove Co-Host", player); buildPage(); } @@ -36,7 +36,7 @@ public class RemoveAdminPage extends BasePage while (iterator.hasNext()) { String name = iterator.next(); - ItemStack head = getPlayerHead(name, C.cGreen + C.Bold + name, new String[] {ChatColor.RESET + C.cGray + "Click to Remove Admin"}); + ItemStack head = getPlayerHead(name, C.cGreen + C.Bold + name, new String[] {ChatColor.RESET + C.cGray + "Click to Remove Co-Host"}); addButton(slot, head, getRemoveAdminButton(slot, name)); slot++; @@ -52,7 +52,7 @@ public class RemoveAdminPage extends BasePage { _manager.removeAdmin(playerName); removeButton(slot); - UtilPlayer.message(getPlayer(), F.main("Server", "You removed admin power from " + F.name(playerName) + ".")); + UtilPlayer.message(getPlayer(), F.main("Server", "You removed Co-Host power from " + F.name(playerName) + ".")); } }; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java index d69147917..c190beadc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.kit.perks; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -109,7 +110,9 @@ public class PerkBaconBlast extends Perk implements IThrown public void Explode(ProjectileUser data) { - data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f); + // for whatever reason, you can't put a location in createExplosion if you don't want it to break blocks >.> + Location loc = data.GetThrown().getLocation(); + data.GetThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false); data.GetThrown().remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBladeVortex.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBladeVortex.java index 66292d9d7..f07e50acb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBladeVortex.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBladeVortex.java @@ -53,6 +53,10 @@ public class PerkBladeVortex extends Perk if (!UtilGear.isWeapon(event.getPlayer().getItemInHand())) return; + + //Dont allow usage in early game + if (!UtilTime.elapsed(Manager.GetGame().GetStateTime(), 30000)) + return; final Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java index 7ca633d75..bbe144332 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -125,7 +125,7 @@ public class PerkDoubleJump extends Perk if (!Recharge.Instance.usable(player, "Double Jump")) continue; - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock()))) player.setAllowFlight(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java index 041bae71c..94b7376bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java @@ -93,7 +93,8 @@ public class PerkFlameDash extends Perk _data.add(new FireflyData(player)); - Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true); + Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); + //Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java index d6d70875b..7baa5eb0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java @@ -109,6 +109,8 @@ public class PerkWitchPotion extends SmashPerk Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, 5, true, true, false, UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName()); + + Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 3, 1, true, false, false, false); } //Super Effect else @@ -121,6 +123,7 @@ public class PerkWitchPotion extends SmashPerk DamageCause.CUSTOM, 5 + bonus, true, true, false, UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName()); + Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 7, 2, true, false, false, false); //Manager.GetCondition().Factory().Confuse(reason, ent, source, duration, mult, extend, showIndicator, ambient) } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index e5be1cdbc..50a838155 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -396,7 +396,7 @@ public class GameHostManager implements Listener if (!isAdmin(event.getPlayer(), true)) { - event.getPlayer().sendMessage(F.main("Broadcast", "Only MPS admins can use this command.")); + event.getPlayer().sendMessage(F.main("Broadcast", "Only Co-Hosts can use this command.")); event.setCancelled(true); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index ba57f7f18..60bf68b48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -61,13 +61,13 @@ public class GameLootManager implements Listener //Chest _rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Old Chest", "Old Chest", 1, 1, - new ItemStack(Material.CHEST), RewardRarity.COMMON, 2)); + new ItemStack(Material.CHEST), RewardRarity.COMMON, 2, 0)); _rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Ancient Chest", "Ancient Chest", 1, 1, - new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40)); + new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40, 0)); _rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Mythical Chest", "Mythical Chest", 1, 1, - new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1)); + new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1, 0)); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 354939f26..ca7bb2df2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseLiving; import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.gadget.gadgets.MorphWither; +import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.minecraft.game.core.condition.Condition.ConditionType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index ba2c0d8cd..2328f93dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -304,14 +304,16 @@ public class HolidayManager implements Listener if (Manager.GetGame() != null && !Manager.GetGame().IsAlive(event.getPlayer())) return; - if (!_active.contains(event.getClickedBlock())) - return; - specialBlockBreak(event.getPlayer(), event.getClickedBlock()); } private void specialBlockBreak(Player player, final Block block) { + if (!_active.contains(block)) + return; + + _active.remove(block); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType()); block.setType(Material.AIR); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathBomberStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathBomberStatTracker.java index 9d4ac4865..90316be6e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathBomberStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathBomberStatTracker.java @@ -46,6 +46,11 @@ public class DeathBomberStatTracker extends StatTracker if (!event.GetLog().GetPlayer().IsPlayer()) return; + + Player killed = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + + if(killer.equals(killed)) + return; if (event.GetLog().GetKiller() != null && event.GetLog().GetKiller().GetReason().contains("Throwing TNT")) { diff --git a/RemoteSystemsTempFiles/.project b/RemoteSystemsTempFiles/.project new file mode 100644 index 000000000..5447a64fa --- /dev/null +++ b/RemoteSystemsTempFiles/.project @@ -0,0 +1,12 @@ + + + RemoteSystemsTempFiles + + + + + + + org.eclipse.rse.ui.remoteSystemsTempNature + +