Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-12-17 18:34:25 -05:00
commit c2fb6e6c15
267 changed files with 7044 additions and 2749 deletions

BIN
Art/BlackFriday.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
Art/ChristmasChaos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

BIN
Art/ClansBanner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 KiB

BIN
Art/TitanLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

BIN
Art/WinterTreasure.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
Art/WinterTreasureTrim.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
Art/y5O7WYh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
Art/zKzkfLE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -20,7 +20,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Game.Clans.Core" />
<element id="module-output" name="Mineplex.PlayerCache" />
<element id="module-output" name="Mineplex.Cache" />
</root>
</artifact>
</component>

View File

@ -20,8 +20,8 @@
<element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.PlayerCache" />
<element id="module-output" name="Mineplex.Game.Clans.Core" />
<element id="module-output" name="Mineplex.Cache" />
</root>
</artifact>
</component>

View File

@ -1,9 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" name="Nautilus.Core.Craftbukkit:jar">
<output-path>$PROJECT_DIR$/bin</output-path>
<root id="archive" name="craftbukkit.jar">
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/craftbukkit_official.jar" path-in-jar="/" />
<element id="module-output" name="Nautilus.Core.CraftBukkit" />
</root>
</artifact>
</component>

View File

@ -19,7 +19,7 @@
<element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.PlayerCache" />
<element id="module-output" name="Mineplex.Cache" />
</root>
</artifact>
</component>

View File

@ -23,7 +23,7 @@
</profile>
<profile default="false" name="Annotation profile for bungee" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target\generated-test-sources\test-annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
</profile>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" hash="2876127046">
<component name="DataSourceManagerImpl" format="xml" hash="1486084220">
<data-source source="LOCAL" name="Mineplex" uuid="14dfc55d-5343-47c4-ab24-76a055b8059e">
<driver-ref>mysql</driver-ref>
<synchronize>true</synchronize>

View File

@ -5,19 +5,19 @@
<module fileurl="file://$PROJECT_DIR$/Classpath.Dummy/Classpath.Dummy.iml" filepath="$PROJECT_DIR$/Classpath.Dummy/Classpath.Dummy.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/JedisTest/JedisTest.iml" filepath="$PROJECT_DIR$/JedisTest/JedisTest.iml" group="Legacy" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml" filepath="$PROJECT_DIR$/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml" group="Bungee" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Cache/Mineplex.Cache.iml" filepath="$PROJECT_DIR$/Mineplex.Cache/Mineplex.Cache.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" filepath="$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" filepath="$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Clans" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" group="Clans" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" group="Other" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" group="Other" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" group="Other" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" filepath="$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" group="Legacy" />
</modules>

View File

@ -9,6 +9,7 @@
<jar jarfile="../bin/Mineplex.Core.Common.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
</jar>
<copy file="../bin/Mineplex.Core.Common.jar" todir="../Libraries"/>
@ -110,6 +111,7 @@
<jar jarfile="../bin/Mineplex.Core.Common.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
</jar>
<copy file="../bin/Mineplex.Core.Common.jar" todir="../Libraries"/>
@ -142,6 +144,7 @@
</fileset>
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
<include name="**/*.class"/>
@ -191,6 +194,7 @@
</fileset>
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.Game.Clans.Core/bin">
<include name="**/*.class"/>
@ -239,6 +243,7 @@
</fileset>
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.StaffServer">
<include name="*.yml"/>
@ -276,6 +281,7 @@
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.MapParser">
@ -403,6 +409,7 @@
<jar jarfile="../bin/ServerMonitor.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.ServerMonitor/bin">
<include name="**/*.class"/>
@ -435,6 +442,7 @@
<jar jarfile="../bin/TaskConverter.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.ChestConverter/bin">
<include name="**/*.class"/>
@ -462,6 +470,7 @@
<jar jarfile="../bin/PetConverter.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.PetConverter/bin">
<include name="**/*.class"/>
@ -490,6 +499,7 @@
<jar jarfile="../bin/Queuer.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="../Mineplex.Queuer/bin">
<include name="**/*.class"/>

View File

@ -13,6 +13,6 @@
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="httpcore" level="project" />
<orderEntry type="library" name="httpclient" level="project" />
<orderEntry type="module" module-name="Mineplex.PlayerCache" />
<orderEntry type="module" module-name="Mineplex.Cache" />
</component>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
</component>
</module>

View File

@ -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;

View File

@ -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<String> 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;
}
}

View File

@ -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";

View File

@ -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);

View File

@ -2,7 +2,7 @@ package mineplex.core.common.util;
public enum LineFormat
{
LORE(200), CHAT(319);
LORE(220), CHAT(319);
private int _length;

View File

@ -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());
}
}

View File

