Merge branches 'feature/report' and 'master' of ssh://184.154.0.242:7999/min/mineplex into feature/report

# Conflicts:
#	Plugins/.idea/modules.xml
#	Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java
This commit is contained in:
Keir 2015-12-16 14:07:56 +00:00
commit 6f82f8349d
354 changed files with 11747 additions and 3583 deletions

BIN
Art/BlackFriday.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
Art/ChristmasChaos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

BIN
Art/ClansBanner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 KiB

BIN
Art/TitanLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

BIN
Art/WinterTreasure.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
Art/WinterTreasureTrim.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
Art/y5O7WYh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
Art/zKzkfLE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

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

View File

@ -5,8 +5,8 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.playerCache.PlayerCache;
import mineplex.playerCache.PlayerInfo;
import mineplex.cache.player.PlayerCache;
import mineplex.cache.player.PlayerInfo;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;

View File

@ -9,7 +9,7 @@ import java.sql.Statement;
import java.util.UUID;
import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.playerCache.PlayerInfo;
import mineplex.cache.player.PlayerInfo;
public class PlayerStatsRepository
{

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

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

@ -1,4 +1,4 @@
package mineplex.playerCache;
package mineplex.cache.player;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package mineplex.playerCache;
package mineplex.cache.player;
import java.util.UUID;

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,97 @@
package mineplex.core.common.skin;
import java.util.List;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MinecraftKey;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.NBTTagList;
import net.minecraft.server.v1_8_R3.NBTTagString;
public class SkinData
{
private static long _nameCount = -99999999999999L;
public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ=");
public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg=");
public final static SkinData SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU=");
public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU=");
public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc=");
public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ=");
private Property _skinProperty;
public SkinData(String value, String signature)
{
_skinProperty = new Property("textures", value, signature);
}
public SkinData(GameProfile profile)
{
_skinProperty = profile.getProperties().get("textures").iterator().next();
}
public SkinData(Player player)
{
this(((CraftPlayer)player).getProfile());
}
public ItemStack getSkull()
{
NBTTagCompound arrayElement = new NBTTagCompound();
arrayElement.setString("Value", _skinProperty.getValue());
arrayElement.setString("Signature", _skinProperty.getSignature());
NBTTagList textures = new NBTTagList();
textures.add(arrayElement);
NBTTagCompound properties = new NBTTagCompound();
properties.set("textures", textures);
NBTTagCompound skullOwner = new NBTTagCompound();
skullOwner.set("Properties", properties);
skullOwner.set("Name", new NBTTagString(getUnusedSkullName()));
NBTTagCompound tag = new NBTTagCompound();
tag.set("SkullOwner", skullOwner);
net.minecraft.server.v1_8_R3.ItemStack nmsItem = new net.minecraft.server.v1_8_R3.ItemStack(Item.REGISTRY.get(new MinecraftKey("skull")), 1, 3);
nmsItem.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItem);
}
public ItemStack getSkull(String name, List<String> lore)
{
ItemStack stack = getSkull();
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(name);
meta.setLore(lore);
stack.setItemMeta(meta);
return stack;
}
public Property getProperty()
{
return new Property(_skinProperty.getName(), _skinProperty.getValue(), _skinProperty.getSignature());
}
public static String getUnusedSkullName()
{
_nameCount++;
return "_" + _nameCount;
}
}

View File

@ -4,6 +4,8 @@ import org.bukkit.ChatColor;
public class C
{
public static final String blankLine = ChatColor.RESET + " ";
public static String Scramble = "§k";
public static String Bold = "§l";
public static String Strike = "§m";

View File

@ -106,6 +106,11 @@ public class F
return rank.getTag(false, false);
}
public static String value(String variable, int value)
{
return value(variable, "" + value);
}
public static String value(String variable, String value)
{
return value(0, variable, value);

View File

@ -0,0 +1,18 @@
package mineplex.core.common.util;
public enum LineFormat
{
LORE(220), CHAT(319);
private int _length;
private LineFormat(int length)
{
_length = length;
}
public int getLength()
{
return _length;
}
}

View File

@ -835,7 +835,7 @@ public class UtilBlock
return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null;
}
public static HashSet<Block> findConnectedBlocks(Block block, HashSet<Block> blocks, int limit)
public static HashSet<Block> findConnectedBlocks(Block source, Block block, HashSet<Block> blocks, int limit, double range)
{
if (blocks == null)
blocks = new HashSet<Block>();
@ -852,10 +852,13 @@ public class UtilBlock
{
if (neighbour.getType() == Material.AIR)
continue;
if (UtilMath.offset(source.getLocation(), neighbour.getLocation()) > range)
continue;
//If neighbour hasn't been searched, recursively search it!
if (!blocks.contains(neighbour))
findConnectedBlocks(neighbour, blocks, limit);
findConnectedBlocks(source, neighbour, blocks, limit, range);
}
return blocks;

View File

@ -12,6 +12,7 @@ import java.util.Map.Entry;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.structs.ItemContainer;
@ -1116,4 +1117,12 @@ public class UtilItem
{
return _materials.containsKey(material);
}
public static ItemStack makeUnbreakable(ItemStack i)
{
ItemMeta im = i.getItemMeta();
im.spigot().setUnbreakable(true);
i.setItemMeta(im);
return i;
}
}

View File

@ -249,12 +249,30 @@ public class UtilParticle
public static void PlayParticleToAll(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist)
{
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers());
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(type, location, x, y, z, speed, count, dist, UtilServer.getPlayers());
}
public static void PlayParticle(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist, Player... players)
{
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, players);
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(type, location, x, y, z, speed, count, dist, players);
}
public static void PlayParticleToAll(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
@ -283,4 +301,26 @@ public class UtilParticle
UtilPlayer.sendPacket(player, packet);
}
}
public static void PlayParticleToAll(String particle, Location location, Vector offset, float speed, int count, ViewDist dist)
{
float x = 0;
float y = 0;
float z = 0;
if(offset != null)
{
x = (float) offset.getX();
y = (float) offset.getY();
z = (float) offset.getZ();
}
PlayParticle(particle, location, x, y, z, speed, count, dist, UtilServer.getPlayers());
}
public static void PlayParticleToAll(String particle, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count, ViewDist dist)
{
PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers());
}
}

View File

