Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2015-12-13 23:46:46 -05:00
commit 8e31c79c58
194 changed files with 5481 additions and 2066 deletions

View File

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

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mineplex.Cache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -4,10 +4,10 @@ import org.bukkit.Material;
public enum CurrencyType public enum CurrencyType
{ {
Tokens(" Tokens", Material.EMERALD), Tokens("Tokens", Material.EMERALD),
Coins(" Coins", Material.DOUBLE_PLANT), Coins("Treasure Shards", Material.PRISMARINE_SHARD),
Gems(" Gems", Material.EMERALD), Gems("Gems", Material.EMERALD),
Gold(" Gold", Material.GOLD_NUGGET); Gold("Gold", Material.GOLD_NUGGET);
private String _prefix; private String _prefix;
private Material _displayMaterial; private Material _displayMaterial;

View File

@ -0,0 +1,84 @@
package mineplex.core.common.skin;
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 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 SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg=");
public final static SkinData SNOWMAN = 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 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 class C
{ {
public static final String blankLine = ChatColor.RESET + " ";
public static String Scramble = "§k"; public static String Scramble = "§k";
public static String Bold = "§l"; public static String Bold = "§l";
public static String Strike = "§m"; public static String Strike = "§m";

View File

@ -106,6 +106,11 @@ public class F
return rank.getTag(false, false); 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) public static String value(String variable, String value)
{ {
return value(0, variable, value); return value(0, variable, value);

View File

@ -2,7 +2,7 @@ package mineplex.core.common.util;
public enum LineFormat public enum LineFormat
{ {
LORE(200), CHAT(319); LORE(220), CHAT(319);
private int _length; 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) 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) 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, 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); 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; 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) public static ArrayList<String> splitLines(String[] strings, LineFormat lineFormat)
{ {
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<String>();
@ -271,10 +281,35 @@ public class UtilText
return lines; 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) public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
{ {
ArrayList<String> strings = new ArrayList<String>(); 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 = ""; String current = "";
int currentLength = 0; int currentLength = 0;
String[] split = string.split(" "); String[] split = string.split(" ");

View File

@ -3,6 +3,8 @@ package mineplex.core.common.util;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import net.minecraft.server.v1_8_R3.MinecraftServer;
public class UtilTime public class UtilTime
{ {
public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss"; public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss";
@ -41,6 +43,15 @@ public class UtilTime
default: return "th"; 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 public enum TimeUnit
{ {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <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/httpcore-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-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"/> <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

@ -35,6 +35,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
@ -81,6 +83,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_loggedIn.remove(event.getPlayer()); _loggedIn.remove(event.getPlayer());
} }
@EventHandler(priority = EventPriority.LOW)
public void playerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
player.setCustomName("");
player.setCustomNameVisible(false);
}
@EventHandler @EventHandler
public void ncpExempt(final PlayerToggleFlightEvent event) public void ncpExempt(final PlayerToggleFlightEvent event)
{ {
@ -140,7 +151,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{ {
Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next(); Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next();
for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator.hasNext();) for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator
.hasNext();)
{ {
final Entry<CheckType, Long> entry2 = innerIterator.next(); final Entry<CheckType, Long> entry2 = innerIterator.next();
@ -247,7 +259,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName); _entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
_entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[] _entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[]
{ {
newId newId
}); });
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1); sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1);
@ -349,7 +361,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{ {
newId = new Integer[] newId = new Integer[]
{ {
UtilEnt.getNewEntityId() UtilEnt.getNewEntityId()
}; };
_entityMap.get(owner.getName()).put(metaPacket.a, newId); _entityMap.get(owner.getName()).put(metaPacket.a, newId);
@ -469,8 +481,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityRiding.get(owner.getName()).remove(attachPacket.b); _entityRiding.get(owner.getName()).remove(attachPacket.b);
sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], _entityNameMap.get(owner.getName()).get(vehicleId),
_entityNameMap.get(owner.getName()).get(vehicleId), verifier, true, ids.length > 1 ? ids[0] : -1); verifier, true, ids.length > 1 ? ids[0] : -1);
} }
else else
{ {

View File

@ -16,6 +16,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Fly extends MiniPlugin implements Detector 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) if (nearBlocks)
{ {
count = 0; count = 0;

View File

@ -19,7 +19,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager; 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.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.InventoryManager; 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.shop.item.IButton;
public class OpenArrowTrails implements IButton
{
private Menu _page;
public OpenArrowTrails(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new ArrowTrailPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Arrow Trails", 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.DeathEffectPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenDeathAnimations implements IButton
{
private Menu _page;
public OpenDeathAnimations(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new DeathEffectPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.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.shop.item.IButton;
public class OpenDoubleJump implements IButton
{
private Menu _page;
public OpenDoubleJump(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new DoubleJumpPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Double Jump Effects", 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.HatPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenHats implements IButton
{
private Menu _page;
public OpenHats(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new HatPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Hats", 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 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.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

@ -1,18 +1,23 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager; 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.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
@ -36,19 +41,20 @@ public class CostumePage extends GadgetPage
{ {
int slot; int slot;
List<Class> costumeClasses = new ArrayList<Class>();
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume))
{ {
if (gadget.GetCost(CurrencyType.Coins) == -1)
continue;
OutfitGadget outfitGadget = ((OutfitGadget) gadget); OutfitGadget outfitGadget = ((OutfitGadget) gadget);
Class clazz = gadget.getClass();
if (!costumeClasses.contains(clazz)) int offset = 0;
{
costumeClasses.add(clazz); if (gadget instanceof OutfitRaveSuit) offset = 0;
} else if (gadget instanceof OutfitSpaceSuit) offset = 1;
else offset = 2;
slot = (costumeClasses.indexOf(clazz) * 2) + 3 + 18;
slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down
if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest) if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest)
slot += 9; 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.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

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

@ -4,9 +4,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; 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.account.CoreClientManager;
import mineplex.core.common.CurrencyType; 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.DeactivateGadgetButton;
import mineplex.core.cosmetic.ui.button.GadgetButton; import mineplex.core.cosmetic.ui.button.GadgetButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.MorphNotch;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.HatGadget;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
@ -69,68 +72,211 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
protected void addGadget(Gadget gadget, int slot) protected void addGadget(Gadget gadget, int slot)
{ {
if (gadget instanceof MorphNotch) if (gadget instanceof MorphBlock)
{
//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)
{ {
//Prevent stacker bug
if (getPlayer().getPassenger() != null) if (getPlayer().getPassenger() != null)
return; return;
} }
List<String> itemLore = new ArrayList<String>(); 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)
{
}
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription())); itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGray + 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.cGray + 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) if (gadget instanceof ItemGadget)
{ {
ItemGadget itemGadget = (ItemGadget)gadget;
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Right-Click To Purchase:"); itemLore.add(C.cWhite + "You Have: " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins");
itemLore.add(C.cBlack); boolean canAffordAmmo = true;
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); 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.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()) || getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()) > 0) if(gadget instanceof HatGadget)
{
ItemStack item = ((HatGadget)gadget).getHelmetItem();
ItemMeta im = item.getItemMeta();
im.setDisplayName(C.cGreen + C.Bold + gadget.GetName());
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));
}
return;
}
//Standard
if (gadget.ownsGadget(getPlayer()))
{ {
if (gadget.GetActive().contains(getPlayer())) 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)); 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 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)); 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 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)) 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 itemLore.add(C.cBlack);
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.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) 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()) if(getClientManager().Get(player).isDisguised())
{ {
UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!")); UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!"));

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.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

@ -1,20 +1,30 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import java.util.EnumMap;
import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilUI;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; 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.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.OpenGadgets;
import mineplex.core.cosmetic.ui.button.OpenHats;
import mineplex.core.cosmetic.ui.button.OpenMorphs; import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts; import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenMusic; import mineplex.core.cosmetic.ui.button.OpenMusic;
@ -25,6 +35,7 @@ import mineplex.core.donation.Donor;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
@ -43,124 +54,195 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
Donor donor = getDonationManager().Get(getPlayer()); // Donor donor = getDonationManager().Get(getPlayer());
// addItem(2, new ShopItem(CurrencyType.Gems.GetDisplayMaterial(), donor.GetGems() + " Gems", new String[] { // addItem(2, new ShopItem(CurrencyType.Gems.GetDisplayMaterial(), donor.GetGems() + " Gems", new String[] {
// " " // " "
// }, 1, false)); // }, 1, false));
int[] slots = UtilUI.getIndicesFor(12, 1);
int particleSlot = slots[0];
int arrowSlot = slots[1];
int jumpSlot = slots[2];
int deathSlot = slots[3];
int gadgetSlot = slots[4];
int morphSlot = slots[5];
int mountSlot = slots[6];
int petSlot = slots[7];
int hatSlot = slots[8];
int costumeSlot = slots[9];
int musicSlot = slots[10];
int tauntSlot = slots[11];
addItem(4, new ShopItem(175, getDonationManager().Get(getPlayer().getName()).getCoins() + " Coins", new String[] 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)
{ {
" ", if (gadget.ownsGadget(getPlayer()))
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()
{ {
public void onClick(Player player, ClickType clickType) ownedCount.put(type, ownedCount.get(type) + 1);
{ }
playAcceptSound(player);
gadget.Disable(player); maxCount.put(type, maxCount.get(type) + 1);
refresh(); }
} }
});
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
if(gadget != null) enabled.put(type, gadget);
// addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[0], 1, false, false),
// new IButton()
// {
// public void onClick(Player player, ClickType clickType) {
// playAcceptSound(player);
// gadget.Disable(player);
// refresh();
// };
// });
} }
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 (mount.HasMount(getPlayer()))
{
mountOwned++;
}
addButton(20 + 9, mountMax++;
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();
}
});
} }
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()); if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
{
petOwned++;
}
addButton(24 + 9, petMax++;
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();
}
});
} }
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), enabled.get(type));
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this));
if (enabled.containsKey(type)) addGlow(particleSlot);
type = GadgetType.ArrowTrail;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this));
if (enabled.containsKey(type)) addGlow(arrowSlot);
type = GadgetType.DoubleJump;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this));
if (enabled.containsKey(type)) addGlow(jumpSlot);
type = GadgetType.Death;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this));
if (enabled.containsKey(type)) addGlow(deathSlot);
type = GadgetType.Item;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this));
if (enabled.containsKey(type)) addGlow(gadgetSlot);
type = GadgetType.Morph;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this));
if (enabled.containsKey(type)) addGlow(morphSlot);
lore = getLore(mountOwned, mountMax, mountActive == null ? null : mountActive.GetName());
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this));
if (mountActive != null) addGlow(mountSlot);
lore = getLore(petOwned, petMax, 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), enabled.get(type));
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this));
if (enabled.containsKey(type)) addGlow(hatSlot);
type = GadgetType.Costume;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this));
if (enabled.containsKey(type)) addGlow(costumeSlot);
type = GadgetType.MusicDisc;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this));
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()); @Override
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName(); public void onClick(Player player, ClickType clickType)
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() player.sendMessage(F.main("Shop", "Coming soon!"));
{ }
public void onClick(Player player, ClickType clickType) });
{
playAcceptSound(player); // if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
getPlugin().getPetManager().RemovePet(player, true); // {
refresh(); // Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
} // String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
}); // addButton(25 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), C.mItem + petName, new String[0], 1, false, false),
// new IButton()
// {
// public void onClick(Player player, ClickType clickType)
// {
// playAcceptSound(player);
// getPlugin().getPetManager().RemovePet(player, true);
// refresh();
// }
// });
// }
}
private String[] getLore(int ownedCount, int maxCount, Gadget enabled)
{
return getLore(ownedCount, maxCount, enabled == null ? null : enabled.GetName());
}
private String[] getLore(int ownedCount, int maxCount, String enabled)
{
if (enabled != null)
{
return UtilText.splitLinesToArray(new String[] {
C.blankLine,
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount,
C.blankLine,
C.cWhite + "Active: " + C.cGreen + enabled,
C.cWhite + "Right Click to Disable",
C.blankLine,
C.cWhite + "Left Click to View Category"
}, LineFormat.LORE);
}
else
{
return UtilText.splitLinesToArray(new String[] {
C.blankLine,
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount,
C.blankLine,
C.cWhite + "Left Click to View Category"
}, LineFormat.LORE);
} }
} }