@ -260,6 +260,16 @@ public class UtilText
return string;
}
public static String[] splitLinesToArray(String[] strings, LineFormat lineFormat)
{
ArrayList<String> lineList = splitLines(strings, lineFormat);
String[] lineArray = new String[lineList.size()];
lineArray = lineList.toArray(lineArray);
return lineArray;
}
public static ArrayList<String> splitLines(String[] strings, LineFormat lineFormat)
{
ArrayList<String> lines = new ArrayList<String>();
@ -271,10 +281,35 @@ public class UtilText
return lines;
}
public static String[] splitLineToArray(String string, LineFormat lineFormat)
{
ArrayList<String> lineList = splitLine(string, lineFormat);
String[] lineArray = new String[lineList.size()];
lineArray = lineList.toArray(lineArray);
return lineArray;
}
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
{
ArrayList<String> strings = new ArrayList<String>();
//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(" ");

View File

@ -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
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>

View File

@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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.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.8

View File

@ -20,6 +20,6 @@
<orderEntry type="library" name="jooq" level="project" />
<orderEntry type="library" name="commons-dbcp2" level="project" />
<orderEntry type="library" name="NoCheatPlus" level="project" />
<orderEntry type="module" module-name="Mineplex.PlayerCache" />
<orderEntry type="module" module-name="Mineplex.Cache" />
</component>
</module>

View File

@ -539,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;
@ -555,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;

View File

@ -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;

View File

@ -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<String> 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<String> 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<String> 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);
}
}

View File

@ -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<BonusClientData> 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<BonusClientData> 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<BonusClientData> 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<BonusClientData> 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<BonusClientData> 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));
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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();
}
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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();
}
}
}

View File

@ -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));
}
});
}
}

View File

@ -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<Class> costumeClasses = new ArrayList<Class>();
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;

View File

@ -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));
}
});
}
}

View File

@ -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));
}
});
}
}

View File

@ -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<CosmeticManager, CosmeticShop>
{
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<CosmeticManager, CosmeticShop>
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<String> itemLore = new ArrayList<String>();
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<String> itemLore = new ArrayList<String>();
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<CosmeticManager, CosmeticShop>
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)

View File

@ -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<Gadget> 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));
}
});
}
}

View File

@ -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<CosmeticManager, CosmeticShop>
{
@ -43,124 +59,182 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@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<String> shardLore = new ArrayList<String>();
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<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
EnumMap<GadgetType, Gadget> enabled = new EnumMap<GadgetType, Gadget>(GadgetType.class);
for(GadgetType type : GadgetType.values())
{
ownedCount.put(type, 0);
maxCount.put(type, 0);
List<Gadget> 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<EntityType, String> 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 cant be a tiger! Thats 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<CosmeticManager, CosmeticShop>
{
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
}
public void attemptPurchaseKey(Player player)
{
getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1);
refresh();
}
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
}
}

View File

@ -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()

View File

@ -24,65 +24,137 @@ import mineplex.core.shop.page.ShopPageBase;
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
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<String> itemLore = new ArrayList<String>();
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<String> itemLore = new ArrayList<String>();
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));
}
}
}
}

View File

@ -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++;

View File

@ -61,27 +61,60 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
List<String> itemLore = new ArrayList<String>();
//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<CosmeticManager, CosmeticShop>
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++;

View File

@ -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<Gadget> 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));
}
});
}
}

View File

@ -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());
}

View File

@ -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()
{

View File

@ -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<Player, Long> _lastMove = new NautHashMap<Player, Long>();
private NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<Player, NautHashMap<GadgetType, Gadget>>();
private HashSet<GadgetSet> _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<? extends Gadget> c)
{
for(GadgetType type : GadgetType.values())
{
for(Gadget gadget : getGadgets(type))
{
if(gadget.getClass().equals(c)) return gadget;
}
}
return null;
}
public Set<GadgetSet> getSets(Gadget gadget)
{
HashSet<GadgetSet> hset = new HashSet<>();
for(GadgetSet set : _sets)
{
if(set.isPartOfSet(gadget)) hset.add(set);
}
return hset;
}
public GadgetSet getGadgetSet(Class<? extends GadgetSet> 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<Gadget> 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);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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<Item, Long> _activeBombs = new HashMap<Item, Long>();
private HashSet<Item> _gems = new HashSet<Item>();
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<Item> 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<Item> gemIterator = _gems.iterator();
while (gemIterator.hasNext())
{
Item gem = gemIterator.next();
if (!gem.isValid() || gem.getTicksLived() > 1200)
{
gem.remove();
gemIterator.remove();
}
}
}
}

View File

@ -1,5 +0,0 @@
package mineplex.core.gadget.gadgets;
public class ItemKothSword {
}

View File

@ -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));
}
}

View File

@ -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.");
}
}

View File

@ -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);
}
}

View File

@ -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<Arrow> _arrows = new HashSet<Arrow>();
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<Arrow> 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);
}
}

View File

@ -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);
}
}
}
}

View File

@ -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<Arrow> _arrows = new HashSet<Arrow>();
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<Arrow> 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());
}
}
}

View File

@ -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? Santas 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);
}
}

View File

@ -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 Lords 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());
}
}

View File

@ -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());
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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());
}
}
}

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}
}

View File

@ -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));
}
}

View File

@ -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 wheres the Roast Beast?!", LineFormat.LORE),
-3,
SkinData.THE_GRINCH.getSkull(), "The Grinch Hat");
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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));

View File

@ -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 didnt 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<Boolean>()
{
@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<RewardData>()
{
@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<Boolean>()
{
@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());
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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;

View File

@ -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<Player, Long> _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<Block> 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<Player> 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();
}
}

View File

@ -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));

View File

@ -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!"

View File

@ -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());
}

View File

@ -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<Item> _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();
*/
}
}

Some files were not shown because too many files have changed in this diff Show More