@ -1,52 +1,487 @@
package mineplex.core.common.util;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import javax.imageio.ImageIO;
import mineplex.core.common.CurrencyType;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Material;
import org.bukkit.ChatColor;
public class UtilText {
public static <T> String listToString(Collection<T> inputList, boolean comma) {
String out = "";
public class UtilText
{
private static HashMap<Character, Integer> _characters = new HashMap<Character, Integer>();
for (T cur : inputList) {
out += cur.toString() + (comma ? ", " : " ");
static
{
try
{
InputStream inputStream = CurrencyType.class.getResourceAsStream("ascii.png");
BufferedImage image = ImageIO.read(inputStream);
char[] text = new char[]
{
' ',
'!',
'"',
'#',
'$',
'%',
'&',
'\'',
'(',
')',
'*',
'+',
',',
'-',
'.',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
'<',
'=',
'>',
'?',
'@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
'[',
'\\',
']',
'^',
'_',
'`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
'{',
'|',
'}',
'~'
};
int x = 0;
int y = 16;
for (char c : text)
{
grab(c, image, x, y);
if (x < 15 * 8)
{
x += 8;
}
else
{
x = 0;
y += 8;
}
}
inputStream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static String center(String string, LineFormat lineFormat)
{
int length = getLength(string);
if (length > lineFormat.getLength())
{
return string;
}
if (out.length() > 0) {
out = out.substring(0, out.length() - (comma ? 2 : 1));
// Get the number of empty pixels on both sides of the string
int div = (int) Math.floor((lineFormat.getLength() - length) / 2D);
div -= 2; // For the gap between the strings
return fillLine(" ", div) + string + fillLine(" ", div);
}
public static String alignRight(String string, LineFormat lineFormat)
{
int length = getLength(string);
if (length > lineFormat.getLength())
{
return string;
}
return out;
// Get the number of empty pixels on both sides of the string
int div = lineFormat.getLength() - length;
div -= 1; // For the gap between the strings
return fillLine(" ", div) + string;
}
public static String centerChat(String string, LineFormat lineFormat)
{
int length = getLength(string);
if (length > lineFormat.getLength())
{
return string;
}
// Get the number of empty pixels on both sides of the string
int div = (int) Math.floor(((lineFormat.getLength() + 10) - length) / 2D);
div -= 2; // For the gap between the strings
return fillLine(" ", div) + string;
}
public static String substringPixels(String string, int cutoff)
{
int len = 0;
char[] array = string.toCharArray();
boolean bold = false;
for (int i = 0; i < array.length; i++)
{
char c = array[i];
if (c == '<27>')
{
if (++i < array.length)
{
ChatColor color = ChatColor.getByChar(array[i]);
if (color != null)
{
if (color.equals(ChatColor.BOLD))
{
bold = true;
}
else if (color.equals(ChatColor.RESET) || color.isColor())
{
bold = false;
}
}
}
continue;
}
if (!_characters.containsKey(c))
{
continue;
}
int toAdd = _characters.get(c);
if (bold)
{
toAdd++;
}
if (len + toAdd > cutoff)
{
return string.substring(0, Math.max(0, i - 1));
}
if (i + 1 < array.length)
{
len++;
}
}
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 int upperCaseCount(String input) {
int count = 0;
for (int k = 0; k < input.length(); k++) {
char ch = input.charAt(k);
if (Character.isUpperCase(ch))
count++;
public static ArrayList<String> splitLines(String[] strings, LineFormat lineFormat)
{
ArrayList<String> lines = new ArrayList<String>();
for (String s : strings)
{
lines.addAll(splitLine(s, lineFormat));
}
return count;
return lines;
}
public static int lowerCaseCount(String input) {
int count = 0;
public static String[] splitLineToArray(String string, LineFormat lineFormat)
{
ArrayList<String> lineList = splitLine(string, lineFormat);
for (int k = 0; k < input.length(); k++) {
char ch = input.charAt(k);
if (Character.isLowerCase(ch))
count++;
String[] lineArray = new String[lineList.size()];
lineArray = lineList.toArray(lineArray);
return lineArray;
}
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
{
ArrayList<String> strings = new ArrayList<String>();
//Ignore lines with #
if (string.startsWith("#"))
{
strings.add(string.substring(1, string.length()));
return strings;
}
return count;
//Empty
if (string.equals("") || string.equals(" "))
{
strings.add(string);
return strings;
}
String current = "";
int currentLength = 0;
String[] split = string.split(" ");
String colors = "";
for (int i = 0; i < split.length; i++)
{
String word = split[i];
int wordLength = getLength(colors + word);
if (currentLength + wordLength + 4 > lineFormat.getLength() && !current.isEmpty())
{
strings.add(current);
current = colors + word;
currentLength = wordLength + 1;
continue;
}
if (i != 0)
{
current += " ";
currentLength += 4;
}
current += word;
currentLength += wordLength;
colors = ChatColor.getLastColors(current);
}
if (!current.isEmpty())
{
strings.add(current);
}
return strings;
}
public static String fillLine(String filler, int maxPixels)
{
int pixels = getLength(filler);
if (pixels <= 0)
{
return "";
}
String toReturn = "";
int currentLen = 0;
int offset = maxPixels % 4;
boolean isOffset = false;
if (offset > 0)
{
toReturn += C.Bold;
}
while (currentLen + pixels <= maxPixels)
{
currentLen += pixels + 1;
toReturn += filler;
if (offset-- > 0)
{
currentLen++;
if (offset == 0)
{
isOffset = false;
toReturn += ChatColor.RESET;
}
}
}
if (isOffset)
{
toReturn += ChatColor.RESET;
}
return toReturn;
}
public static boolean fitsOneLine(String string, LineFormat lineFormat)
{
return getLength(string) <= lineFormat.getLength();
}
public static int getLength(String string)
{
int len = 0;
char[] array = string.toCharArray();
boolean bold = false;
for (int i = 0; i < array.length; i++)
{
char c = array[i];
if (c == '<27>')
{
if (++i < array.length)
{
ChatColor color = ChatColor.getByChar(array[i]);
if (color != null)
{
if (color.equals(ChatColor.BOLD))
{
bold = true;
}
else if (color.equals(ChatColor.RESET) || color.isColor())
{
bold = false;
}
}
}
continue;
}
if (!_characters.containsKey(c))
{
continue;
}
len += _characters.get(c);
if (bold)
{
len++;
}
if (i + 1 < array.length)
{
len++;
}
}
return len;
}
private static void grab(Character character, BufferedImage image, int imageX, int imageY)
{
if (character == ' ')
{
_characters.put(character, 3);
return;
}
for (int x = 0; x < 8; x++)
{
boolean isTransparentLine = true;
for (int y = 0; y < 8; y++)
{
int pixel = image.getRGB(imageX + x, imageY + y);
if ((pixel >> 24) != 0x00)
{
isTransparentLine = false;
break;
}
}
if (isTransparentLine)
{
_characters.put(character, x);
return;
}
}
_characters.put(character, 8);
}
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
@ -55,84 +490,136 @@ public class UtilText {
{
return newString.toLowerCase().equals(oldString.toLowerCase());
}
for (int i=0 ; i < newString.length() * matchRequirement ; i++)
for (int i = 0; i < newString.length() * matchRequirement; i++)
{
int matchFromIndex = 0;
//Look for substrings starting at i
for (int j=0 ; j < oldString.length() ; j++)
// Look for substrings starting at i
for (int j = 0; j < oldString.length(); j++)
{
//End of newString
if (i+j >= newString.length())
// End of newString
if (i + j >= newString.length())
{
break;
}
//Matched
if (newString.charAt(i+j) == oldString.charAt(j))
// Matched
if (newString.charAt(i + j) == oldString.charAt(j))
{
matchFromIndex++;
if (matchFromIndex >= newString.length() * matchRequirement)
return true;
}
//No Match > Reset
// No Match > Reset
else
{
break;
}
}
}
return false;
}
public static <T> String listToString(Collection<T> inputList, boolean comma)
{
String out = "";
for (T cur : inputList)
{
out += cur.toString() + (comma ? ", " : " ");
}
if (out.length() > 0)
{
out = out.substring(0, out.length() - (comma ? 2 : 1));
}
return out;
}
public static int lowerCaseCount(String input)
{
int count = 0;
for (int k = 0; k < input.length(); k++)
{
char ch = input.charAt(k);
if (Character.isLowerCase(ch))
count++;
}
return count;
}
public static int upperCaseCount(String input)
{
int count = 0;
for (int k = 0; k < input.length(); k++)
{
char ch = input.charAt(k);
if (Character.isUpperCase(ch))
count++;
}
return count;
}
public static String[] wrap(String text, int lineLength)
{
return wrap(text, lineLength, true);
}
public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) {
public static String[] wrap(String text, int lineLength, boolean wrapLongerWords)
{
return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0");
}
public static String repeat(String txt, int times)
{
return new String(new byte[times]).replace("\0", txt);
}
public static boolean plural(int x){
public static boolean plural(int x)
{
return x <= 0 ? true : x > 1;
}
public static String trim(int maxLength, String s) {
public static String trim(int maxLength, String s)
{
return s.length() <= maxLength ? s : s.substring(0, maxLength);
}
public static <X> String arrayToString(X[] array, String delimiter)
{
StringBuilder string = new StringBuilder();
int index = 0;
for (X x : array)
{
string.append(x.toString());
if (index != array.length - 1)
{
string.append(delimiter);
}
index++;
}
return string.toString();
}
public static <X> String arrayToString(X[] array)
{
return arrayToString(array, null);
}
}
}

View File

@ -3,6 +3,8 @@ package mineplex.core.common.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import net.minecraft.server.v1_8_R3.MinecraftServer;
public class UtilTime
{
public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss";
@ -41,6 +43,15 @@ public class UtilTime
default: return "th";
}
}
/**
*
* @return Returns the current global server tick. Is reset on server restart. Starts out negative. Counts upwards.
*/
public static int getServerTick()
{
return MinecraftServer.currentTick;
}
public enum TimeUnit
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
@ -13,7 +13,7 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,12 +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.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

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

View File

@ -35,6 +35,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
@ -81,6 +83,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_loggedIn.remove(event.getPlayer());
}
@EventHandler(priority = EventPriority.LOW)
public void playerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
player.setCustomName("");
player.setCustomNameVisible(false);
}
@EventHandler
public void ncpExempt(final PlayerToggleFlightEvent event)
{
@ -140,7 +151,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{
Entry<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();
@ -247,7 +259,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
_entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[]
{
newId
newId
});
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1);
@ -349,7 +361,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{
newId = new Integer[]
{
UtilEnt.getNewEntityId()
UtilEnt.getNewEntityId()
};
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
@ -469,8 +481,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityRiding.get(owner.getName()).remove(attachPacket.b);
sendProtocolPackets(owner, vehicleId, ids[ids.length - 1],
_entityNameMap.get(owner.getName()).get(vehicleId), verifier, true, ids.length > 1 ? ids[0] : -1);
sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], _entityNameMap.get(owner.getName()).get(vehicleId),
verifier, true, ids.length > 1 ? ids[0] : -1);
}
else
{
@ -527,9 +539,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
squidWatcher.a(0, (byte) (0 | 1 << 5));
final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
spawnPacket.a = squidId;
spawnPacket.b = (byte) EntityType.SQUID.getTypeId();
spawnPacket.c = 1000000;
spawnPacket.l = squidWatcher;
@ -543,9 +556,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
UtilPlayer.sendPacket(owner, vehiclePacket);
}
final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
spawnPacket.a = newEntityId;
spawnPacket.b = (byte) 30;
spawnPacket.c = 1000000;
spawnPacket.l = watcher;

View File

@ -9,6 +9,9 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson;
import mineplex.cache.player.PlayerCache;
import mineplex.cache.player.PlayerInfo;
import mineplex.core.MiniPlugin;
import mineplex.core.account.command.TestRank;
import mineplex.core.account.command.UpdateRank;
@ -24,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.playerCache.PlayerCache;
import mineplex.playerCache.PlayerInfo;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;

View File

@ -770,6 +770,48 @@ public enum Achievement
new String[]{"Get hit by a monster and", "land on the Safe Pad"},
new int[]{1},
AchievementCategory.MONSTER_MAZE),
GLADIATORS_HARDENED_GLADIATOR("Hardened Gladiator", 1000,
new String[]{"Gladiators.Wins"},
new String[]{"Win 50 games of Gladiators"},
new int[]{50},
AchievementCategory.GLADIATORS),
GLADIATORS_BATTLE_BRED("Battle Bred", 1500,
new String[]{"Gladiators.Wins"},
new String[]{"Win 100 games of Gladiators"},
new int[]{100},
AchievementCategory.GLADIATORS),
GLADIATORS_BRAWLER("Brawler", 1000,
new String[]{"Gladiators.Brawler"},
new String[]{"Kill 3 Gladiators", "with your bare hands"},
new int[]{3},
AchievementCategory.GLADIATORS),
// GLADIATORS_UNTOUCHABLE("Untouchable", 1500,
// new String[]{"Gladiators.Untouchable"},
// new String[]{"Kill 10 Gladiators", "without taking any damage"},
// new int[]{10},
// AchievementCategory.GLADIATORS),
// GLADIATORS_FLAWLESS("Flawless", 1000,
// new String[]{"Gladiators.Flawless"},
// new String[]{"Win a game of gladiators", "without taking any damage"},
// new int[]{1},
// AchievementCategory.GLADIATORS),
GLADIATORS_PRECISION("Precision", 800,
new String[]{"Gladiators.Precision"},
new String[]{"Don't miss a single", "arrow in a game of", "Gladiators (Minimum 3)"},
new int[]{1},
AchievementCategory.GLADIATORS),
GLADIATORS_SWIFT_KILL("Swift Kill", 1000,
new String[]{"Gladiators.SwiftKill"},
new String[]{"Earn 15 first bloods", "in Gladiators"},
new int[]{15},
AchievementCategory.GLADIATORS)
;

View File

@ -105,7 +105,7 @@ public enum AchievementCategory
ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"),
Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit"),
SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -137,7 +137,7 @@ public enum AchievementCategory
MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LAVA, 0, GameCategory.ARCADE, null),
Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null),
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -150,6 +150,10 @@ public enum AchievementCategory
MONSTER_MAZE("Monster Maze", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"),
GLADIATORS("Gladiators", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_SWORD, 0, GameCategory.ARCADE, null)
;

View File

@ -16,6 +16,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Fly extends MiniPlugin implements Detector
{
@ -128,6 +130,10 @@ public class Fly extends MiniPlugin implements Detector
}
}
for (PotionEffect effect : player.getActivePotionEffects())
if (effect.getType() == PotionEffectType.JUMP || effect.getType().equals(PotionEffectType.JUMP))
nearBlocks = true;
if (nearBlocks)
{
count = 0;

View File

@ -17,6 +17,9 @@ public class BonusAmount
private int _experience;
private int _bonusExperience;
private int _tickets;
private int _oldChests;
private int _ancientChests;
private int _mythicalChests;
public BonusAmount()
{
@ -133,19 +136,52 @@ public class BonusAmount
_tickets = tickets;
}
public int getOldChests()
{
return _oldChests;
}
public void setOldChests(int oldChests)
{
_oldChests = oldChests;
}
public int getAncientChests()
{
return _ancientChests;
}
public void setAncientChests(int ancientChests)
{
_ancientChests = ancientChests;
}
public int getMythicalChests()
{
return _mythicalChests;
}
public void setMythicalChests(int mythicalChests)
{
_mythicalChests = mythicalChests;
}
public boolean isGreaterThanZero()
{
return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0;
return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0;
}
public void addLore(List<String> lore)
{
lore.add(C.cYellow + "Rewards");
addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : ""));
addLore(lore, getCoins(), getBonusCoins(), "Coins");
addLore(lore, getCoins(), getBonusCoins(), "Treasure Shards");
addLore(lore, getGems(), getBonusGems(), "Gems");
addLore(lore, getGold(), getBonusGold(), "Gold");
addLore(lore, getExperience(), getBonusExperience(), "Experience");
addLore(lore, getOldChests(), 0, "Old Chest", "Old Chests");
addLore(lore, getAncientChests(), 0, "Ancient Chest", "Ancient Chests");
addLore(lore, getMythicalChests(), 0, "Mythical Chest", "Mythical Chests");
}
private void addLore(List<String> lore, int amount, int bonus, String suffix)
@ -156,4 +192,12 @@ public class BonusAmount
// if (bonus > 0)
// lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix);
}
private void addLore(List<String> lore, int amount, int bonus, String suffix, String plural)
{
if (amount == 1)
lore.add(" " + C.cWhite + amount + " " + plural);
else if (amount > 0)
lore.add(" " + C.cWhite + amount + " " + suffix);
}
}

View File

@ -43,6 +43,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.reward.RewardManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.TreasureType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.database.Tables;
@ -122,6 +123,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
private BonusRepository _repository;
private CoreClientManager _clientManager;
private InventoryManager _inventoryManager;
private DonationManager _donationManager;
private PollManager _pollManager;
private NpcManager _npcManager;
@ -174,6 +176,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_donationManager = donationManager;
_npcManager = npcManager;
_hologramManager = hologramManager;
_inventoryManager = inventoryManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
100, 250,
@ -673,21 +676,21 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
BonusAmount data = new BonusAmount();
if (rank.has(Rank.MODERATOR))
if (rank.has(Rank.TITAN))
{
data.setCoins(35000);
data.setMythicalChests(5);
}
if (rank.has(Rank.LEGEND))
else if (rank.has(Rank.LEGEND))
{
data.setCoins(30000);
data.setMythicalChests(3);
}
else if (rank.has(Rank.HERO))
{
data.setCoins(15000);
data.setMythicalChests(2);
}
else if (rank.has(Rank.ULTRA))
{
data.setCoins(7500);
data.setMythicalChests(1);
}
return data;
@ -722,6 +725,27 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
final int coins = amount.getTotalCoins();
final int tickets = amount.getTickets();
int experience = amount.getTotalExperience();
int oldChests = amount.getOldChests();
int ancientChests = amount.getAncientChests();
int mythicalChests = amount.getMythicalChests();
if (oldChests > 0)
{
_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests);
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests")));
}
if (ancientChests > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests);
}
if (mythicalChests > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests);
}
if (gems > 0)
{
@ -750,7 +774,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (coins > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Coins")));
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards")));
_coinQueue.add(new GiveDonorData(player.getName(), coreClient.getAccountId(), player.getUniqueId(), coins));
}

View File

@ -7,29 +7,21 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.Map;
import com.sun.org.apache.xpath.internal.operations.Bool;
import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.database.Tables;
import mineplex.database.tables.records.BonusRecord;
import org.jooq.Configuration;
import org.jooq.DSLContext;
import org.jooq.Record2;
import org.jooq.SQLDialect;
import org.jooq.TableField;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultConfiguration;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -273,7 +265,7 @@ public class BonusRepository extends RepositoryBase
final int accountId = _manager.getClientManager().Get(player).getAccountId();
final int coins = _manager.getRankBonusAmount(player).getCoins();
if (coins == 0/* && gems == 0 */) {
if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) {
result.run(false);
return;
}

View File

@ -19,7 +19,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.OutfitTeam;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.InventoryManager;

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.ArrowTrailPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
public class OpenArrowTrails extends OpenPageButton
{
public OpenArrowTrails(Menu menu, Gadget active)
{
super(menu, active);
}
@Override
protected void leftClick(Player player)
{
getMenu().getShop().openPageForPlayer(player, new ArrowTrailPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Arrow Trails", player));
}
}

View File

@ -1,23 +1,20 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.gadget.types.Gadget;
public class OpenCostumes implements IButton
public class OpenCostumes extends OpenPageButton
{
private Menu _menu;
public OpenCostumes(Menu menu)
public OpenCostumes(Menu menu, Gadget active)
{
_menu = menu;
super(menu, active);
}
@Override
public void onClick(Player player, ClickType clickType)
protected void leftClick(Player player)
{
_menu.openCostumes(player);
getMenu().openCostumes(player);
}
}

View File

@ -0,0 +1,24 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DeathEffectPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
public class OpenDeathAnimations extends OpenPageButton
{
public OpenDeathAnimations(Menu menu, Gadget active)
{
super(menu, active);
}
@Override
protected void leftClick(Player player)
{
getMenu().getShop().openPageForPlayer(player, new DeathEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Death Animations", player));
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DoubleJumpPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
public class OpenDoubleJump extends OpenPageButton
{
public OpenDoubleJump(Menu menu, Gadget active)
{
super(menu, active);
}
@Override
protected void leftClick(Player player)
{
getMenu().getShop().openPageForPlayer(player, new DoubleJumpPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Double Jump Effects", player));
}
}

View File

@ -2,23 +2,23 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenGadgets implements IButton
public class OpenGadgets extends OpenPageButton
{
private Menu _page;
public OpenGadgets(Menu page)
public OpenGadgets(Menu menu, Gadget active)
{
_page = page;
super(menu, active);
}
@Override
public void onClick(Player player, ClickType clickType)
protected void leftClick(Player player)
{
_page.getShop().openPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player));
getMenu().getShop().openPageForPlayer(player, new GadgetPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Gadgets", player));
}
}

View File

@ -0,0 +1,21 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.HatPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
public class OpenHats extends OpenPageButton
{
public OpenHats(Menu menu, Gadget active)
{
super(menu, active);
}
@Override
protected void leftClick(Player player)
{
getMenu().getShop().openPageForPlayer(player, new HatPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Hats", player));
}
}

View File

@ -2,22 +2,21 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.IButton;
import mineplex.core.gadget.types.Gadget;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenMorphs implements IButton
public class OpenMorphs extends OpenPageButton
{
private Menu _page;
public OpenMorphs(Menu page)
public OpenMorphs(Menu menu, Gadget active)
{
_page = page;
super(menu, active);
}
public void onClick(Player player, ClickType clickType)
@Override
protected void leftClick(Player player)
{
_page.getShop().openPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player));
getMenu().getShop().openPageForPlayer(player, new MorphPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Morphs", player));
}
}

View File

@ -2,6 +2,8 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
@ -9,15 +11,28 @@ import org.bukkit.event.inventory.ClickType;
public class OpenMounts implements IButton
{
private Menu _page;
public OpenMounts(Menu page)
private Menu _menu;
private Mount<?> _active;
public OpenMounts(Menu menu, Mount<?> active)
{
_page = page;
_menu = menu;
_active = active;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
if (clickType.isLeftClick())
_menu.getShop().openPageForPlayer(player, new MountPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Mounts", player));
else
{
if (_active != null)
{
_menu.playAcceptSound(player);
_active.Disable(player);
_menu.refresh();
}
}
}
}

View File

@ -4,22 +4,19 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
/**
* Created by shaun on 14-09-15.
*/
public class OpenMusic implements IButton
public class OpenMusic extends OpenPageButton
{
private Menu _menu;
public OpenMusic(Menu menu)
public OpenMusic(Menu menu, Gadget active)
{
_menu = menu;
super(menu, active);
}
public void onClick(Player player, ClickType clickType)
@Override
protected void leftClick(Player player)
{
_menu.openMusic(player);
getMenu().openMusic(player);
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
public abstract class OpenPageButton implements IButton
{
private Menu _menu;
private Gadget _active;
public OpenPageButton(Menu menu, Gadget active)
{
_active = active;
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
if (clickType.isLeftClick())
leftClick(player);
else
{
if (_active != null)
{
_menu.playAcceptSound(player);
_active.Disable(player);
_menu.refresh();
}
}
}
protected Menu getMenu()
{
return _menu;
}
protected Gadget getActive()
{
return _active;
}
protected abstract void leftClick(Player player);
}

View File

@ -2,22 +2,23 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.ParticlePage;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenParticles implements IButton
public class OpenParticles extends OpenPageButton
{
private Menu _page;
public OpenParticles(Menu page)
public OpenParticles(Menu menu, Gadget active)
{
_page = page;
super(menu, active);
}
public void onClick(Player player, ClickType clickType)
@Override
protected void leftClick(Player player)
{
_page.getShop().openPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
getMenu().getShop().openPageForPlayer(player, new ParticlePage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Particles", player));
}
}

View File

@ -1,7 +1,9 @@
package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
@ -9,16 +11,23 @@ import org.bukkit.event.inventory.ClickType;
public class OpenPets implements IButton
{
private Menu _page;
public OpenPets(Menu page)
private Menu _menu;
public OpenPets(Menu menu)
{
_page = page;
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
if (clickType.isLeftClick())
_menu.getShop().openPageForPlayer(player, new PetPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Pets", player));
else
{
_menu.playAcceptSound(player);
_menu.getPlugin().getPetManager().RemovePet(player, true);
_menu.refresh();
}
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class ArrowTrailPage extends GadgetPage
{
public ArrowTrailPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

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

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class DeathEffectPage extends GadgetPage
{
public DeathEffectPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager,
String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class DoubleJumpPage extends GadgetPage
{
public DoubleJumpPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -4,9 +4,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
@ -19,10 +22,10 @@ import mineplex.core.cosmetic.ui.button.ActivateGadgetButton;
import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton;
import mineplex.core.cosmetic.ui.button.GadgetButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.MorphBlock;
import mineplex.core.gadget.gadgets.MorphNotch;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.HatGadget;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
@ -31,33 +34,33 @@ import mineplex.core.shop.page.ShopPageBase;
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item))
{
if (gadget.GetCost(CurrencyType.Coins) == -3)
continue;
addGadget(gadget, slot);
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item))
{
if (gadget.GetCost(CurrencyType.Coins) == -3)
continue;
addGadget(gadget, slot);
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
@ -65,72 +68,245 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
protected void addGadget(Gadget gadget, int slot)
{
if (gadget instanceof MorphNotch)
{
//setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false));
//return;
}
else if (gadget instanceof MorphBlock)
}
protected void addGadget(Gadget gadget, int slot)
{
if (gadget instanceof MorphBlock)
{
//Prevent stacker bug
if (getPlayer().getPassenger() != null)
return;
}
List<String> itemLore = new ArrayList<String>();
if (gadget.GetCost(CurrencyType.Coins) >= 0)
{
itemLore.add(C.cYellow + gadget.GetCost(CurrencyType.Coins) + " Coins");
}
else if (gadget.GetCost(CurrencyType.Coins) == -2)
{
itemLore.add(C.cGold + "Found in Treasure Chests.");
}
else if (gadget.GetCost(CurrencyType.Coins) == -3)
{
}
List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (gadget instanceof ItemGadget)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Right-Click To Purchase:");
itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins");
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
}
if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()) || getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()) > 0)
{
if (gadget.GetActive().contains(getPlayer()))
{
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Deactivate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this));
}
else
{
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Activate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
}
}
else
{
if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this));
else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set;");
//Elements
for (Gadget cur : gadget.getSet().getGadgets())
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen + '▪' : C.cDRed + '▪' ) + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
itemLore.add(C.cBlack);
//Bonus
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus;");
for (String bonus : gadget.getSet().getBonus())
itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus);
}
if (!gadget.ownsGadget(getPlayer()))
{
if (gadget.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
//Chest Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -2 || gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (gadget.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
//Special case for item gadgets!
if (gadget instanceof ItemGadget)
{
ItemGadget itemGadget = (ItemGadget)gadget;
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
// boolean canAffordAmmo = true;
// if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) > 0)
// {
// itemLore.add(C.cBlack);
// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins");
//
// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().GetCost(CurrencyType.Coins))
// {
// itemLore.add(C.cGreen + "Right-Click To Purchase");
// }
// else
// {
// itemLore.add(C.cRed + "Not Enough Treasure Shards.");
// canAffordAmmo = false;
// }
// }
if (itemGadget.hasAmmo(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Left-Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
}
else
{
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new ActivateGadgetButton(gadget, this));
}
return;
}
if(gadget instanceof HatGadget)
{
ItemStack item = ((HatGadget)gadget).getHelmetItem();
ItemMeta im = item.getItemMeta();
im.setDisplayName(C.cGreen + C.Bold + gadget.GetName());
if (gadget.ownsGadget(getPlayer()))
{
if (gadget.GetActive().contains(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
im.setLore(itemLore);
item.setItemMeta(im);
addButton(slot, new ShopItem(item, false, false), new DeactivateGadgetButton(gadget, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
im.setLore(itemLore);
item.setItemMeta(im);
addButton(slot, new ShopItem(item, false, false), new ActivateGadgetButton(gadget, this));
}
}
else
{
if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards");
}
if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this));
}
else if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
return;
}
//Standard
if (gadget.ownsGadget(getPlayer()))
{
if (gadget.GetActive().contains(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
}
}
else
{
if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards");
}
if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this));
}
else if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
}
public void purchaseGadget(final Player player, final Gadget gadget)
{
//Dont allow purchase!
if (gadget instanceof ItemGadget)
{
ItemGadget itemGadget = (ItemGadget)gadget;
if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) < 0)
return;
}
if(getClientManager().Get(player).isDisguised())
{
UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!"));
@ -148,27 +324,27 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void activateGadget(Player player, Gadget gadget)
{
if (gadget instanceof ItemGadget)
{
if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
{
purchaseGadget(player, gadget);
return;
}
}
// if (gadget instanceof ItemGadget)
// {
// if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
// {
// purchaseGadget(player, gadget);
// return;
// }
// }
playAcceptSound(player);
gadget.Enable(player);
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
public void handleRightClick(Player player, Gadget gadget)
{
if (gadget instanceof ItemGadget)
{
purchaseGadget(player, gadget);
}
// if (gadget instanceof ItemGadget)
// {
// purchaseGadget(player, gadget);
// }
}
public void deactivateGadget(Player player, Gadget gadget)

View File

@ -0,0 +1,57 @@
package mineplex.core.cosmetic.ui.page;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class HatPage extends GadgetPage
{
public HatPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -1,20 +1,34 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.NautArrayList;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilUI;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.OpenArrowTrails;
import mineplex.core.cosmetic.ui.button.OpenCostumes;
import mineplex.core.cosmetic.ui.button.OpenDeathAnimations;
import mineplex.core.cosmetic.ui.button.OpenDoubleJump;
import mineplex.core.cosmetic.ui.button.OpenGadgets;
import mineplex.core.cosmetic.ui.button.OpenHats;
import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenMusic;
@ -25,11 +39,13 @@ import mineplex.core.donation.Donor;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.mount.Mount;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureType;
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -43,124 +59,182 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@Override
protected void buildPage()
{
Donor donor = getDonationManager().Get(getPlayer());
// Treasure Shards
int treasureShards = getDonationManager().Get(getPlayer()).getCoins();
// addItem(2, new ShopItem(CurrencyType.Gems.GetDisplayMaterial(), donor.GetGems() + " Gems", new String[] {
// " "
// }, 1, false));
List<String> shardLore = new ArrayList<String>();
shardLore.add(" ");
shardLore.add(C.cGray + "This seems like it might come in");
shardLore.add(C.cGray + "handy. Maybe I can collect more!");
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
addItem(4, shards);
addItem(4, new ShopItem(175, getDonationManager().Get(getPlayer().getName()).getCoins() + " Coins", new String[]
// Cosmetic Items
// int[] slots = UtilUI.getIndicesFor(12, 2);
int particleSlot = 10;//slots[0];
int arrowSlot = 12;//slots[1];
int jumpSlot = 14;//slots[2];
int deathSlot = 16;//slots[3];
int gadgetSlot = 28;//slots[4];
int morphSlot = 30;//slots[5];
int mountSlot = 32;//slots[6];
int petSlot = 34;//slots[7];
int hatSlot = 46;//slots[8];
int costumeSlot = 48;//slots[9];
int musicSlot = 50;//slots[10];
int tauntSlot = 52;//slots[11];
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
EnumMap<GadgetType, Gadget> enabled = new EnumMap<GadgetType, Gadget>(GadgetType.class);
for(GadgetType type : GadgetType.values())
{
ownedCount.put(type, 0);
maxCount.put(type, 0);
List<Gadget> gadgets = getPlugin().getGadgetManager().getGadgets(type);
if (gadgets != null)
{
for (Gadget gadget : gadgets)
{
" ",
ChatColor.RESET + C.cYellow + "Purchase Coins",
ChatColor.RESET + "www.mineplex.com/shop",
" ",
ChatColor.RESET + C.cAqua + "Ultra Rank",
ChatColor.RESET + "Receives 7500 Coins per Month",
" ",
ChatColor.RESET + C.cPurple + "Hero Rank",
ChatColor.RESET + "Receives 15000 Coins per Month",
" ",
ChatColor.RESET + C.cGreen + "Legend Rank",
ChatColor.RESET + "Receives 30000 Coins per Month"
}, 1, false));
// addItem(6, new ShopItem(Material.GOLD_INGOT, donor.getGold() + " Gold", new String[] {
// " "
// }, 1, false));
addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
addButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
addButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
addButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
addButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
//
addButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
addButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) != null)
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle);
addButton(18 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
if (gadget.ownsGadget(getPlayer()))
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
ownedCount.put(type, ownedCount.get(type) + 1);
}
maxCount.put(type, maxCount.get(type) + 1);
}
}
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
if(gadget != null) enabled.put(type, gadget);
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item) != null)
int mountOwned = 0;
int mountMax = 0;
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item);
if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.GetName()) || mount.HasMount(getPlayer()))
{
mountOwned++;
}
addButton(20 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) != null)
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph);
addButton(22 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
mountMax++;
}
if (getPlugin().getMountManager().getActive(getPlayer()) != null)
int petOwned = 0;
int petMax = 0;
for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets())
{
final Mount<?> mount = getPlugin().getMountManager().getActive(getPlayer());
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).GetPets();
if (pets != null && pets.containsKey(pet.GetPetType()))
{
petOwned++;
}
addButton(24 + 9,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
mount.Disable(player);
refresh();
}
});
petMax++;
}
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer());
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
GadgetType type = GadgetType.Particle;
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type));
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(particleSlot);
type = GadgetType.ArrowTrail;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type));
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(arrowSlot);
type = GadgetType.DoubleJump;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type));
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(jumpSlot);
type = GadgetType.Death;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type));
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(deathSlot);
type = GadgetType.Item;
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zaney contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type));
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gadgetSlot);
type = GadgetType.Morph;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you cant be a tiger! Thats silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(morphSlot);
lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName());
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive));
if (mountActive != null) addGlow(mountSlot);
lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", "Usable in Lobbies", petActive == null ? null : petActive.getCustomName());
addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this));
if (petActive != null) addGlow(petSlot);
type = GadgetType.Hat;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type));
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(hatSlot);
type = GadgetType.Costume;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(costumeSlot);
type = GadgetType.MusicDisc;
lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type));
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(musicSlot);
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
{
Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
addButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
getPlugin().getPetManager().RemovePet(player, true);
refresh();
}
});
@Override
public void onClick(Player player, ClickType clickType)
{
player.sendMessage(F.main("Shop", "Coming soon!"));
}
});
}
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
{
return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName());
}
private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled)
{
if (enabled != null)
{
return UtilText.splitLinesToArray(new String[] {
C.blankLine,
C.cGray + info,
C.cDGray + visibility,
C.blankLine,
C.cWhite + "You own " + ownedCount + "/" + maxCount,
C.blankLine,
C.cWhite + "Active: " + C.cYellow + enabled,
C.cGreen + "Right-Click to Disable",
C.blankLine,
C.cGreen + "Left-Click to View Category"
}, LineFormat.LORE);
}
else
{
return UtilText.splitLinesToArray(new String[] {
C.blankLine,
C.cGray + info,
C.cDGray + visibility,
C.blankLine,
C.cWhite + "You own " + ownedCount + "/" + maxCount,
C.blankLine,
C.cGreen + "Left-Click to View Category"
}, LineFormat.LORE);
}
}
@ -173,16 +247,4 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
}
public void attemptPurchaseKey(Player player)
{
getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1);
refresh();
}
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
}
}