View File

@ -37,6 +37,8 @@ public class MorphPage extends GadgetPage
if (slot == 26) if (slot == 26)
slot = 28; slot = 28;
if (slot == 35)
slot = 37;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() 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 class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{ {
super(plugin, shop, clientManager, donationManager, name, player, 54); super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage(); buildPage();
} }
protected void buildPage() protected void buildPage()
{ {
int slot = 19; int slot = 19;
for (Mount<?> mount : getPlugin().getMountManager().getMounts()) for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{ {
addMount(mount, slot); addMount(mount, slot);
slot++; slot++;
if (slot == 26) if (slot == 26)
slot = 28; slot = 28;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{ {
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
} }
}); });
} }
protected void addMount(Mount<?> mount, int slot) protected void addMount(Mount<?> mount, int slot)
{ {
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
if (mount.GetCost(CurrencyType.Coins) != -1) itemLore.add(C.cBlack);
{ itemLore.addAll(Arrays.asList(mount.GetDescription()));
itemLore.add(C.cYellow + mount.GetCost(CurrencyType.Coins) + " Coins");
} if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
itemLore.add(C.cBlack); if (mount.GetCost(CurrencyType.Coins) == -1)
itemLore.addAll(Arrays.asList(mount.GetDescription())); {
//Nothing
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) }
{ //Chest Unlocks
if (mount.GetActive().containsKey(getPlayer())) else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0)
{ {
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Deactivate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); itemLore.add(C.cBlack);
} itemLore.add(C.cBlue + "Found in Treasure Chests");
else }
{ else if (mount.GetCost(CurrencyType.Coins) == -3)
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Activate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); {
} itemLore.add(C.cBlack);
} itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
else }
{ else if (mount.GetCost(CurrencyType.Coins) == -4)
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)); itemLore.add(C.cBlack);
else itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
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)); }
} 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

