Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex into clans/alpha
Conflicts: Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs
BIN
Art/BlackFriday.png
Normal file
After Width: | Height: | Size: 170 KiB |
BIN
Art/ChristmasChaos.png
Normal file
After Width: | Height: | Size: 438 KiB |
BIN
Art/ClansBanner.png
Normal file
After Width: | Height: | Size: 1017 KiB |
BIN
Art/TitanLogo.png
Normal file
After Width: | Height: | Size: 375 KiB |
BIN
Art/WinterTreasure.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
Art/WinterTreasureTrim.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
Art/y5O7WYh.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
Art/zKzkfLE.png
Normal file
After Width: | Height: | Size: 93 KiB |
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -5,19 +5,19 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/Classpath.Dummy/Classpath.Dummy.iml" filepath="$PROJECT_DIR$/Classpath.Dummy/Classpath.Dummy.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/JedisTest/JedisTest.iml" filepath="$PROJECT_DIR$/JedisTest/JedisTest.iml" group="Legacy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml" filepath="$PROJECT_DIR$/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml" group="Bungee" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Cache/Mineplex.Cache.iml" filepath="$PROJECT_DIR$/Mineplex.Cache/Mineplex.Cache.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" filepath="$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" filepath="$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Clans" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" group="Clans" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" group="Other" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" group="Other" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" group="Other" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" filepath="$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" group="Legacy" />
|
||||
</modules>
|
||||
|
@ -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"/>
|
||||
|
@ -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>
|
||||
|
@ -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
|
@ -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>
|
@ -56,7 +56,7 @@ public class MotdManager implements Listener, Runnable
|
||||
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
|
||||
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
||||
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
|
||||
String motdLine = " §f❄ §2§lWinter Update §f❄ §2§lSnow Fight §f❄";
|
||||
String motdLine = " §f❄ §2§lNew Game §f❄ §2§lType Wars §f❄";
|
||||
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
||||
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
@ -51,13 +51,13 @@ public abstract class DnsMadeEasyApiCallBase
|
||||
try
|
||||
{
|
||||
String timeStamp = getServerTime();
|
||||
SecretKeySpec keySpec = new SecretKeySpec("35bb3b97-3815-4b63-b60b-eb1882c07b40".getBytes(), "HmacSHA1");
|
||||
SecretKeySpec keySpec = new SecretKeySpec("9041bc01-5cbc-49cf-ae09-a23b98350c62".getBytes(), "HmacSHA1");
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
mac.init(keySpec);
|
||||
byte[] hashBytes = mac.doFinal((timeStamp + "").getBytes());
|
||||
Hex.encodeHexString(hashBytes);
|
||||
|
||||
request.addHeader("x-dnsme-apiKey", "a9750980-b7df-4a7e-a047-2ade43628f0d");
|
||||
request.addHeader("x-dnsme-apiKey", "2039c697-6ca9-412f-abda-0aef659a382a");
|
||||
request.addHeader("x-dnsme-requestDate", timeStamp + "");
|
||||
request.addHeader("x-dnsme-hmac", Hex.encodeHexString(hashBytes));
|
||||
request.addHeader("Content-Type", "application/json");
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.PlayerCache</name>
|
||||
<name>Mineplex.Cache</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -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
|
@ -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;
|
||||
|
@ -26,7 +26,7 @@ public enum Rank
|
||||
|
||||
//Media
|
||||
YOUTUBE("YouTube", ChatColor.RED),
|
||||
YOUTUBE_SMALL("MooTube", ChatColor.DARK_PURPLE),
|
||||
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE),
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE),
|
||||
|
||||
//Player
|
||||
|
BIN
Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -6,18 +6,35 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.Dropper;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.Hopper;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.material.Bed;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
import net.minecraft.server.v1_8_R3.Item;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftKey;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
public class UtilBlock
|
||||
@ -535,8 +552,8 @@ public class UtilBlock
|
||||
if (diagonals)
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int y = -1; y <= 1; y++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int y = 1; y >= -1; y--)
|
||||
{
|
||||
if (x == 0 && y == 0 && z == 0) continue;
|
||||
|
||||
@ -546,11 +563,11 @@ public class UtilBlock
|
||||
else
|
||||
{
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||
blocks.add(block.getRelative(BlockFace.EAST));
|
||||
blocks.add(block.getRelative(BlockFace.WEST));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
return blocks;
|
||||
@ -818,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>();
|
||||
@ -835,18 +852,23 @@ 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;
|
||||
}
|
||||
|
||||
public static ItemStack blockToInventoryItemStack(Block block)
|
||||
public static ArrayList<ItemStack> blockToInventoryItemStacks(Block block)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData());
|
||||
ArrayList<ItemStack> itemStacks = new ArrayList<ItemStack>();
|
||||
itemStacks.add(itemStack);
|
||||
|
||||
switch (block.getType())
|
||||
{
|
||||
@ -877,6 +899,17 @@ public class UtilBlock
|
||||
break;
|
||||
case DISPENSER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Dispenser dispenser = (Dispenser) block.getState();
|
||||
|
||||
for (ItemStack is : dispenser.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case BED_BLOCK:
|
||||
itemStack.setType(Material.BED);
|
||||
@ -921,6 +954,17 @@ public class UtilBlock
|
||||
break;
|
||||
case CHEST:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Chest chest = (Chest) block.getState();
|
||||
|
||||
for (ItemStack is : chest.getBlockInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case REDSTONE_WIRE:
|
||||
itemStack.setType(Material.REDSTONE);
|
||||
@ -936,10 +980,32 @@ public class UtilBlock
|
||||
break;
|
||||
case FURNACE:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Furnace furnace = (Furnace) block.getState();
|
||||
|
||||
for (ItemStack is : furnace.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case BURNING_FURNACE:
|
||||
itemStack.setType(Material.FURNACE);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Furnace burningFurnace = (Furnace) block.getState();
|
||||
|
||||
for (ItemStack is : burningFurnace.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case SIGN_POST:
|
||||
itemStack.setType(Material.SIGN);
|
||||
@ -1001,6 +1067,12 @@ public class UtilBlock
|
||||
break;
|
||||
case JUKEBOX:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Jukebox jukebox = (Jukebox) block.getState();
|
||||
|
||||
if (jukebox.getPlaying() != Material.AIR)
|
||||
itemStacks.add(new ItemStack(jukebox.getPlaying()));
|
||||
|
||||
break;
|
||||
case PORTAL:
|
||||
itemStack.setType(Material.AIR);
|
||||
@ -1057,10 +1129,25 @@ public class UtilBlock
|
||||
case BREWING_STAND:
|
||||
itemStack.setType(Material.BREWING_STAND_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
BrewingStand brewingStand = (BrewingStand) block.getState();
|
||||
|
||||
for (ItemStack is : brewingStand.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case CAULDRON:
|
||||
itemStack.setType(Material.CAULDRON_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
if (block.getData() != 0)
|
||||
itemStacks.add(new ItemStack(Material.WATER_BUCKET));
|
||||
|
||||
break;
|
||||
case ENDER_PORTAL:
|
||||
itemStack.setType(Material.AIR);
|
||||
@ -1068,6 +1155,10 @@ public class UtilBlock
|
||||
break;
|
||||
case ENDER_PORTAL_FRAME:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
if ((block.getData() & 0x4) != 0)
|
||||
itemStacks.add(new ItemStack(Material.EYE_OF_ENDER));
|
||||
|
||||
break;
|
||||
case REDSTONE_LAMP_ON:
|
||||
itemStack.setType(Material.REDSTONE_LAMP_OFF);
|
||||
@ -1111,6 +1202,27 @@ public class UtilBlock
|
||||
case FLOWER_POT:
|
||||
itemStack.setType(Material.FLOWER_POT_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
//The FlowerPot class is outdated and doesn't work so we do some NBT checking
|
||||
TileEntityFlowerPot tefp = (TileEntityFlowerPot) ((CraftWorld) block.getWorld()).getHandle().getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()));
|
||||
|
||||
NBTTagCompound c = new NBTTagCompound();
|
||||
tefp.b(c);
|
||||
|
||||
ItemStack blockInPot = new ItemStack(Material.AIR);
|
||||
|
||||
if (c.hasKey("Item"))
|
||||
{
|
||||
MinecraftKey mk = new MinecraftKey(c.getString("Item"));
|
||||
blockInPot = CraftItemStack.asNewCraftStack(Item.REGISTRY.get(mk));
|
||||
}
|
||||
|
||||
if (c.hasKey("Data"))
|
||||
blockInPot.setDurability(c.getShort("Data"));
|
||||
|
||||
if (blockInPot.getType() != Material.AIR)
|
||||
itemStacks.add(blockInPot);
|
||||
|
||||
break;
|
||||
case CARROT:
|
||||
itemStack.setType(Material.CARROT_ITEM);
|
||||
@ -1125,9 +1237,31 @@ public class UtilBlock
|
||||
break;
|
||||
case SKULL:
|
||||
itemStack.setType(Material.SKULL_ITEM);
|
||||
|
||||
Skull skull = (Skull) block.getState();
|
||||
itemStack.setDurability((short) skull.getSkullType().ordinal());
|
||||
|
||||
if (skull.getSkullType() == SkullType.PLAYER && skull.hasOwner())
|
||||
{
|
||||
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
skullMeta.setOwner(skull.getOwner());
|
||||
itemStack.setItemMeta(skullMeta);
|
||||
}
|
||||
|
||||
break;
|
||||
case TRAPPED_CHEST:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Chest trappedChest = (Chest) block.getState();
|
||||
|
||||
for (ItemStack is : trappedChest.getBlockInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case GOLD_PLATE:
|
||||
itemStack.setDurability((short) 0);
|
||||
@ -1148,6 +1282,17 @@ public class UtilBlock
|
||||
break;
|
||||
case HOPPER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Hopper hopper = (Hopper) block.getState();
|
||||
|
||||
for (ItemStack is : hopper.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case QUARTZ_STAIRS:
|
||||
itemStack.setDurability((short) 0);
|
||||
@ -1157,6 +1302,17 @@ public class UtilBlock
|
||||
break;
|
||||
case DROPPER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Dropper dropper = (Dropper) block.getState();
|
||||
|
||||
for (ItemStack is : dropper.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case LEAVES_2:
|
||||
itemStack.setDurability((short) (itemStack.getDurability() % 4));
|
||||
@ -1178,11 +1334,27 @@ public class UtilBlock
|
||||
break;
|
||||
case STANDING_BANNER:
|
||||
itemStack.setType(Material.BANNER);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Banner banner = (Banner) block.getState();
|
||||
itemStack.setDurability(banner.getBaseColor().getDyeData());
|
||||
|
||||
BannerMeta bannerMeta = (BannerMeta) itemStack.getItemMeta();
|
||||
bannerMeta.setBaseColor(bannerMeta.getBaseColor());
|
||||
bannerMeta.setPatterns(banner.getPatterns());
|
||||
itemStack.setItemMeta(bannerMeta);
|
||||
|
||||
break;
|
||||
case WALL_BANNER:
|
||||
itemStack.setType(Material.BANNER);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Banner wallBanner = (Banner) block.getState();
|
||||
itemStack.setDurability(wallBanner.getBaseColor().getDyeData());
|
||||
|
||||
BannerMeta wallBannerMeta = (BannerMeta) itemStack.getItemMeta();
|
||||
wallBannerMeta.setBaseColor(wallBannerMeta.getBaseColor());
|
||||
wallBannerMeta.setPatterns(wallBanner.getPatterns());
|
||||
itemStack.setItemMeta(wallBannerMeta);
|
||||
|
||||
break;
|
||||
case DAYLIGHT_DETECTOR_INVERTED:
|
||||
itemStack.setType(Material.DAYLIGHT_DETECTOR);
|
||||
@ -1235,6 +1407,6 @@ public class UtilBlock
|
||||
break;
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
return itemStacks;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -803,6 +804,20 @@ public class UtilEnt
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void setAI(LivingEntity entity, boolean ai)
|
||||
{
|
||||
if(entity instanceof ArmorStand)
|
||||
{
|
||||
((ArmorStand)entity).setGravity(ai);
|
||||
return;
|
||||
}
|
||||
CraftEntity e = (CraftEntity)entity;
|
||||
if(e.getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
((EntityInsentient)e.getHandle()).k(!ai);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inWater(LivingEntity ent)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@ -509,13 +511,21 @@ public class UtilPlayer
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
//Ignore Check
|
||||
if (ignore != null)
|
||||
{
|
||||
for (int i = 0; i < ignore.length; i++)
|
||||
boolean shouldIgnore = false;
|
||||
for (Entity ent : ignore)
|
||||
{
|
||||
if (cur.equals(ignore[i]))
|
||||
continue;
|
||||
if (cur.equals(ent))
|
||||
{
|
||||
shouldIgnore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldIgnore)
|
||||
continue;
|
||||
}
|
||||
|
||||
double dist = UtilMath.offset(cur.getLocation(), loc);
|
||||
|
@ -1,10 +1,12 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
@ -18,6 +20,11 @@ public class UtilServer
|
||||
return getServer().getOnlinePlayers().toArray(new Player[0]);
|
||||
}
|
||||
|
||||
public static Collection<? extends Player> getPlayersCollection()
|
||||
{
|
||||
return getServer().getOnlinePlayers();
|
||||
}
|
||||
|
||||
public static List<Player> getSortedPlayers()
|
||||
{
|
||||
return getSortedPlayers(new Comparator<Player>()
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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";
|
||||
@ -47,6 +49,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
|
||||
{
|
||||
|
@ -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.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -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
|
||||
|
@ -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>
|
@ -19,13 +19,13 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
@ -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;
|
||||
@ -49,8 +51,10 @@ import fr.neatmonster.nocheatplus.hooks.NCPHookManager;
|
||||
|
||||
public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer[]>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer[]>>();
|
||||
private NautHashMap<String, NautHashMap<Integer, String>> _entityNameMap = new NautHashMap<String, NautHashMap<Integer, String>>();
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityRiding = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
||||
|
||||
private HashSet<String> _loggedIn = new HashSet<String>();
|
||||
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
|
||||
|
||||
@ -63,7 +67,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
||||
PacketPlayInUseEntity.class);
|
||||
PacketPlayOutNamedEntitySpawn.class, PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class);
|
||||
|
||||
NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||
NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||
@ -75,9 +79,19 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
_entityMap.remove(event.getPlayer().getName());
|
||||
_entityNameMap.remove(event.getPlayer().getName());
|
||||
_entityRiding.remove(event.getPlayer().getName());
|
||||
_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)
|
||||
{
|
||||
@ -137,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();
|
||||
|
||||
@ -167,6 +182,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
iterator.remove();
|
||||
_entityMap.remove(player);
|
||||
_entityNameMap.remove(player);
|
||||
_entityRiding.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +206,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
if (owner.isOnline() && !_entityMap.containsKey(owner.getName()))
|
||||
{
|
||||
_entityMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
||||
_entityMap.put(owner.getName(), new NautHashMap<Integer, Integer[]>());
|
||||
_entityNameMap.put(owner.getName(), new NautHashMap<Integer, String>());
|
||||
_loggedIn.add(owner.getName());
|
||||
}
|
||||
@ -217,10 +233,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
||||
{
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_entityMap.get(owner.getName()).get(spawnPacket.a)
|
||||
}));
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(spawnPacket.a);
|
||||
int[] newIds = new int[ids.length];
|
||||
|
||||
for (int a = 0; a < ids.length; a++)
|
||||
{
|
||||
newIds[a] = ids[a];
|
||||
}
|
||||
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(newIds));
|
||||
|
||||
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
_entityMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
@ -236,9 +257,59 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, newId);
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[]
|
||||
{
|
||||
newId
|
||||
});
|
||||
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true);
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutNamedEntitySpawn)
|
||||
{
|
||||
PacketPlayOutNamedEntitySpawn spawnPacket = (PacketPlayOutNamedEntitySpawn) packet;
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>) spawnPacket.i.c())
|
||||
{
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte) watchable.b()) == 1)
|
||||
{
|
||||
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
||||
{
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(spawnPacket.a);
|
||||
|
||||
int[] newIds = new int[ids.length];
|
||||
|
||||
for (int a = 0; a < ids.length; a++)
|
||||
{
|
||||
newIds[a] = ids[a];
|
||||
}
|
||||
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(newIds));
|
||||
|
||||
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
_entityMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
}
|
||||
|
||||
final String entityName = spawnPacket.i.getString(2);
|
||||
|
||||
if (entityName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
int newId2 = UtilEnt.getNewEntityId();
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[]
|
||||
{
|
||||
newId,
|
||||
newId2
|
||||
});
|
||||
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId2, entityName, verifier, true, newId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -247,7 +318,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata) packet;
|
||||
|
||||
if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a))
|
||||
if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a) && metaPacket.a != owner.getEntityId())
|
||||
{
|
||||
boolean isDisplaying = _entityMap.get(owner.getName()).containsKey(metaPacket.a);
|
||||
String currentName = _entityNameMap.get(owner.getName()).get(metaPacket.a);
|
||||
@ -279,7 +350,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
// If name is still being displayed
|
||||
if (newDisplay)
|
||||
{
|
||||
int newId;
|
||||
Integer[] newId;
|
||||
|
||||
if (isDisplaying) // Sending metadata
|
||||
{
|
||||
@ -288,22 +359,28 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
else
|
||||
// Spawning new entity
|
||||
{
|
||||
newId = UtilEnt.getNewEntityId();
|
||||
newId = new Integer[]
|
||||
{
|
||||
UtilEnt.getNewEntityId()
|
||||
};
|
||||
|
||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||
}
|
||||
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, newName, verifier, !isDisplaying);
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, newName);
|
||||
sendProtocolPackets(owner, metaPacket.a, newId[0], newName, verifier, !isDisplaying, -1);
|
||||
}
|
||||
else
|
||||
{ // Lets delete it
|
||||
int id = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
int[] newIds = new int[ids.length];
|
||||
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
id
|
||||
}));
|
||||
for (int a = 0; a < ids.length; a++)
|
||||
{
|
||||
newIds[a] = ids[a];
|
||||
}
|
||||
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(newIds));
|
||||
|
||||
_entityMap.get(owner.getName()).remove(metaPacket.a);
|
||||
_entityNameMap.get(owner.getName()).remove(metaPacket.a);
|
||||
@ -319,10 +396,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
if (_entityMap.get(owner.getName()).containsKey(id))
|
||||
{
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_entityMap.get(owner.getName()).get(id)
|
||||
}));
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(id);
|
||||
int[] newIds = new int[ids.length];
|
||||
|
||||
for (int a = 0; a < ids.length; a++)
|
||||
{
|
||||
newIds[a] = ids[a];
|
||||
}
|
||||
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(newIds));
|
||||
_entityMap.get(owner.getName()).remove(id);
|
||||
_entityNameMap.get(owner.getName()).remove(id);
|
||||
}
|
||||
@ -345,19 +427,79 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet;
|
||||
|
||||
for (Entry<Integer, Integer> entry : _entityMap.get(owner.getName()).entrySet())
|
||||
{
|
||||
if (entry.getValue() == usePacket.a)
|
||||
{
|
||||
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
||||
newPacket.a = entry.getKey();
|
||||
newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK
|
||||
: EnumEntityUseAction.INTERACT;
|
||||
loop:
|
||||
|
||||
for (Entry<Integer, Integer[]> entry : _entityMap.get(owner.getName()).entrySet())
|
||||
{
|
||||
for (int id : entry.getValue())
|
||||
{
|
||||
if (id == usePacket.a)
|
||||
{
|
||||
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
||||
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
||||
newPacket.a = entry.getKey();
|
||||
newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK
|
||||
: EnumEntityUseAction.INTERACT;
|
||||
|
||||
{
|
||||
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
||||
}
|
||||
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutAttachEntity)
|
||||
{
|
||||
PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity) packet;
|
||||
|
||||
// c = rider, b = ridden
|
||||
// When detaching, c is sent, b is -1
|
||||
|
||||
// If this attach packet is for a player that has the fix
|
||||
// If the attach packet isn't ordained by me
|
||||
if (!_entityMap.containsKey(owner.getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_entityRiding.containsKey(owner.getName()))
|
||||
{
|
||||
_entityRiding.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
||||
}
|
||||
|
||||
int vehicleId = -1;
|
||||
|
||||
if (_entityRiding.get(owner.getName()).containsKey(attachPacket.b))
|
||||
{
|
||||
vehicleId = _entityRiding.get(owner.getName()).get(attachPacket.b);
|
||||
}
|
||||
|
||||
if (attachPacket.c == -1 && _entityMap.get(owner.getName()).containsKey(vehicleId))
|
||||
{
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(vehicleId);
|
||||
|
||||
_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);
|
||||
}
|
||||
else
|
||||
{
|
||||
Integer[] ids = _entityMap.get(owner.getName()).get(attachPacket.c);
|
||||
|
||||
if (ids != null && ids[0] != attachPacket.b)
|
||||
{
|
||||
_entityRiding.get(owner.getName()).put(attachPacket.b, attachPacket.c);
|
||||
|
||||
int[] newIds = new int[ids.length];
|
||||
|
||||
for (int a = 0; a < ids.length; a++)
|
||||
{
|
||||
newIds[a] = ids[a];
|
||||
}
|
||||
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(newIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -365,7 +507,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
}
|
||||
|
||||
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName,
|
||||
final PacketVerifier packetList, final boolean newPacket)
|
||||
final PacketVerifier packetList, final boolean newPacket, final int squidId)
|
||||
{
|
||||
CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName);
|
||||
_plugin.getServer().getPluginManager().callEvent(event);
|
||||
@ -375,82 +517,49 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||
|
||||
watcher.a(0, Byte.valueOf((byte) 0));
|
||||
watcher.a(0, (byte) (0 | 1 << 5)); // Invisible
|
||||
watcher.a(1, Short.valueOf((short) 300));
|
||||
watcher.a(2, "");
|
||||
watcher.a(3, Byte.valueOf((byte) 0));
|
||||
watcher.a(2, finalEntityName);
|
||||
watcher.a(3, (byte) 1);
|
||||
watcher.a(4, Byte.valueOf((byte) 0));
|
||||
watcher.a(7, Integer.valueOf(0));
|
||||
watcher.a(8, Byte.valueOf((byte) 0));
|
||||
watcher.a(9, Byte.valueOf((byte) 0));
|
||||
watcher.a(6, Float.valueOf(1.0F));
|
||||
watcher.a(10, Byte.valueOf((byte) 0));
|
||||
|
||||
// Set invisible
|
||||
int i1 = watcher.getByte(0);
|
||||
watcher.watch(0, Byte.valueOf((byte) (i1 | 1 << 5)));
|
||||
|
||||
// Set small
|
||||
byte b1 = watcher.getByte(10);
|
||||
b1 = (byte) (b1 | 0x1);
|
||||
|
||||
watcher.watch(10, Byte.valueOf(b1));
|
||||
|
||||
watcher.watch(2, finalEntityName);
|
||||
watcher.watch(3, Byte.valueOf((byte) 1));
|
||||
watcher.a(10, (byte) (0 | 0x1)); // Small
|
||||
|
||||
if (newPacket)
|
||||
{
|
||||
final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
if (squidId >= 0)
|
||||
{
|
||||
watcher.watch(10, (byte) 16);
|
||||
|
||||
DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||
squidWatcher.a(0, (byte) (0 | 1 << 5));
|
||||
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
spawnPacket.a = squidId;
|
||||
spawnPacket.b = (byte) EntityType.SQUID.getTypeId();
|
||||
spawnPacket.c = 1000000;
|
||||
|
||||
spawnPacket.l = squidWatcher;
|
||||
|
||||
UtilPlayer.sendPacket(owner, spawnPacket);
|
||||
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = spawnPacket.a;
|
||||
vehiclePacket.c = entityId;
|
||||
|
||||
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||
}
|
||||
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
spawnPacket.a = newEntityId;
|
||||
spawnPacket.b = (byte) 30;
|
||||
spawnPacket.c = (int) MathHelper.floor(100 * 32);
|
||||
spawnPacket.d = (int) MathHelper.floor(64 * 32.0D);
|
||||
spawnPacket.e = (int) MathHelper.floor(100 * 32);
|
||||
spawnPacket.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
spawnPacket.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
spawnPacket.k = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
|
||||
double var2 = 3.9D;
|
||||
double var4 = 0;
|
||||
double var6 = 0;
|
||||
double var8 = 0;
|
||||
|
||||
if (var4 < -var2)
|
||||
{
|
||||
var4 = -var2;
|
||||
}
|
||||
|
||||
if (var6 < -var2)
|
||||
{
|
||||
var6 = -var2;
|
||||
}
|
||||
|
||||
if (var8 < -var2)
|
||||
{
|
||||
var8 = -var2;
|
||||
}
|
||||
|
||||
if (var4 > var2)
|
||||
{
|
||||
var4 = var2;
|
||||
}
|
||||
|
||||
if (var6 > var2)
|
||||
{
|
||||
var6 = var2;
|
||||
}
|
||||
|
||||
if (var8 > var2)
|
||||
{
|
||||
var8 = var2;
|
||||
}
|
||||
|
||||
spawnPacket.f = (int) (var4 * 8000.0D);
|
||||
spawnPacket.g = (int) (var6 * 8000.0D);
|
||||
spawnPacket.h = (int) (var8 * 8000.0D);
|
||||
spawnPacket.c = 1000000;
|
||||
|
||||
spawnPacket.l = watcher;
|
||||
|
||||
@ -459,7 +568,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = spawnPacket.a;
|
||||
vehiclePacket.c = entityId;
|
||||
vehiclePacket.c = squidId >= 0 ? squidId : entityId;
|
||||
|
||||
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
{
|
||||
synchronized (_clientDataLock)
|
||||
{
|
||||
saveData(event.GetName(), event.getAccountId());
|
||||
_clientData.remove(event.GetName());
|
||||
}
|
||||
}
|
||||
@ -40,6 +41,8 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
return _clientData.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData(String name, int accountId) {}
|
||||
|
||||
public DataType Get(Player player)
|
||||
{
|
||||
|
@ -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;
|
||||
@ -34,7 +35,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -103,14 +103,15 @@ public class CoreClientManager extends MiniPlugin
|
||||
return newClient;
|
||||
}
|
||||
|
||||
public void Del(String name)
|
||||
public void Del(String name, int accountId)
|
||||
{
|
||||
synchronized(_clientLock)
|
||||
{
|
||||
_clientList.remove(name);
|
||||
}
|
||||
|
||||
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name));
|
||||
// rawr added account id for custom data - william
|
||||
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name, accountId));
|
||||
}
|
||||
|
||||
public CoreClient Get(String name)
|
||||
@ -364,7 +365,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
if (client == null || client.GetRank() == null)
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "There was an error logging you in. Please reconncet.");
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "There was an error logging you in. Please reconnect.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -406,7 +407,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
if (!_duplicateLoginGlitchPreventionList.contains(event.getPlayer().getName()))
|
||||
{
|
||||
Del(event.getPlayer().getName());
|
||||
Del(event.getPlayer().getName(), _clientList.get(event.getPlayer().getName()).getAccountId());
|
||||
_duplicateLoginGlitchPreventionList.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
||||
@ -472,7 +473,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
public void run(List<String> matches)
|
||||
{
|
||||
String tempName = null;
|
||||
|
||||
|
||||
for (String match : matches)
|
||||
{
|
||||
if (match.equalsIgnoreCase(playerName))
|
||||
@ -481,12 +482,12 @@ public class CoreClientManager extends MiniPlugin
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final String matchedName = tempName;
|
||||
|
||||
|
||||
if (matchedName != null)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext(); )
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(playerName))
|
||||
{
|
||||
@ -494,7 +495,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
public void run(final String target)
|
||||
@ -528,7 +529,8 @@ public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
for (Iterator<Entry<String, CoreClient>> clientIterator = _clientList.entrySet().iterator(); clientIterator.hasNext();)
|
||||
{
|
||||
Player clientPlayer = clientIterator.next().getValue().GetPlayer();
|
||||
CoreClient client = clientIterator.next().getValue(); // rawr, needed this for custom data - william
|
||||
Player clientPlayer = client.GetPlayer();
|
||||
|
||||
if (clientPlayer != null && !clientPlayer.isOnline())
|
||||
{
|
||||
@ -536,7 +538,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
if (clientPlayer != null)
|
||||
{
|
||||
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(clientPlayer.getName()));
|
||||
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(clientPlayer.getName(), client.getAccountId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,17 +8,24 @@ public class ClientUnloadEvent extends Event
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private String _name;
|
||||
private int _accountId;
|
||||
|
||||
public ClientUnloadEvent(String name)
|
||||
public ClientUnloadEvent(String name, int accountId)
|
||||
{
|
||||
_name = name;
|
||||
_accountId = accountId;
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
public int getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
|
@ -46,7 +46,7 @@ public class AccountRepository extends RepositoryBase
|
||||
|
||||
public AccountRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
@ -23,6 +23,13 @@ public enum Achievement
|
||||
new int[]{200},
|
||||
AchievementCategory.HOLIDAY),
|
||||
|
||||
GLOBAL_PRESENT_HOARDER_2015("2015 Present Hoarder", 4000,
|
||||
new String[]{"Global.Christmas Presents 2015"},
|
||||
new String[]{"Open 200 Christmas Presents,",
|
||||
"during Christmas 2015!"},
|
||||
new int[]{200},
|
||||
AchievementCategory.HOLIDAY),
|
||||
|
||||
//Bridges
|
||||
BRIDGES_WINS("Bridge Champion", 600,
|
||||
new String[]{"The Bridges.Wins"},
|
||||
@ -770,8 +777,84 @@ 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),
|
||||
|
||||
;
|
||||
TYPE_WARS_SPEED_DEMON("Speed Demon", 1000,
|
||||
new String[]{"Type Wars.Demon"},
|
||||
new String[]{"Kill 5 Mobs in 8 seconds", "by typing"},
|
||||
new int[]{1},
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
TYPE_WARS_PERFECTIONIST("Perfectionist", 1200,
|
||||
new String[]{"Type Wars.Perfectionist"},
|
||||
new String[]{"Go an entire game", "without mistyping"},
|
||||
new int[]{1},
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
TYPE_WARS_WAIT_FOR_IT("Wait for it", 1200,
|
||||
new String[]{"Type Wars.Nuke"},
|
||||
new String[]{"Kill 30 or more Mobs", "with a Nuke Spell"},
|
||||
new int[]{1},
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
TYPE_WARS_HOARDER("Hoarder", 1000,
|
||||
new String[]{"Type Wars.Hoarder"},
|
||||
new String[]{"Summon 50 Mobs in one game"},
|
||||
new int[]{1},
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
TYPE_WARS_DUMBLEDONT("Dumbledont", 800,
|
||||
new String[]{"Type Wars.Dumbledont"},
|
||||
new String[]{"Win without using any spells"},
|
||||
new int[]{1},
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
TYPE_WARS_WINNS("The True Typewriter", 2000,
|
||||
new String[]{"Type Wars.Wins"},
|
||||
new String[]{"Win 30 Games"},
|
||||
new int[]{30},
|
||||
AchievementCategory.TYPE_WARS);
|
||||
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
|
@ -2,6 +2,10 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,10 +14,6 @@ import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -23,7 +23,7 @@ public enum AchievementCategory
|
||||
|
||||
HOLIDAY("Holiday Achievements", null,
|
||||
new StatDisplay[] {},
|
||||
Material.PUMPKIN_PIE, 0, GameCategory.HOLIDAY, "None"),
|
||||
Material.CAKE, 0, GameCategory.HOLIDAY, "None"),
|
||||
|
||||
BRIDGES("The Bridges", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
@ -105,11 +105,11 @@ 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 },
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE, null),
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit"),
|
||||
|
||||
TURF_WARS("Turf Wars", 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 },
|
||||
@ -151,7 +151,14 @@ public enum AchievementCategory
|
||||
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),
|
||||
|
||||
TYPE_WARS("Type Wars", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED},
|
||||
Material.NAME_TAG, 0, GameCategory.CLASSICS, null);
|
||||
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToPull;
|
||||
@ -239,7 +246,7 @@ public enum AchievementCategory
|
||||
if (!clientManager.Get(player).GetRank().has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
|
||||
continue;
|
||||
|
||||
int statNumber = 0;
|
||||
double statNumber = 0;
|
||||
|
||||
|
||||
// This is so we could load stats from other games
|
||||
@ -252,15 +259,49 @@ public enum AchievementCategory
|
||||
else
|
||||
{
|
||||
for (String statToPull : _statsToPull)
|
||||
{
|
||||
for (String statName : _statDisplays[i].getStats())
|
||||
statNumber += stats.getStat(statToPull + "." + statName);
|
||||
{
|
||||
if(_statDisplays[i].isDivideStats())
|
||||
{
|
||||
if(statNumber == 0)
|
||||
{
|
||||
statNumber = stats.getStat(statToPull + "." + statName);
|
||||
continue;
|
||||
}
|
||||
double stat = stats.getStat(statToPull + "." + statName);
|
||||
if(stat == 0)
|
||||
statNumber = statNumber / 1;
|
||||
else
|
||||
statNumber = (double) statNumber / stat;
|
||||
}
|
||||
else
|
||||
statNumber += stats.getStat(statToPull + "." + statName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String statString = C.cWhite + statNumber;
|
||||
String statString = C.cWhite + Math.round(statNumber);
|
||||
|
||||
// doubles
|
||||
// Special display for Words per Minute
|
||||
if (displayName.equalsIgnoreCase("Words Per Minute"))
|
||||
{
|
||||
statString = C.cWhite + (double) statNumber;
|
||||
if(statString.length() > 7)
|
||||
statString = statString.substring(0, 7);
|
||||
|
||||
lore.add(C.cYellow + displayName + ": " + statString);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// ints
|
||||
// Need to display special for time
|
||||
if (displayName.equalsIgnoreCase("Time In Game"))
|
||||
statString = C.cWhite + UtilTime.convertString(statNumber * 1000L, 0, UtilTime.TimeUnit.FIT);
|
||||
statString = C.cWhite + UtilTime.convertString(Math.round(statNumber) * 1000L, 0, UtilTime.TimeUnit.FIT);
|
||||
|
||||
|
||||
lore.add(C.cYellow + displayName + ": " + statString);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public class StatDisplay
|
||||
private String[] _stats;
|
||||
private boolean _fullStat;
|
||||
private boolean _justDisplayName;
|
||||
private boolean _divideStats;
|
||||
|
||||
public StatDisplay(String stat)
|
||||
{
|
||||
@ -25,19 +26,26 @@ public class StatDisplay
|
||||
_displayName = stat;
|
||||
_stats = new String[] { stat };
|
||||
_fullStat = false;
|
||||
_divideStats = false;
|
||||
_justDisplayName = justDisplayName;
|
||||
}
|
||||
|
||||
public StatDisplay(String displayName, boolean divideStats, String... stats)
|
||||
{
|
||||
this(displayName, false, divideStats, stats);
|
||||
}
|
||||
|
||||
public StatDisplay(String displayName, String... stats)
|
||||
{
|
||||
this(displayName, false, stats);
|
||||
this(displayName, false, false, stats);
|
||||
}
|
||||
|
||||
public StatDisplay(String displayName, boolean fullStat, String... stats)
|
||||
public StatDisplay(String displayName, boolean fullStat, boolean divideStats, String... stats)
|
||||
{
|
||||
_displayName = displayName;
|
||||
_stats = stats;
|
||||
_fullStat = fullStat;
|
||||
_divideStats = divideStats;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
@ -59,6 +67,11 @@ public class StatDisplay
|
||||
{
|
||||
return _fullStat;
|
||||
}
|
||||
|
||||
public boolean isDivideStats()
|
||||
{
|
||||
return _divideStats;
|
||||
}
|
||||
|
||||
public static StatDisplay fromGame(String name, GameDisplay gameDisplay, String... stats)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
"XXXXOXXXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"XXOXOXOXX").getItemSlots();
|
||||
"XOXOXOXOX").getItemSlots();
|
||||
int listSlot = 0;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
|
@ -345,7 +345,10 @@ public class AntiHack extends MiniPlugin
|
||||
}
|
||||
|
||||
//Auto-Kick
|
||||
if (!handled && _clientManager.Get(player).GetRank() != Rank.YOUTUBE && _clientManager.Get(player).GetRank() != Rank.TWITCH)
|
||||
if (!handled &&
|
||||
_clientManager.Get(player).GetRank() != Rank.YOUTUBE &&
|
||||
_clientManager.Get(player).GetRank() != Rank.YOUTUBE_SMALL &&
|
||||
_clientManager.Get(player).GetRank() != Rank.TWITCH)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 0.5f);
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class AntiHackRepository
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.STATS_MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getStats().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -19,7 +19,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
||||
|
||||
public BenefitManagerRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
@ -765,7 +789,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
try
|
||||
{
|
||||
final int newTickets = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
final int newTickets = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
where(Tables.bonus.accountId.eq(accountId)).returning(Tables.bonus.tickets).fetchOne().getTickets();
|
||||
runSync(new Runnable()
|
||||
{
|
||||
|
@ -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;
|
||||
@ -44,7 +36,7 @@ public class BonusRepository extends RepositoryBase
|
||||
|
||||
public BonusRepository(JavaPlugin plugin, BonusManager bonusManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
_manager = bonusManager;
|
||||
_donationManager = donationManager;
|
||||
}
|
||||
@ -153,7 +145,7 @@ public class BonusRepository extends RepositoryBase
|
||||
{
|
||||
try
|
||||
{
|
||||
DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||
create.update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
where(Tables.bonus.accountId.eq(accountId)).execute();
|
||||
final int newTickets = create.select(Tables.bonus.tickets).from(Tables.bonus).where(Tables.bonus.accountId.eq(accountId)).fetchOne().value1();
|
||||
@ -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;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class BotSpamRepository extends RepositoryBase
|
||||
|
||||
public BotSpamRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public ArrayList<SpamText> getSpamText()
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -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)
|
||||
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -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 can’t be a tiger! That’s silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(morphSlot);
|
||||
|
||||
lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName());
|
||||
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive));
|
||||
if (mountActive != null) addGlow(mountSlot);
|
||||
|
||||
lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", "Usable in Lobbies", petActive == null ? null : petActive.getCustomName());
|
||||
addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this));
|
||||
if (petActive != null) addGlow(petSlot);
|
||||
|
||||
type = GadgetType.Hat;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(hatSlot);
|
||||
|
||||
type = GadgetType.Costume;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(costumeSlot);
|
||||
|
||||
type = GadgetType.MusicDisc;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(musicSlot);
|
||||
|
||||
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
|
||||
{
|
||||
Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
|
||||
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
|
||||
addButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[]{}, 1, false, false),
|
||||
new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
getPlugin().getPetManager().RemovePet(player, true);
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
player.sendMessage(F.main("Shop", "Coming soon!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
|
||||
{
|
||||
return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName());
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled)
|
||||
{
|
||||
if (enabled != null)
|
||||
{
|
||||
return UtilText.splitLinesToArray(new String[] {
|
||||
C.blankLine,
|
||||
C.cGray + info,
|
||||
C.cDGray + visibility,
|
||||
C.blankLine,
|
||||
C.cWhite + "You own " + ownedCount + "/" + maxCount,
|
||||
C.blankLine,
|
||||
C.cWhite + "Active: " + C.cYellow + enabled,
|
||||
C.cGreen + "Right-Click to Disable",
|
||||
C.blankLine,
|
||||
C.cGreen + "Left-Click to View Category"
|
||||
}, LineFormat.LORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return UtilText.splitLinesToArray(new String[] {
|
||||
C.blankLine,
|
||||
C.cGray + info,
|
||||
C.cDGray + visibility,
|
||||
C.blankLine,
|
||||
C.cWhite + "You own " + ownedCount + "/" + maxCount,
|
||||
C.blankLine,
|
||||
C.cGreen + "Left-Click to View Category"
|
||||
}, LineFormat.LORE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,16 +247,4 @@ public class Menu extends ShopPageBase<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()));
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -24,58 +24,26 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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)
|
||||
@ -83,5 +51,110 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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++;
|
||||
|
@ -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++;
|
||||
|
@ -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."));
|
||||
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package mineplex.core.customdata;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 17/12/15
|
||||
*/
|
||||
public class CorePlayer extends MineplexPlayer
|
||||
{
|
||||
public CorePlayer(Player player, CustomDataManager customDataManager)
|
||||
{
|
||||
super(player, customDataManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyPrefix()
|
||||
{
|
||||
return "core.";
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package mineplex.core.customdata;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 16/12/15
|
||||
*/
|
||||
public class CustomData
|
||||
{
|
||||
private int _id;
|
||||
private String _key;
|
||||
|
||||
public CustomData(int id, String key)
|
||||
{
|
||||
_id = id;
|
||||
_key = key;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getKey()
|
||||
{
|
||||
return _key;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package mineplex.core.customdata;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.customdata.repository.CustomDataRepository;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 16/12/15
|
||||
*/
|
||||
public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
|
||||
{
|
||||
private CustomDataRepository _repository;
|
||||
|
||||
public CustomDataManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
{
|
||||
super("Custom Data Manager", plugin, clientManager);
|
||||
|
||||
_repository = new CustomDataRepository(plugin, clientManager, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
PlayerCustomData data = new PlayerCustomData(_repository);
|
||||
while (resultSet.next())
|
||||
{
|
||||
data.setData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data"));
|
||||
}
|
||||
Set(playerName, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
return "SELECT accountId, customDataId, data FROM accountCustomData INNER JOIN customData ON customData.id = accountCustomData.customDataId WHERE accountId = " + accountId + ";";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerCustomData AddPlayer(String player)
|
||||
{
|
||||
return new PlayerCustomData(_repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(String name, int accountId)
|
||||
{
|
||||
_repository.saveData(name, accountId);
|
||||
}
|
||||
|
||||
public CorePlayer getCorePlayer(Player player)
|
||||
{
|
||||
return new CorePlayer(player, this);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package mineplex.core.customdata;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 16/12/15
|
||||
*/
|
||||
public abstract class MineplexPlayer
|
||||
{
|
||||
private Player _player;
|
||||
private CustomDataManager _customDataManager;
|
||||
|
||||
public MineplexPlayer(Player player, CustomDataManager customDataManager)
|
||||
{
|
||||
_player = player;
|
||||
_customDataManager = customDataManager;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public String getKeyPrefix()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public void put(String key, int data)
|
||||
{
|
||||
key = getKeyPrefix() + key;
|
||||
_customDataManager.Get(getPlayer()).setData(key, data);
|
||||
}
|
||||
|
||||
public int get(String key)
|
||||
{
|
||||
key = getKeyPrefix() + key;
|
||||
return _customDataManager.Get(getPlayer()).getData(key);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package mineplex.core.customdata;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.customdata.repository.CustomDataRepository;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 16/12/15
|
||||
*/
|
||||
public class PlayerCustomData
|
||||
{
|
||||
private HashMap<CustomData, Integer> _data;
|
||||
private CustomDataRepository _repository;
|
||||
|
||||
public PlayerCustomData(CustomDataRepository repository)
|
||||
{
|
||||
_data = new HashMap<>();
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public HashMap<CustomData, Integer> getDataMap()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public void setData(CustomData cd, int amount)
|
||||
{
|
||||
_data.put(cd, amount);
|
||||
}
|
||||
|
||||
public void setData(String key, int amount)
|
||||
{
|
||||
if (_repository.doesKeyExist(key))
|
||||
{
|
||||
setData(_repository.getKey(key), amount);
|
||||
return;
|
||||
}
|
||||
|
||||
_repository.getClientManager().getScheduler().runTaskAsynchronously(
|
||||
_repository.getClientManager().getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.registerKey(key); // Make sure it's in the DB.
|
||||
|
||||
setData(_repository.getKey(key), amount); // Input
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getData(String key)
|
||||
{
|
||||
if (_data.containsKey(_repository.getKey(key)))
|
||||
return _data.get(_repository.getKey(key));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package mineplex.core.customdata.repository;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.customdata.CustomData;
|
||||
import mineplex.core.customdata.CustomDataManager;
|
||||
import mineplex.core.customdata.PlayerCustomData;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 16/12/15
|
||||
*/
|
||||
public class CustomDataRepository extends RepositoryBase
|
||||
{
|
||||
private static final String SELECT_KEYS = "SELECT id, name FROM customData;";
|
||||
private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);";
|
||||
private static final String UPDATE_DATA = "UPDATE accountCustomData SET data = ? WHERE accountId = ? AND customDataId = ?;";
|
||||
private static final String INSERT_DATA = "INSERT INTO accountCustomData (accountId, customDataId, data) VALUES (?, ?, ?);";
|
||||
|
||||
private ArrayList<CustomData> _dataKeys;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private CustomDataManager _customDataManager;
|
||||
|
||||
public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager, CustomDataManager customDataManager)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_clientManager = clientManager;
|
||||
_customDataManager = customDataManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
downloadDataKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update() {}
|
||||
|
||||
private void downloadDataKeys()
|
||||
{
|
||||
_dataKeys = new ArrayList<>();
|
||||
|
||||
executeQuery(SELECT_KEYS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
_dataKeys.add(new CustomData(resultSet.getInt("id"), resultSet.getString("name")));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void saveData(String name, int accountId)
|
||||
{
|
||||
PlayerCustomData data = _customDataManager.Get(name);
|
||||
|
||||
for (CustomData cd : data.getDataMap().keySet())
|
||||
{
|
||||
if (executeUpdate(
|
||||
UPDATE_DATA,
|
||||
new ColumnInt("data", data.getDataMap().get(cd)),
|
||||
new ColumnInt("account", accountId),
|
||||
new ColumnInt("customData", cd.getId())) < 1)
|
||||
{
|
||||
// Not already in the DB
|
||||
executeUpdate(
|
||||
INSERT_DATA,
|
||||
new ColumnInt("account", accountId),
|
||||
new ColumnInt("customData", cd.getId()),
|
||||
new ColumnInt("data", data.getDataMap().get(cd))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerKey(String key)
|
||||
{
|
||||
if (doesKeyExist(key))
|
||||
return;
|
||||
|
||||
executeUpdate(INSERT_KEY, new ColumnVarChar("name", 100, key));
|
||||
downloadDataKeys();
|
||||
}
|
||||
|
||||
public ArrayList<CustomData> getDataKeys()
|
||||
{
|
||||
return _dataKeys;
|
||||
}
|
||||
|
||||
public boolean doesKeyExist(String key)
|
||||
{
|
||||
for (CustomData cur : _dataKeys)
|
||||
if (cur.getKey().equals(key))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public CustomData getKey(int id)
|
||||
{
|
||||
for (CustomData cur : _dataKeys)
|
||||
if (cur.getId() == id)
|
||||
return cur;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CustomData getKey(String key)
|
||||
{
|
||||
for (CustomData cur : _dataKeys)
|
||||
if (cur.getKey().equals(key))
|
||||
return cur;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
}
|
@ -1,16 +1,26 @@
|
||||
package mineplex.core.database;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import mineplex.serverdata.redis.RedisConfig;
|
||||
import mineplex.serverdata.servers.ConnectionData;
|
||||
import mineplex.serverdata.servers.ConnectionData.ConnectionType;
|
||||
|
||||
public final class DBPool
|
||||
{
|
||||
public static final DataSource ACCOUNT = openDataSource("jdbc:mysql://db.mineplex.com/Account", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource QUEUE = openDataSource("jdbc:mysql://db.mineplex.com/Queue", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource MINEPLEX = openDataSource("jdbc:mysql://db.mineplex.com:3306/Mineplex", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource STATS_MINEPLEX = openDataSource("jdbc:mysql://sqlstats.mineplex.com:3306/Mineplex", "root", "tAbechAk3wR7tuTh");
|
||||
private static DataSource ACCOUNT;
|
||||
private static DataSource QUEUE;
|
||||
private static DataSource MINEPLEX;
|
||||
private static DataSource STATS_MINEPLEX;
|
||||
|
||||
private static DataSource openDataSource(String url, String username, String password)
|
||||
{
|
||||
@ -30,8 +40,86 @@ public final class DBPool
|
||||
return source;
|
||||
}
|
||||
|
||||
private DBPool()
|
||||
public static DataSource getAccount()
|
||||
{
|
||||
if (ACCOUNT == null)
|
||||
loadDataSources();
|
||||
|
||||
return ACCOUNT;
|
||||
}
|
||||
|
||||
public static DataSource getQueue()
|
||||
{
|
||||
if (QUEUE == null)
|
||||
loadDataSources();
|
||||
|
||||
return QUEUE;
|
||||
}
|
||||
|
||||
public static DataSource getMineplex()
|
||||
{
|
||||
if (MINEPLEX == null)
|
||||
loadDataSources();
|
||||
|
||||
return MINEPLEX;
|
||||
}
|
||||
|
||||
public static DataSource getStats()
|
||||
{
|
||||
if (STATS_MINEPLEX == null)
|
||||
loadDataSources();
|
||||
|
||||
return STATS_MINEPLEX;
|
||||
}
|
||||
|
||||
private static void loadDataSources()
|
||||
{
|
||||
try
|
||||
{
|
||||
File configFile = new File("database-config.dat");
|
||||
|
||||
if (configFile.exists())
|
||||
{
|
||||
List<String> lines = Files.readAllLines(configFile.toPath(), Charset.defaultCharset());
|
||||
|
||||
for (String line : lines)
|
||||
{
|
||||
deserializeConnection(line);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("database-config.dat not found at " + configFile.toPath().toString());
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
System.out.println("---Unable To Parse DBPOOL Configuration File---");
|
||||
}
|
||||
}
|
||||
|
||||
private static void deserializeConnection(String line)
|
||||
{
|
||||
String[] args = line.split(" ");
|
||||
|
||||
if (args.length == 4)
|
||||
{
|
||||
String dbSource = args[0];
|
||||
String dbHost = args[1];
|
||||
String userName = args[2];
|
||||
String password = args[3];
|
||||
|
||||
System.out.println(dbSource + " " + dbHost + " " + userName + " " + password);
|
||||
|
||||
if (dbSource.toUpperCase().equalsIgnoreCase("ACCOUNT"))
|
||||
ACCOUNT = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("QUEUE"))
|
||||
QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX"))
|
||||
MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("STATS"))
|
||||
STATS_MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public abstract class RepositoryBase implements Listener
|
||||
|
||||
protected DSLContext jooq()
|
||||
{
|
||||
return DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}
|
||||
|