View File

@ -37,6 +37,8 @@ public class MorphPage extends GadgetPage
if (slot == 26)
slot = 28;
if (slot == 35)
slot = 37;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()

View File

@ -24,65 +24,137 @@ import mineplex.core.shop.page.ShopPageBase;
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
addMount(mount, slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
addMount(mount, slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
protected void addMount(Mount<?> mount, int slot)
{
List<String> itemLore = new ArrayList<String>();
if (mount.GetCost(CurrencyType.Coins) != -1)
{
itemLore.add(C.cYellow + mount.GetCost(CurrencyType.Coins) + " Coins");
}
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
{
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Deactivate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
}
else
{
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Activate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
}
}
else
{
if (mount.GetCost(CurrencyType.Coins) != -1 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this));
else
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
}
protected void addMount(Mount<?> mount, int slot)
{
List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
//Chest Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (mount.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
}
}
else
{
if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.Coins) + " Treasure Shards");
}
if (mount.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
}
}

View File

@ -30,7 +30,7 @@ public class ParticlePage extends GadgetPage
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget)
addGlow(slot);
slot++;

View File

@ -61,27 +61,60 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
List<String> itemLore = new ArrayList<String>();
//Halloween Name
if (pet.GetCost(CurrencyType.Coins) == -1)
itemLore.add(C.cBlack);
itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!");
//Chest Unlocks
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
{
if (pet instanceof Pumpkin)
{
itemLore.add(C.cBlack);
itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King");
itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Halloween Horror Event.");
}
if (pet instanceof Elf)
{
itemLore.add(C.cBlack);
itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King");
itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Christmas Chaos Event.");
}
if (pet.GetPetType() == EntityType.WITHER)
{
itemLore.add(C.cBlack);
itemLore.add(ChatColor.RESET + C.cGreen + "Unlocked with Legend Rank");
}
}
if (pet.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (pet.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
//Owned
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
@ -94,35 +127,52 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType())
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
"Deactivate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
addGlow(slot);
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
"Activate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
}
}
//Not Owned
else
{
//Cost Lore
if (pet.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins");
itemLore.add(C.cBlack);
}
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.Coins) + " Treasure Shards");
}
if (pet.GetCost(CurrencyType.Coins) == -1)
if (pet.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
}
else if (pet.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
else if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetButton(pet, this));
}
else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
{
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
slot++;

View File

@ -1,5 +1,6 @@
package mineplex.core.cosmetic.ui.page;
import mineplex.cache.player.PlayerCache;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
@ -16,7 +17,6 @@ import mineplex.core.pet.repository.token.PetChangeToken;
import mineplex.core.pet.repository.token.PetToken;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.playerCache.PlayerCache;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items;
@ -64,7 +64,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
_tagName = ChatColor.stripColor(_tagName);
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
System.out.println("Pet name: " + _tagName + ".");
if (_tagName.length() == 0)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters."));
playDenySound(getPlayer());
getShop().openPageForPlayer(getPlayer(), new PetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pets", getPlayer()));
return;
}
if (_tagName.length() > 16)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));