@ -61,27 +61,60 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
//Halloween Name itemLore.add(C.cBlack);
if (pet.GetCost(CurrencyType.Coins) == -1) itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!");
//Chest Unlocks
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
{ {
if (pet instanceof Pumpkin) if (pet.GetCost(CurrencyType.Coins) == -1)
{ {
itemLore.add(C.cBlack); //Nothing
itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King"); }
itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Halloween Horror Event.");
} else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0)
if (pet instanceof Elf) {
{ itemLore.add(C.cBlack);
itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests");
itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King"); }
itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Christmas Chaos Event."); else if (pet.GetCost(CurrencyType.Coins) == -3)
} {
if (pet.GetPetType() == EntityType.WITHER) itemLore.add(C.cBlack);
{ itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
itemLore.add(C.cBlack); }
itemLore.add(ChatColor.RESET + C.cGreen + "Unlocked with Legend Rank"); 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 //Owned
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) 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()) 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(), 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())); itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
addGlow(slot); addGlow(slot);
} }
else else
{ {
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), 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)); itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
} }
} }
//Not Owned //Not Owned
else else
{ {
//Cost Lore
if (pet.GetCost(CurrencyType.Coins) > 0) 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)); 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 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++; 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.Iterator;
import java.util.Map.Entry; 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.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -73,11 +44,39 @@ import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.disguise.disguises.DisguiseRabbit;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketVerifier;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
import mineplex.core.packethandler.PacketVerifier;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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 public class DisguiseManager extends MiniPlugin implements IPacketHandler
{ {
@ -382,9 +381,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
for (Player player : players) for (Player player : players)
addViewerToDisguise(disguise, player, false); 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()); _blockedNames.add(((Player) disguise.GetEntity()).getName());
} }

View File