View File

@ -0,0 +1,57 @@
package mineplex.core.cosmetic.ui.page;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class TauntPage extends GadgetPage
{
public TauntPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -9,35 +9,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Chunk;
import net.minecraft.server.v1_8_R3.ChunkSection;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -73,11 +44,39 @@ import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.disguise.disguises.DisguiseRabbit;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketVerifier;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.packethandler.PacketVerifier;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Chunk;
import net.minecraft.server.v1_8_R3.ChunkSection;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R3.WorldServer;
public class DisguiseManager extends MiniPlugin implements IPacketHandler
{
@ -382,9 +381,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
for (Player player : players)
addViewerToDisguise(disguise, player, false);
if (disguise.GetEntity() instanceof Player && disguise instanceof DisguisePlayer)
if (disguise.GetEntity() instanceof EntityPlayer && disguise instanceof DisguisePlayer)
{
if (!((Player) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName()))
if (!((EntityPlayer) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName()))
{
_blockedNames.add(((Player) disguise.GetEntity()).getName());
}

View File

@ -2,29 +2,25 @@ package mineplex.core.disguise.disguises;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.skin.SkinData;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInSettings;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R3.WorldSettings;
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
import net.minecraft.server.v1_8_R3.WorldSettings;
public class DisguisePlayer extends DisguiseHuman
{
private GameProfile _profile;
private boolean _sneaking;
private BlockFace _sleeping;
private boolean _sendSkinToSelf;
public DisguisePlayer(org.bukkit.entity.Entity entity)
{
@ -46,6 +42,29 @@ public class DisguisePlayer extends DisguiseHuman
_profile = newProfile;
}
public GameProfile getProfile()
{
return _profile;
}
public void setSkinData(SkinData skin)
{
_profile.getProperties().put("textures", skin.getProperty());
}
/**
* Currently not working.
*/
public void setSendSkinDataToSelf(boolean sendToSelf)
{
_sendSkinToSelf = sendToSelf;
}
public boolean getSendSkinDataToSelf()
{
return _sendSkinToSelf;
}
public BlockFace getSleepingDirection()
{

View File

@ -10,6 +10,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.Gson;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
@ -24,7 +26,6 @@ import mineplex.core.donation.repository.token.DonorTokenWrapper;
import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.playerCache.PlayerCache;
public class DonationManager extends MiniDbClientPlugin<Donor>
{

View File

@ -1,73 +1,9 @@
package mineplex.core.gadget;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.ItemBatGun;
import mineplex.core.gadget.gadgets.ItemCoinBomb;
import mineplex.core.gadget.gadgets.ItemDuelingSword;
import mineplex.core.gadget.gadgets.ItemEtherealPearl;
import mineplex.core.gadget.gadgets.ItemFirework;
import mineplex.core.gadget.gadgets.ItemFleshHook;
import mineplex.core.gadget.gadgets.ItemMelonLauncher;
import mineplex.core.gadget.gadgets.ItemPaintballGun;
import mineplex.core.gadget.gadgets.ItemPaintbrush;
import mineplex.core.gadget.gadgets.ItemTNT;
import mineplex.core.gadget.gadgets.MorphBat;
import mineplex.core.gadget.gadgets.MorphBlaze;
import mineplex.core.gadget.gadgets.MorphBlock;
import mineplex.core.gadget.gadgets.MorphBunny;
import mineplex.core.gadget.gadgets.MorphChicken;
import mineplex.core.gadget.gadgets.MorphCow;
import mineplex.core.gadget.gadgets.MorphCreeper;
import mineplex.core.gadget.gadgets.MorphEnderman;
import mineplex.core.gadget.gadgets.MorphPig;
import mineplex.core.gadget.gadgets.MorphPumpkinKing;
import mineplex.core.gadget.gadgets.MorphSlime;
import mineplex.core.gadget.gadgets.MorphTitan;
import mineplex.core.gadget.gadgets.MorphVillager;
import mineplex.core.gadget.gadgets.MorphWither;
import mineplex.core.gadget.gadgets.OutfitRaveSuit;
import mineplex.core.gadget.gadgets.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.OutfitTeam;
import mineplex.core.gadget.gadgets.ParticleBlizzard;
import mineplex.core.gadget.gadgets.ParticleEnchant;
import mineplex.core.gadget.gadgets.ParticleFairy;
import mineplex.core.gadget.gadgets.ParticleFireRings;
import mineplex.core.gadget.gadgets.ParticleFoot;
import mineplex.core.gadget.gadgets.ParticleGreen;
import mineplex.core.gadget.gadgets.ParticleHeart;
import mineplex.core.gadget.gadgets.ParticleHelix;
import mineplex.core.gadget.gadgets.ParticleLegend;
import mineplex.core.gadget.gadgets.ParticleRain;
import mineplex.core.gadget.gadgets.ParticleTitan;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -82,6 +18,51 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.gadgets.arrowtrail.*;
import mineplex.core.gadget.gadgets.death.*;
import mineplex.core.gadget.gadgets.doublejump.*;
import mineplex.core.gadget.gadgets.hat.*;
import mineplex.core.gadget.gadgets.item.*;
import mineplex.core.gadget.gadgets.morph.*;
import mineplex.core.gadget.gadgets.outfit.*;
import mineplex.core.gadget.gadgets.particle.*;
import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetRaveSuit;
import mineplex.core.gadget.set.SetSpaceSuit;
import mineplex.core.gadget.set.SetTitan;
import mineplex.core.gadget.types.ArrowEffectGadget;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetSet;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
public class GadgetManager extends MiniPlugin
{
private CoreClientManager _clientManager;
@ -100,6 +81,8 @@ public class GadgetManager extends MiniPlugin
private NautHashMap<Player, Long> _lastMove = new NautHashMap<Player, Long>();
private NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<Player, NautHashMap<GadgetType, Gadget>>();
private HashSet<GadgetSet> _sets = new HashSet<>();
private boolean _hideParticles = false;
private int _activeItemSlot = 3;
private boolean _gadgetsEnabled = true;
@ -122,6 +105,19 @@ public class GadgetManager extends MiniPlugin
_mountManager = mountManager;
CreateGadgets();
createSets();
}
private void createSets()
{
//Particles
addSet(new SetFrostLord(this));
addSet(new SetCandyCane(this));
addSet(new SetTitan(this));
//Costumes
addSet(new SetRaveSuit(this));
addSet(new SetSpaceSuit(this));
}
private void CreateGadgets()
@ -139,17 +135,21 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoinBomb(this));
addGadget(new ItemPaintbrush(this));
addGadget(new ItemDuelingSword(this));
addGadget(new ItemPartyPopper(this));
addGadget(new ItemCoal(this));
addGadget(new ItemFreezeCannon(this));
addGadget(new ItemSnowball(this));
// Costume
addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0));
addGadget(new OutfitRaveSuitHelmet(this));
addGadget(new OutfitRaveSuitChestplate(this));
addGadget(new OutfitRaveSuitLeggings(this));
addGadget(new OutfitRaveSuitBoots(this));
addGadget(new OutfitSpaceSuit(this, "Space Helmet", -2, ArmorSlot.Helmet, Material.GLASS, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Pants", -2, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0));
addGadget(new OutfitSpaceSuitHelmet(this));
addGadget(new OutfitSpaceSuitChestplate(this));
addGadget(new OutfitSpaceSuitLeggings(this));
addGadget(new OutfitSpaceSuitBoots(this));
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0));
@ -171,6 +171,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphBunny(this));
addGadget(new MorphSlime(this, _achievementManager));
addGadget(new MorphTitan(this));
addGadget(new MorphSnowman(this));
// Particles
addGadget(new ParticleFoot(this));
@ -182,9 +183,33 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleHeart(this));
addGadget(new ParticleFairy(this));
addGadget(new ParticleLegend(this));
addGadget(new ParticleBlizzard(this));
addGadget(new ParticleFrostLord(this));
addGadget(new ParticleTitan(this));
//addGadget(new ParticleKronos(this));
addGadget(new ParticleCandyCane(this));
addGadget(new ParticleCoalFumes(this));
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));
addGadget(new ArrowTrailTitan(this));
addGadget(new ArrowTrailCandyCane(this));
// Death Effect
addGadget(new DeathFrostLord(this));
addGadget(new DeathTitan(this));
addGadget(new DeathCandyCane(this));
// Double Jump
addGadget(new DoubleJumpFrostLord(this));
addGadget(new DoubleJumpTitan(this));
addGadget(new DoubleJumpCandyCane(this));
// Hat
addGadget(new HatSanta(this));
addGadget(new HatSnowman(this));
addGadget(new HatPresent(this));
addGadget(new HatCoal(this));
addGadget(new HatRudolph(this));
addGadget(new HatGrinch(this));
// Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
@ -200,6 +225,42 @@ public class GadgetManager extends MiniPlugin
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000));
}
public Gadget getGadget(Class<? extends Gadget> c)
{
for(GadgetType type : GadgetType.values())
{
for(Gadget gadget : getGadgets(type))
{
if(gadget.getClass().equals(c)) return gadget;
}
}
return null;
}
public Set<GadgetSet> getSets(Gadget gadget)
{
HashSet<GadgetSet> hset = new HashSet<>();
for(GadgetSet set : _sets)
{
if(set.isPartOfSet(gadget)) hset.add(set);
}
return hset;
}
public GadgetSet getGadgetSet(Class<? extends GadgetSet> c)
{
for(GadgetSet set : _sets)
{
if(set.getClass().equals(c)) return set;
}
return null;
}
private void addSet(GadgetSet set)
{
_sets.add(set);
}
private void addGadget(Gadget gadget)
{
if (!_gadgets.containsKey(gadget.getGadgetType()))
@ -231,6 +292,7 @@ public class GadgetManager extends MiniPlugin
return _gadgets.get(gadgetType);
}
// Disallows two armor gadgets in same slot.
public void RemoveOutfit(Player player, ArmorSlot slot)
{
@ -250,52 +312,14 @@ public class GadgetManager extends MiniPlugin
}
}
}
public void RemoveItem(Player player)
{
for (GadgetType gadgetType : _gadgets.keySet())
{
for (Gadget gadget : _gadgets.get(gadgetType))
{
if (gadget instanceof ItemGadget)
{
ItemGadget item = (ItemGadget) gadget;
item.RemoveItem(player);
}
}
}
}
public void RemoveParticle(Player player)
{
for (GadgetType gadgetType : _gadgets.keySet())
{
for (Gadget gadget : _gadgets.get(gadgetType))
{
if (gadget instanceof ParticleGadget)
{
ParticleGadget part = (ParticleGadget) gadget;
part.Disable(player);
}
}
}
}
public void RemoveMorph(Player player)
public void removeGadgetType(Player player, GadgetType type)
{
for (GadgetType gadgetType : _gadgets.keySet())
List<Gadget> gadgets = _gadgets.get(type);
if(gadgets == null) return;
for(Gadget g : gadgets)
{
for (Gadget gadget : _gadgets.get(gadgetType))
{
if (gadget instanceof MorphGadget)
{
MorphGadget part = (MorphGadget) gadget;
part.Disable(player);
}
}
g.Disable(player);
}
}
@ -307,6 +331,15 @@ public class GadgetManager extends MiniPlugin
{
if (gadget instanceof ParticleGadget)
continue;
if (gadget instanceof ArrowEffectGadget)
continue;
if (gadget instanceof DoubleJumpEffectGadget)
continue;
if (gadget instanceof DeathEffectGadget)
continue;
for (Player player : UtilServer.getPlayers())
gadget.Disable(player);
@ -391,7 +424,7 @@ public class GadgetManager extends MiniPlugin
@EventHandler
public void setMoving(PlayerMoveEvent event)
{
if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0)
if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0.1)
return;
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
@ -399,6 +432,8 @@ public class GadgetManager extends MiniPlugin
public boolean isMoving(Player player)
{
if (!UtilEnt.isGrounded(player)) return true;
if (!_lastMove.containsKey(player))
return false;
@ -518,7 +553,7 @@ public class GadgetManager extends MiniPlugin
}
@EventHandler
public void GadgetActivate(GadgetActivateEvent event)
public void GadgetActivate(GadgetEnableEvent event)
{
if (!_gadgetsEnabled)
event.setCancelled(true);

View File

@ -0,0 +1,43 @@
package mineplex.core.gadget.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import mineplex.core.gadget.types.Gadget;
public class GadgetDisableEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Gadget _gadget;
public GadgetDisableEvent(Player player, Gadget gadget)
{
_player = player;
_gadget = gadget;
}
public Player getPlayer()
{
return _player;
}
public Gadget getGadget()
{
return _gadget;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public HandlerList getHandlers()
{
return handlers;
}
}

View File

@ -7,16 +7,17 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class GadgetActivateEvent extends Event
public class GadgetEnableEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Gadget _gadget;
private boolean _cancelled = false;
public GadgetActivateEvent(Player player, Gadget gadget)
public GadgetEnableEvent(Player player, Gadget gadget)
{
_player = player;
_gadget = gadget;
@ -41,7 +42,7 @@ public class GadgetActivateEvent extends Event
{
return _player;
}
public void setCancelled(boolean cancel)
{
_cancelled = cancel;

View File

@ -1,217 +0,0 @@
package mineplex.core.gadget.gadgets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemGemBomb extends ItemGadget
{
private HashMap<Item, Long> _activeBombs = new HashMap<Item, Long>();
private HashSet<Item> _gems = new HashSet<Item>();
public ItemGemBomb(GadgetManager manager)
{
super(manager, "Gem Party Bomb", new String[]
{
C.cWhite + "It's party time! You will be",
C.cWhite + "everyones favourite player",
C.cWhite + "when you use one of these!",
" ",
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "This uses 2000 Gems"
},
-1,
Material.EMERALD, (byte)0,
30000, new Ammo("Gem Party Bomb", "10 Gem Party Bomb", Material.EMERALD, (byte)0, new String[] { C.cWhite + "10 Coin Party Bomb to PARTY!" }, 10, 10));
}
@Override
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial()))
return;
Player player = event.getPlayer();
if (!IsActive(player))
return;
event.setCancelled(true);
//Stock
if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0)
{
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
//Gems
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Gems) < 2000)
{
UtilPlayer.message(player, F.main("Inventory", "You do not have the required " + C.cGreen + "2000 Gems") + ".");
return;
}
//Already In Use
if (!_activeBombs.isEmpty())
{
UtilPlayer.message(player, F.main("Inventory", "There is already a " + F.elem(C.cGreen + "Gem Bomb")) + " being used.");
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false))
{
UtilInv.Update(player);
return;
}
//Use Stock/Gems
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);
Manager.getDonationManager().RewardGems(null, GetName(), event.getPlayer().getName(), event.getPlayer().getUniqueId(), -2000);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName())));
ActivateCustom(event.getPlayer());
}
@Override
public void ActivateCustom(Player player)
{
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.EMERALD_BLOCK));
UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
_activeBombs.put(item, System.currentTimeMillis());
//Inform
for (Player other : UtilServer.getPlayers())
UtilPlayer.message(other, C.cGreen + C.Bold + player.getName() + C.cWhite + C.Bold + " has thrown a " + C.cGreen + C.Bold + "Gem Party Bomb" + C.cWhite + C.Bold + "!");
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> itemIterator = _activeBombs.keySet().iterator();
while (itemIterator.hasNext())
{
Item item = itemIterator.next();
long time = _activeBombs.get(item);
if (UtilTime.elapsed(time, 3000))
{
if (Math.random() > 0.80)
UtilFirework.playFirework(item.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BURST).trail(false).build());
else
item.getWorld().playSound(item.getLocation(), Sound.FIREWORK_LAUNCH, 1f, 1f);
Item gem = item.getWorld().dropItem(item.getLocation().add(0, 1, 0), new ItemStack(Material.EMERALD));
//Velocity
long passed = System.currentTimeMillis() - time;
Vector vel = new Vector(Math.sin(passed/300d), 0, Math.cos(passed/300d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(passed/3000d)), false, 0, 0.2 + Math.abs(Math.cos(passed/3000d))*0.8, 1, false);
gem.setPickupDelay(40);
_gems.add(gem);
}
if (UtilTime.elapsed(time, 23000))
{
item.remove();
itemIterator.remove();
}
}
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (_activeBombs.keySet().contains(event.getItem()))
{
event.setCancelled(true);
}
else if (_gems.contains(event.getItem()))
{
event.setCancelled(true);
event.getItem().remove();
Manager.getDonationManager().RewardGemsLater(GetName() + " Pickup", event.getPlayer(), 4);
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
}
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
Iterator<Item> gemIterator = _gems.iterator();
while (gemIterator.hasNext())
{
Item gem = gemIterator.next();
if (!gem.isValid() || gem.getTicksLived() > 1200)
{
gem.remove();
gemIterator.remove();
}
}
}
}

View File

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

View File

@ -1,75 +0,0 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.util.C;
import mineplex.core.common.util.ProfileLoader;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphGeno extends MorphGadget
{
private GameProfile _profile = null;
public MorphGeno(GadgetManager manager)
{
super(manager, "Genocide604", new String[]
{
"Say goodbye to Genocide604 by burping",
"and eating a lot.",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Burp",
" ",
C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "This is a temporary item!",
},
10,
Material.SKULL_ITEM, (byte)3);
_profile = new ProfileLoader(UUIDFetcher.getUUIDOf("Genocide604").toString(), "Genocide604").loadProfile();
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguisePlayer disguise = new DisguisePlayer(player, _profile);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void Action(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
return;
player.getWorld().playSound(player.getEyeLocation(), Sound.BURP, 1f, (float) (0.8f + Math.random() * 0.4f));
}
}

View File

@ -1,70 +0,0 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.util.C;
import mineplex.core.common.util.ProfileLoader;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphNotch extends MorphGadget
{
private GameProfile _notchProfile = null;
public MorphNotch(GadgetManager manager)
{
super(manager, "Notch", new String[]
{
"Who wouldn't want to be Notch?!",
//C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA",
},
50000,
Material.SKULL_ITEM, (byte)3);
_notchProfile = new ProfileLoader(UUIDFetcher.getUUIDOf("Notch").toString(), "Notch").loadProfile();
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguisePlayer disguise = new DisguisePlayer(player, _notchProfile);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
//@EventHandler
public void Action(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
return;
player.sendMessage("You have enforced the EULA.");
}
}

View File

@ -1,29 +0,0 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget;
public class OutfitSpaceSuit extends OutfitGadget
{
public OutfitSpaceSuit(GadgetManager manager, String name,
int cost, ArmorSlot slot, Material mat, byte data)
{
super(manager, name, new String[] {ChatColor.RESET + "Wear the complete set for",ChatColor.RESET + "awesome bonus effects!", ChatColor.RESET + "Bonus coming soon..."}, cost, slot, mat, data);
}
@Override
public void EnableCustom(Player player)
{
ApplyArmor(player);
}
@Override
public void DisableCustom(Player player)
{
RemoveArmor(player);
}
}

View File

@ -1,164 +0,0 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleBlizzard extends ParticleGadget
{
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
public ParticleBlizzard(GadgetManager manager)
{
super(manager, "Frost Lord", new String[]
{
C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.",
" ",
C.cPurple + "No longer available",
},
-1,
Material.SNOW_BALL, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.015f, 0.2f);
double scale = (double)(player.getTicksLived() % 50) / 50d;
for (int i = 0 ; i < 8 ; i++)
{
double r = (1d-scale) * Math.PI * 2;
double x = Math.sin(r + (i * (Math.PI/4))) * (r%(Math.PI * 4)) * 0.4;
double z = Math.cos(r + (i * (Math.PI/4))) * (r%(Math.PI * 4)) * 0.4;
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false))
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60,
ViewDist.NORMAL, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 1f, 1.5f);
}
}
}
}
}
@EventHandler
public void jump(PlayerToggleFlightEvent event)
{
if (!shouldDisplay(event.getPlayer()))
return;
if (!event.getPlayer().isFlying())
if (IsActive(event.getPlayer()))
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.6f, 100,
ViewDist.LONGER, UtilServer.getPlayers());
}
@EventHandler
public void arrow(ProjectileLaunchEvent event)
{
if (Manager.hideParticles())
return;
if (event.getEntity() instanceof Arrow)
{
if (event.getEntity().getShooter() != null)
{
if (GetActive().contains(event.getEntity().getShooter()))
{
_arrows.add((Arrow)event.getEntity());
}
}
}
}
@EventHandler
public void arrow(ProjectileHitEvent event)
{
if (!_arrows.remove(event.getEntity()))
return;
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getEntity().getLocation(), 0f, 0f, 0f, 0.4f, 12,
ViewDist.LONGER, UtilServer.getPlayers());
}
@EventHandler
public void arrowClean(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove();
}
else
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1,
ViewDist.LONGER, UtilServer.getPlayers());
}
}
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.SNOW_BALL, (byte)0);
}
}