@ -2,29 +2,25 @@ package mineplex.core.disguise.disguises;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockFace; 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 com.mojang.authlib.GameProfile;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilServer;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet; 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.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; 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.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
import net.minecraft.server.v1_8_R3.WorldSettings;
public class DisguisePlayer extends DisguiseHuman public class DisguisePlayer extends DisguiseHuman
{ {
private GameProfile _profile; private GameProfile _profile;
private boolean _sneaking; private boolean _sneaking;
private BlockFace _sleeping; private BlockFace _sleeping;
private boolean _sendSkinToSelf;
public DisguisePlayer(org.bukkit.entity.Entity entity) public DisguisePlayer(org.bukkit.entity.Entity entity)
{ {
@ -46,6 +42,29 @@ public class DisguisePlayer extends DisguiseHuman
_profile = newProfile; _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() public BlockFace getSleepingDirection()
{ {

View File

@ -1,73 +1,9 @@
package mineplex.core.gadget; package mineplex.core.gadget;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
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 org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -82,6 +18,48 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.java.JavaPlugin; 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.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 public class GadgetManager extends MiniPlugin
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
@ -100,6 +78,8 @@ public class GadgetManager extends MiniPlugin
private NautHashMap<Player, Long> _lastMove = new NautHashMap<Player, Long>(); private NautHashMap<Player, Long> _lastMove = new NautHashMap<Player, Long>();
private NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<Player, NautHashMap<GadgetType, Gadget>>(); private NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<Player, NautHashMap<GadgetType, Gadget>>();
private HashSet<GadgetSet> _sets = new HashSet<>();
private boolean _hideParticles = false; private boolean _hideParticles = false;
private int _activeItemSlot = 3; private int _activeItemSlot = 3;
private boolean _gadgetsEnabled = true; private boolean _gadgetsEnabled = true;
@ -122,6 +102,19 @@ public class GadgetManager extends MiniPlugin
_mountManager = mountManager; _mountManager = mountManager;
CreateGadgets(); 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() private void CreateGadgets()
@ -139,17 +132,21 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoinBomb(this)); addGadget(new ItemCoinBomb(this));
addGadget(new ItemPaintbrush(this)); addGadget(new ItemPaintbrush(this));
addGadget(new ItemDuelingSword(this)); addGadget(new ItemDuelingSword(this));
addGadget(new ItemPartyPopper(this));
addGadget(new ItemCoal(this));
addGadget(new ItemFreezeCannon(this));
addGadget(new ItemSnowball(this));
// Costume // Costume
addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitRaveSuitHelmet(this));
addGadget(new OutfitRaveSuit(this, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); addGadget(new OutfitRaveSuitChestplate(this));
addGadget(new OutfitRaveSuit(this, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0)); addGadget(new OutfitRaveSuitLeggings(this));
addGadget(new OutfitRaveSuit(this, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0)); addGadget(new OutfitRaveSuitBoots(this));
addGadget(new OutfitSpaceSuit(this, "Space Helmet", -2, ArmorSlot.Helmet, Material.GLASS, (byte)0)); addGadget(new OutfitSpaceSuitHelmet(this));
addGadget(new OutfitSpaceSuit(this, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0)); addGadget(new OutfitSpaceSuitChestplate(this));
addGadget(new OutfitSpaceSuit(this, "Space Pants", -2, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0)); addGadget(new OutfitSpaceSuitLeggings(this));
addGadget(new OutfitSpaceSuit(this, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0)); addGadget(new OutfitSpaceSuitBoots(this));
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); 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)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0));
@ -171,6 +168,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphBunny(this)); addGadget(new MorphBunny(this));
addGadget(new MorphSlime(this, _achievementManager)); addGadget(new MorphSlime(this, _achievementManager));
addGadget(new MorphTitan(this)); addGadget(new MorphTitan(this));
addGadget(new MorphSnowman(this));
// Particles // Particles
addGadget(new ParticleFoot(this)); addGadget(new ParticleFoot(this));
@ -182,9 +180,33 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleHeart(this)); addGadget(new ParticleHeart(this));
addGadget(new ParticleFairy(this)); addGadget(new ParticleFairy(this));
addGadget(new ParticleLegend(this)); addGadget(new ParticleLegend(this));
addGadget(new ParticleBlizzard(this)); addGadget(new ParticleFrostLord(this));
addGadget(new ParticleTitan(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 // Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
@ -200,6 +222,42 @@ public class GadgetManager extends MiniPlugin
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000)); 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) private void addGadget(Gadget gadget)
{ {
if (!_gadgets.containsKey(gadget.getGadgetType())) if (!_gadgets.containsKey(gadget.getGadgetType()))
@ -231,6 +289,7 @@ public class GadgetManager extends MiniPlugin
return _gadgets.get(gadgetType); return _gadgets.get(gadgetType);
} }
// Disallows two armor gadgets in same slot. // Disallows two armor gadgets in same slot.
public void RemoveOutfit(Player player, ArmorSlot slot) public void RemoveOutfit(Player player, ArmorSlot slot)
{ {
@ -250,52 +309,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)) g.Disable(player);
{
if (gadget instanceof MorphGadget)
{
MorphGadget part = (MorphGadget) gadget;
part.Disable(player);
}
}
} }
} }
@ -391,7 +412,7 @@ public class GadgetManager extends MiniPlugin
@EventHandler @EventHandler
public void setMoving(PlayerMoveEvent event) public void setMoving(PlayerMoveEvent event)
{ {
if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0.1)
return; return;
_lastMove.put(event.getPlayer(), System.currentTimeMillis()); _lastMove.put(event.getPlayer(), System.currentTimeMillis());
@ -399,6 +420,8 @@ public class GadgetManager extends MiniPlugin
public boolean isMoving(Player player) public boolean isMoving(Player player)
{ {
if (!UtilEnt.isGrounded(player)) return true;
if (!_lastMove.containsKey(player)) if (!_lastMove.containsKey(player))
return false; return false;
@ -518,7 +541,7 @@ public class GadgetManager extends MiniPlugin
} }
@EventHandler @EventHandler
public void GadgetActivate(GadgetActivateEvent event) public void GadgetActivate(GadgetEnableEvent event)
{ {
if (!_gadgetsEnabled) if (!_gadgetsEnabled)
event.setCancelled(true); 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.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class GadgetActivateEvent extends Event public class GadgetEnableEvent extends Event
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Player _player; private Player _player;
private Gadget _gadget; private Gadget _gadget;
private boolean _cancelled = false; private boolean _cancelled = false;
public GadgetActivateEvent(Player player, Gadget gadget) public GadgetEnableEvent(Player player, Gadget gadget)
{ {
_player = player; _player = player;
_gadget = gadget; _gadget = gadget;
@ -41,7 +42,7 @@ public class GadgetActivateEvent extends Event
{ {
return _player; return _player;
} }
public void setCancelled(boolean cancel) public void setCancelled(boolean cancel)
{ {
_cancelled = 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.SNOW_BALL, (byte)0);
}
@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.SNOW_BALL, (byte)0);
}
@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.SNOW_BALL, (byte)0);
}
@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());
}
}

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, "Snowmans 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -13,16 +13,19 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -36,11 +39,8 @@ public class ItemBatGun extends ItemGadget
public ItemBatGun(GadgetManager manager) public ItemBatGun(GadgetManager manager)
{ {
super(manager, "Bat Blaster", new String[] super(manager, "Bat Blaster",
{ UtilText.splitLineToArray(C.cGray + "Unleash waves of terrifying bats at people you don't like!", LineFormat.LORE),
C.cWhite + "Launch waves of annoying bats",
C.cWhite + "at people you don't like!",
},
-1, -1,
Material.IRON_BARDING, (byte)0, 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)); 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,253 @@
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
{
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 = 250;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 250)
{
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(), -250);
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 = 1000;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 1000)
{
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);
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(), -1000);
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 = 2500;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 2500)
{
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(), -2500);
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.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -17,12 +17,15 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -34,27 +37,23 @@ public class ItemCoinBomb extends ItemGadget
public ItemCoinBomb(GadgetManager manager) public ItemCoinBomb(GadgetManager manager)
{ {
super(manager, "Coin Party Bomb", new String[] 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),
C.cWhite + "It's party time! You will be",
C.cWhite + "everyones favourite player",
C.cWhite + "when you use one of these!",
},
-1, -1,
Material.getMaterial(175), (byte)0, Material.PRISMARINE, (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)); 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 @Override
public void ActivateCustom(Player player) 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); UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
_active.put(item, System.currentTimeMillis()); _active.put(item, System.currentTimeMillis());
//Inform //Inform
for (Player other : UtilServer.getPlayers()) 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 @EventHandler
@ -73,11 +72,11 @@ public class ItemCoinBomb extends ItemGadget
if (UtilTime.elapsed(time, 3000)) if (UtilTime.elapsed(time, 3000))
{ {
if (Math.random() > 0.80) 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 else
item.getWorld().playSound(item.getLocation(), Sound.FIREWORK_LAUNCH, 1f, 1f); 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 //Velocity
long passed = System.currentTimeMillis() - time; 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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -7,6 +7,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.gadget.GadgetManager; 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.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -26,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget
@Override @Override
public void ApplyItem(Player player, boolean inform) public void ApplyItem(Player player, boolean inform)
{ {
Manager.RemoveItem(player); Manager.removeGadgetType(player, GadgetType.Item);
_active.add(player); _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.ArrayList;
import java.util.HashSet; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -34,11 +37,8 @@ public class ItemEtherealPearl extends ItemGadget
public ItemEtherealPearl(GadgetManager manager) public ItemEtherealPearl(GadgetManager manager)
{ {
super(manager, "Ethereal Pearl", new String[] super(manager, "Ethereal Pearl",
{ UtilText.splitLineToArray(C.cWhite + "These Pearls are stolen from sleeping Endermen!", LineFormat.LORE),
C.cWhite + "Take a ride through the skies",
C.cWhite + "on your very own Ethereal Pearl!",
},
-1, -1,
Material.ENDER_PEARL, (byte)0, 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)); 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.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.recharge.Recharge;
public class ItemFirework extends ItemGadget public class ItemFirework extends ItemGadget
{ {
public ItemFirework(GadgetManager manager) public ItemFirework(GadgetManager manager)
{ {
super(manager, "Fireworks", new String[] super(manager, "Fireworks",
{ UtilText.splitLineToArray(C.cWhite + "Need to celebrate? These fireworks should do the trick!", LineFormat.LORE),
C.cWhite + "Need to celebrate?!",
C.cWhite + "Use some fireworks!",
C.cWhite + "Pew pew pew!",
},
-1, -1,
Material.FIREWORK, (byte)0, 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)); 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.EntityEffect;
import org.bukkit.Material; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
@ -26,12 +29,8 @@ public class ItemFleshHook extends ItemGadget implements IThrown
{ {
public ItemFleshHook(GadgetManager manager) public ItemFleshHook(GadgetManager manager)
{ {
super(manager, "Flesh Hook", new String[] 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),
C.cWhite + "Make new friends by throwing a hook",
C.cWhite + "into their face and pulling them",
C.cWhite + "towards you!",
},
-1, -1,
Material.getMaterial(131), (byte)0, 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)); 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; 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.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; 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, 2000, 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.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -20,11 +20,14 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
@ -38,12 +41,8 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
public ItemMelonLauncher(GadgetManager manager) public ItemMelonLauncher(GadgetManager manager)
{ {
super(manager, "Melon Launcher", new String[] super(manager, "Melon Launcher",
{ UtilText.splitLineToArray(C.cWhite + "Because who doesn't want to shoot watermelons at people?!", LineFormat.LORE),
C.cWhite + "Deliciously fun!",
C.cWhite + "Eat the melon slices for a",
C.cWhite + "temporary speed boost!",
},
-1, -1,
Material.MELON_BLOCK, (byte)0, 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)); 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.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@ -21,14 +21,17 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -39,10 +42,9 @@ public class ItemPaintballGun extends ItemGadget
public ItemPaintballGun(GadgetManager manager) public ItemPaintballGun(GadgetManager manager)
{ {
super(manager, "Paintball Gun", new String[] super(manager, "Paintball Gun",
{ UtilText.splitLineToArray(C.cWhite + "PEW PEW PEW!", LineFormat.LORE),
C.cWhite + "PEW PEW PEW PEW!", -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING,
}, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING,
(byte) 0, new String[] (byte) 0, new String[]
{ {
C.cWhite + "100 Paintballs for you to shoot!" 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.ArrayList;
import java.util.Arrays; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent; 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.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.GadgetManager; 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.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -41,12 +45,8 @@ public class ItemPaintbrush extends ItemGadget
public ItemPaintbrush(GadgetManager manager) public ItemPaintbrush(GadgetManager manager)
{ {
super(manager, "Paintbrush", new String[] super(manager, "Paintbrush",
{ UtilText.splitLineToArray(C.cWhite + "Unleash your inner Bob Ross! Happy little trees!", LineFormat.LORE),
C.cWhite + "Unleash your inner creativity!",
C.cWhite + "",
C.cGreen + "Activated at a Painter NPC",
},
-3, -3,
Material.WOOD_SWORD, (byte)0, 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)); 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 @Override
public void ApplyItem(Player player, boolean inform) public void ApplyItem(Player player, boolean inform)
{ {
Manager.RemoveItem(player); Manager.removeGadgetType(player, GadgetType.Item);
_active.add(player); _active.add(player);
@ -200,7 +200,7 @@ public class ItemPaintbrush extends ItemGadget
Villager villager = (Villager)event.getRightClicked(); 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()); 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();
*/
}
}

View File

@ -0,0 +1,60 @@
package mineplex.core.gadget.gadgets.item;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
public class ItemSnowball extends ItemGadget
{
private HashSet<Snowball> _snowballs = new HashSet<>();
public ItemSnowball(GadgetManager manager)
{
super(manager, "Snowball",
UtilText.splitLineToArray(C.cWhite + "Join in on the festive fun by throwing snow at people!", LineFormat.LORE),
-1, Material.SNOW_BALL, (byte) 0, 1, new Ammo("Snowball", "1 Snowball", Material.SNOW_BALL, (byte) 0, new String[]
{
C.cWhite + "50 Snowballs for you to throw!"
}
, -3, 1));
}
@Override
public void ActivateCustom(Player player)
{
Snowball ball = player.launchProjectile(Snowball.class);
_snowballs.add(ball);
ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f);
}
@EventHandler
public void onHit(EntityDamageByEntityEvent event)
{
if(!_snowballs.contains(event.getDamager())) return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity());
if(gevent.isCancelled()) return;
UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5));
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.item;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -12,14 +12,17 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -30,11 +33,8 @@ public class ItemTNT extends ItemGadget
public ItemTNT(GadgetManager manager) public ItemTNT(GadgetManager manager)
{ {
super(manager, "TNT", new String[] super(manager, "TNT",
{ UtilText.splitLineToArray(C.cWhite + "Throwing TNT at Mineplex Staff is highly encouraged.", LineFormat.LORE),
C.cWhite + "Blow some people up!",
C.cWhite + "KABOOM!",
},
-1, -1,
Material.TNT, (byte)0, Material.TNT, (byte)0,
1000, new Ammo("TNT", "20 TNT", Material.TNT, (byte)0, new String[] { C.cWhite + "20 TNT for you to explode!" }, 500, 20)); 1000, new Ammo("TNT", "20 TNT", Material.TNT, (byte)0, new String[] { C.cWhite + "20 TNT for you to explode!" }, 500, 20));

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -19,12 +19,14 @@ import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
@ -40,15 +42,15 @@ public class MorphBat extends MorphGadget implements IThrown
{ {
public MorphBat(GadgetManager manager) public MorphBat(GadgetManager manager)
{ {
super(manager, "Bat Morph", new String[] super(manager, "Bat Morph",
UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Flap around and annoy people by", C.cGray + "Flap around and annoy people by screeching loudly into their ears!",
C.cWhite + "screeching loudly into their ears!", C.blankLine,
" ", "#" + C.cWhite + "Left-Click to use Screech",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Screech", "#" + C.cWhite + "Double Jump to use Flap",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", "#" + C.cWhite + "Sneak to use Poop",
C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop", }, LineFormat.LORE),
},
40000, 40000,
Material.SKULL_ITEM, (byte)1); Material.SKULL_ITEM, (byte)1);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -9,9 +9,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.disguise.disguises.DisguiseBlaze;
@ -24,15 +26,14 @@ public class MorphBlaze extends MorphGadget
{ {
public MorphBlaze(GadgetManager manager) public MorphBlaze(GadgetManager manager)
{ {
super(manager, "Blaze Morph", new String[] super(manager, "Blaze Morph",
UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Transforms the wearer into a fiery Blaze!", C.cGray + "Transform into a fiery Blaze, straight from the Nether!",
" ", C.blankLine,
C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Firefly", "#" + C.cWhite + "Crouch to use Firefly",
" ", }, LineFormat.LORE),
C.cPurple + "Unlocked with Hero Rank", -11,
},
-1,
Material.BLAZE_POWDER, (byte)0); Material.BLAZE_POWDER, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap; import java.util.HashMap;
@ -14,9 +14,11 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.event.StackerEvent; import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
@ -32,13 +34,13 @@ public class MorphBlock extends MorphGadget
public MorphBlock(GadgetManager manager) public MorphBlock(GadgetManager manager)
{ {
super(manager, "Block Morph", new String[] super(manager, "Block Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "The blockiest block that ever blocked.", C.cGray + "The blockiest block that ever blocked.",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block", "#" + C.cWhite + "Left Click to use Change Block",
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify", "#" + C.cWhite + "Stay Still to use Solidify",
}, }, LineFormat.LORE),
30000, 30000,
Material.EMERALD_BLOCK, (byte)0); Material.EMERALD_BLOCK, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -24,12 +24,14 @@ import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -50,18 +52,16 @@ public class MorphBunny extends MorphGadget
public MorphBunny(GadgetManager manager) public MorphBunny(GadgetManager manager)
{ {
super(manager, "Easter Bunny Morph", new String[] super(manager, "Easter Bunny Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Happy Easter!", C.cGray + "Happy Easter!",
" ", C.blankLine,
C.cYellow + "Charge Crouch" + C.cGray + " to use " + C.cGreen + "Super Jump", "#" + C.cWhite + "Charge Crouch to use Super Jump",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Hide Easter Egg", "#" + C.cWhite + "Left Click to use Hide Easter Egg",
" ", C.blankLine,
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" ,
" ", }, LineFormat.LORE),
C.cPurple + "No longer available", -5,
},
-1,
Material.MONSTER_EGG, (byte)98); Material.MONSTER_EGG, (byte)98);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
@ -17,10 +17,12 @@ import org.bukkit.util.Vector;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -33,13 +35,13 @@ public class MorphChicken extends MorphGadget
{ {
public MorphChicken(GadgetManager manager) public MorphChicken(GadgetManager manager)
{ {
super(manager, "Chicken Morph", new String[] super(manager, "Chicken Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Soar through the air like a fat Chicken!", C.cGray + "Soar through the air like a fat Chicken!",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot", "#" + C.cWhite + "Left Click to use Egg Shot",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", "#" + C.cWhite + "Double Jump to use Flap",
}, }, LineFormat.LORE),
20000, 20000,
Material.FEATHER, (byte)0); Material.FEATHER, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -7,7 +7,9 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -18,12 +20,12 @@ public class MorphCow extends MorphGadget
{ {
public MorphCow(GadgetManager manager) public MorphCow(GadgetManager manager)
{ {
super(manager, "Cow Morph", new String[] super(manager, "Cow Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "How now brown cow?", C.cGray + "How now brown cow?",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo", "#" + C.cWhite + "Left Click to use Moo",
}, }, LineFormat.LORE),
6000, 6000,
Material.LEATHER, (byte)0); Material.LEATHER, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap; import java.util.HashMap;
@ -13,11 +13,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
@ -33,15 +35,13 @@ public class MorphCreeper extends MorphGadget
public MorphCreeper(GadgetManager manager) public MorphCreeper(GadgetManager manager)
{ {
super(manager, "Creeper Morph", new String[] super(manager, "Creeper Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Transforms the wearer into a creepy Creeper!", C.cGray + "Become the creepiest of Creepers that ever creeped!",
" ", C.blankLine,
C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Detonate", C.cWhite + "Crouch to use Detonate",
" ", }, LineFormat.LORE),
C.cPurple + "Unlocked with Hero Rank", -11,
},
-1,
Material.SKULL_ITEM, (byte)4); Material.SKULL_ITEM, (byte)4);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
@ -16,8 +16,10 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
@ -29,12 +31,12 @@ public class MorphEnderman extends MorphGadget
{ {
public MorphEnderman(GadgetManager manager) public MorphEnderman(GadgetManager manager)
{ {
super(manager, "Enderman Morph", new String[] super(manager, "Enderman Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Transforms the wearer into an Enderman!", C.cGray + "Using this morph is the ultimate diet! Guaranteed instant results!",
" ", C.blankLine,
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Blink", "#" + C.cWhite + "Double Jump to use Blink",
}, }, LineFormat.LORE),
30000, 30000,
Material.ENDER_PEARL, (byte)0); Material.ENDER_PEARL, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashSet; import java.util.HashSet;
@ -11,11 +11,13 @@ import org.bukkit.event.player.*;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguisePig;
@ -31,16 +33,14 @@ public class MorphPig extends MorphGadget
public MorphPig(GadgetManager manager) public MorphPig(GadgetManager manager)
{ {
super(manager, "Pig Morph", new String[] super(manager, "Pig Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Oink. Oink. Oink.... Oink?", C.cGray + "Oink. Oink. Oink.... Oink?",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Oink", "#" + C.cWhite + "Left Click to use Oink",
C.cYellow + "Collide" + C.cGray + " to use " + C.cGreen + "Pig Bounce", "#" + C.cWhite + "Collide to use Pig Bounce",
" ", }, LineFormat.LORE),
C.cAqua + "Unlocked with Ultra Rank", -10,
},
-1,
Material.PORK, (byte)0); Material.PORK, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
@ -7,7 +7,9 @@ import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
@ -17,15 +19,11 @@ public class MorphPumpkinKing extends MorphGadget
{ {
public MorphPumpkinKing(GadgetManager manager) public MorphPumpkinKing(GadgetManager manager)
{ {
super(manager, "Pumpkin Kings Head", new String[] super(manager, "Pumpkin Kings Head", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Transforms the wearer into", C.cGray + "Transforms the wearer into the dreaded Pumpkin King!",
C.cWhite + "the dreaded Pumpkin King!", }, LineFormat.LORE),
"", -4,
C.cYellow + "Earned by defeating the Pumpkin King",
C.cYellow + "in the 2013 Halloween Horror Event.",
},
-1,
Material.PUMPKIN, (byte)0); Material.PUMPKIN, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -9,9 +9,11 @@ import org.bukkit.event.player.*;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -25,14 +27,14 @@ public class MorphSlime extends MorphGadget
public MorphSlime(GadgetManager manager, AchievementManager achievements) public MorphSlime(GadgetManager manager, AchievementManager achievements)
{ {
super(manager, "Big Larry Morph", new String[] super(manager, "Big Larry Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Become a slime like Big Larry!", C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy!\'? Well, today is your lucky day!",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Bounce", "#" + C.cWhite + "Left Click to use Bounce",
" ", C.blankLine,
C.cWhite + "+1 Slime Size for every 10 Mineplex Levels", "#" + C.cWhite + "+1 Size per 10 Mineplex Levels",
}, }, LineFormat.LORE),
80000, 80000,
Material.SLIME_BALL, (byte)0); Material.SLIME_BALL, (byte)0);

View File

@ -0,0 +1,154 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargeData;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphSnowman extends MorphGadget
{
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
public MorphSnowman(GadgetManager manager)
{
super(manager, "Olaf Morph",
UtilText.splitLinesToArray(new String[]
{
C.cGray + "Do you wanna build a snowman?",
C.cGray + "It doesn't have to be a snowman...",
C.cGray + "Or... it kind of does...",
C.blankLine,
"#" + C.cWhite + "Left-Click to use Blizzard",
"#" + C.cWhite + "Sneak to use Snow Slide",
}, LineFormat.LORE),
-3, Material.SNOW_BALL, (byte) 0);
}
@Override
public void EnableCustom(Player player)
{
this.ApplyArmor(player);
DisguiseSnowman disguise = new DisguiseSnowman(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.setCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if(!IsActive(event.getPlayer())) return;
if(!UtilEvent.isAction(event, ActionType.L)) return;
if(event.getItem() != null && event.getItem().getType() != Material.AIR) return;
if(Recharge.Instance.use(event.getPlayer(), "Blizzard", 12000, true, true))
{
event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Blizzard") + "."));
}
}
@EventHandler
public void Snow(UpdateEvent event)
{
if (event.getType() == UpdateType.FASTEST)
{
for (Player player : GetActive())
{
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
if(map == null) continue;
RechargeData data = map.get("Blizzard");
if(data == null) continue;
if(data.GetRemaining() < 10000) continue;
for (int i=0 ; i<4 ; i++)
{
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
double x = 0.1 - (UtilMath.r(20)/100d);
double y = UtilMath.r(20)/100d;
double z = 0.1 - (UtilMath.r(20)/100d);
snow.setShooter(player);
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, player);
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f);
}
}
if(event.getType() == UpdateType.TICK)
{
for (Player player : GetActive())
{
if(player.isSneaking() && UtilEnt.isGrounded(player))
{
player.setVelocity(player.getLocation().getDirection().setY(0).normalize());
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0.3f, 0.1f, 0.3f, 0, 10, ViewDist.NORMAL);
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.3f, 0.3f);
}
}
}
}
@EventHandler
public void Snowball(EntityDamageByEntityEvent event)
{
if (!(event.getDamager() instanceof Snowball))
return;
Snowball proj = (Snowball) event.getDamager();
if (!_snowball.containsKey(proj))
return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity());
if(gevent.isCancelled()) return;
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -9,9 +9,7 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -19,12 +17,13 @@ import org.bukkit.util.Vector;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -45,16 +44,14 @@ public class MorphTitan extends MorphGadget
public MorphTitan(GadgetManager manager) public MorphTitan(GadgetManager manager)
{ {
super(manager, "Elder Guardian Morph", new String[] super(manager, "Elder Guardian Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "From the depths of the sea, the", C.cGray + "From the depths of the sea, the Elder Guardian posseses powers more amazing than any seen before!",
C.cWhite + "Elder Guardian posseses powers", C.blankLine,
C.cWhite + "more amazing than any seen before!", "#" + C.cWhite + "Left-Click to use Guardians Laser",
" ", }, LineFormat.LORE),
C.cRed + "Unlocked with Titan Rank", -13,
}, Material.PRISMARINE_CRYSTALS, (byte)0);
-1,
Material.PRISMARINE_SHARD, (byte)0);
} }
@Override @Override

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -19,10 +19,12 @@ import org.bukkit.util.Vector;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseVillager;
@ -40,14 +42,14 @@ public class MorphVillager extends MorphGadget implements IThrown
public MorphVillager(GadgetManager manager) public MorphVillager(GadgetManager manager)
{ {
super(manager, "Villager Morph", new String[] super(manager, "Villager Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "HURRRR! MURR HURRR!", C.cGray + "HURRRR! MURR HURRR!",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Gem Throw", "#" + C.cWhite + "Left Click to use Gem Throw",
" ", C.blankLine,
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems" "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems"
}, }, LineFormat.LORE),
12000, 12000,
Material.EMERALD, (byte)0); Material.EMERALD, (byte)0);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.morph;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -6,10 +6,12 @@ import java.util.Iterator;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -43,15 +45,13 @@ public class MorphWither extends MorphGadget
public MorphWither(GadgetManager manager) public MorphWither(GadgetManager manager)
{ {
super(manager, "Wither Morph", new String[] super(manager, "Wither Morph", UtilText.splitLinesToArray(new String[]
{ {
C.cWhite + "Become a legendary Wither!", C.cGray + "Legends have foretold the coming of a powerful Wither...",
" ", C.blankLine,
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull", "#" + C.cWhite + "Left Click to use Wither Skull",
" ", }, LineFormat.LORE),
C.cGreen + "Unlocked with Legend Rank", -12,
},
-1,
Material.SKULL_ITEM, (byte)1); Material.SKULL_ITEM, (byte)1);
} }

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets.outfit;
import java.util.HashMap; import java.util.HashMap;
@ -11,9 +11,14 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -27,7 +32,9 @@ public class OutfitRaveSuit extends OutfitGadget
public OutfitRaveSuit(GadgetManager manager, String name, public OutfitRaveSuit(GadgetManager manager, String name,
int cost, ArmorSlot slot, Material mat, byte data) int cost, ArmorSlot slot, Material mat, byte data)
{ {
super(manager, name, new String[] {ChatColor.RESET + "Wear the complete set for",ChatColor.RESET + "awesome bonus effects!", ChatColor.RESET + "Bonus coming soon..."}, cost, slot, mat, data); super(manager, name,
UtilText.splitLineToArray(C.cWhite + "There's nothing more suitable for celebration than this high tech flashing outfit!", LineFormat.LORE),
cost, slot, mat, data);
} }
@Override @Override
@ -155,4 +162,18 @@ public class OutfitRaveSuit extends OutfitGadget
{ {
_colorPhase.remove(event.getPlayer().getName()); _colorPhase.remove(event.getPlayer().getName());
} }
@EventHandler
public void setBonus(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetSlot() != ArmorSlot.Helmet)
return;
for (Player player : UtilServer.getPlayers())
if (getSet() != null && getSet().isActive(player))
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 39, 4, true, false), true);
}
} }

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitRaveSuitBoots extends OutfitRaveSuit
{
public OutfitRaveSuitBoots(GadgetManager manager)
{
super(manager, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0);
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitRaveSuitChestplate extends OutfitRaveSuit
{
public OutfitRaveSuitChestplate(GadgetManager manager)
{
super(manager, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0);
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitRaveSuitHelmet extends OutfitRaveSuit
{
public OutfitRaveSuitHelmet(GadgetManager manager)
{
super(manager, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0);
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitRaveSuitLeggings extends OutfitRaveSuit
{
public OutfitRaveSuitLeggings(GadgetManager manager)
{
super(manager, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0);
}
}

View File

@ -0,0 +1,55 @@
package mineplex.core.gadget.gadgets.outfit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class OutfitSpaceSuit extends OutfitGadget
{
public OutfitSpaceSuit(GadgetManager manager, String name,
int cost, ArmorSlot slot, Material mat, byte data)
{
super(manager, name,
UtilText.splitLineToArray(C.cWhite + "Designed specifically for combat in deep space for a sport known as \'Gravity\'", LineFormat.LORE),
cost, slot, mat, data);
}
@Override
public void EnableCustom(Player player)
{
ApplyArmor(player);
}
@Override
public void DisableCustom(Player player)
{
RemoveArmor(player);
}
@EventHandler
public void setBonus(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetSlot() != ArmorSlot.Helmet)
return;
for (Player player : UtilServer.getPlayers())
if (getSet() != null && getSet().isActive(player))
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 39, 7, true, false), true);
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitSpaceSuitBoots extends OutfitSpaceSuit
{
public OutfitSpaceSuitBoots(GadgetManager manager)
{
super(manager, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0);
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit;
import mineplex.core.gadget.GadgetManager;
import org.bukkit.Material;
public class OutfitSpaceSuitChestplate extends OutfitSpaceSuit
{
public OutfitSpaceSuitChestplate(GadgetManager manager)
{
super(manager, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0);
}
}

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