View File

@ -1,79 +0,0 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleHelix extends ParticleGadget
{
public ParticleHelix(GadgetManager manager)
{
super(manager, "Blood Helix", new String[]
{
C.cWhite + "Ancient legend says this magic",
C.cWhite + "empowers the blood of its user,",
C.cWhite + "giving them godly powers.",
},
-2,
Material.REDSTONE, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
for (int height=0 ; height <= 20 ; height++)
{
for (int i=0 ; i < 2 ; i++)
{
double lead = i * ((2d * Math.PI)/2);
double heightLead = height * ((2d * Math.PI)/20);
float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
float y = 0.15f * height;
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
}
//UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f);
}
}
}
}

View File

@ -1,202 +0,0 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.util.Vector;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleTitan extends ParticleGadget
{
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
private int _tick;
public ParticleTitan(GadgetManager manager)
{
super(manager, "Flame of the Titans", new String[]
{
C.cWhite + "These flames are said to be the",
C.cWhite + "souls of a lost civilisation of",
C.cWhite + "Titans, forgotten by time.",
" ",
C.cRed + "Unlocked with Titan Rank",
},
-3,
Material.FIREBALL, (byte)0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
_tick++;
_tick = _tick%620;
for(Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
double total = 3;
double step = (1/total)*Math.PI*2;
double offset1 = (step/20)*_tick%20;
double offset2 = (step/31)*_tick%31;
double r = 3;
boolean redstone = false;
if(Manager.isMoving(player))
r = 0.5;
for(int i = 0; i < total; i++)
{
double rad = step*i + offset1;
double x = Math.sin(rad);
double y = 0;
double z = Math.cos(rad);
Vector v = new Vector(x,y,z).normalize();
v.multiply(r);
Location loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
rad = -(step*i + offset2);
x = Math.sin(rad);
z = Math.cos(rad);
v = new Vector(x,y,z).normalize();
v.multiply(r);
loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
}
}
}
@EventHandler
public void jump(PlayerToggleFlightEvent event)
{
if (!shouldDisplay(event.getPlayer()))
return;
if (!event.getPlayer().isFlying())
if (IsActive(event.getPlayer()))
{
UtilParticle.PlayParticle(ParticleType.LAVA, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.2f, 40,
ViewDist.NORMAL, UtilServer.getPlayers());
}
}
@EventHandler
public void arrow(ProjectileLaunchEvent event)
{
if (Manager.hideParticles())
return;
if (event.getEntity() instanceof Arrow)
{
if (event.getEntity().getShooter() != null)
{
if (GetActive().contains(event.getEntity().getShooter()))
{
_arrows.add((Arrow)event.getEntity());
}
}
}
}
@EventHandler
public void arrow(ProjectileHitEvent event)
{
if (!_arrows.remove(event.getEntity()))
return;
UtilParticle.PlayParticle(ParticleType.LAVA, event.getEntity().getLocation(), 0f, 0f, 0f, 0f, 24,
ViewDist.LONGER, UtilServer.getPlayers());
}
@EventHandler
public void arrowClean(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove();
}
else
{
UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0f, 0f, 0f, 0f, 1,
ViewDist.LONGER, UtilServer.getPlayers());
}
}
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.FIREBALL, (byte)0);
}
@EventHandler
public void legendOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
{
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailCandyCane extends ArrowEffectGadget
{
public ArrowTrailCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Arrows",
UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santas Elves are deadly shots.", LineFormat.LORE),
-3,
Material.INK_SACK, (byte)1);
}
@Override
public void doTrail(Arrow arrow)
{
int data = 15;
int tick = Math.abs(UtilTime.getServerTick()%3);
if(tick == 1) data = 1;
if(tick == 2) data = 2;
Location loc = arrow.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), loc, 0, 0, 0, 0.0f, 1, ViewDist.NORMAL);
}
@Override
public void doHitEffect(Arrow arrow)
{
Location loc = arrow.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
}
}

View File

@ -0,0 +1,39 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.ArrowEffectGadget;
import mineplex.core.gadget.GadgetManager;
public class ArrowTrailFrostLord extends ArrowEffectGadget
{
public ArrowTrailFrostLord(GadgetManager manager)
{
super(manager, "Arrows of the Frost Lord",
UtilText.splitLineToArray(C.cGray + "The Frost Lords arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE),
-3,
Material.SNOW_BALL, (byte)0, "Frost Lord");
}
@Override
public void doTrail(Arrow arrow)
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1,
ViewDist.LONGER, UtilServer.getPlayers());
}
@Override
public void doHitEffect(Arrow arrow)
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0.4f, 12,
ViewDist.LONGER, UtilServer.getPlayers());
}
}

View File

@ -0,0 +1,51 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailTitan extends ArrowEffectGadget
{
public ArrowTrailTitan(GadgetManager manager)
{
super(manager, "Arrows of the Titans",
UtilText.splitLineToArray(C.cGray + "Arrows forged in the Fires of Creation, they leave fiery trails in their wake.", LineFormat.LORE),
-13,
Material.FIREBALL, (byte)0);
}
@Override
public void doTrail(Arrow arrow)
{
UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0f, 0f, 0f, 0f, 1,
ViewDist.LONGER, UtilServer.getPlayers());
}
@Override
public void doHitEffect(Arrow arrow)
{
UtilParticle.PlayParticle(ParticleType.LAVA, arrow.getLocation(), 0f, 0f, 0f, 0f, 24,
ViewDist.LONGER, UtilServer.getPlayers());
}
@EventHandler
public void titanOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
{
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.gadget.GadgetManager;
public class DeathCandyCane extends DeathEffectGadget
{
public DeathCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Remains",
UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays, is January.", LineFormat.LORE),
-3,
Material.INK_SACK, (byte)1);
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setCancelled(true);
event.setItem(Material.INK_SACK, (byte) 15);
Location loc = event.getLocation();
int a = event.getParticles();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL);
}
}

View File

@ -0,0 +1,37 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.gadget.GadgetManager;
public class DeathFrostLord extends DeathEffectGadget
{
public DeathFrostLord(GadgetManager manager)
{
super(manager, "Fall of the Frost Lord",
UtilText.splitLineToArray(C.cGray + "The power of Winter must eventually give way to Spring.", LineFormat.LORE),
-3,
Material.SNOW_BALL, (byte)0, "Frost Lord");
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.SNOW_BALL, (byte)0);
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathTitan extends DeathEffectGadget
{
public DeathTitan(GadgetManager manager)
{
super(manager, "Ashes of the Titans",
UtilText.splitLineToArray(C.cGray + "Even a Titan can fall in combat if their opponent is fierce enough.", LineFormat.LORE),
-13,
Material.FIREBALL, (byte)0);
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.FIREBALL, (byte)0);
}
@EventHandler
public void titanOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
{
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
}

View File

@ -0,0 +1,36 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpCandyCane extends DoubleJumpEffectGadget
{
public DoubleJumpCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Blast",
UtilText.splitLineToArray(C.cGray + "It is said every time an elf jumps, bits of Candy Cane fall out of their pockets.", LineFormat.LORE),
-3,
Material.INK_SACK, (byte)1);
}
@Override
public void doEffect(Player player)
{
Location loc = player.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
}
}

View File

@ -0,0 +1,32 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpFrostLord extends DoubleJumpEffectGadget
{
public DoubleJumpFrostLord(GadgetManager manager)
{
super(manager, "Gust of the Frost Lord",
UtilText.splitLineToArray(C.cGray + "Listen, the Frost Lord is a very proper individual. Stop making fart jokes!", LineFormat.LORE),
-3,
Material.SNOW_BALL, (byte)0, "Frost Lord");
}
@Override
public void doEffect(Player player)
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0f, 0f, 0f, 0.6f, 100,
ViewDist.LONGER, UtilServer.getPlayers());
}
}

View File

@ -0,0 +1,46 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpTitan extends DoubleJumpEffectGadget
{
public DoubleJumpTitan(GadgetManager manager)
{
super(manager, "Leap of the Titans",
UtilText.splitLineToArray(C.cGray + "Out of the frying pan and into the fire.", LineFormat.LORE),
-13,
Material.FIREBALL, (byte)0);
}
@Override
public void doEffect(Player player)
{
UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0f, 0f, 0f, 0.2f, 40,
ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation(), 0, 0, 0, 0.2f, 40, ViewDist.NORMAL);
}
@EventHandler
public void titanOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
{
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.gadget.gadgets.hat;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.HatGadget;
public class HatCoal extends HatGadget
{
public HatCoal(GadgetManager manager)
{
super(manager, "Lump of Coal Hat",
UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a wierd cube hat out it!", LineFormat.LORE),
-1,
new ItemStack(Material.COAL_BLOCK));
}
}

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