diff --git a/PrevailBunkers/.classpath b/PrevailBunkers/.classpath new file mode 100644 index 0000000..b927b89 --- /dev/null +++ b/PrevailBunkers/.classpath @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/PrevailBunkers/.idea/.name b/PrevailBunkers/.idea/.name new file mode 100644 index 0000000..91ca596 --- /dev/null +++ b/PrevailBunkers/.idea/.name @@ -0,0 +1 @@ +UHC Bunkers \ No newline at end of file diff --git a/PrevailBunkers/.idea/artifacts/UHC_Bunkers_jar.xml b/PrevailBunkers/.idea/artifacts/UHC_Bunkers_jar.xml new file mode 100644 index 0000000..4c4e57e --- /dev/null +++ b/PrevailBunkers/.idea/artifacts/UHC_Bunkers_jar.xml @@ -0,0 +1,20 @@ + + + $PROJECT_DIR$/classes/artifacts/UHC_Bunkers_jar + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailBunkers/.idea/encodings.xml b/PrevailBunkers/.idea/encodings.xml new file mode 100644 index 0000000..2611eff --- /dev/null +++ b/PrevailBunkers/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PrevailBunkers/.idea/misc.xml b/PrevailBunkers/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/PrevailBunkers/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PrevailBunkers/.idea/modules.xml b/PrevailBunkers/.idea/modules.xml new file mode 100644 index 0000000..8232060 --- /dev/null +++ b/PrevailBunkers/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PrevailBunkers/.idea/workspace.xml b/PrevailBunkers/.idea/workspace.xml new file mode 100644 index 0000000..c4d93f3 --- /dev/null +++ b/PrevailBunkers/.idea/workspace.xml @@ -0,0 +1,812 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1504672144081 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jar://C:/Program Files/Java/jdk1.8.0_144/src.zip!/java/util/function/Consumer.java + 63 + + + + file://$PROJECT_DIR$/src/com/prevailpots/bunkers/Core.java + 181 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UHC Bunkers:jar + + + + + + + + No facets are configured + + + + + + + + + + + + + + + 1.8 + + + + + + + + UHC Bunkers + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailBunkers/.project b/PrevailBunkers/.project new file mode 100644 index 0000000..5ae57ed --- /dev/null +++ b/PrevailBunkers/.project @@ -0,0 +1,15 @@ + + + UHC Bunkers + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.jdt.core.javanature + + diff --git a/PrevailBunkers/META-INF/MANIFEST.MF b/PrevailBunkers/META-INF/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/PrevailBunkers/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/PrevailBunkers/UHC Bunkers.eml b/PrevailBunkers/UHC Bunkers.eml new file mode 100644 index 0000000..e7800fb --- /dev/null +++ b/PrevailBunkers/UHC Bunkers.eml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/PrevailBunkers/UHC Bunkers.iml b/PrevailBunkers/UHC Bunkers.iml new file mode 100644 index 0000000..6d59135 --- /dev/null +++ b/PrevailBunkers/UHC Bunkers.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/PrevailBunkers/UHC Bunkers.userlibraries b/PrevailBunkers/UHC Bunkers.userlibraries new file mode 100644 index 0000000..5aec3f5 --- /dev/null +++ b/PrevailBunkers/UHC Bunkers.userlibraries @@ -0,0 +1,3 @@ + + + diff --git a/PrevailBunkers/classes/artifacts/UHC_Bunkers_jar/UHC Bunkers.jar b/PrevailBunkers/classes/artifacts/UHC_Bunkers_jar/UHC Bunkers.jar new file mode 100644 index 0000000..cd238e3 Binary files /dev/null and b/PrevailBunkers/classes/artifacts/UHC_Bunkers_jar/UHC Bunkers.jar differ diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/Core.java b/PrevailBunkers/out/com/prevailpots/bunkers/Core.java new file mode 100644 index 0000000..1a64f3e --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/Core.java @@ -0,0 +1,226 @@ +package com.prevailpots.bunkers; + +import java.io.File; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.command.CommandExecutor; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +import com.prevailpots.bunkers.commands.ForceStart; +import com.prevailpots.bunkers.commands.LobbySpawn; +import com.prevailpots.bunkers.commands.TeamCommand; +import com.prevailpots.bunkers.config.ConfigurationService; +import com.prevailpots.bunkers.game.GameHandler; +import com.prevailpots.bunkers.game.managers.BalanceManager; +import com.prevailpots.bunkers.game.managers.ChatManager; +import com.prevailpots.bunkers.game.managers.CooldownManager; +import com.prevailpots.bunkers.game.managers.DTRManager; +import com.prevailpots.bunkers.game.managers.FreezeManager; +import com.prevailpots.bunkers.game.managers.ItemManager; +import com.prevailpots.bunkers.game.managers.PointManager; +import com.prevailpots.bunkers.game.managers.ShopManager; +import com.prevailpots.bunkers.game.managers.TeamJoinManager; +import com.prevailpots.bunkers.game.managers.TeamManager; +import com.prevailpots.bunkers.scoreboard.ScoreboardHandler; +import com.prevailpots.bunkers.tab.TabEvent; +import com.prevailpots.bunkers.world.ConfigManager; +import com.prevailpots.bunkers.world.WorldManager; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; + +import me.vertises.aztec.tablist.TablistManager; +import me.vertises.aztec.tablist.example.ExampleSupplier; + + +public class Core extends JavaPlugin +{ + private static Core instance; + private static Plugin plugin; + private GameHandler gameHandler; + private BalanceManager balanceManager; + private PointManager pointManager; + private TeamManager teamManager; + private FreezeManager freezeManager; + private ScoreboardHandler scoreboardHandler; + private ItemManager itemManager; + private DTRManager dtrManager; + private ChatManager chatManager; + private CooldownManager cooldownManager; + private WorldEditPlugin worldEdit; + public static final Random RANDOM; + public WorldManager wm; + public ConfigManager config; + private TeamJoinManager teamjoinManager; + + static { + RANDOM = new Random(); + } + + public static Core getInstance() { + if (Core.instance == null) { + Core.instance = new Core(); + } + return Core.instance; + } + + public FreezeManager getFreezeManager() { + if (this.freezeManager == null) { + this.freezeManager = new FreezeManager(); + } + return this.freezeManager; + } + + public Core() { + this.wm = new WorldManager(); + this.config = new ConfigManager("WorldRollback", "config"); + } + + public BalanceManager getBalanceManager() { + if (this.balanceManager == null) { + this.balanceManager = new BalanceManager(); + } + return this.balanceManager; + } + + public DTRManager getDTRManager() { + if (this.dtrManager == null) { + this.dtrManager = new DTRManager(); + } + return this.dtrManager; + } + + public ChatManager getChatManager() { + if (this.chatManager == null) { + this.chatManager = new ChatManager(); + } + return this.chatManager; + } + + public ItemManager getItemManager() { + if (this.itemManager == null) { + this.itemManager = new ItemManager(); + } + return this.itemManager; + } + + public PointManager getPointManager() { + if (this.pointManager == null) { + this.pointManager = new PointManager(); + } + return this.pointManager; + } + + public ScoreboardHandler getScoreboardHandler() { + if (this.scoreboardHandler == null) { + this.scoreboardHandler = new ScoreboardHandler(getInstance()); + } + return this.scoreboardHandler; + } + + public GameHandler getGameHandler() { + if (this.gameHandler == null) { + this.gameHandler = new GameHandler(); + } + return this.gameHandler; + } + + public TeamManager getTeamManager() { + if (this.teamManager == null) { + this.teamManager = new TeamManager(); + } + return this.teamManager; + } + + public CooldownManager getCooldownManager() { + if (this.cooldownManager == null) { + this.cooldownManager = new CooldownManager(); + } + return this.cooldownManager; + } + + public void onEnable() { + Core.instance = this; + new TablistManager(this, new TabEvent(), TimeUnit.SECONDS.toMillis(5l)); + this.gameHandler = new GameHandler(); + this.balanceManager = new BalanceManager(); + this.itemManager = new ItemManager(); + this.pointManager = new PointManager(); + this.chatManager = new ChatManager(); + this.cooldownManager = new CooldownManager(); + this.freezeManager = new FreezeManager(); + this.scoreboardHandler = new ScoreboardHandler(getInstance()); + this.teamManager = new TeamManager(); + this.teamjoinManager = new TeamJoinManager(); + this.dtrManager = new DTRManager(); + final Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); + if (p instanceof WorldEditPlugin) { + this.worldEdit = (WorldEditPlugin)p; + } + ConfigurationService.init(); + this.registerEvents(); + this.registerCommands(); + Bukkit.getScheduler().runTaskTimer((Plugin)getInstance(), (Runnable)this.getGameHandler(), 20L, 20L); + Bukkit.broadcastMessage("�cThis server is running pBunkers by PrevailPots"); + Core.plugin = (Plugin)this; + if (this.config.getFile() == null) { + this.config.createFile(); + this.config.saveFile(); + } + if (this.config.getFile().getString("world") == null) { + this.config.getFile().set("world", (Object)"world"); + this.config.getFile().set("map", (Object)"_map"); + this.config.saveFile(); + } + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "The world has been refreshed for the next game!"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This network is running p-1-29-Version-BETA"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin is only licensed to prevailpots.com"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin was coded by S3ries, Clipped"); + } + + + public void onDisable() { + for (final Player p : Bukkit.getOnlinePlayers()) { + p.kickPlayer("�aServer reloading, please try again later."); + final World delete = Bukkit.getWorld(this.config.getFile().getString("world")); + final File deleteFolder = delete.getWorldFolder(); + this.wm.deleteWorld(deleteFolder); + Bukkit.getServer().createWorld(new WorldCreator(this.config.getFile().getString("map"))); + final World source = Bukkit.getWorld(this.config.getFile().getString("map")); + final File sourceFolder = source.getWorldFolder(); + final World target = Bukkit.getWorld(this.config.getFile().getString("world")); + final File targetFolder = target.getWorldFolder(); + this.wm.copyWorld(sourceFolder, targetFolder); + } + } + + public WorldEditPlugin getWorldEdit() { + return this.worldEdit; + } + + private void registerEvents() { + final PluginManager pm = Bukkit.getPluginManager(); + pm.registerEvents((Listener)this.getGameHandler(), (Plugin)getInstance()); + pm.registerEvents((Listener)new ShopManager(), (Plugin)getInstance()); + pm.registerEvents((Listener)this.scoreboardHandler, (Plugin)getInstance()); + new TablistManager(this, new TabEvent(), TimeUnit.SECONDS.toMillis(5l)); + pm.registerEvents((Listener)this.freezeManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.cooldownManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.chatManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.teamjoinManager, (Plugin)getInstance()); + } + + private void registerCommands() { + this.getCommand("setlobbyspawn").setExecutor((CommandExecutor)new LobbySpawn()); + this.getCommand("removetab").setExecutor((CommandExecutor)new RemoveTab()); + this.getCommand("team").setExecutor((CommandExecutor)new TeamCommand()); + this.getCommand("forcestart").setExecutor((CommandExecutor)new ForceStart()); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/commands/ForceStart.java b/PrevailBunkers/out/com/prevailpots/bunkers/commands/ForceStart.java new file mode 100644 index 0000000..630722c --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/commands/ForceStart.java @@ -0,0 +1,36 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; + +import ru.tehkode.permissions.bukkit.*; + +public class ForceStart implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (!PermissionsEx.getUser(player).has("uhcb.forcestart") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) { + player.sendMessage("§cThe game is already running!"); + return true; + } + Core.getInstance().getGameHandler().startGame(); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oForce started the game.§7]", "uhcb.forcestart"); + return true; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/commands/LobbySpawn.java b/PrevailBunkers/out/com/prevailpots/bunkers/commands/LobbySpawn.java new file mode 100644 index 0000000..20434b7 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/commands/LobbySpawn.java @@ -0,0 +1,31 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.utils.*; + +import ru.tehkode.permissions.bukkit.*; + +public class LobbySpawn implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (!PermissionsEx.getUser(player).has("uhcb.setlobbyspawn") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + ConfigurationService.setLobbySpawn(player.getLocation()); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the lobby spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setlobbyspawn"); + return true; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/commands/RemoveTab.java b/PrevailBunkers/out/com/prevailpots/bunkers/commands/RemoveTab.java new file mode 100644 index 0000000..e41a5c7 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/commands/RemoveTab.java @@ -0,0 +1,44 @@ +package com.prevailpots.bunkers.commands; + + +import java.util.ArrayList; +import java.util.Collection; + +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import com.prevailpots.bunkers.Core; + +import me.vertises.aztec.tablist.ClientVersion; + + +public class RemoveTab implements CommandExecutor { + + + + + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + if(!(commandSender instanceof Player)) { + return true; + } + return true; + } + public boolean getEntries(Player player) { + Table table = HashBasedTable.create(); + int index = 0; + int magic = ClientVersion.getVersion(player).ordinal() != 0 ? 4 : 3; + for (Player next : Bukkit.getOnlinePlayers()) { + int x = index % magic; + int y = index / magic; + table.put(x, y, next.getName()); + player.sendMessage("§eYou have §6§lremoved §eyour custom tab!"); + } + return true; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/commands/TeamCommand.java b/PrevailBunkers/out/com/prevailpots/bunkers/commands/TeamCommand.java new file mode 100644 index 0000000..e76a308 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/commands/TeamCommand.java @@ -0,0 +1,144 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; +import ru.tehkode.permissions.bukkit.*; + +import org.bukkit.*; +import org.apache.commons.lang3.*; +import org.bukkit.util.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; +import com.sk89q.worldedit.bukkit.selections.*; + +public class TeamCommand implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (args.length == 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + if (args[0].equalsIgnoreCase("setspawn")) { + if (!PermissionsEx.getUser(player).has("uhcb.setteamspawn") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setspawn "); + return true; + } + final String team = args[1]; + if (Team.fromString(team) == null) { + player.sendMessage("§eInvalid team."); + return true; + } + ConfigurationService.setTeamSpawn(player.getLocation(), Team.fromString(team)); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setteamspawn"); + } + else if (args[0].equalsIgnoreCase("info") || args[0].equalsIgnoreCase("stats") || args[0].equalsIgnoreCase("show") || args[0].equalsIgnoreCase("who")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team " + args[0] + " "); + return true; + } + String team = args[1]; + if (Team.fromString(team) == null) { + team = (Core.getInstance().getGameHandler().getPlayers().containsKey(team) ? StringUtils.capitalize(Core.getInstance().getGameHandler().getPlayers().get(Bukkit.getPlayer(team).getName()).toString().toLowerCase()) : "NULLBLOCK"); + } + final Team tem = Team.fromString(team); + if (tem == null) { + player.sendMessage("§eInvalid team."); + return true; + } + String toSend = ""; + toSend = String.valueOf(toSend) + "§7§m------------------------------------\n"; + toSend = String.valueOf(toSend) + "§7[" + tem.getColor().toString() + "Team " + StringUtils.capitalize(tem.toString().toLowerCase()) + "§7]\n"; + toSend = String.valueOf(toSend) + " \n"; + toSend = String.valueOf(toSend) + "§aTeam members" + tem.getColor().toString() + ":\n"; + String[] members; + for (int length = (members = Core.getInstance().getTeamManager().getMembers(tem)).length, i = 0; i < length; ++i) { + final String s = members[i]; + toSend = String.valueOf(toSend) + "§7[" + (Core.getInstance().getGameHandler().getPlayersDeadOrRespawning().contains(Bukkit.getPlayer(s).getName()) ? "§c" : "§a") + s + "§7]" + "\n"; + } + toSend = String.valueOf(toSend) + " \n"; + toSend = String.valueOf(toSend) + "§aTeam info" + tem.getColor().toString() + ":\n"; + toSend = String.valueOf(toSend) + "§aTotal team balance" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamBalanceFormatted(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team kills" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalKills(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team deaths" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalDeaths(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team points" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamPoints(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aDTR" + tem.getColor().toString() + ": " + Core.getInstance().getDTRManager().getDTRFormatted(tem) + "\n"; + toSend = String.valueOf(toSend) + "§7§m------------------------------------\n"; + player.sendMessage(toSend); + } + else if (args[0].equalsIgnoreCase("setregion")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setregion "); + return true; + } + final String team = args[1]; + if (!PermissionsEx.getUser(player).has("uhcb.setteamregion") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (Team.fromString(team) == null) { + player.sendMessage("§cInvalid team."); + return true; + } + final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player); + if (s2 == null) { + player.sendMessage("§cNo region selected. Select one with WorldEdit."); + return true; + } + final Vector point1 = new Vector(s2.getMinimumPoint().getX(), 0.0, s2.getMinimumPoint().getZ()); + final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ()); + ConfigurationService.setRegions(Team.fromString(team), new Vector[] { point1, point2 }); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team region.§7]", "uhcb.setteamregion"); + } + else if (args[0].equalsIgnoreCase("setcapzone")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setcapzone "); + return true; + } + final String team = args[1]; + if (!PermissionsEx.getUser(player).has("uhcb.setteamcapzone") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (Team.fromString(team) == null) { + player.sendMessage("§cInvalid team."); + return true; + } + final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player); + if (s2 == null) { + player.sendMessage("§cNo region selected. Select one with WorldEdit."); + return true; + } + final Vector point1 = new Vector(s2.getMinimumPoint().getX(), s2.getMinimumPoint().getY(), s2.getMinimumPoint().getZ()); + final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ()); + ConfigurationService.setCapzone(Team.fromString(team), new Vector[] { point1, point2 }); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team capzone.§7]", "uhcb.setteamcapzone"); + } + else if (args[0].equalsIgnoreCase("chat") || args[0].equalsIgnoreCase("c")) { + if (args.length != 1) { + player.sendMessage("§cCorrect usage: /team chat"); + return true; + } + if (Core.getInstance().getChatManager().isTeamChat(player)) { + Core.getInstance().getChatManager().setTeamChat(player, false); + player.sendMessage("§aYou are no longer talking in team chat."); + } + else { + Core.getInstance().getChatManager().setTeamChat(player, true); + player.sendMessage("§aYou are now talking in team chat."); + } + } + return true; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/config/ConfigurationService.java b/PrevailBunkers/out/com/prevailpots/bunkers/config/ConfigurationService.java new file mode 100644 index 0000000..f452b50 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/config/ConfigurationService.java @@ -0,0 +1,212 @@ +package com.prevailpots.bunkers.config; + +import org.bukkit.configuration.file.*; +import org.bukkit.util.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.sk89q.worldedit.Vector; + +import java.util.*; +import org.bukkit.entity.*; +import java.io.*; +import org.bukkit.*; + +public class ConfigurationService +{ + private static final File databaseFile; + private static YamlConfiguration database; + private static final File playerDatabaseFile; + private static YamlConfiguration playerDatabase; + public static final String NO_PERMISSIONS = "§c§lNO PERMISSIONS..."; + public static final String PLAYERS_ONLY = "§c§lPLAYERS ONLY!"; + public static final String PERM_SET_LOBBY_SPAWN = "uhcb.setlobbyspawn"; + public static final String PERM_SET_TEAM_SPAWN = "uhcb.setteamspawn"; + public static final String PERM_SET_TEAM_REGION = "uhcb.setteamregion"; + public static final String PERM_SET_TEAM_CAPZONE = "uhcb.setteamcapzone"; + public static final String PERM_FORCE_START = "uhcb.forcestart"; + public static final String SCOREBOARD_TITLE = "§6§lPURGE §c[UHCBunkers]"; + public static final int GAME_MAX_TIME_MINUTES = 35; + public static final int GAME_MAX_PLAYERS = 16; + public static final int GAME_MIN_PLAYERS = 4; + public static final int GAME_MAX_TEAM_SIZE = 4; + public static final int GAME_COUNTDOWN_TIME = 10; + public static final int GAME_START_FREEZE_SECONDS = 5; + public static final int GAME_DEATH_FREEZE_SECONDS = 5; + public static final double GAME_BALANCE_PER_2_SECONDS = 0.55; + public static final int GAME_COBBLESTONE_ORE_RESPAWN_SECONDS = 5; + public static final int TEAM_POINTS_TO_WIN = 125; + public static final int POINTS_LOST_ON_DEATH = 5; + public static final int POINTS_GAINED_ON_KILL = 5; + public static final double IRON_SELL_PRICE = 10.0; + public static final double GOLD_SELL_PRICE = 15.0; + public static final double DIAMOND_SELL_PRICE = 20.0; + private static Vector lobbySpawn; + private static Map teamRegions; + private static Map teamCapzones; + private static HashMap teamSpawns1; + private static HashMap statKills; + private static HashMap statDeaths; + private static Object teamSpawns; + + static { + databaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "database.yml"); + playerDatabaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "playerDatabase.yml"); + ConfigurationService.teamRegions = new HashMap(); + ConfigurationService.teamCapzones = new HashMap(); + ConfigurationService.teamSpawns1 = new HashMap(); + ConfigurationService.statKills = new HashMap(); + ConfigurationService.statDeaths = new HashMap(); + } + + public static void init() { + ConfigurationService.database = YamlConfiguration.loadConfiguration(ConfigurationService.databaseFile); + ConfigurationService.playerDatabase = YamlConfiguration.loadConfiguration(ConfigurationService.playerDatabaseFile); + registerShit(); + } + + private static void registerShit() { + ConfigurationService.lobbySpawn = new Vector(ConfigurationService.database.getDouble("lobbySpawn.x"), ConfigurationService.database.getDouble("lobbySpawn.y"), ConfigurationService.database.getDouble("lobbySpawn.z")); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + ConfigurationService.teamSpawns1.put(t, new Vector(ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".z"))); + } + for (final String s : ConfigurationService.playerDatabase.getKeys(false)) { + if (s == null) { + continue; + } + if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".kills")) { + continue; + } + if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".deaths")) { + continue; + } + ConfigurationService.statKills.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".kills")); + ConfigurationService.statDeaths.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".deaths")); + } + Team[] values2; + for (int length2 = (values2 = Team.values()).length, j = 0; j < length2; ++j) { + final Team t = values2[j]; + ConfigurationService.teamRegions.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".x"), 0.0, ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".z")) }); + ConfigurationService.teamCapzones.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".z")) }); + } + } + + public static Integer getStatKills(final Player p) { + return ConfigurationService.statKills.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statKills.get(p.getUniqueId().toString()) : 0; + } + + public static Vector[] getRegions(final Team t) { + return ConfigurationService.teamRegions.get(t); + } + + public static Vector[] getCapzone(final Team t) { + return ConfigurationService.teamCapzones.get(t); + } + + public static void setRegions(final Team t, final Vector[] vectors) { + if (ConfigurationService.teamRegions.containsKey(t)) { + ConfigurationService.teamRegions.remove(t); + } + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".x", (Object)vectors[0].getX()); + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".y", (Object)vectors[0].getY()); + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".z", (Object)vectors[0].getZ()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".x", (Object)vectors[1].getX()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".y", (Object)vectors[1].getY()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".z", (Object)vectors[1].getZ()); + saveDatabase(); + ConfigurationService.teamRegions.put(t, vectors); + } + + public static void setCapzone(final Team t, final Vector[] points) { + if (ConfigurationService.teamCapzones.containsKey(t)) { + ConfigurationService.teamCapzones.remove(t); + } + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".x", (Object)points[0].getX()); + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".y", (Object)points[0].getY()); + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".z", (Object)points[0].getZ()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".x", (Object)points[1].getX()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".y", (Object)points[1].getY()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".z", (Object)points[1].getZ()); + saveDatabase(); + ConfigurationService.teamCapzones.put(t, points); + } + + private static void saveDatabase() { + try { + ConfigurationService.database.save(ConfigurationService.databaseFile); + } + catch (IOException ex) {} + } + + private static void savePlayerDatabase() { + try { + ConfigurationService.playerDatabase.save(ConfigurationService.playerDatabaseFile); + } + catch (IOException ex) {} + } + + public static void setStatKills(final Player p, final int kills) { + if (ConfigurationService.statKills.containsKey(p.getUniqueId().toString())) { + ConfigurationService.statKills.remove(p.getUniqueId().toString()); + } + ConfigurationService.statKills.put(p.getUniqueId().toString(), kills); + ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".kills", (Object)kills); + savePlayerDatabase(); + } + + public static Integer getStatDeaths(final Player p) { + return ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statDeaths.get(p.getUniqueId().toString()) : 0; + } + + public static void setStatDeaths(final Player p, final int deaths) { + if (ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString())) { + ConfigurationService.statDeaths.remove(p.getUniqueId().toString()); + } + ConfigurationService.statDeaths.put(p.getUniqueId().toString(), deaths); + ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".deaths", (Object)deaths); + savePlayerDatabase(); + } + + public static Vector getLobbySpawn() { + return ConfigurationService.lobbySpawn; + } + + public static Vector getTeamSpawn(final Team t) { + return ConfigurationService.teamSpawns1.get(t); + } + + public static void setTeamSpawn(final Location loc, final Team team) { + if (team != null) { + if (ConfigurationService.teamSpawns1.containsKey(team)) { + ConfigurationService.teamSpawns1.remove(team); + } + ConfigurationService.teamSpawns1.put(team, new Vector(loc.getX(), loc.getY(), loc.getZ())); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".x", (Object)loc.getX()); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".y", (Object)loc.getY()); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".z", (Object)loc.getZ()); + saveDatabase(); + } + } + + public static void setLobbySpawn(final Location lobbySpawn) { + ConfigurationService.lobbySpawn = new Vector(lobbySpawn.getX(), lobbySpawn.getY(), lobbySpawn.getZ()); + ConfigurationService.database.set("lobbySpawn.x", (Object)lobbySpawn.getX()); + ConfigurationService.database.set("lobbySpawn.y", (Object)lobbySpawn.getY()); + ConfigurationService.database.set("lobbySpawn.z", (Object)lobbySpawn.getZ()); + saveDatabase(); + } + + public static void setCapzone(Team fromString, org.bukkit.util.Vector[] vectors) { + // TODO Auto-generated method stub + + } + + public static void setRegions(Team fromString, org.bukkit.util.Vector[] vectors) { + // TODO Auto-generated method stub + + + } + +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/GameHandler.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/GameHandler.java new file mode 100644 index 0000000..bab537e --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/GameHandler.java @@ -0,0 +1,587 @@ +package com.prevailpots.bunkers.game; +import org.apache.commons.lang3.StringUtils; +import org.bukkit.util.*; +import org.bukkit.event.*; +import org.bukkit.inventory.*; + +import java.util.*; +import org.bukkit.scheduler.*; +import org.bukkit.plugin.*; +import org.bukkit.entity.*; +import java.util.concurrent.*; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.task.*; +import com.prevailpots.bunkers.utils.*; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.bukkit.selections.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; + +public class GameHandler implements Listener, Runnable +{ + public Map players; + private List playersDeadOrRespawning; + private long actualTime; + private GameState gameState; + private int lastTeam; + public long gameStartCountdown; + private ArrayList bloq; + private Object bloq1; + + public GameHandler() { + this.players = new HashMap(); + this.playersDeadOrRespawning = new ArrayList(); + this.actualTime = 0L; + this.gameState = GameState.LOBBY; + this.lastTeam = 0; + this.gameStartCountdown = 10L; + this.bloq = new ArrayList(); + } + + public int teamSize(final Team t) { + int siz = 0; + for (final String s : this.players.keySet()) { + if (this.players.get(s).equals(t)) { + ++siz; + } + } + return siz; + } + + public Team autoAssign() { + ++this.lastTeam; + if (this.lastTeam == 5) { + this.lastTeam = 1; + } + return Team.values()[this.lastTeam - 1]; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void asyncJoin(final AsyncPlayerPreLoginEvent e) { + if (this.gameState != GameState.LOBBY) { + e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game has already started!"); + } + else if (this.players.size() > 16) { + e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game is full."); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void join(final PlayerJoinEvent e) { + e.setJoinMessage(null); + if (this.gameState == GameState.LOBBY) { + e.getPlayer().teleport(new Location(e.getPlayer().getWorld(), ConfigurationService.getLobbySpawn().getX(), ConfigurationService.getLobbySpawn().getY(), ConfigurationService.getLobbySpawn().getZ())); + e.getPlayer().setHealth(20.0); + e.getPlayer().setFoodLevel(20); + e.getPlayer().getInventory().clear(); + e.getPlayer().getInventory().setHelmet((ItemStack)null); + e.getPlayer().getInventory().setChestplate((ItemStack)null); + e.getPlayer().getActivePotionEffects().clear(); + e.getPlayer().getInventory().setLeggings((ItemStack)null); + e.getPlayer().getInventory().setBoots((ItemStack)null); + e.getPlayer().setFireTicks(0); + try { + e.getPlayer().giveExpLevels(-e.getPlayer().getExpToLevel()); + } + catch (Exception ex) {} + players.put(e.getPlayer().getName(), autoAssign()); + Core.getInstance().getItemManager().giveTeamItems(e.getPlayer()); + Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas joined the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)"); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void leave(final PlayerQuitEvent e) { + e.setQuitMessage((String)null); + if (this.gameState == GameState .LOBBY) { + if (this.players.containsKey(e.getPlayer().getName())) { + this.players.remove(e.getPlayer().getName()); + } + if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) { + this.playersDeadOrRespawning.remove(e.getPlayer().getName()); + } + Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas left the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)"); + } + else { + Bukkit.broadcastMessage(String.valueOf(this.players.get(e.getPlayer().getName()).getColor().toString()) + e.getPlayer().getName() + " §7has quit!"); + if (this.players.containsKey(e.getPlayer().getName())) { + this.players.remove(e.getPlayer().getName()); + } + if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) { + this.playersDeadOrRespawning.remove(e.getPlayer().getName()); + } + Core.getInstance().getPointManager().removePoints(e.getPlayer(), 5); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void kill(final PlayerDeathEvent e) { + e.setDeathMessage(null); + if (this.gameState != GameState.GAME) { + return; + } + new ItemDropTask(new ArrayList<>(e.getDrops()), e.getEntity().getLocation().clone()).execute(); + e.setDroppedExp(0); + e.getDrops().clear(); + e.getEntity().setHealth(20.0); + e.getEntity().setFoodLevel(20); + e.getEntity().setFireTicks(0); + final Team t = this.players.get(e.getEntity().getName()); + if (t != null) { + if (Core.getInstance().getDTRManager().isRaidable(t)) { + e.getEntity().kickPlayer("§aYour team went §4RAIDABLE§a. §aThanks for playing."); + return; + } + e.getEntity().teleport(new Location(e.getEntity().getWorld(), ConfigurationService.getTeamSpawn(t).getX(), ConfigurationService.getTeamSpawn(t).getY(), ConfigurationService.getTeamSpawn(t).getZ())); + } + Core.getInstance().getTeamManager().setDeaths(e.getEntity(), Core.getInstance().getTeamManager().getDeaths(e.getEntity()) + 1); + ConfigurationService.setStatDeaths(e.getEntity(), ConfigurationService.getStatDeaths(e.getEntity()) + 1); + this.playersDeadOrRespawning.add(e.getEntity().getName()); + Core.getInstance().getDTRManager().removeDTR(this.players.get(e.getEntity().getName()), 1.0); + Core.getInstance().getPointManager().removePoints(e.getEntity(), 5); + new BukkitRunnable() { + public void run() { + if (GameHandler.this.playersDeadOrRespawning.contains(e.getEntity().getName())) { + GameHandler.this.playersDeadOrRespawning.remove(e.getEntity().getName()); + } + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + Core.getInstance().getFreezeManager().addFrozen(e.getEntity(), 5, new PlayerItemTask(e.getEntity())); + if (e.getEntity().getKiller() == null || !(e.getEntity().getKiller() instanceof Player)) { + e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §edied" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints."); + return; + } + if (e.getEntity().getKiller() != null) { + Core.getInstance().getTeamManager().setKills(e.getEntity(), Core.getInstance().getTeamManager().getKills(e.getEntity().getKiller()) + 1); + ConfigurationService.setStatKills(e.getEntity().getKiller(), ConfigurationService.getStatKills(e.getEntity().getKiller()) + 1); + } + Core.getInstance().getPointManager().addPoints(e.getEntity().getKiller(), 5); + if (e.getEntity().getKiller() != null) { + e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §ewas slain by " + this.players.get(e.getEntity().getKiller().getName()).getColor().toString() + e.getEntity().getKiller().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getKiller().getName())) + "§7]" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints."); + } + } + + public String getTime() { + final int minutes = (int)(this.actualTime % 3600L / 60L); + final int seconds = (int)(this.actualTime % 60L); + return (this.gameState == GameState.LOBBY) ? "Pre Game" : ((this.gameState == GameState.ENDING) ? "Ending" : String.valueOf(String.valueOf(minutes) + "m " + seconds + "s")); + } + + public Map getPlayers() { + return this.players; + } + + public List getPlayersDeadOrRespawning() { + return this.playersDeadOrRespawning; + } + + public void endGame(final Team winningTeam) { + if (winningTeam == null) { + this.resetGame(); + return; + } + Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aCongratiulations to the " + winningTeam.getColor().toString() + winningTeam.name() + " §ateam for winning!"); + new BukkitRunnable() { + public void run() { + Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aThanks for playing, you will be kicked in §e10 §aseconds."); + } + }.runTaskLater((Plugin)Core.getInstance(), 60L); + new BukkitRunnable() { + public void run() { + GameHandler.this.resetGame(); + } + }.runTaskLater((Plugin)Core.getInstance(), 200L); + } + + private void resetGame() { + this.gameState = GameState.LOBBY; + for (final Player p : Bukkit.getOnlinePlayers()) { + p.kickPlayer("§aThank you for playing!"); + } + Bukkit.getServer().reload(); + } + + public void startGame() { + this.gameState = GameState.GAME; + for (final String s : this.players.keySet()) { + final Player p = Bukkit.getPlayer(s); + if (p != null) { + p.setHealth(20.0); + p.setFoodLevel(20); + p.getInventory().clear(); + p.getInventory().setHelmet((ItemStack)null); + p.setFireTicks(0); + p.getInventory().setChestplate((ItemStack)null); + p.getInventory().setLeggings((ItemStack)null); + p.getActivePotionEffects().clear(); + try { + p.giveExpLevels(-p.getExpToLevel()); + } + catch (Exception ex) {} + p.getInventory().setBoots((ItemStack)null); + p.closeInventory(); + p.teleport(new Location(p.getWorld(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getX(), ConfigurationService.getTeamSpawn(this.players.get(s)).getX() + 6.0), ConfigurationService.getTeamSpawn(this.players.get(s)).getY(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getZ(), ConfigurationService.getTeamSpawn(this.players.get(s)).getZ() + 6.0))); + Core.getInstance().getFreezeManager().addFrozen(p, 5, new PlayerItemTask(p)); + } + } + } + + @EventHandler + public void onAttack(final EntityDamageByEntityEvent e) { + if (this.gameState == GameState.LOBBY) { + if (e.getDamager() != null && e.getDamager() instanceof Player) { + e.setCancelled(true); + } + if (e.getEntity() != null && e.getEntity() instanceof Player) { + e.setCancelled(true); + } + } + + if(this.gameState == GameState.GAME) { + if(e.getDamager() instanceof Player && e.getEntity() instanceof Player) { + Player damager = (Player)e.getDamager(); + Player damaged = (Player)e.getEntity(); + + if(players.get(damager.getName()) == players.get(damaged.getName())) { + e.setCancelled(true); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockBreak(final BlockBreakEvent event) { + final Player player = event.getPlayer(); + if (player.getGameMode() != GameMode.CREATIVE && player.hasPermission("bunkers.mine")) { + final ItemStack stack = player.getItemInHand(); + if (stack != null && stack.getType() != Material.AIR && !stack.containsEnchantment(Enchantment.SILK_TOUCH)) { + final Block block = event.getBlock(); + Material dropType = null; + switch (block.getType()) { + case IRON_ORE: { + dropType = Material.IRON_INGOT; + break; + } + case GOLD_ORE: { + dropType = Material.GOLD_INGOT; + break; + } + case DIAMOND_ORE: { + dropType = Material.DIAMOND; + break; + } + default: { + return; + } + } + } + } + } + + + + + @EventHandler + public void ores(final BlockBreakEvent e) { + if (e.isCancelled()) { + return; + } + if (e.getBlock().getType().equals((Object)Material.GOLD_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.COBBLESTONE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.GOLD_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.GOLD_INGOT)); + e.getPlayer().giveExp(2); + } + else if (e.getBlock().getType().equals((Object)Material.IRON_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.IRON_ORE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.IRON_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.IRON_INGOT)); + e.getPlayer().giveExp(2); + } + else if (e.getBlock().getType().equals((Object)Material.DIAMOND_ORE) &&!e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.GOLD_ORE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.DIAMOND_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.DIAMOND)); + e.getPlayer().giveExp(2); + } + } + + @EventHandler + public void hunger(final FoodLevelChangeEvent e) { + if (this.gameState == GameState.LOBBY) { + e.setCancelled(true); + e.setFoodLevel(20); + } + } + + @EventHandler + public void move(final PlayerMoveEvent e) { + if (this.gameState == GameState.GAME) { + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getPlayer().getWorld(), t); + if (sel.contains(e.getTo()) && !sel.contains(e.getFrom())) { + //e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e."); + e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + if (!sel.contains(e.getTo()) && sel.contains(e.getFrom())) { + e.getPlayer().sendMessage("§eNow leaving the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void place(final BlockPlaceEvent e) { + if (this.gameState != GameState.GAME) { + if (e.getPlayer() != null) { + e.setCancelled(true); + } + } + else { + final Player placer = e.getPlayer(); + final Team team = this.players.get(placer.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), team); + if (!sel.contains(e.getBlockPlaced().getLocation())) { + if(!Core.getInstance().getDTRManager().isRaidable(team)) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), t); + if (sels.contains(e.getBlockPlaced().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot place this in the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot place this here!"); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void breaak(final BlockBreakEvent e) { + if (e.getBlock() != null && this.bloq.contains(e.getBlock().getLocation().toVector())) { + e.setCancelled(true); + return; + } + if (this.gameState != GameState.GAME) { + if (e.getPlayer() != null) { + e.setCancelled(true); + } + } + else { + final Player breaker = e.getPlayer(); + final Team team = this.players.get(breaker.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), team); + if (!sel.contains(e.getBlock().getLocation())) { + if(!Core.getInstance().getDTRManager().isRaidable(team)) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), t); + if (sels.contains(e.getBlock().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot break this in the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot break this here!"); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void bloks(final PlayerInteractEvent e) { + if (this.gameState == GameState.GAME) { + final Team t = this.players.get(e.getPlayer().getName()); + if (t != null) { + if (Core.getInstance().getDTRManager().isRaidable(t)) { + e.setCancelled(true); + } + if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) { + return; + } + if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && ItemUtil.isInteractable(e.getClickedBlock().getType())) { + final Player abuser = e.getPlayer(); + final Team team = this.players.get(abuser.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), team); + if (!Core.getInstance().getDTRManager().isRaidable(team) && !sel.contains(e.getClickedBlock().getLocation())) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t1 = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), t1); + if (sels.contains(e.getClickedBlock().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot use this in the territory of " + t1.getColor().toString() + t1.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot use this here!"); + } + } + } + } + } + + public void run() { + this.update(); + } + + public GameState getGameState() { + return this.gameState; + } + + private Team getBestTeamToWin() { + final double[] points = new double[4]; + int i = 0; + Team[] values; + for (int length = (values = Team.values()).length, j = 0; j < length; ++j) { + final Team t = values[j]; + points[i] = Core.getInstance().getTeamManager().getTeamPoints(t); + ++i; + } + return Team.values()[MathUtils.indexOfMax(points)]; + } + + private void checkEndGame() { + if (this.players.size() == 0) { + this.endGame(null); + return; + } + final int minutes = (int)(this.actualTime % 3600L / 60L); + if (minutes >= 35) { + this.endGame(this.getBestTeamToWin()); + return; + } + final ArrayList raidable = new ArrayList(); + Team[] values; + for (int length = (values = Team.values()).length, j = 0; j < length; ++j) { + final Team t = values[j]; + if (Core.getInstance().getDTRManager().isRaidable(t)) { + raidable.add(t); + } + } + if (raidable.size() != 0 && raidable.size() >= 3) { + Team[] values2; + for (int length2 = (values2 = Team.values()).length, k = 0; k < length2; ++k) { + final Team t = values2[k]; + if (!raidable.contains(t)) { + this.endGame(t); + return; + } + } + } + final ArrayList tied = new ArrayList(); + Team[] values3; + for (int length3 = (values3 = Team.values()).length, l = 0; l < length3; ++l) { + final Team t2 = values3[l]; + if (Core.getInstance().getTeamManager().getTeamPoints(t2) >= 125.0) { + tied.add(t2); + } + } + if (tied.size() != 0) { + if (tied.size() == 1) { + this.endGame(tied.get(0)); + } + else { + final double[] leastDeaths = new double[tied.size()]; + int i = 0; + for (final Team t3 : tied) { + leastDeaths[i] = Core.getInstance().getTeamManager().getTotalDeaths(t3); + ++i; + } + Team winningTeam = tied.get(MathUtils.indexOfMin(leastDeaths)); + if (winningTeam == null) { + winningTeam = tied.get(Core.RANDOM.nextInt(tied.size())); + } + this.endGame(winningTeam); + } + } + } + + private void update() { + if (this.gameState == GameState.LOBBY && this.players.size() >= 4) { + if (this.gameStartCountdown <= 0L) { + this.startGame(); + } + else { + --this.gameStartCountdown; + } + } + if (this.gameState == GameState.GAME) { + this.checkEndGame(); + ++this.actualTime; + if (this.actualTime % 2L == 0L) { + for (final String s : this.players.keySet()) { + if (!this.playersDeadOrRespawning.contains(s)) { + final Player p = Bukkit.getPlayer(s); + if (p == null) { + continue; + } + Core.getInstance().getBalanceManager().addBalance(p, 0.55); + } + } + } + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/GameState.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/GameState.java new file mode 100644 index 0000000..8885c2e --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/GameState.java @@ -0,0 +1,11 @@ +package com.prevailpots.bunkers.game; + +public enum GameState +{ + LOBBY("LOBBY", 0), + GAME("GAME", 1), + ENDING("ENDING", 2); + + private GameState(final String s, final int n) { + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/Team.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/Team.java new file mode 100644 index 0000000..fbbde49 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/Team.java @@ -0,0 +1,32 @@ +package com.prevailpots.bunkers.game; + +import org.bukkit.*; + +public enum Team +{ + RED("RED", 0, ChatColor.RED), + GREEN("GREEN", 1, ChatColor.GREEN), + BLUE("BLUE", 2, ChatColor.BLUE), + YELLOW("YELLOW", 3, ChatColor.YELLOW); + + private ChatColor color; + + private Team(final String s, final int n, final ChatColor color) { + this.color = color; + } + + public static Team fromString(final String s) { + Team[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + if (t.toString().equalsIgnoreCase(s)) { + return t; + } + } + return null; + } + + public ChatColor getColor() { + return this.color; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/BalanceManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/BalanceManager.java new file mode 100644 index 0000000..296a501 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/BalanceManager.java @@ -0,0 +1,58 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.utils.*; + +public class BalanceManager +{ + public HashMap balances; + public static final String BALANCE_SYMBOL = "$"; + public static final int STARTING_BALANCE = 100; + + public BalanceManager() { + this.balances = new HashMap(); + } + + public double getBalance(final Player p) { + return this.balances.containsKey(p.getName()) ? MathUtils.round(this.balances.get(p.getName()), 2) : 100; + } + + public boolean hasEnoughMoney(final Player p, final double price) { + return this.getBalance(p) >= price; + } + + public String getBalanceFormatted(final Player p) { + return "$" + this.getBalance(p); + } + + public void addBalance(final Player p, final double bal) { + final double oldBal = this.getBalance(p); + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(oldBal + bal, 2)); + } + + public void removeBalance(final Player p, final double bal) { + final double oldBal = this.getBalance(p); + if (oldBal - bal < 0.0) { + return; + } + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(oldBal - bal, 2)); + } + + public void setBalance(final Player p, final double bal) { + if (bal < 0.0) { + return; + } + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(bal, 2)); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CapzoneManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CapzoneManager.java new file mode 100644 index 0000000..7c33a62 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CapzoneManager.java @@ -0,0 +1,5 @@ +package com.prevailpots.bunkers.game.managers; + +public class CapzoneManager +{ +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ChatManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ChatManager.java new file mode 100644 index 0000000..0019ecb --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ChatManager.java @@ -0,0 +1,54 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.entity.*; +import org.bukkit.event.player.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; + +import org.bukkit.*; + +import ru.tehkode.permissions.bukkit.*; +import java.util.*; +import org.bukkit.event.*; + +public class ChatManager implements Listener +{ + private ArrayList teamChat; + + public ChatManager() { + this.teamChat = new ArrayList(); + } + + public boolean isTeamChat(final Player p) { + return this.teamChat.contains(p.getName()); + } + + public void setTeamChat(final Player p, final boolean tc) { + if (this.teamChat.contains(p.getName())) { + this.teamChat.remove(p.getName()); + } + if (tc) { + this.teamChat.add(p.getName()); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void chat(final AsyncPlayerChatEvent e) { + if (this.isTeamChat(e.getPlayer())) { + e.setCancelled(true); + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + final Player p = Bukkit.getPlayer(s); + if (p != null) { + final Team t = Core.getInstance().getGameHandler().getPlayers().get(s); + if (t == null || !t.equals(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()))) { + continue; + } + p.sendMessage(String.valueOf(t.getColor().toString()) + "[TEAM] " + t.toString() + ": " + e.getPlayer().getName() + " - §7" + e.getMessage()); + } + } + return; + } + e.setFormat(String.valueOf(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).getColor().toString()) + "[" + Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).toString() + "] " + "§r" + PermissionsEx.getUser(e.getPlayer()).getPrefix() + ((PermissionsEx.getUser(e.getPlayer()).getPrefix() == "") ? "" : " ") + e.getPlayer().getDisplayName() + "§7: " + "§r" + e.getMessage()); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CooldownManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CooldownManager.java new file mode 100644 index 0000000..39f3c09 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/CooldownManager.java @@ -0,0 +1,200 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; + +import org.bukkit.plugin.*; +import org.bukkit.event.entity.*; +import org.bukkit.entity.*; +import org.bukkit.event.*; +import org.bukkit.event.player.*; +import org.bukkit.*; + +public class CooldownManager implements Listener +{ + private Map enderPearl; + private Map gapple; + + public CooldownManager() { + this.enderPearl = new HashMap(); + this.gapple = new HashMap(); + } + + public boolean hasCooldown(final Player p, final Type cooldownType) { + return (cooldownType == Type.GAPPLE) ? this.gapple.containsKey(p.getName()) : this.enderPearl.containsKey(p.getName()); + } + + public long getCooldown(final Player p, final Type cooldownType) { + switch (cooldownType) { + case GAPPLE: { + return this.gapple.containsKey(p.getName()) ? this.gapple.get(p.getName()) : 0L; + } + case EPEARL: { + return this.enderPearl.containsKey(p.getName()) ? this.enderPearl.get(p.getName()) : 0L; + } + default: { + return 0L; + } + } + } + + public String getCooldownFormatted(final Player p, final Type cooldownType) { + return String.valueOf(this.getCooldown(p, cooldownType)) + "s"; + } + + private void deincrementCooldown(final Player p, final Type cooldownType) { + switch (cooldownType) { + case GAPPLE: { + long old = 0L; + if (this.gapple.get(p.getName()) != null) { + old = this.gapple.get(p.getName()); + } + if (old != 0L) { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + } + this.gapple.put(p.getName(), old - 1L); + break; + } + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + break; + } + break; + } + case EPEARL: { + long old = 0L; + if (this.enderPearl.get(p.getName()) != null) { + old = this.enderPearl.get(p.getName()); + } + if (old != 0L) { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + } + this.enderPearl.put(p.getName(), old - 1L); + break; + } + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + break; + } + break; + } + } + } + + public void putCooldown(final Player p, final Type cooldownType, long cooldown) { + ++cooldown; + switch (cooldownType) { + case GAPPLE: { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + } + this.gapple.put(p.getName(), cooldown); + new BukkitRunnable() { + public void run() { + if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) { + CooldownManager.this.removeCooldown(p, cooldownType); + p.sendMessage("§aYou can now gapple."); + this.cancel(); + } + CooldownManager.this.deincrementCooldown(p, cooldownType); + } + }.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L); + break; + } + case EPEARL: { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + } + this.enderPearl.put(p.getName(), cooldown); + new BukkitRunnable() { + public void run() { + if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) { + CooldownManager.this.removeCooldown(p, cooldownType); + p.sendMessage("§aYou can now enderpearl."); + this.cancel(); + } + CooldownManager.this.deincrementCooldown(p, cooldownType); + } + }.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L); + break; + } + } + } + + public void removeCooldown(final Player p, final Type t) { + switch (t) { + case GAPPLE: { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + break; + } + break; + } + case EPEARL: { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + break; + } + break; + } + } + } + + @EventHandler + public void pearl(final ProjectileLaunchEvent e) { + if (e.getEntity() == null) { + return; + } + if (e.getEntity().getShooter() == null) { + return; + } + if (!(e.getEntity().getShooter() instanceof Player)) { + return; + } + if (!(e.getEntity() instanceof EnderPearl)) { + return; + } + if (this.hasCooldown((Player)e.getEntity().getShooter(), Type.EPEARL)) { + e.setCancelled(true); + ((Player)e.getEntity().getShooter()).sendMessage("§eYou are still on §9Enderpearl§e cooldown for another §9" + this.getCooldownFormatted((Player)e.getEntity().getShooter(), Type.EPEARL)); + return; + } + if (e.getEntity() instanceof EnderPearl && !e.isCancelled()) { + this.putCooldown((Player)e.getEntity().getShooter(), Type.EPEARL, 16L); + } + } + + @EventHandler + public void consume(final PlayerItemConsumeEvent e) { + if (e.getItem() == null) { + return; + } + if (e.getItem().getType() == null) { + return; + } + if (e.getItem().getType() != Material.GOLDEN_APPLE) { + return; + } + if (this.hasCooldown(e.getPlayer(), Type.GAPPLE)) { + e.setCancelled(true); + e.getPlayer().sendMessage("§eYou are still on §6Apple§e cooldown for another §9" + this.getCooldownFormatted(e.getPlayer(), Type.GAPPLE)); + return; + } + if (!e.isCancelled()) { + this.putCooldown(e.getPlayer(), Type.GAPPLE, 4L); + } + } + + public enum Type + { + GAPPLE("GAPPLE", 0), + EPEARL("EPEARL", 1); + + private Type(final String s, final int n) { + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/DTRManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/DTRManager.java new file mode 100644 index 0000000..2b0744a --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/DTRManager.java @@ -0,0 +1,72 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.game.*; + +public class DTRManager +{ + public HashMap dtr; + public static final double STARTING_DTR = 5.0; + + public DTRManager() { + this.dtr = new HashMap(); + } + + public double getDTR(final Team p) { + return this.dtr.containsKey(p) ? this.dtr.get(p) : 5.0; + } + + public String getDTRFormatted(final Team t) { + final double dtr = this.getDTR(t); + if (dtr <= 0.0) { + return "§4§lRAIDABLE"; + } + if (dtr >= 5.0) { + return "§a§l" + dtr; + } + if (dtr <= 2.0 && dtr > 1.0) { + return "§e§l" + dtr; + } + if (dtr <= 1.0) { + return "§c§l" + dtr; + } + return "§2§l" + dtr; + } + + public boolean isRaidable(final Team t) { + return this.getDTR(t) <= 0.0; + } + + public void addDTR(final Team p, final double dtr) { + final double oldBal = this.getDTR(p); + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, oldBal + dtr); + } + + public void removeDTR(final Team p, final double dtr) { + final double oldBal = this.getDTR(p); + if (oldBal - dtr < 0.0) { + return; + } + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, oldBal - dtr); + } + + + + public void setDTR(final Team p, final double dtr) { + if (dtr < 0.0) { + return; + } + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, dtr); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/FreezeManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/FreezeManager.java new file mode 100644 index 0000000..583e986 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/FreezeManager.java @@ -0,0 +1,159 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.task.*; + +import org.bukkit.plugin.*; +import org.bukkit.event.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; + +public class FreezeManager implements Listener +{ + private ArrayList frozen; + + public FreezeManager() { + this.frozen = new ArrayList(); + } + + private boolean isFrozen(final Player p) { + return this.frozen.contains(p.getName()); + } + + public void addFrozen(final Player p, final int seconds) { + if (p == null) { + return; + } + if (this.frozen.contains(p.getName())) { + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + return; + } + this.frozen.add(p.getName()); + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + } + + public void addFrozen(final Player p, final int seconds, final DynamicTask taskLater) { + if (p == null) { + return; + } + if (this.frozen.contains(p.getName())) { + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + taskLater.execute(); + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + return; + } + this.frozen.add(p.getName()); + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + taskLater.execute(); + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + } + + + + @EventHandler + public void onAttack(final EntityDamageByEntityEvent e) { + if (e.getDamager() != null && e.getDamager() instanceof Player && this.isFrozen((Player)e.getDamager())) { + e.setCancelled(true); + } + if (e.getEntity() != null && e.getEntity() instanceof Player && this.isFrozen((Player)e.getEntity())) { + e.setCancelled(true); + } + } + + @EventHandler + public void dmg(final EntityDamageEvent e) { + if (!(e.getEntity() instanceof Player)) { + return; + } + if (this.isFrozen((Player)e.getEntity())) { + e.setCancelled(true); + } + } + + @EventHandler + public void hunger(final FoodLevelChangeEvent e) { + e.setCancelled(true); + e.setFoodLevel(20); + } + + @EventHandler + public void place(final BlockPlaceEvent e) { + if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void kick(final PlayerKickEvent e) { + if (e.getReason().toLowerCase().contains("flying is not enabled")) { + e.setCancelled(true); + } + } + + @EventHandler + public void throwProjEvent(final ProjectileLaunchEvent e) { + if (e.getEntity().getShooter() instanceof Player && this.isFrozen((Player)e.getEntity().getShooter())) { + e.setCancelled(true); + } + } + + @EventHandler + public void cons(final PlayerItemConsumeEvent e) { + if (this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void drop(final PlayerDropItemEvent e) { + if (this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void breaak(final BlockBreakEvent e) { + if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ItemManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ItemManager.java new file mode 100644 index 0000000..57f4f27 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ItemManager.java @@ -0,0 +1,65 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.inventory.*; +import org.bukkit.inventory.meta.ItemMeta; + +import com.prevailpots.bunkers.utils.*; + +import org.bukkit.*; +import org.bukkit.entity.*; +import org.bukkit.material.Wool; + +import java.util.*; + +public class ItemManager +{ + private ArrayList starterItems; + + public ItemManager() { + (this.starterItems = new ArrayList()).add(ItemUtil.getItem("§fStarter Sword", Material.STONE_SWORD, 1, "§7Just an ordinary §8Stone Sword§7.")); + this.starterItems.add(ItemUtil.getItem("§fStarter Pick", Material.IRON_PICKAXE, 1, "§7Just an ordinary §fIron Pickaxe§7.")); + } + + public void giveStarterItems(final Player p) { + for (final ItemStack i : this.starterItems) { + p.getInventory().addItem(new ItemStack[] { i }); + } + } + + public void giveTeamItems(Player p) { + ItemStack blue, green, red, leave, yellow; + blue = new Wool(DyeColor.BLUE).toItemStack(1); + green = new Wool(DyeColor.GREEN).toItemStack(1); + red = new Wool(DyeColor.RED).toItemStack(1); + yellow = new Wool(DyeColor.YELLOW).toItemStack(1); + leave = new Wool(DyeColor.WHITE).toItemStack(1); + + //blue + ItemMeta imMeta = blue.getItemMeta(); + imMeta.setDisplayName("§bRight Click to join Blue Team!"); + blue.setItemMeta(imMeta); + //red + ItemMeta imMeta1 = red.getItemMeta(); + imMeta1.setDisplayName("§CRight Click to join Red Team!"); + red.setItemMeta(imMeta1); + //green + ItemMeta imMeta2 = green.getItemMeta(); + imMeta2.setDisplayName("§ARight Click to join GREEN Team!"); + green.setItemMeta(imMeta2); + //yellow + ItemMeta imMeta3 = yellow.getItemMeta(); + imMeta3.setDisplayName("§ERight Click to join Yellow Team!"); + yellow.setItemMeta(imMeta3); + //leave + ItemMeta imMeta4 = leave.getItemMeta(); + imMeta4.setDisplayName("§EClick here to leave the bunkers game!"); + leave.setItemMeta(imMeta4); + + p.getInventory().setItem(0, blue); // 4, 5, 6, 7 + p.getInventory().setItem(1, green); // 4, 5, 6, 7 + p.getInventory().setItem(2, red); // 4, 5, 6, 7 + p.getInventory().setItem(3, yellow); // 4, 5, 6, 7 + p.getInventory().setItem(8, leave); // 4, 5, 6, 7 + p.updateInventory(); + } +} \ No newline at end of file diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/PointManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/PointManager.java new file mode 100644 index 0000000..76a0a9b --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/PointManager.java @@ -0,0 +1,47 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; + +public class PointManager +{ + public HashMap points; + public static final int STARTING_POINTS = 5; + + public PointManager() { + this.points = new HashMap(); + } + + public int getPoints(final Player p) { + return this.points.containsKey(p.getName()) ? this.points.get(p.getName()) : 5; + } + + public void addPoints(final Player p, final int points) { + final int oldBal = this.getPoints(p); + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), oldBal + points); + } + + public void removePoints(final Player p, final int points) { + final int oldBal = this.getPoints(p); + if (oldBal - points < 0) { + return; + } + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), oldBal - points); + } + + public void setPoints(final Player p, final int points) { + if (points < 0) { + return; + } + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), points); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ShopManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ShopManager.java new file mode 100644 index 0000000..0f5e056 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/ShopManager.java @@ -0,0 +1,289 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.potion.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; + +import org.bukkit.enchantments.*; +import org.bukkit.*; +import org.bukkit.inventory.*; +import org.bukkit.inventory.meta.*; +import org.bukkit.entity.*; + +import java.util.*; + +import org.bukkit.event.inventory.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; +import org.bukkit.event.*; + +public class ShopManager implements Listener +{ + private List shopItems; + private Inventory shopGui; + + public ShopManager() { + (this.shopItems = new ArrayList()).add(new ShopItem(ItemUtil.getItem("§fDiamond Sword", Material.DIAMOND_SWORD, 1, (String[])null), 100.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Helmet", Material.DIAMOND_HELMET, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Chestplate", Material.DIAMOND_CHESTPLATE, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Leggings", Material.DIAMOND_LEGGINGS, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Boots", Material.DIAMOND_BOOTS, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bSharpness 1", Material.DIAMOND_SWORD, 1, Enchantment.DAMAGE_ALL, 1, "§bApplies sharpness 1 to your sword."), 150.0, ShopItemType.ENCHANT, Enchantment.DAMAGE_ALL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fFishing Rod", Material.FISHING_ROD, 1, (String[])null), 75.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fHealth Pot", PotionType.INSTANT_HEAL, true, 2, false, 1, (String[])null), 10.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSpeed Pot", PotionType.SPEED, false, 2, true, 1, (String[])null), 75.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fInvis Pot", PotionType.INVISIBILITY, false, 1, false, 1, (String[])null), 300.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fEnder Pearl", Material.ENDER_PEARL, 3, (String[])null), 125.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSlowness Pot", PotionType.SLOWNESS, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fPoison Pot", PotionType.POISON, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fBow", Material.BOW, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fArrow", Material.ARROW, 16, (String[])null), 50.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fGapple", Material.GOLDEN_APPLE, 1, (String[])null), 25.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fSteak", Material.COOKED_BEEF, 16, (String[])null), 25.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Helmet", Material.DIAMOND_HELMET, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your helmet."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Chestplate", Material.DIAMOND_CHESTPLATE, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your chestplate."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Leggings", Material.DIAMOND_LEGGINGS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your leggings."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Boots", Material.DIAMOND_BOOTS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your boots."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bPower 1", Material.BOW, 1, Enchantment.ARROW_DAMAGE, 1, "§bApplies power 1 to your bow."), 150.0, ShopItemType.ENCHANT, Enchantment.ARROW_DAMAGE, 1)); + this.shopGui = Bukkit.createInventory((InventoryHolder)null, 54, "§aShop"); + int index = 10; + for (final ShopItem x : this.shopItems) { + final ItemStack ix = x.getItem(); + final ItemMeta meta = ix.getItemMeta(); + final ArrayList lore = new ArrayList(); + if (meta.getLore() != null) { + lore.addAll(meta.getLore()); + } + if (ix.getItemMeta().hasLore()) { + lore.add(" "); + } + lore.add("§7Price: $" + x.getPrice()); + meta.setLore((List)lore); + ix.setItemMeta(meta); + this.shopGui.setItem(index, ix); + if (index == 16 || index == 25 || index == 34 || index == 43 || index == 52 || index == 61 || index == 70 || index == 79 || index == 87) { + index += 2; + } + ++index; + } + this.shopGui.setItem(49, ItemUtil.getItem("§bSell items", Material.GOLD_BLOCK, 1, "§7Sells all gold, iron and diamonds", "§7in your inventory.")); + } + + private void buyItem(final Player p, final ItemStack i) { + if (this.getActualItem(i) == null) { + return; + } + if (Core.getInstance().getBalanceManager().hasEnoughMoney(p, this.getPrice(i))) { + if (this.getActualItem(i).getType().equals(ShopItemType.ITEM)) { + final ItemStack toadd = i.clone(); + final ItemMeta nigmeta = toadd.getItemMeta(); + nigmeta.setDisplayName(new ItemStack(i.getType()).getItemMeta().getDisplayName()); + nigmeta.setLore((List)Arrays.asList("§7Just a regular " + this.getActualItem(i).getItem().getItemMeta().getDisplayName())); + toadd.setItemMeta(nigmeta); + p.getInventory().addItem(new ItemStack[] { toadd }); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + } + else { + ItemStack[] contents; + for (int length = (contents = p.getInventory().getContents()).length, j = 0; j < length; ++j) { + final ItemStack x = contents[j]; + if (x != null) { + if (x.getType() != null) { + if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) { + x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + return; + } + } + } + } + ItemStack[] armorContents; + for (int length2 = (armorContents = p.getInventory().getArmorContents()).length, k = 0; k < length2; ++k) { + final ItemStack x = armorContents[k]; + if (x != null) { + if (x.getType() != null) { + if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) { + x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + return; + } + } + } + } + } + } + else { + p.sendMessage("§cYou don't have enough money!"); + } + } + + public void sellItems(final Player p) { + final ArrayList items = new ArrayList(); + ItemStack[] contents; + for (int length = (contents = p.getInventory().getContents()).length, k = 0; k < length; ++k) { + final ItemStack i = contents[k]; + if (i != null) { + if (i.getType().equals((Object)Material.GOLD_INGOT) || i.getType().equals((Object)Material.IRON_INGOT) || i.getType().equals((Object)Material.DIAMOND)) { + items.add(i); + } + } + } + for (final ItemStack x : items) { + if (x.getType().equals((Object)Material.GOLD_INGOT)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 15.0); + } + p.getInventory().remove(x); + } + if (x.getType().equals((Object)Material.IRON_INGOT)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 10.0); + } + p.getInventory().remove(x); + } + if (x.getType().equals((Object)Material.DIAMOND)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 20.0); + } + p.getInventory().remove(x); + } + } + items.clear(); + } + + private double getPrice(final ItemStack i) { + return this.getActualItem(i).getPrice(); + } + + private ShopItem getActualItem(final ItemStack i) { + for (int ix = 0; ix < this.shopItems.size(); ++ix) { + if (this.shopItems.get(ix).getItem().equals((Object)i)) { + return this.shopItems.get(ix); + } + } + return null; + } + + public void openShop(final Player p) { + p.openInventory(this.shopGui); + } + + @EventHandler + public void click(final InventoryClickEvent e) { + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) { + return; + } + if (e.getInventory() == null) { + return; + } + if (e.getInventory().getHolder() != null) { + return; + } + if (!e.getInventory().getTitle().toLowerCase().contains("shop")) { + return; + } + if (e.getCurrentItem() == null) { + return; + } + if (e.getWhoClicked() == null || !(e.getWhoClicked() instanceof Player)) { + return; + } + if (!e.getCurrentItem().hasItemMeta()) { + return; + } + if (e.getClick().equals((Object)ClickType.CONTROL_DROP)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.NUMBER_KEY)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.DOUBLE_CLICK)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.DROP)) { + e.setCancelled(true); + return; + } + if (e.getClick().toString().toLowerCase().contains("shift")) { + e.setCancelled(true); + return; + } + if (!e.getSlotType().equals((Object)InventoryType.SlotType.CONTAINER) || e.getSlotType().equals((Object)InventoryType.SlotType.OUTSIDE)) { + return; + } + e.setCancelled(true); + final Player p = (Player)e.getWhoClicked(); + if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§bSell items")) { + this.sellItems(p); + } + else { + this.buyItem(p, e.getCurrentItem()); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void bloks(final PlayerInteractEvent e) { + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) { + return; + } + if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) { + return; + } + if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && e.getClickedBlock().getType().equals((Object)Material.WORKBENCH)) { + e.setCancelled(true); + this.openShop(e.getPlayer()); + } + } + + public enum ShopItemType + { + ITEM("ITEM", 0), + ENCHANT("ENCHANT", 1); + + private ShopItemType(final String s, final int n) { + } + } + + public class ShopItem + { + private ItemStack item; + private double price; + private ShopItemType type; + public Enchantment ench; + public int enchLevel; + + public ShopItem(final ItemStack item, final double price, final ShopItemType type) { + this.item = item; + this.price = price; + this.type = type; + } + + public ShopItem(final ItemStack item, final double price, final ShopItemType type, final Enchantment ench, final int enchLevel) { + this.item = item; + this.price = price; + this.type = type; + this.ench = ench; + this.enchLevel = enchLevel; + } + + public ItemStack getItem() { + return this.item; + } + + public ShopItemType getType() { + return this.type; + } + + public double getPrice() { + return this.price; + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamJoinManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamJoinManager.java new file mode 100644 index 0000000..dfa44a0 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamJoinManager.java @@ -0,0 +1,54 @@ +package com.prevailpots.bunkers.game.managers; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.game.GameState; +import com.prevailpots.bunkers.game.Team; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.material.Wool; + +/** + * Created by Spirit on 09/08/2017. + */ +public class TeamJoinManager implements Listener { + @EventHandler + public void onInteract(PlayerInteractEvent e) { + if(Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) { + if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) { + if (e.getPlayer().getItemInHand().getType() == Material.WOOL) { + Wool wool = (Wool) e.getPlayer().getItemInHand().getData(); + // blue green red yellow + if(Core.getInstance().getGameHandler().players.containsKey(e.getPlayer().getName())) + Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName()); + // e.setCancelled(true); + if(wool.getColor() == DyeColor.BLUE) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.BLUE); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.BLUE + "Blue" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.GREEN) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.GREEN); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GREEN + "Green" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.RED) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.RED); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.RED + "Red" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.YELLOW) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.YELLOW); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GOLD + "Yellow" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.WHITE) { + Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName()); + e.getPlayer().kickPlayer("§eYou have kicked yourself from the Bunkers game!"); + + } + } + } + } +} +} \ No newline at end of file diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamManager.java new file mode 100644 index 0000000..603be63 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/game/managers/TeamManager.java @@ -0,0 +1,115 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; + +import org.bukkit.*; + +import java.util.*; + +public class TeamManager +{ + public HashMap kills; + public HashMap deaths; + + public TeamManager() { + this.kills = new HashMap(); + this.deaths = new HashMap(); + } + + public int getKills(final Player p) { + return this.kills.containsKey(p.getName()) ? this.kills.get(p.getName()) : 0; + } + + public int getDeaths(final Player p) { + return this.deaths.containsKey(p.getName()) ? this.deaths.get(p.getName()) : 0; + } + + public void setDeaths(final Player p, final int deaths) { + if (this.deaths.containsKey(p.getName())) { + this.deaths.remove(p.getName()); + } + this.deaths.put(p.getName(), deaths); + } + + public void setKills(final Player p, final int kills) { + if (this.kills.containsKey(p.getName())) { + this.kills.remove(p.getName()); + } + this.kills.put(p.getName(), kills); + } + + public double getTeamBalance(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getBalanceManager().getBalance(p); + } + } + } + return totalBal; + } + + public String getTeamBalanceFormatted(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getBalanceManager().getBalance(p); + } + } + } + return "$" + totalBal; + } + + public double getTeamPoints(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getPointManager().getPoints(p); + } + } + } + return totalBal; + } + + public String[] getMembers(final Team t) { + final ArrayList members = new ArrayList(); + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + members.add(p.getName()); + } + } + } + return members.toArray(new String[0]); + } + + public int getTotalKills(final Team t) { + int totalKills = 0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalKills += this.getKills(p); + } + } + } + return totalKills; + } + + public int getTotalDeaths(final Team t) { + int totalDeaths = 0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalDeaths += this.getDeaths(p); + } + } + } + return totalDeaths; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/BufferedObjective.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/BufferedObjective.java new file mode 100644 index 0000000..c410d4f --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/BufferedObjective.java @@ -0,0 +1,121 @@ +package com.prevailpots.bunkers.scoreboard; + +import net.minecraft.util.gnu.trove.map.hash.*; +import org.apache.commons.lang3.*; +import net.minecraft.util.gnu.trove.procedure.*; +import org.bukkit.scoreboard.*; +import java.util.*; + +public class BufferedObjective +{ + private static final int MAX_SIDEBAR_ENTRIES = 32; + private static final int MAX_NAME_LENGTH = 32; + private static final int MAX_PREFIX_LENGTH = 32; + private static final int MAX_SUFFIX_LENGTH = 32; + private final Scoreboard scoreboard; + private Set previousLines; + private TIntObjectHashMap contents; + private boolean requiresUpdate; + private String title; + private Objective current; + private DisplaySlot displaySlot; + + public BufferedObjective(final Scoreboard scoreboard) { + this.previousLines = new HashSet(); + this.contents = (TIntObjectHashMap)new TIntObjectHashMap(); + this.requiresUpdate = false; + this.scoreboard = scoreboard; + this.title = RandomStringUtils.randomAlphabetic(4); + this.current = scoreboard.registerNewObjective("buffered", "dummy"); + } + + public void setTitle(final String title) { + if (this.title == null || !this.title.equals(title)) { + this.title = title; + this.requiresUpdate = true; + } + } + + public void setDisplaySlot(final DisplaySlot slot) { + this.displaySlot = slot; + this.current.setDisplaySlot(slot); + } + + public void setAllLines(final List lines) { + if (lines.size() != this.contents.size()) { + this.contents.clear(); + if (lines.isEmpty()) { + this.requiresUpdate = true; + return; + } + } + final int size = Math.min(32, lines.size()); + int count = 0; + for (final SidebarEntry sidebarEntry : lines) { + this.setLine(size - count++, sidebarEntry); + } + } + + public void setLine(final int lineNumber, final SidebarEntry sidebarEntry) { + final SidebarEntry value = (SidebarEntry)this.contents.get(lineNumber); + if (value == null || value != sidebarEntry) { + this.contents.put(lineNumber, (SidebarEntry)sidebarEntry); + this.requiresUpdate = true; + } + } + + public void flip() { + if (!this.requiresUpdate) { + return; + } + final Set adding = new HashSet(); + this.contents.forEachEntry((TIntObjectProcedure)new TIntObjectProcedure() { + public boolean execute(final int i, final SidebarEntry sidebarEntry) { + String name = sidebarEntry.name; + if (name.length() > 32) { + name = name.substring(0, 32); + } + Team team = BufferedObjective.this.scoreboard.getTeam(name); + if (team == null) { + team = BufferedObjective.this.scoreboard.registerNewTeam(name); + } + if (sidebarEntry.prefix != null) { + team.setPrefix((sidebarEntry.prefix.length() > 32) ? sidebarEntry.prefix.substring(0, 32) : sidebarEntry.prefix); + } + if (sidebarEntry.suffix != null) { + team.setSuffix((sidebarEntry.suffix.length() > 32) ? sidebarEntry.suffix.substring(0, 32) : sidebarEntry.suffix); + } + adding.add(name); + if (!team.hasEntry(name)) { + team.addEntry(name); + } + BufferedObjective.this.current.getScore(name).setScore(i); + return true; + } + }); + this.previousLines.removeAll(adding); + final Iterator iterator = this.previousLines.iterator(); + while (iterator.hasNext()) { + final String last = iterator.next(); + final Team team = this.scoreboard.getTeam(last); + if (team != null) { + team.removeEntry(last); + } + this.scoreboard.resetScores(last); + iterator.remove(); + } + this.previousLines = adding; + this.current.setDisplayName(this.title); + this.requiresUpdate = false; + } + + public void setVisible(final boolean value) { + if (this.displaySlot != null && !value) { + this.scoreboard.clearSlot(this.displaySlot); + this.displaySlot = null; + } + else if (this.displaySlot == null && value) { + this.current.setDisplaySlot(this.displaySlot = DisplaySlot.SIDEBAR); + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/PlayerBoard.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/PlayerBoard.java new file mode 100644 index 0000000..be9205d --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/PlayerBoard.java @@ -0,0 +1,179 @@ +package com.prevailpots.bunkers.scoreboard; + +import org.bukkit.scheduler.*; +import java.util.concurrent.atomic.*; +import org.bukkit.entity.*; +import org.bukkit.scoreboard.*; + +import com.prevailpots.bunkers.*; + +import org.bukkit.plugin.*; +import java.util.*; +import org.bukkit.*; + +public class PlayerBoard +{ + private boolean sidebarVisible; + private SidebarProvider defaultProvider; + private SidebarProvider temporaryProvider; + private BukkitRunnable runnable; + private final AtomicBoolean removed; + private final Team red; + private final Team green; + private final Team blue; + private final Team yellow; + private final BufferedObjective bufferedObjective; + private final Scoreboard scoreboard; + private final Player player; + private final Core plugin; + + public PlayerBoard(final Core plugin, final Player player) { + this.sidebarVisible = false; + this.removed = new AtomicBoolean(false); + this.plugin = plugin; + this.player = player; + this.scoreboard = plugin.getServer().getScoreboardManager().getNewScoreboard(); + this.bufferedObjective = new BufferedObjective(this.scoreboard); + (this.red = this.scoreboard.registerNewTeam("red")).setPrefix(com.prevailpots.bunkers.game.Team.RED.getColor().toString()); + this.red.setCanSeeFriendlyInvisibles(true); + (this.green = this.scoreboard.registerNewTeam("green")).setPrefix(com.prevailpots.bunkers.game.Team.GREEN.getColor().toString()); + this.green.setCanSeeFriendlyInvisibles(true); + (this.blue = this.scoreboard.registerNewTeam("blue")).setPrefix(com.prevailpots.bunkers.game.Team.BLUE.getColor().toString()); + this.blue.setCanSeeFriendlyInvisibles(true); + (this.yellow = this.scoreboard.registerNewTeam("yellow")).setPrefix(com.prevailpots.bunkers.game.Team.YELLOW.getColor().toString()); + this.yellow.setCanSeeFriendlyInvisibles(true); + player.setScoreboard(this.scoreboard); + } + + public void remove() { + if (!this.removed.getAndSet(true) && this.scoreboard != null) { + for (final Team team : this.scoreboard.getTeams()) { + team.unregister(); + } + for (final Objective objective : this.scoreboard.getObjectives()) { + objective.unregister(); + } + } + } + + public Player getPlayer() { + return this.player; + } + + public Scoreboard getScoreboard() { + return this.scoreboard; + } + + public boolean isSidebarVisible() { + return this.sidebarVisible; + } + + public void setSidebarVisible(final boolean visible) { + this.sidebarVisible = visible; + this.bufferedObjective.setDisplaySlot(visible ? DisplaySlot.SIDEBAR : null); + } + + public void setDefaultSidebar(final SidebarProvider provider, final long updateInterval) { + if (provider != this.defaultProvider) { + this.defaultProvider = provider; + if (this.runnable != null) { + this.runnable.cancel(); + } + if (provider == null) { + this.scoreboard.clearSlot(DisplaySlot.SIDEBAR); + return; + } + (this.runnable = new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + if (provider == PlayerBoard.this.defaultProvider) { + PlayerBoard.this.updateObjective(); + } + } + }).runTaskTimerAsynchronously((Plugin)this.plugin, updateInterval, updateInterval); + } + } + + public void setTemporarySidebar(final SidebarProvider provider, final long expiration) { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + this.temporaryProvider = provider; + this.updateObjective(); + new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + if (PlayerBoard.this.temporaryProvider == provider) { + PlayerBoard.access$4(PlayerBoard.this, null); + PlayerBoard.this.updateObjective(); + } + } + }.runTaskLaterAsynchronously((Plugin)this.plugin, expiration); + } + + private void updateObjective() { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + final SidebarProvider provider = (this.temporaryProvider != null) ? this.temporaryProvider : this.defaultProvider; + if (provider == null) { + this.bufferedObjective.setVisible(false); + } + else { + try { + this.bufferedObjective.setTitle(provider.getTitle()); + this.bufferedObjective.setAllLines(provider.getLines(this.player)); + this.bufferedObjective.flip(); + } + catch (Exception ex) {} + } + } + + public void addUpdate(final Player target) { + this.addUpdates(Collections.singleton(target)); + } + + public void addUpdates(final Iterable updates) { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + for (final Player update : updates) { + if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().containsKey(update.getName())) { + continue; + } + if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.RED)) { + PlayerBoard.this.red.addPlayer((OfflinePlayer)update); + } + else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.GREEN)) { + PlayerBoard.this.green.addPlayer((OfflinePlayer)update); + } + else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.BLUE)) { + PlayerBoard.this.blue.addPlayer((OfflinePlayer)update); + } + else { + if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.YELLOW)) { + continue; + } + PlayerBoard.this.yellow.addPlayer((OfflinePlayer)update); + } + } + } + }.runTaskAsynchronously((Plugin)this.plugin); + } + + static /* synthetic */ void access$4(final PlayerBoard playerBoard, final SidebarProvider temporaryProvider) { + playerBoard.temporaryProvider = temporaryProvider; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java new file mode 100644 index 0000000..632ddcd --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java @@ -0,0 +1,80 @@ +package com.prevailpots.bunkers.scoreboard; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.Plugin; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.scoreboard.provider.TimerSidebarProvider; + + + +public class ScoreboardHandler implements Listener +{ + private static final long UPDATE_TICK_INTERVAL = 2L; + private final Map playerBoards; + private final TimerSidebarProvider timerSidebarProvider; + private final Core plugin; + + public ScoreboardHandler(final Core plugin) { + this.playerBoards = new HashMap(); + this.plugin = plugin; + plugin.getServer().getPluginManager().registerEvents((Listener)this, (Plugin)plugin); + this.timerSidebarProvider = new TimerSidebarProvider(plugin); + final Set players = new HashSet(); + for (final Player player : players) { + this.applyBoard(player).addUpdates(players); + } + } + + @EventHandler(ignoreCancelled = true) + public void onPlayerJoin(final PlayerJoinEvent event) { + final Player player = event.getPlayer(); + for (final PlayerBoard board : this.playerBoards.values()) { + board.addUpdate(player); + } + final Set players = new HashSet(); + this.applyBoard(player).addUpdates(players); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPlayerQuit(final PlayerQuitEvent event) { + if (this.playerBoards.containsKey(event.getPlayer().getUniqueId())) { + this.playerBoards.remove(event.getPlayer().getUniqueId()).remove(); + } + } + + public PlayerBoard getPlayerBoard(final UUID uuid) { + return this.playerBoards.get(uuid); + } + + public PlayerBoard applyBoard(final Player player) { + final PlayerBoard board = new PlayerBoard(this.plugin, player); + final PlayerBoard previous = this.playerBoards.put(player.getUniqueId(), board); + if (previous != null && previous != board) { + previous.remove(); + } + board.setSidebarVisible(true); + board.setDefaultSidebar(this.timerSidebarProvider, 2L); + return board; + } + + public void clearBoards() { + final Iterator iterator = this.playerBoards.values().iterator(); + while (iterator.hasNext()) { + iterator.next().remove(); + iterator.remove(); + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarEntry.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarEntry.java new file mode 100644 index 0000000..2319513 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarEntry.java @@ -0,0 +1,67 @@ +package com.prevailpots.bunkers.scoreboard; + +public class SidebarEntry +{ + public final String name; + public String prefix; + public String suffix; + + public SidebarEntry(final String name) { + this.name = name; + } + + public SidebarEntry(final Object name) { + this.name = String.valueOf(name); + } + + public SidebarEntry(final String prefix, final String name, final String suffix) { + this.name = name; + this.prefix = prefix; + this.suffix = suffix; + } + + public SidebarEntry(final Object prefix, final Object name, final Object suffix) { + this(name); + this.prefix = String.valueOf(prefix); + this.suffix = String.valueOf(suffix); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SidebarEntry)) { + return false; + } + final SidebarEntry that = (SidebarEntry)o; + Label_0054: { + if (this.name != null) { + if (this.name.equals(that.name)) { + break Label_0054; + } + } + else if (that.name == null) { + break Label_0054; + } + return false; + } + if (this.prefix != null) { + if (this.prefix.equals(that.prefix)) { + return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null)); + } + } + else if (that.prefix == null) { + return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null)); + } + return false; + } + + @Override + public int hashCode() { + int result = (this.name != null) ? this.name.hashCode() : 0; + result = 31 * result + ((this.prefix != null) ? this.prefix.hashCode() : 0); + result = 31 * result + ((this.suffix != null) ? this.suffix.hashCode() : 0); + return result; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarProvider.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarProvider.java new file mode 100644 index 0000000..f4aa3b4 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/SidebarProvider.java @@ -0,0 +1,11 @@ +package com.prevailpots.bunkers.scoreboard; + +import org.bukkit.entity.*; +import java.util.*; + +public interface SidebarProvider +{ + String getTitle(); + + List getLines(final Player p0); +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java new file mode 100644 index 0000000..a95dfaf --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java @@ -0,0 +1,72 @@ +package com.prevailpots.bunkers.scoreboard.provider; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.game.managers.*; +import com.prevailpots.bunkers.scoreboard.*; + + +import java.util.*; + +import org.apache.commons.lang3.*; +import org.bukkit.*; + +public class TimerSidebarProvider implements SidebarProvider +{ + public static final String STRAIGHT_LINE; + private final Core plugin; + private boolean add; + + static { + STRAIGHT_LINE = "------------------------------------".substring(0, 14); + } + + public TimerSidebarProvider(final Core plugin) { + this.plugin = plugin; + } + + @Override + public String getTitle() { + return "§b§lPrevailPots §c[Bunkers]"; + } + + @Override + public List getLines(final Player player) { + final List lines = new ArrayList(); + if (!this.plugin.getGameHandler().getTime().equalsIgnoreCase("pre game")) { + lines.add(new SidebarEntry("", "§aGame Time§7: ", "§f" + this.plugin.getGameHandler().getTime())); + final Team t = this.plugin.getGameHandler().getPlayers().get(player.getName()); + lines.add(new SidebarEntry("", "§aTeam§7: ", t.getColor() + StringUtils.capitalize(t.toString().toLowerCase()))); + lines.add(new SidebarEntry(" §b» ", "§aKills§7: ", "§f" + this.plugin.getTeamManager().getKills(player))); + lines.add(new SidebarEntry(" §b» §aBala", "§ance§7: §f", this.plugin.getBalanceManager().getBalanceFormatted(player))); + lines.add(new SidebarEntry(" §b» ", "§aPoints§7: ", "§f" + this.plugin.getPointManager().getPoints(player))); + lines.add(new SidebarEntry(" §b» ", "§aDTR§7: ", this.plugin.getDTRManager().getDTRFormatted(Core.getInstance().getGameHandler().getPlayers().get(player.getName())))); + } + else { + if (this.plugin.getGameHandler().gameStartCountdown != 10L) { + lines.add(new SidebarEntry("", "§6Countdown§7: ", "§f" + this.plugin.getGameHandler().gameStartCountdown + "s")); + } + else { + lines.add(new SidebarEntry("", "§6Game State§7: ", "§eLobby")); + } + lines.add(new SidebarEntry("", "§6Players§7: ", "§e" + String.valueOf(this.plugin.getGameHandler().getPlayers().size()) + "/" + 16 + ":")); + lines.add(new SidebarEntry(" §b» ", "§cRed§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.RED) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§aGreen§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.GREEN) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§9Blue§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.BLUE) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§eYellow§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.YELLOW) + "/" + 4)); + } + if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.EPEARL)) { + lines.add(new SidebarEntry(" * ", "§9§lEnder", "pearl§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.EPEARL))); + } + if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.GAPPLE)) { + lines.add(new SidebarEntry(" * ", "§6§lApple", "§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.GAPPLE))); + } + if (!lines.isEmpty()) { + lines.add(0, new SidebarEntry(String.valueOf(ChatColor.GRAY.toString()) + ChatColor.STRIKETHROUGH.toString(), TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE)); + lines.add(lines.size(), new SidebarEntry(ChatColor.GRAY.toString(), String.valueOf(ChatColor.STRIKETHROUGH.toString()) + TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE)); + } + return lines; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/tab/TabEvent.java b/PrevailBunkers/out/com/prevailpots/bunkers/tab/TabEvent.java new file mode 100644 index 0000000..46d4d03 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/tab/TabEvent.java @@ -0,0 +1,53 @@ +package com.prevailpots.bunkers.tab; + +import org.bukkit.entity.Player; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; + +import me.vertises.aztec.tablist.TablistEntrySupplier; +import net.md_5.bungee.api.ChatColor; + +public class TabEvent implements TablistEntrySupplier { + + + @Override + public Table getEntries(Player player) { + Table table = HashBasedTable.create(); + table.put(1, 0, ChatColor.AQUA + "Prevail" + ChatColor.GRAY + " [Bunkers]"); + table.put(0, 3, ChatColor.AQUA + "Bunkers:" + ChatColor.GRAY + " [Online]"); + table.put(0, 4, ChatColor.AQUA + "HCFactions:" + ChatColor.GRAY + " [Offline]"); + table.put(0, 5, ChatColor.AQUA + "Practice:" + ChatColor.GRAY + " [Offline]"); + + //mid + table.put(1, 3, ChatColor.AQUA + "Wins:" + ChatColor.GRAY + " [3]"); + table.put(1, 4, ChatColor.AQUA + "Team:" + ChatColor.GRAY + " [Blue]"); + table.put(1, 5, ChatColor.AQUA + "Proxy:" + ChatColor.GRAY + " [EU-1]"); + + table.put(2, 3, ChatColor.AQUA + "Kills:" + ChatColor.GRAY + " [13]"); + table.put(2, 4, ChatColor.AQUA + "Deaths:" + ChatColor.GRAY + " [41]"); + table.put(2, 5, ChatColor.AQUA + "Online:" + ChatColor.GRAY + " [1]"); + + table.put(0, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + ""); + table.put(1, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + ""); + table.put(2, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + ""); + table.put(3, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + ""); + // + + table.put(3, 0, ChatColor.GRAY + "You are using 1.8" + ChatColor.YELLOW + ""); + table.put(3, 1, ChatColor.GRAY + "Please use 1.7 for" + ChatColor.YELLOW + ""); + table.put(3, 2, ChatColor.GRAY + "For the best quality!" + ChatColor.YELLOW + ""); + return table; + } + + @Override + public String getHeader(Player player) { + return "§bYou are connected to 1.8 Bunkers!"; + } + + @Override + public String getFooter(Player player) { + return "§CWe suggest using 1.7 for the highest quality!"; + } + +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/task/DynamicTask.java b/PrevailBunkers/out/com/prevailpots/bunkers/task/DynamicTask.java new file mode 100644 index 0000000..6c0cc19 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/task/DynamicTask.java @@ -0,0 +1,6 @@ +package com.prevailpots.bunkers.task; + +public interface DynamicTask +{ + void execute(); +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/task/ItemDropTask.java b/PrevailBunkers/out/com/prevailpots/bunkers/task/ItemDropTask.java new file mode 100644 index 0000000..f410784 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/task/ItemDropTask.java @@ -0,0 +1,34 @@ +package com.prevailpots.bunkers.task; + +import org.bukkit.inventory.*; +import org.bukkit.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; + +import java.util.*; + +import org.bukkit.plugin.*; + +public class ItemDropTask implements DynamicTask +{ + private List drops; + private Location drop; + + public ItemDropTask(final List dropd, final Location drop) { + this.drops = new ArrayList(); + this.drops = dropd; + this.drop = drop; + } + + @Override + public void execute() { + new BukkitRunnable() { + public void run() { + for (final ItemStack i : ItemDropTask.this.drops) { + ItemDropTask.this.drop.getWorld().dropItemNaturally(ItemDropTask.this.drop, i); + } + } + }.runTaskLater((Plugin)Core.getInstance(), 2L); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/task/PlayerItemTask.java b/PrevailBunkers/out/com/prevailpots/bunkers/task/PlayerItemTask.java new file mode 100644 index 0000000..a60ca8c --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/task/PlayerItemTask.java @@ -0,0 +1,19 @@ +package com.prevailpots.bunkers.task; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; + +public class PlayerItemTask implements DynamicTask +{ + private Player player; + + public PlayerItemTask(final Player p) { + this.player = p; + } + + @Override + public void execute() { + Core.getInstance().getItemManager().giveStarterItems(this.player); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/BroadcastUtils.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/BroadcastUtils.java new file mode 100644 index 0000000..25e03b6 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/BroadcastUtils.java @@ -0,0 +1,17 @@ +package com.prevailpots.bunkers.utils; + +import org.bukkit.*; +import org.bukkit.entity.*; +import ru.tehkode.permissions.bukkit.*; +import java.util.*; + +public class BroadcastUtils +{ + public static void broadcastToPerm(final String msg, final String permission) { + for (final Player p : Bukkit.getOnlinePlayers() { + if (PermissionsEx.getUser(p).has(permission) || p.isOp()) { + p.sendMessage(msg); + } +} + } +} \ No newline at end of file diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/ItemUtil.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ItemUtil.java new file mode 100644 index 0000000..7845133 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ItemUtil.java @@ -0,0 +1,184 @@ +package com.prevailpots.bunkers.utils; + +import org.bukkit.*; +import org.bukkit.inventory.*; +import java.util.*; +import org.bukkit.inventory.meta.*; +import org.bukkit.enchantments.*; +import org.bukkit.potion.*; + +public class ItemUtil +{ + public static boolean isInteractable(final Material m) { + switch (m) { + case ENCHANTMENT_TABLE: { + return true; + } + case ANVIL: { + return true; + } + case BREWING_STAND: { + return true; + } + case BREWING_STAND_ITEM: { + return true; + } + case CAULDRON: { + return true; + } + case CAULDRON_ITEM: { + return true; + } + case TRAPPED_CHEST: { + return true; + } + case TRAP_DOOR: { + return true; + } + case FENCE_GATE: { + return true; + } + case NOTE_BLOCK: { + return true; + } + case FURNACE: { + return true; + } + case JUKEBOX: { + return true; + } + case BOAT: { + return true; + } + case GOLD_PLATE: { + return true; + } + case IRON_PLATE: { + return true; + } + case STONE_PLATE: { + return true; + } + case WOOD_PLATE: { + return true; + } + case BED: { + return true; + } + case IRON_DOOR: { + return true; + } + case WOOD_DOOR: { + return true; + } + case IRON_DOOR_BLOCK: { + return true; + } + case WOODEN_DOOR: { + return true; + } + case CHEST: { + return true; + } + case WORKBENCH: { + return true; + } + case MINECART: { + return true; + } + case COMMAND_MINECART: { + return true; + } + case EXPLOSIVE_MINECART: { + return true; + } + case HOPPER_MINECART: { + return true; + } + case POWERED_MINECART: { + return true; + } + case STORAGE_MINECART: { + return true; + } + case HOPPER: { + return true; + } + case BEACON: { + return true; + } + case COMMAND: { + return true; + } + case CAKE_BLOCK: { + return true; + } + case CAKE: { + return true; + } + case WATER: { + return true; + } + case STATIONARY_WATER: { + return true; + } + case LAVA: { + return true; + } + case STATIONARY_LAVA: { + return true; + } + case BURNING_FURNACE: { + return true; + } + case LEVER: { + return true; + } + case DISPENSER: { + return true; + } + case DROPPER: { + return true; + } + default: { + return false; + } + } + } + + public static ItemStack getItem(final String displayName, final Material type, final int count, final String... lore) { + final ItemStack toReturn = new ItemStack(type, count); + final ItemMeta meta = toReturn.getItemMeta(); + meta.setDisplayName(displayName); + if (lore != null) { + meta.setLore((List)Arrays.asList(lore)); + } + toReturn.setItemMeta(meta); + return toReturn; + } + + public static ItemStack getEnchantedItem(final String displayName, final Material type, final int count, final Enchantment enchantment, final int enchLevel, final String... lore) { + final ItemStack toReturn = new ItemStack(type, count); + toReturn.addUnsafeEnchantment(enchantment, enchLevel); + final ItemMeta meta = toReturn.getItemMeta(); + meta.setDisplayName(displayName); + if (lore != null) { + meta.setLore((List)Arrays.asList(lore)); + } + toReturn.setItemMeta(meta); + return toReturn; + } + + public static ItemStack getPotion(final String displayName, final PotionType type, final boolean splash, final int level, final boolean extendDuration, final int count, final String... lore) { + final ItemStack toReturn = getItem(displayName, Material.POTION, count, lore); + final Potion pot = new Potion(1); + pot.setType(type); + if (!type.toString().toLowerCase().contains("instant") && extendDuration) { + pot.setHasExtendedDuration(true); + } + pot.setSplash(splash); + pot.setLevel(level); + pot.apply(toReturn); + return toReturn; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/MathUtils.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/MathUtils.java new file mode 100644 index 0000000..8b123b6 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/MathUtils.java @@ -0,0 +1,32 @@ +package com.prevailpots.bunkers.utils; + +import java.math.*; +import java.util.*; + +public class MathUtils +{ + public static double round(final double value, final int places) { + if (places < 0) { + throw new IllegalArgumentException(); + } + BigDecimal bd = new BigDecimal(value); + bd = bd.setScale(places, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + + public static int indexOfMax(final double[] array) { + final List list = new ArrayList(); + for (int i = 0; i < array.length; ++i) { + list.add(array[i]); + } + return list.indexOf(Collections.max(null)); + } + + public static int indexOfMin(final double[] array) { + final List list = new ArrayList(); + for (int i = 0; i < array.length; ++i) { + list.add(array[i]); + } + return list.indexOf(Collections.min(null)); + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/ParticleEffect.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ParticleEffect.java new file mode 100644 index 0000000..be417a3 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ParticleEffect.java @@ -0,0 +1,674 @@ +package com.prevailpots.bunkers.utils; + +import java.util.*; +import org.bukkit.entity.*; +import org.bukkit.util.*; + +import com.sk89q.worldedit.Vector; + +import java.lang.reflect.*; +import org.bukkit.*; + +public enum ParticleEffect +{ + EXPLOSION_NORMAL("EXPLOSION_NORMAL", 0, "explode", 0, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + EXPLOSION_LARGE("EXPLOSION_LARGE", 1, "largeexplode", 1, -1, new ParticleProperty[0]), + EXPLOSION_HUGE("EXPLOSION_HUGE", 2, "hugeexplosion", 2, -1, new ParticleProperty[0]), + FIREWORKS_SPARK("FIREWORKS_SPARK", 3, "fireworksSpark", 3, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + WATER_BUBBLE("WATER_BUBBLE", 4, "bubble", 4, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER }), + WATER_SPLASH("WATER_SPLASH", 5, "splash", 5, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + WATER_WAKE("WATER_WAKE", 6, "wake", 6, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SUSPENDED("SUSPENDED", 7, "suspended", 7, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_WATER }), + SUSPENDED_DEPTH("SUSPENDED_DEPTH", 8, "depthSuspend", 8, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + CRIT("CRIT", 9, "crit", 9, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + CRIT_MAGIC("CRIT_MAGIC", 10, "magicCrit", 10, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SMOKE_NORMAL("SMOKE_NORMAL", 11, "smoke", 11, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SMOKE_LARGE("SMOKE_LARGE", 12, "largesmoke", 12, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SPELL("SPELL", 13, "spell", 13, -1, new ParticleProperty[0]), + SPELL_INSTANT("SPELL_INSTANT", 14, "instantSpell", 14, -1, new ParticleProperty[0]), + SPELL_MOB("SPELL_MOB", 15, "mobSpell", 15, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SPELL_MOB_AMBIENT("SPELL_MOB_AMBIENT", 16, "mobSpellAmbient", 16, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SPELL_WITCH("SPELL_WITCH", 17, "witchMagic", 17, -1, new ParticleProperty[0]), + DRIP_WATER("DRIP_WATER", 18, "dripWater", 18, -1, new ParticleProperty[0]), + DRIP_LAVA("DRIP_LAVA", 19, "dripLava", 19, -1, new ParticleProperty[0]), + VILLAGER_ANGRY("VILLAGER_ANGRY", 20, "angryVillager", 20, -1, new ParticleProperty[0]), + VILLAGER_HAPPY("VILLAGER_HAPPY", 21, "happyVillager", 21, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + TOWN_AURA("TOWN_AURA", 22, "townaura", 22, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + NOTE("NOTE", 23, "note", 23, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + PORTAL("PORTAL", 24, "portal", 24, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + ENCHANTMENT_TABLE("ENCHANTMENT_TABLE", 25, "enchantmenttable", 25, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + FLAME("FLAME", 26, "flame", 26, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + LAVA("LAVA", 27, "lava", 27, -1, new ParticleProperty[0]), + FOOTSTEP("FOOTSTEP", 28, "footstep", 28, -1, new ParticleProperty[0]), + CLOUD("CLOUD", 29, "cloud", 29, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + REDSTONE("REDSTONE", 30, "reddust", 30, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SNOWBALL("SNOWBALL", 31, "snowballpoof", 31, -1, new ParticleProperty[0]), + SNOW_SHOVEL("SNOW_SHOVEL", 32, "snowshovel", 32, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SLIME("SLIME", 33, "slime", 33, -1, new ParticleProperty[0]), + HEART("HEART", 34, "heart", 34, -1, new ParticleProperty[0]), + BARRIER("BARRIER", 35, "barrier", 35, 8, new ParticleProperty[0]), + ITEM_CRACK("ITEM_CRACK", 36, "iconcrack", 36, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }), + BLOCK_CRACK("BLOCK_CRACK", 37, "blockcrack", 37, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_DATA }), + BLOCK_DUST("BLOCK_DUST", 38, "blockdust", 38, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }), + WATER_DROP("WATER_DROP", 39, "droplet", 39, 8, new ParticleProperty[0]), + ITEM_TAKE("ITEM_TAKE", 40, "take", 40, 8, new ParticleProperty[0]), + MOB_APPEARANCE("MOB_APPEARANCE", 41, "mobappearance", 41, 8, new ParticleProperty[0]); + + private static final Map NAME_MAP; + private static final Map ID_MAP; + private final String name; + private final int id; + private final int requiredVersion; + private final List properties; + + static { + NAME_MAP = new HashMap(); + ID_MAP = new HashMap(); + ParticleEffect[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final ParticleEffect effect = values[i]; + ParticleEffect.NAME_MAP.put(effect.name, effect); + ParticleEffect.ID_MAP.put(effect.id, effect); + } + } + + private ParticleEffect(final String s, final int n, final String name, final int id, final int requiredVersion, final ParticleProperty... properties) { + this.name = name; + this.id = id; + this.requiredVersion = requiredVersion; + this.properties = Arrays.asList(properties); + } + + public String getName() { + return this.name; + } + + public int getId() { + return this.id; + } + + public int getRequiredVersion() { + return this.requiredVersion; + } + + public boolean hasProperty(final ParticleProperty property) { + return this.properties.contains(property); + } + + public boolean isSupported() { + return this.requiredVersion == -1 || ParticlePacket.getVersion() >= this.requiredVersion; + } + + public static ParticleEffect fromName(final String name) { + for (final Map.Entry entry : ParticleEffect.NAME_MAP.entrySet()) { + if (!entry.getKey().equalsIgnoreCase(name)) { + continue; + } + return entry.getValue(); + } + return null; + } + + public static ParticleEffect fromId(final int id) { + for (final Map.Entry entry : ParticleEffect.ID_MAP.entrySet()) { + if (entry.getKey() != id) { + continue; + } + return entry.getValue(); + } + return null; + } + + private static boolean isWater(final Location location) { + final Material material = location.getBlock().getType(); + return material == Material.WATER || material == Material.STATIONARY_WATER; + } + + private static boolean isLongDistance(final Location location, final List players) { + final String world = location.getWorld().getName(); + for (final Player player : players) { + final Location playerLocation = player.getLocation(); + if (world.equals(playerLocation.getWorld().getName())) { + if (playerLocation.distanceSquared(location) < 65536.0) { + continue; + } + return true; + } + } + return false; + } + + private static boolean isDataCorrect(final ParticleEffect effect, final ParticleData data) { + return ((effect == ParticleEffect.BLOCK_CRACK || effect == ParticleEffect.BLOCK_DUST) && data instanceof BlockData) || (effect == ParticleEffect.ITEM_CRACK && data instanceof ItemData); + } + + private static boolean isColorCorrect(final ParticleEffect effect, final ParticleColor color) { + return ((effect == ParticleEffect.SPELL_MOB || effect == ParticleEffect.SPELL_MOB_AMBIENT || effect == ParticleEffect.REDSTONE) && color instanceof OrdinaryColor) || (effect == ParticleEffect.NOTE && color instanceof NoteColor); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, null).sendTo(center, range); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + this.display(offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players)); + } + + public void display(final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) { + throw new IllegalArgumentException("This particle effect is not directional"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, direction, speed, range > 256.0, null).sendTo(center, range); + } + + public void display(final Vector direction, final float speed, final Location center, final List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) { + throw new IllegalArgumentException("This particle effect is not directional"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players); + } + + public void display(final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + this.display(direction, speed, center, Arrays.asList(players)); + } + + public void display(final ParticleColor color, final Location center, final double range) throws ParticleVersionException, ParticleColorException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.COLORABLE)) { + throw new ParticleColorException("This particle effect is not colorable"); + } + if (!isColorCorrect(this, color)) { + throw new ParticleColorException("The particle color type is incorrect"); + } + new ParticlePacket(this, color, range > 256.0).sendTo(center, range); + } + + public void display(final ParticleColor color, final Location center, final List players) throws ParticleVersionException, ParticleColorException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.COLORABLE)) { + throw new ParticleColorException("This particle effect is not colorable"); + } + if (!isColorCorrect(this, color)) { + throw new ParticleColorException("The particle color type is incorrect"); + } + new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players); + } + + public void display(final ParticleColor color, final Location center, final Player... players) throws ParticleVersionException, ParticleColorException { + this.display(color, center, Arrays.asList(players)); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, data).sendTo(center, range); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List players) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException { + this.display(data, offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players)); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, direction, speed, range > 256.0, data).sendTo(center, range); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final List players) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException { + this.display(data, direction, speed, center, Arrays.asList(players)); + } + + public enum ParticleProperty + { + REQUIRES_WATER("REQUIRES_WATER", 0), + REQUIRES_DATA("REQUIRES_DATA", 1), + DIRECTIONAL("DIRECTIONAL", 2), + COLORABLE("COLORABLE", 3); + + private ParticleProperty(final String s, final int n) { + } + } + + public abstract static class ParticleData + { + private final Material material; + private final byte data; + private final int[] packetData; + + public ParticleData(final Material material, final byte data) { + this.material = material; + this.data = data; + this.packetData = new int[] { material.getId(), data }; + } + + public Material getMaterial() { + return this.material; + } + + public byte getData() { + return this.data; + } + + public int[] getPacketData() { + return this.packetData; + } + + public String getPacketDataString() { + return "_" + this.packetData[0] + "_" + this.packetData[1]; + } + } + + public static final class ItemData extends ParticleData + { + public ItemData(final Material material, final byte data) { + super(material, data); + } + } + + public static final class BlockData extends ParticleData + { + public BlockData(final Material material, final byte data) throws IllegalArgumentException { + super(material, data); + if (!material.isBlock()) { + throw new IllegalArgumentException("The material is not a block"); + } + } + } + + public abstract static class ParticleColor + { + public abstract float getValueX(); + + public abstract float getValueY(); + + public abstract float getValueZ(); + } + + public static final class OrdinaryColor extends ParticleColor + { + private final int red; + private final int green; + private final int blue; + + public OrdinaryColor(final int red, final int green, final int blue) throws IllegalArgumentException { + if (red < 0) { + throw new IllegalArgumentException("The red value is lower than 0"); + } + if (red > 255) { + throw new IllegalArgumentException("The red value is higher than 255"); + } + this.red = red; + if (green < 0) { + throw new IllegalArgumentException("The green value is lower than 0"); + } + if (green > 255) { + throw new IllegalArgumentException("The green value is higher than 255"); + } + this.green = green; + if (blue < 0) { + throw new IllegalArgumentException("The blue value is lower than 0"); + } + if (blue > 255) { + throw new IllegalArgumentException("The blue value is higher than 255"); + } + this.blue = blue; + } + + public OrdinaryColor(final Color color) { + this(color.getRed(), color.getGreen(), color.getBlue()); + } + + public int getRed() { + return this.red; + } + + public int getGreen() { + return this.green; + } + + public int getBlue() { + return this.blue; + } + + @Override + public float getValueX() { + return this.red / 255.0f; + } + + @Override + public float getValueY() { + return this.green / 255.0f; + } + + @Override + public float getValueZ() { + return this.blue / 255.0f; + } + } + + public static final class NoteColor extends ParticleColor + { + private final int note; + + public NoteColor(final int note) throws IllegalArgumentException { + if (note < 0) { + throw new IllegalArgumentException("The note value is lower than 0"); + } + if (note > 24) { + throw new IllegalArgumentException("The note value is higher than 24"); + } + this.note = note; + } + + @Override + public float getValueX() { + return this.note / 24.0f; + } + + @Override + public float getValueY() { + return 0.0f; + } + + @Override + public float getValueZ() { + return 0.0f; + } + } + + private static final class ParticleDataException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleDataException(final String message) { + super(message); + } + } + + private static final class ParticleColorException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleColorException(final String message) { + super(message); + } + } + + private static final class ParticleVersionException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleVersionException(final String message) { + super(message); + } + } + + public static final class ParticlePacket + { + private static int version; + private static Class enumParticle; + private static Constructor packetConstructor; + private static Method getHandle; + private static Field playerConnection; + private static Method sendPacket; + private static boolean initialized; + private final ParticleEffect effect; + private float offsetX; + private final float offsetY; + private final float offsetZ; + private final float speed; + private final int amount; + private final boolean longDistance; + private final ParticleData data; + private Object packet; + + public ParticlePacket(final ParticleEffect effect, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final boolean longDistance, final ParticleData data) throws IllegalArgumentException { + initialize(); + if (speed < 0.0f) { + throw new IllegalArgumentException("The speed is lower than 0"); + } + if (amount < 0) { + throw new IllegalArgumentException("The amount is lower than 0"); + } + this.effect = effect; + this.offsetX = offsetX; + this.offsetY = offsetY; + this.offsetZ = offsetZ; + this.speed = speed; + this.amount = amount; + this.longDistance = longDistance; + this.data = data; + } + + public ParticlePacket(final ParticleEffect effect, final Vector direction, final float speed, final boolean longDistance, final ParticleData data) throws IllegalArgumentException { + this(effect, (float)direction.getX(), (float)direction.getY(), (float)direction.getZ(), speed, 0, longDistance, data); + } + + public ParticlePacket(final ParticleEffect effect, final ParticleColor color, final boolean longDistance) { + this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1.0f, 0, longDistance, null); + if (effect == ParticleEffect.REDSTONE && color instanceof OrdinaryColor && ((OrdinaryColor)color).getRed() == 0) { + this.offsetX = Float.MIN_NORMAL; + } + } + + public static void initialize() throws VersionIncompatibleException { + if (ParticlePacket.initialized) { + return; + } + try { + ParticlePacket.version = Integer.parseInt(Character.toString(ReflectionUtils.PackageType.getServerVersion().charAt(3))); + if (ParticlePacket.version > 7) { + ParticlePacket.enumParticle = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("EnumParticle"); + } + final Class packetClass = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass((ParticlePacket.version < 7) ? "Packet63WorldParticles" : "PacketPlayOutWorldParticles"); + ParticlePacket.packetConstructor = ReflectionUtils.getConstructor(packetClass, (Class[])new Class[0]); + ParticlePacket.getHandle = ReflectionUtils.getMethod("CraftPlayer", ReflectionUtils.PackageType.CRAFTBUKKIT_ENTITY, "getHandle", (Class[])new Class[0]); + ParticlePacket.playerConnection = ReflectionUtils.getField("EntityPlayer", ReflectionUtils.PackageType.MINECRAFT_SERVER, false, "playerConnection"); + ParticlePacket.sendPacket = ReflectionUtils.getMethod(ParticlePacket.playerConnection.getType(), "sendPacket", ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("Packet")); + } + catch (Exception exception) { + throw new VersionIncompatibleException("Your current bukkit version seems to be incompatible with this library", exception); + } + ParticlePacket.initialized = true; + } + + public static int getVersion() { + if (!ParticlePacket.initialized) { + initialize(); + } + return ParticlePacket.version; + } + + public static boolean isInitialized() { + return ParticlePacket.initialized; + } + + private void initializePacket(final Location center) throws PacketInstantiationException { + if (this.packet != null) { + return; + } + try { + this.packet = ParticlePacket.packetConstructor.newInstance(new Object[0]); + if (ParticlePacket.version < 8) { + String name = this.effect.getName(); + if (this.data != null) { + name = String.valueOf(name) + this.data.getPacketDataString(); + } + ReflectionUtils.setValue(this.packet, true, "a", name); + } + else { + ReflectionUtils.setValue(this.packet, true, "a", ParticlePacket.enumParticle.getEnumConstants()[this.effect.getId()]); + ReflectionUtils.setValue(this.packet, true, "j", this.longDistance); + if (this.data != null) { + final int[] packetData = this.data.getPacketData(); + final Object packet = this.packet; + final boolean declared = true; + final String fieldName = "k"; + int[] value = null; + if (this.effect != ParticleEffect.ITEM_CRACK) { + value = new int[] { packetData[0] | packetData[1] << 12 }; + } + ReflectionUtils.setValue(packet, declared, fieldName, value); + } + } + ReflectionUtils.setValue(this.packet, true, "b", (float)center.getX()); + ReflectionUtils.setValue(this.packet, true, "c", (float)center.getY()); + ReflectionUtils.setValue(this.packet, true, "d", (float)center.getZ()); + ReflectionUtils.setValue(this.packet, true, "e", this.offsetX); + ReflectionUtils.setValue(this.packet, true, "f", this.offsetY); + ReflectionUtils.setValue(this.packet, true, "g", this.offsetZ); + ReflectionUtils.setValue(this.packet, true, "h", this.speed); + ReflectionUtils.setValue(this.packet, true, "i", this.amount); + } + catch (Exception exception) { + throw new PacketInstantiationException("Packet instantiation failed", exception); + } + } + + public void sendTo(final Location center, final Player player) throws PacketInstantiationException, PacketSendingException { + this.initializePacket(center); + try { + ParticlePacket.sendPacket.invoke(ParticlePacket.playerConnection.get(ParticlePacket.getHandle.invoke(player, new Object[0])), this.packet); + } + catch (Exception exception) { + throw new PacketSendingException("Failed to send the packet to player '" + player.getName() + "'", exception); + } + } + + public void sendTo(final Location center, final List players) throws IllegalArgumentException { + if (players.isEmpty()) { + throw new IllegalArgumentException("The player list is empty"); + } + for (final Player player : players) { + this.sendTo(center, player); + } + } + + public void sendTo(final Location center, final double range) throws IllegalArgumentException { + if (range < 1.0) { + throw new IllegalArgumentException("The range is lower than 1"); + } + final String worldName = center.getWorld().getName(); + final double squared = range * range; + for (final Player player : Bukkit.getOnlinePlayers()) { + if (player.getWorld().getName().equals(worldName)) { + if (player.getLocation().distanceSquared(center) > squared) { + continue; + } + this.sendTo(center, player); + } + } + } + + private static final class VersionIncompatibleException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public VersionIncompatibleException(final String message, final Throwable cause) { + super(message, cause); + } + } + + private static final class PacketInstantiationException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public PacketInstantiationException(final String message, final Throwable cause) { + super(message, cause); + } + } + + private static final class PacketSendingException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public PacketSendingException(final String message, final Throwable cause) { + super(message, cause); + } + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/ReflectionUtils.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ReflectionUtils.java new file mode 100644 index 0000000..a672285 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/ReflectionUtils.java @@ -0,0 +1,248 @@ +package com.prevailpots.bunkers.utils; + +import java.lang.reflect.*; +import java.util.*; +import org.bukkit.*; + +public final class ReflectionUtils +{ + public static Constructor getConstructor(final Class clazz, final Class... parameterTypes) throws NoSuchMethodException { + final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); + Constructor[] constructors; + for (int length = (constructors = clazz.getConstructors()).length, i = 0; i < length; ++i) { + final Constructor constructor = constructors[i]; + if (DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) { + return constructor; + } + } + throw new NoSuchMethodException("There is no such constructor in this class with the specified parameter types"); + } + + public static Constructor getConstructor(final String className, final PackageType packageType, final Class... parameterTypes) throws NoSuchMethodException, ClassNotFoundException { + return getConstructor(packageType.getClass(className), parameterTypes); + } + + public static Object instantiateObject(final Class clazz, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getConstructor(clazz, DataType.getPrimitive(arguments)).newInstance(arguments); + } + + public static Object instantiateObject(final String className, final PackageType packageType, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { + return instantiateObject(packageType.getClass(className), arguments); + } + + public static Method getMethod(final Class clazz, final String methodName, final Class... parameterTypes) throws NoSuchMethodException { + final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); + Method[] methods; + for (int length = (methods = clazz.getMethods()).length, i = 0; i < length; ++i) { + final Method method = methods[i]; + if (method.getName().equals(methodName) && DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) { + return method; + } + } + throw new NoSuchMethodException("There is no such method in this class with the specified name and parameter types"); + } + + public static Method getMethod(final String className, final PackageType packageType, final String methodName, final Class... parameterTypes) throws NoSuchMethodException, ClassNotFoundException { + return getMethod(packageType.getClass(className), methodName, parameterTypes); + } + + public static Object invokeMethod(final Object instance, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getMethod(instance.getClass(), methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments); + } + + public static Object invokeMethod(final Object instance, final Class clazz, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getMethod(clazz, methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments); + } + + public static Object invokeMethod(final Object instance, final String className, final PackageType packageType, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { + return invokeMethod(instance, packageType.getClass(className), methodName, arguments); + } + + public static Field getField(final Class clazz, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException { + final Field field = declared ? clazz.getDeclaredField(fieldName) : clazz.getField(fieldName); + field.setAccessible(true); + return field; + } + + public static Field getField(final String className, final PackageType packageType, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException, ClassNotFoundException { + return getField(packageType.getClass(className), declared, fieldName); + } + + public static Object getValue(final Object instance, final Class clazz, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + return getField(clazz, declared, fieldName).get(instance); + } + + public static Object getValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { + return getValue(instance, packageType.getClass(className), declared, fieldName); + } + + public static Object getValue(final Object instance, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + return getValue(instance, instance.getClass(), declared, fieldName); + } + + public static void setValue(final Object instance, final Class clazz, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + getField(clazz, declared, fieldName).set(instance, value); + } + + public static void setValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { + setValue(instance, packageType.getClass(className), declared, fieldName, value); + } + + public static void setValue(final Object instance, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + setValue(instance, instance.getClass(), declared, fieldName, value); + } + + public enum DataType + { + BYTE((Class)Byte.TYPE, (Class)Byte.class), + SHORT((Class)Short.TYPE, (Class)Short.class), + INTEGER((Class)Integer.TYPE, (Class)Integer.class), + LONG((Class)Long.TYPE, (Class)Long.class), + CHARACTER((Class)Character.TYPE, (Class)Character.class), + FLOAT((Class)Float.TYPE, (Class)Float.class), + DOUBLE((Class)Double.TYPE, (Class)Double.class), + BOOLEAN((Class)Boolean.TYPE, (Class)Boolean.class); + + private static final Map, DataType> CLASS_MAP; + private final Class primitive; + private final Class reference; + + static { + CLASS_MAP = new HashMap, DataType>(); + DataType[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final DataType type = values[i]; + DataType.CLASS_MAP.put(type.primitive, type); + DataType.CLASS_MAP.put(type.reference, type); + } + } + + private DataType(final Class primitive, final Class reference) { + this.primitive = primitive; + this.reference = reference; + } + + public Class getPrimitive() { + return this.primitive; + } + + public Class getReference() { + return this.reference; + } + + public static DataType fromClass(final Class clazz) { + return DataType.CLASS_MAP.get(clazz); + } + + public static Class getPrimitive(final Class clazz) { + final DataType type = fromClass(clazz); + return (type == null) ? clazz : type.getPrimitive(); + } + + public static Class getReference(final Class clazz) { + final DataType type = fromClass(clazz); + return (type == null) ? clazz : type.getReference(); + } + + public static Class[] getPrimitive(final Class[] classes) { + final int length = (classes == null) ? 0 : classes.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getPrimitive(classes[index]); + } + return (Class[])types; + } + + public static Class[] getReference(final Class[] classes) { + final int length = (classes == null) ? 0 : classes.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getReference(classes[index]); + } + return (Class[])types; + } + + public static Class[] getPrimitive(final Object[] objects) { + final int length = (objects == null) ? 0 : objects.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getPrimitive(objects[index].getClass()); + } + return (Class[])types; + } + + public static Class[] getReference(final Object[] objects) { + final int length = (objects == null) ? 0 : objects.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getReference(objects[index].getClass()); + } + return (Class[])types; + } + + public static boolean compare(final Class[] primary, final Class[] secondary) { + if (primary == null || secondary == null || primary.length != secondary.length) { + return false; + } + for (int index = 0; index < primary.length; ++index) { + final Class primaryClass = primary[index]; + final Class secondaryClass = secondary[index]; + if (!primaryClass.equals(secondaryClass) && !primaryClass.isAssignableFrom(secondaryClass)) { + return false; + } + } + return true; + } + } + + public enum PackageType + { + MINECRAFT_SERVER("MINECRAFT_SERVER", 0, "net.minecraft.server." + getServerVersion()), + CRAFTBUKKIT("CRAFTBUKKIT", 1, "org.bukkit.craftbukkit." + getServerVersion()), + CRAFTBUKKIT_BLOCK("CRAFTBUKKIT_BLOCK", 2, PackageType.CRAFTBUKKIT, "block"), + CRAFTBUKKIT_CHUNKIO("CRAFTBUKKIT_CHUNKIO", 3, PackageType.CRAFTBUKKIT, "chunkio"), + CRAFTBUKKIT_COMMAND("CRAFTBUKKIT_COMMAND", 4, PackageType.CRAFTBUKKIT, "command"), + CRAFTBUKKIT_CONVERSATIONS("CRAFTBUKKIT_CONVERSATIONS", 5, PackageType.CRAFTBUKKIT, "conversations"), + CRAFTBUKKIT_ENCHANTMENS("CRAFTBUKKIT_ENCHANTMENS", 6, PackageType.CRAFTBUKKIT, "enchantments"), + CRAFTBUKKIT_ENTITY("CRAFTBUKKIT_ENTITY", 7, PackageType.CRAFTBUKKIT, "entity"), + CRAFTBUKKIT_EVENT("CRAFTBUKKIT_EVENT", 8, PackageType.CRAFTBUKKIT, "event"), + CRAFTBUKKIT_GENERATOR("CRAFTBUKKIT_GENERATOR", 9, PackageType.CRAFTBUKKIT, "generator"), + CRAFTBUKKIT_HELP("CRAFTBUKKIT_HELP", 10, PackageType.CRAFTBUKKIT, "help"), + CRAFTBUKKIT_INVENTORY("CRAFTBUKKIT_INVENTORY", 11, PackageType.CRAFTBUKKIT, "inventory"), + CRAFTBUKKIT_MAP("CRAFTBUKKIT_MAP", 12, PackageType.CRAFTBUKKIT, "map"), + CRAFTBUKKIT_METADATA("CRAFTBUKKIT_METADATA", 13, PackageType.CRAFTBUKKIT, "metadata"), + CRAFTBUKKIT_POTION("CRAFTBUKKIT_POTION", 14, PackageType.CRAFTBUKKIT, "potion"), + CRAFTBUKKIT_PROJECTILES("CRAFTBUKKIT_PROJECTILES", 15, PackageType.CRAFTBUKKIT, "projectiles"), + CRAFTBUKKIT_SCHEDULER("CRAFTBUKKIT_SCHEDULER", 16, PackageType.CRAFTBUKKIT, "scheduler"), + CRAFTBUKKIT_SCOREBOARD("CRAFTBUKKIT_SCOREBOARD", 17, PackageType.CRAFTBUKKIT, "scoreboard"), + CRAFTBUKKIT_UPDATER("CRAFTBUKKIT_UPDATER", 18, PackageType.CRAFTBUKKIT, "updater"), + CRAFTBUKKIT_UTIL("CRAFTBUKKIT_UTIL", 19, PackageType.CRAFTBUKKIT, "util"); + + private final String path; + + private PackageType(final String s, final int n, final String path) { + this.path = path; + } + + private PackageType(final String s, final int n, final PackageType parent, final String path) { + this(s, n, parent + "." + path); + } + + public String getPath() { + return this.path; + } + + public Class getClass(final String className) throws ClassNotFoundException { + return Class.forName(this + "." + className); + } + + @Override + public String toString() { + return this.path; + } + + public static String getServerVersion() { + return Bukkit.getServer().getClass().getPackage().getName().substring(23); + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/utils/RegionUtils.java b/PrevailBunkers/out/com/prevailpots/bunkers/utils/RegionUtils.java new file mode 100644 index 0000000..71d2fb4 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/utils/RegionUtils.java @@ -0,0 +1,17 @@ +package com.prevailpots.bunkers.utils; + +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.game.*; +import com.sk89q.worldedit.bukkit.selections.*; + +import org.bukkit.*; + +public class RegionUtils +{ + public static CuboidSelection getSelectionFromRegion(final World w, final Team team) { + final Location p1 = new Location(w, ConfigurationService.getRegions(team)[0].getX(), 0.0, ConfigurationService.getRegions(team)[0].getZ()); + final Location p2 = new Location(w, ConfigurationService.getRegions(team)[1].getX(), 255.0, ConfigurationService.getRegions(team)[1].getZ()); + final CuboidSelection sel = new CuboidSelection(w, p1, p2); + return sel; + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/world/ConfigManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/world/ConfigManager.java new file mode 100644 index 0000000..4228bd0 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/world/ConfigManager.java @@ -0,0 +1,43 @@ +package com.prevailpots.bunkers.world; + +import org.bukkit.configuration.file.*; +import java.io.*; + +public class ConfigManager +{ + String path; + String plugin; + File Data; + FileConfiguration DataFile; + + public ConfigManager(final String plugin, final String path) { + this.path = null; + this.plugin = null; + this.path = path; + this.plugin = plugin; + this.Data = new File("plugins/" + plugin + "/" + path + ".yml"); + this.DataFile = (FileConfiguration)YamlConfiguration.loadConfiguration(this.Data); + } + + public void createFile() { + try { + this.Data.createNewFile(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + public FileConfiguration getFile() { + return this.DataFile; + } + + public void saveFile() { + try { + this.getFile().save(this.Data); + } + catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/PrevailBunkers/out/com/prevailpots/bunkers/world/WorldManager.java b/PrevailBunkers/out/com/prevailpots/bunkers/world/WorldManager.java new file mode 100644 index 0000000..f444050 --- /dev/null +++ b/PrevailBunkers/out/com/prevailpots/bunkers/world/WorldManager.java @@ -0,0 +1,62 @@ +package com.prevailpots.bunkers.world; + +import org.bukkit.*; +import java.util.*; +import java.io.*; + +public class WorldManager +{ + public void unloadWorld(final World world) { + if (!world.equals(null)) { + Bukkit.getServer().unloadWorld(world, true); + } + } + + public boolean deleteWorld(final File path) { + if (path.exists()) { + final File[] files = path.listFiles(); + for (int i = 0; i < files.length; ++i) { + if (files[i].isDirectory()) { + this.deleteWorld(files[i]); + } + else { + files[i].delete(); + } + } + } + return path.delete(); + } + + public void copyWorld(final File source, final File target) { + try { + final ArrayList ignore = new ArrayList(Arrays.asList("uid.dat", "session.lock")); + if (!ignore.contains(source.getName())) { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdirs(); + } + final String[] files = source.list(); + String[] array; + for (int length2 = (array = files).length, i = 0; i < length2; ++i) { + final String file = array[i]; + final File srcFile = new File(source, file); + final File destFile = new File(target, file); + this.copyWorld(srcFile, destFile); + } + } + else { + final InputStream in = new FileInputStream(source); + final OutputStream out = new FileOutputStream(target); + final byte[] buffer = new byte[1024]; + int length; + while ((length = in.read(buffer)) > 0) { + out.write(buffer, 0, length); + } + in.close(); + out.close(); + } + } + } + catch (IOException ex) {} + } +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/ClientVersion.java b/PrevailBunkers/out/me/vertises/aztec/tablist/ClientVersion.java new file mode 100644 index 0000000..67f2778 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/ClientVersion.java @@ -0,0 +1,22 @@ +package me.vertises.aztec.tablist; + +import org.bukkit.entity.Player; + +import me.vertises.aztec.tablist.reflection.ReflectionConstants; + +public enum ClientVersion { + + v1_7, v1_8; + + public static ClientVersion getVersion(Player player) { + Object handle = ReflectionConstants.GET_HANDLE_METHOD.invoke(player); + Object connection = ReflectionConstants.PLAYER_CONNECTION.get(handle); + Object manager = ReflectionConstants.NETWORK_MANAGER.get(connection); + Object version = ReflectionConstants.VERSION_METHOD.invoke(manager); + if (version instanceof Integer) { + return (int) version > 5 ? v1_8 : v1_7; + } + return v1_7; + } + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/Reflection.java b/PrevailBunkers/out/me/vertises/aztec/tablist/Reflection.java new file mode 100644 index 0000000..7da5ae3 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/Reflection.java @@ -0,0 +1,404 @@ +package me.vertises.aztec.tablist; + + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.bukkit.Bukkit; + +/** + * An utility class that simplifies reflection in Bukkit plugins. + * + * @author Kristian + */ +public final class Reflection { + /** + * An interface for invoking a specific constructor. + */ + public interface ConstructorInvoker { + /** + * Invoke a constructor for a specific class. + * + * @param arguments - the arguments to pass to the constructor. + * @return The constructed object. + */ + public Object invoke(Object... arguments); + } + + /** + * An interface for invoking a specific method. + */ + public interface MethodInvoker { + /** + * Invoke a method on a specific target object. + * + * @param target - the target object, or NULL for a static method. + * @param arguments - the arguments to pass to the method. + * @return The return value, or NULL if is void. + */ + public Object invoke(Object target, Object... arguments); + } + + /** + * An interface for retrieving the field content. + * + * @param - field type. + */ + public interface FieldAccessor { + /** + * Retrieve the content of a field. + * + * @param target - the target object, or NULL for a static field. + * @return The value of the field. + */ + public T get(Object target); + + /** + * Set the content of a field. + * + * @param target - the target object, or NULL for a static field. + * @param value - the new value of the field. + */ + public void set(Object target, Object value); + + /** + * Determine if the given object has this field. + * + * @param target - the object to test. + * @return TRUE if it does, FALSE otherwise. + */ + public boolean hasField(Object target); + } + + // Deduce the net.minecraft.server.v* package + private static String OBC_PREFIX = Bukkit.getServer().getClass().getPackage().getName(); + private static String NMS_PREFIX = OBC_PREFIX.replace("org.bukkit.craftbukkit", "net.minecraft.server"); + private static String VERSION = OBC_PREFIX.replace("org.bukkit.craftbukkit", "").replace(".", ""); + + // Variable replacement + private static Pattern MATCH_VARIABLE = Pattern.compile("\\{([^\\}]+)\\}"); + + private Reflection() { + // Seal class + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param target - the target type. + * @param name - the name of the field, or NULL to ignore. + * @param fieldType - a compatible field type. + * @return The field accessor. + */ + public static FieldAccessor getField(Class target, String name, Class fieldType) { + return getField(target, name, fieldType, 0); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param name - the name of the field, or NULL to ignore. + * @param fieldType - a compatible field type. + * @return The field accessor. + */ + public static FieldAccessor getField(String className, String name, Class fieldType) { + return getField(getClass(className), name, fieldType, 0); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param target - the target type. + * @param fieldType - a compatible field type. + * @param index - the number of compatible fields to skip. + * @return The field accessor. + */ + public static FieldAccessor getField(Class target, Class fieldType, int index) { + return getField(target, null, fieldType, index); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param fieldType - a compatible field type. + * @param index - the number of compatible fields to skip. + * @return The field accessor. + */ + public static FieldAccessor getField(String className, Class fieldType, int index) { + return getField(getClass(className), fieldType, index); + } + + // Common method + private static FieldAccessor getField(Class target, String name, Class fieldType, int index) { + for (final Field field : target.getDeclaredFields()) { + if ((name == null || field.getName().equals(name)) && fieldType.isAssignableFrom(field.getType()) && index-- <= 0) { + field.setAccessible(true); + + // A function for retrieving a specific field value + return new FieldAccessor() { + + @Override + @SuppressWarnings("unchecked") + public T get(Object target) { + try { + return (T) field.get(target); + } catch (IllegalAccessException e) { + throw new RuntimeException("Cannot access reflection.", e); + } + } + + @Override + public void set(Object target, Object value) { + try { + field.set(target, value); + } catch (IllegalAccessException e) { + throw new RuntimeException("Cannot access reflection.", e); + } + } + + @Override + public boolean hasField(Object target) { + // target instanceof DeclaringClass + return field.getDeclaringClass().isAssignableFrom(target.getClass()); + } + }; + } + } + + // Search in parent classes + if (target.getSuperclass() != null) + return getField(target.getSuperclass(), name, fieldType, index); + + throw new IllegalArgumentException("Cannot find field with type " + fieldType); + } + + /** + * Search for the first publically and privately defined method of the given name and parameter count. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param methodName - the method name, or NULL to skip. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getMethod(String className, String methodName, Class... params) { + return getTypedMethod(getClass(className), methodName, null, params); + } + + /** + * Search for the first publically and privately defined method of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param methodName - the method name, or NULL to skip. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getMethod(Class clazz, String methodName, Class... params) { + return getTypedMethod(clazz, methodName, null, params); + } + + /** + * Search for the first publically and privately defined method of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param methodName - the method name, or NULL to skip. + * @param returnType - the expected return type, or NULL to ignore. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getTypedMethod(Class clazz, String methodName, Class returnType, Class... params) { + for (final Method method : clazz.getDeclaredMethods()) { + if ((methodName == null || method.getName().equals(methodName)) + && (returnType == null || method.getReturnType().equals(returnType)) + && Arrays.equals(method.getParameterTypes(), params)) { + method.setAccessible(true); + + return new MethodInvoker() { + + @Override + public Object invoke(Object target, Object... arguments) { + try { + return method.invoke(target, arguments); + } catch (Exception e) { + throw new RuntimeException("Cannot invoke method " + method, e); + } + } + + }; + } + } + + // Search in every superclass + if (clazz.getSuperclass() != null) + return getMethod(clazz.getSuperclass(), methodName, params); + + throw new IllegalStateException(String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params))); + } + + /** + * Search for the first publically and privately defined constructor of the given name and parameter count. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param params - the expected parameters. + * @return An object that invokes this constructor. + * @throws IllegalStateException If we cannot find this method. + */ + public static ConstructorInvoker getConstructor(String className, Class... params) { + return getConstructor(getClass(className), params); + } + + /** + * Search for the first publically and privately defined constructor of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param params - the expected parameters. + * @return An object that invokes this constructor. + * @throws IllegalStateException If we cannot find this method. + */ + public static ConstructorInvoker getConstructor(Class clazz, Class... params) { + for (final Constructor constructor : clazz.getDeclaredConstructors()) { + if (Arrays.equals(constructor.getParameterTypes(), params)) { + constructor.setAccessible(true); + + return new ConstructorInvoker() { + + @Override + public Object invoke(Object... arguments) { + try { + return constructor.newInstance(arguments); + } catch (Exception e) { + throw new RuntimeException("Cannot invoke constructor " + constructor, e); + } + } + + }; + } + } + + throw new IllegalStateException(String.format("Unable to find constructor for %s (%s).", clazz, Arrays.asList(params))); + } + + /** + * Retrieve a class from its full name, without knowing its type on compile time. + *

+ * This is useful when looking up fields by a NMS or OBC type. + *

+ * + * @see {@link #getClass()} for more information. + * @param lookupName - the class name with variables. + * @return The class. + */ + public static Class getUntypedClass(String lookupName) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + Class clazz = (Class) getClass(lookupName); + return clazz; + } + + /** + * Retrieve a class from its full name. + *

+ * Strings enclosed with curly brackets - such as {TEXT} - will be replaced according to the following table: + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
VariableContent
{nms}Actual package name of net.minecraft.server.VERSION
{obc}Actual pacakge name of org.bukkit.craftbukkit.VERSION
{version}The current Minecraft package VERSION, if any.
+ * + * @param lookupName - the class name with variables. + * @return The looked up class. + * @throws IllegalArgumentException If a variable or class could not be found. + */ + public static Class getClass(String lookupName) { + return getCanonicalClass(expandVariables(lookupName)); + } + + /** + * Retrieve a class in the net.minecraft.server.VERSION.* package. + * + * @param name - the name of the class, excluding the package. + * @throws IllegalArgumentException If the class doesn't exist. + */ + public static Class getMinecraftClass(String name) { + return getCanonicalClass(NMS_PREFIX + "." + name); + } + + /** + * Retrieve a class in the org.bukkit.craftbukkit.VERSION.* package. + * + * @param name - the name of the class, excluding the package. + * @throws IllegalArgumentException If the class doesn't exist. + */ + public static Class getCraftBukkitClass(String name) { + return getCanonicalClass(OBC_PREFIX + "." + name); + } + + /** + * Retrieve a class by its canonical name. + * + * @param canonicalName - the canonical name. + * @return The class. + */ + private static Class getCanonicalClass(String canonicalName) { + try { + return Class.forName(canonicalName); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException("Cannot find " + canonicalName, e); + } + } + + /** + * Expand variables such as "{nms}" and "{obc}" to their corresponding packages. + * + * @param name - the full name of the class. + * @return The expanded string. + */ + private static String expandVariables(String name) { + StringBuffer output = new StringBuffer(); + Matcher matcher = MATCH_VARIABLE.matcher(name); + + while (matcher.find()) { + String variable = matcher.group(1); + String replacement = ""; + + // Expand all detected variables + if ("nms".equalsIgnoreCase(variable)) + replacement = NMS_PREFIX; + else if ("obc".equalsIgnoreCase(variable)) + replacement = OBC_PREFIX; + else if ("version".equalsIgnoreCase(variable)) + replacement = VERSION; + else + throw new IllegalArgumentException("Unknown variable: " + variable); + + // Assume the expanded variables are all packages, and append a dot + if (replacement.length() > 0 && matcher.end() < name.length() && name.charAt(matcher.end()) != '.') + replacement += "."; + matcher.appendReplacement(output, Matcher.quoteReplacement(replacement)); + } + + matcher.appendTail(output); + return output.toString(); + } +} \ No newline at end of file diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/Tablist.java b/PrevailBunkers/out/me/vertises/aztec/tablist/Tablist.java new file mode 100644 index 0000000..69a40ec --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/Tablist.java @@ -0,0 +1,189 @@ +package me.vertises.aztec.tablist; + +import java.util.Arrays; +import java.util.UUID; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; +import org.spigotmc.ProtocolInjector; + +import com.google.common.collect.Table; + +import lombok.Getter; +import me.vertises.aztec.tablist.reflection.ReflectionConstants; +import net.minecraft.server.v1_7_R4.ChatSerializer; + +public class Tablist { + + public static final Object[] GAME_PROFILES; + public static final String[] TAB_NAMES; + + public static String[] BLANK_SKIN = {"eyJ0aW1lc3RhbXAiOjE0MTEyNjg3OTI3NjUsInByb2ZpbGVJZCI6IjNmYmVjN2RkMGE1ZjQwYmY5ZDExODg1YTU0NTA3MTEyIiwicHJvZmlsZU5hbWUiOiJsYXN0X3VzZXJuYW1lIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg0N2I1Mjc5OTg0NjUxNTRhZDZjMjM4YTFlM2MyZGQzZTMyOTY1MzUyZTNhNjRmMzZlMTZhOTQwNWFiOCJ9fX0=", "u8sG8tlbmiekrfAdQjy4nXIcCfNdnUZzXSx9BE1X5K27NiUvE1dDNIeBBSPdZzQG1kHGijuokuHPdNi/KXHZkQM7OJ4aCu5JiUoOY28uz3wZhW4D+KG3dH4ei5ww2KwvjcqVL7LFKfr/ONU5Hvi7MIIty1eKpoGDYpWj3WjnbN4ye5Zo88I2ZEkP1wBw2eDDN4P3YEDYTumQndcbXFPuRRTntoGdZq3N5EBKfDZxlw4L3pgkcSLU5rWkd5UH4ZUOHAP/VaJ04mpFLsFXzzdU4xNZ5fthCwxwVBNLtHRWO26k/qcVBzvEXtKGFJmxfLGCzXScET/OjUBak/JEkkRG2m+kpmBMgFRNtjyZgQ1w08U6HHnLTiAiio3JswPlW5v56pGWRHQT5XWSkfnrXDalxtSmPnB5LmacpIImKgL8V9wLnWvBzI7SHjlyQbbgd+kUOkLlu7+717ySDEJwsFJekfuR6N/rpcYgNZYrxDwe4w57uDPlwNL6cJPfNUHV7WEbIU1pMgxsxaXe8WSvV87qLsR7H06xocl2C0JFfe2jZR4Zh3k9xzEnfCeFKBgGb4lrOWBu1eDWYgtKV67M2Y+B3W5pjuAjwAxn0waODtEn/3jKPbc/sxbPvljUCw65X+ok0UUN1eOwXV5l2EGzn05t3Yhwq19/GxARg63ISGE8CKw="}; + + @Getter + private final ClientVersion version; + + @Getter + private final Player player; + + @Getter + private boolean initiated; + + private Scoreboard scoreboard; + + public Tablist(Player player) { + this.player = player; + this.version = ClientVersion.getVersion(player); + Scoreboard scoreboard = player.getScoreboard(); + if (scoreboard == Bukkit.getScoreboardManager().getMainScoreboard()) { + scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + } + player.setScoreboard(scoreboard); + this.scoreboard = scoreboard; + addFakePlayers(); + update(); + } + + public void sendPacket(Player player, Object packet) { + Object handle = ReflectionConstants.GET_HANDLE_METHOD.invoke(player); + Object connection = ReflectionConstants.PLAYER_CONNECTION.get(handle); + ReflectionConstants.SEND_PACKET.invoke(connection, packet); + } + + public Tablist update() { + TablistManager manager = TablistManager.INSTANCE; + if (!initiated || manager == null) return this; + Table entries = manager.getSupplier().getEntries(player); + boolean useProfiles = version.ordinal() != 0; + int magic = useProfiles ? 4 : 3; + if (useProfiles) { + String header = manager.getSupplier().getHeader(player); + if (header == null) { + header = ""; + } + String footer = manager.getSupplier().getFooter(player); + if (footer == null) { + footer = ""; + } + ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(ChatSerializer.a("{text:\"" + StringEscapeUtils.escapeJava(header) + "\"}"), ChatSerializer.a("{text:\"" + StringEscapeUtils.escapeJava(footer) + "\"}")); + sendPacket(player, packet); + } + for (int i = 0; i < (magic * 20); i ++) { + int x = i % magic; + int y = i / magic; + String text = entries.get(x, y); + if (text == null) { + text = ""; + } + String name = TAB_NAMES[i]; + Team team = scoreboard.getTeam(name); + if (team == null) { + team = scoreboard.registerNewTeam(name); + } + if (!team.hasEntry(name)) { + team.addEntry(name); + } + String prefix = "", suffix = ""; + if (text.length() < 17) { + prefix = text; + } else { + String left = text.substring(0, 16), right = text.substring(16, text.length()); + if (left.endsWith("§")) { + left = left.substring(0, left.length() - 1); + right = "§" + right; + } + String last = ChatColor.getLastColors(left); + right = last + right; + prefix = left; + suffix = StringUtils.left(right, 16); + } + team.setPrefix(prefix); + team.setSuffix(suffix); + } + return this; + } + + public Tablist hideRealPlayers() { + if (!initiated) return this; + boolean useProfiles = version.ordinal() != 0; + Bukkit.getOnlinePlayers().forEach(other -> { + if (!player.canSee(other)) return; + Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke(); + if (useProfiles) { + Object profile = ReflectionConstants.GET_PROFILE_METHOD.invoke(other); + ReflectionConstants.TAB_PACKET_PROFILE.set(packet, profile); + } else { + ReflectionConstants.TAB_PACKET_NAME.set(packet, other.getName()); + } + ReflectionConstants.TAB_PACKET_ACTION.set(packet, 4); + sendPacket(player, packet); + }); + return this; + } + + public Tablist hideFakePlayers() { + if (!initiated) return this; + boolean useProfiles = version.ordinal() != 0; + Arrays.stream(GAME_PROFILES).forEach(other -> { + Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke(); + if (useProfiles) { + ReflectionConstants.TAB_PACKET_PROFILE.set(packet, other); + } else { + String name = ReflectionConstants.GAME_PROFILE_NAME.get(other); + ReflectionConstants.TAB_PACKET_NAME.set(packet, name); + } + ReflectionConstants.TAB_PACKET_ACTION.set(packet, 4); + sendPacket(player, packet); + }); + return this; + } + + public Tablist addFakePlayers() { + if (initiated) return this; + boolean useProfiles = version.ordinal() != 0; + int magic = useProfiles ? 4 : 3; + for (int i = 0; i < (magic * 20); i ++) { + int x = i % magic; + int y = i / magic; + Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke(); + Object profile = GAME_PROFILES[i]; + if (useProfiles) { + ReflectionConstants.TAB_PACKET_PROFILE.set(packet, profile); + } else { + String name = ReflectionConstants.GAME_PROFILE_NAME.get(profile); + ReflectionConstants.TAB_PACKET_NAME.set(packet, name); + } + ReflectionConstants.TAB_PACKET_ACTION.set(packet, 0); + sendPacket(player, packet); + } + initiated = true; + return this; + } + + public void clear() { + player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard()); + scoreboard.getTeams().forEach(team -> team.unregister()); + scoreboard = null; + System.gc(); + } + + static { + GAME_PROFILES = new Object[80]; + TAB_NAMES = new String[80]; + for (int i = 0; i < 80; i ++) { + int x = i % 4; + int y = i / 4; + String name = (x > 9 ? ("§" + String.valueOf(x).toCharArray()[0] + "§" + String.valueOf(x).toCharArray()[1]) : "§0§" + x) + (y > 9 ? ("§" + String.valueOf(y).toCharArray()[0] + "§" + String.valueOf(y).toCharArray()[1]) : "§0§" + String.valueOf(y).toCharArray()[0]); + UUID id = UUID.randomUUID(); + Object profile = ReflectionConstants.GAME_PROFILE_CONSTRUCTOR.invoke(id, name); + TAB_NAMES[i] = name; + GAME_PROFILES[i] = profile; + } + } + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/TablistEntrySupplier.java b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistEntrySupplier.java new file mode 100644 index 0000000..d96b833 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistEntrySupplier.java @@ -0,0 +1,15 @@ +package me.vertises.aztec.tablist; + +import org.bukkit.entity.Player; + +import com.google.common.collect.Table; + +public interface TablistEntrySupplier { + + Table getEntries(Player player); + + String getHeader(Player player); + + String getFooter(Player player); + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/TablistManager.java b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistManager.java new file mode 100644 index 0000000..d86ac98 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistManager.java @@ -0,0 +1,124 @@ +package me.vertises.aztec.tablist; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.PluginDisableEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; + +public class TablistManager implements Listener { + + public static TablistManager INSTANCE; + + @Getter + private final JavaPlugin plugin; + + private final Map tablists; + + @Setter @NonNull @Getter + private TablistEntrySupplier supplier; + + private int updateTaskId = -1; + + public TablistManager(@NonNull JavaPlugin plugin, @NonNull TablistEntrySupplier supplier, long updateTime) { + boolean startUpdater = true; + if (TablistManager.INSTANCE != null) { + for (int i = 0; i < 7; i ++) { + Bukkit.getLogger().warning(""); + } + Bukkit.getLogger().warning("WARNING! AN INSTANCE OF TABLISTMANAGER ALREADY EXISTS!"); + Bukkit.getLogger().warning("IT IS RECOMMENDED TO ONLY USE ONE OTHERWISE IT CAN CAUSE FLICKERING AND OTHER ISSUES!"); + for (int i = 0; i < 7; i ++) { + Bukkit.getLogger().warning(""); + } + } + updateTime: { + long remainder = updateTime % 50l; + if (remainder != 0l) { + updateTime = updateTime - remainder; + Bukkit.getLogger().info("FIXING UPDATE TIME TO VALID TICK-COUNT..."); + } + break updateTime; + } + if (updateTime < 50l) { + startUpdater = false; + for (int i = 0; i < 7; i ++) { + Bukkit.getLogger().warning(""); + } + Bukkit.getLogger().warning("WARNING! TABLIST UPDATE TASK NOT STARTED!"); + Bukkit.getLogger().warning("REASON: UPDATE TIME IS TOO SHORT."); + for (int i = 0; i < 7; i ++) { + Bukkit.getLogger().warning(""); + } + } + TablistManager.INSTANCE = this; + this.tablists = new ConcurrentHashMap<>(); + this.supplier = supplier; + this.plugin = plugin; + if (startUpdater) { + updateTaskId = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new TablistUpdateTask(), updateTime / 50, updateTime / 50).getTaskId(); + } + Bukkit.getPluginManager().registerEvents(this, plugin); + Bukkit.getOnlinePlayers().forEach(player -> { + getTablist(player, true); + }); + } + + @Deprecated + public Tablist getTablist(Player player) { + return getTablist(player, false); + } + + @Deprecated + public Tablist getTablist(Player player, boolean create) { + UUID uniqueId = player.getUniqueId(); + Tablist tablist = tablists.get(uniqueId); + if (tablist == null && create) { + tablists.put(uniqueId, tablist = new Tablist(player)); + } + return tablist; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + Player player = event.getPlayer(); + Tablist tablist = getTablist(player, true); + } + + @EventHandler + public void onDisable(PluginDisableEvent event) { + if (event.getPlugin() == plugin) { + tablists.forEach((id, tablist) -> { + tablist.hideFakePlayers().clear(); + }); + tablists.clear(); + HandlerList.unregisterAll(this); + if (updateTaskId != -1) { + Bukkit.getScheduler().cancelTask(updateTaskId); + } + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) { + Player player = event.getPlayer(); + UUID uniqueId = player.getUniqueId(); + Tablist tablist; + if ((tablist = tablists.remove(uniqueId)) != null) { + tablist.hideFakePlayers().clear(); + } + } + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/TablistUpdateTask.java b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistUpdateTask.java new file mode 100644 index 0000000..21b798e --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/TablistUpdateTask.java @@ -0,0 +1,20 @@ +package me.vertises.aztec.tablist; + +import org.bukkit.Bukkit; + +public class TablistUpdateTask implements Runnable { + + @Override + public void run() { + TablistManager manager = TablistManager.INSTANCE; + if (manager == null) return; + Bukkit.getOnlinePlayers().forEach(player -> { + Tablist tablist = manager.getTablist(player); + if (tablist != null) { + tablist.hideRealPlayers().update(); + } + }); + } + + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/example/ExampleSupplier.java b/PrevailBunkers/out/me/vertises/aztec/tablist/example/ExampleSupplier.java new file mode 100644 index 0000000..fcc0f04 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/example/ExampleSupplier.java @@ -0,0 +1,38 @@ +package me.vertises.aztec.tablist.example; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; + +import me.vertises.aztec.tablist.TablistEntrySupplier; + +import net.md_5.bungee.api.ChatColor; + + +public class ExampleSupplier implements TablistEntrySupplier { + + + @Override + public Table getEntries(Player player) { + Table table = HashBasedTable.create(); + table.put(1, 0, ChatColor.AQUA + "Prevail" + ChatColor.GRAY + " [Bunkers]"); + table.put(1, 2, ChatColor.AQUA + "Bunkers:" + ChatColor.GRAY + " [Offline]"); + table.put(1, 3, ChatColor.AQUA + "HCFactions:" + ChatColor.GRAY + " [Offline]"); + table.put(1, 4, ChatColor.AQUA + "Practice:" + ChatColor.GRAY + " [Offline]"); + return table; + } + + @Override + public String getHeader(Player player) { + return "Godly header"; + } + + @Override + public String getFooter(Player player) { + return "Godly footer"; + } + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/example/TablistPlugin.java b/PrevailBunkers/out/me/vertises/aztec/tablist/example/TablistPlugin.java new file mode 100644 index 0000000..346dd41 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/example/TablistPlugin.java @@ -0,0 +1,16 @@ +package me.vertises.aztec.tablist.example; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.plugin.java.JavaPlugin; + +import me.vertises.aztec.tablist.TablistManager; + +public class TablistPlugin extends JavaPlugin { + + @Override + public void onEnable() { + new TablistManager(this, new ExampleSupplier(), TimeUnit.SECONDS.toMillis(5l)); + } + +} diff --git a/PrevailBunkers/out/me/vertises/aztec/tablist/reflection/ReflectionConstants.java b/PrevailBunkers/out/me/vertises/aztec/tablist/reflection/ReflectionConstants.java new file mode 100644 index 0000000..592f349 --- /dev/null +++ b/PrevailBunkers/out/me/vertises/aztec/tablist/reflection/ReflectionConstants.java @@ -0,0 +1,54 @@ +package me.vertises.aztec.tablist.reflection; + +import java.util.Map; +import java.util.UUID; + +import net.minecraft.server.v1_7_R4.EnumProtocol; +import me.vertises.aztec.tablist.*; +public class ReflectionConstants { + + //base tablist + public static final Class TAB_PACKET_CLASS = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo"); + public static final Reflection.ConstructorInvoker TAB_PACKET_CONSTRUCTOR = Reflection.getConstructor(TAB_PACKET_CLASS); + public static final Reflection.FieldAccessor TAB_PACKET_ACTION = Reflection.getField(TAB_PACKET_CLASS, int.class, 5); + + //1.7 tablist + public static final Reflection.FieldAccessor TAB_PACKET_NAME = Reflection.getField(TAB_PACKET_CLASS, String.class, 0); + + //1.8 tablist + public static final Class GAME_PROFILE_CLASS = getUntypedClasses("net.minecraft.util.com.mojang.authlib.GameProfile", "com.mojang.authlib.GameProfile"); + public static final Reflection.ConstructorInvoker GAME_PROFILE_CONSTRUCTOR = Reflection.getConstructor(GAME_PROFILE_CLASS, UUID.class, String.class); + public static final Reflection.FieldAccessor GAME_PROFILE_NAME = Reflection.getField(GAME_PROFILE_CLASS, String.class, 0); + public static final Reflection.FieldAccessor TAB_PACKET_PROFILE = Reflection.getField(TAB_PACKET_CLASS, GAME_PROFILE_CLASS, 0); + + //misc + public static final Class CRAFT_PLAYER_CLASS = Reflection.getCraftBukkitClass("entity.CraftPlayer"); + public static final Class NMS_PACKET_CLASS = Reflection.getMinecraftClass("Packet"); + public static final Class NMS_PLAYER_CLASS = Reflection.getMinecraftClass("EntityPlayer"); + public static final Class PLAYER_CONNECTION_CLASS = Reflection.getMinecraftClass("PlayerConnection"); + public static final Class NETWORK_MANAGER_CLASS = Reflection.getMinecraftClass("NetworkManager"); + public static final Reflection.MethodInvoker GET_HANDLE_METHOD = Reflection.getMethod(CRAFT_PLAYER_CLASS, "getHandle"); + public static final Reflection.MethodInvoker GET_PROFILE_METHOD = Reflection.getMethod(CRAFT_PLAYER_CLASS, "getProfile"); + public static final Reflection.MethodInvoker VERSION_METHOD = Reflection.getMethod(NETWORK_MANAGER_CLASS, "getVersion"); + public static final Reflection.MethodInvoker SEND_PACKET = Reflection.getMethod(PLAYER_CONNECTION_CLASS, "sendPacket", NMS_PACKET_CLASS); + public static final Reflection.FieldAccessor PLAYER_CONNECTION = Reflection.getField(NMS_PLAYER_CLASS, PLAYER_CONNECTION_CLASS, 0); + public static final Reflection.FieldAccessor NETWORK_MANAGER = Reflection.getField(PLAYER_CONNECTION_CLASS, NETWORK_MANAGER_CLASS, 0); + + //packet registry + public static final Class ENUM_PROTOCOL_CLASS = Reflection.getMinecraftClass("EnumProtocol"); + public static final Reflection.FieldAccessor ENUM_PROTOCOL_PLAY = Reflection.getField(ENUM_PROTOCOL_CLASS, ENUM_PROTOCOL_CLASS, 1); + public static final Reflection.FieldAccessor ENUM_PROTOCOL_REGISTRY = Reflection.getField(ENUM_PROTOCOL_CLASS, Map.class, 0); + + public static Class getUntypedClasses(String ...lookupNames) { + EnumProtocol.class.getName(); + for (String lookupName : lookupNames) { + try { + return Reflection.getUntypedClass(lookupName); + } catch (IllegalArgumentException e) { + continue; + } + } + throw new IllegalArgumentException("No class found in selection given"); + } + +} diff --git a/PrevailBunkers/out/plugin.yml b/PrevailBunkers/out/plugin.yml new file mode 100644 index 0000000..2f72c4b --- /dev/null +++ b/PrevailBunkers/out/plugin.yml @@ -0,0 +1,19 @@ +name: PrevailBunkers +main: com.prevailpots.bunkers.Core +author: s3ries +version: 1 +dependencies: [WorldEdit, PermissionsEx] +commands: + setlobbyspawn: + description: 'Sets the lobby spawn.' + aliases: [sls] + usage: '/setlobbyspawn' + team: + description: 'Team command.' + aliases: [f, t] + usage: '/team ' + forcestart: + description: 'Starts game no matter what (Might be unsafe).' + aliases: [fs] + usage: '/forcestart' + removetab: \ No newline at end of file diff --git a/PrevailBunkers/out/production/UHC Bunkers/META-INF/MANIFEST.MF b/PrevailBunkers/out/production/UHC Bunkers/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fbba0d5 --- /dev/null +++ b/PrevailBunkers/out/production/UHC Bunkers/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: com.prevailpots.bunkers.Core + diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/Core.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/Core.class new file mode 100644 index 0000000..454863e Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/Core.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/ForceStart.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/ForceStart.class new file mode 100644 index 0000000..997279f Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/ForceStart.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/LobbySpawn.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/LobbySpawn.class new file mode 100644 index 0000000..61ff1bb Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/LobbySpawn.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/TeamCommand.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/TeamCommand.class new file mode 100644 index 0000000..5b086e5 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/commands/TeamCommand.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/config/ConfigurationService.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/config/ConfigurationService.class new file mode 100644 index 0000000..b8309bf Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/config/ConfigurationService.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$1.class new file mode 100644 index 0000000..6129345 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$2.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$2.class new file mode 100644 index 0000000..266a231 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$2.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$3.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$3.class new file mode 100644 index 0000000..375786f Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$3.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$4.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$4.class new file mode 100644 index 0000000..d09d22e Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$4.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$5.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$5.class new file mode 100644 index 0000000..1e4f266 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$5.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$6.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$6.class new file mode 100644 index 0000000..778c25a Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$6.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$7.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$7.class new file mode 100644 index 0000000..83ceb71 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler$7.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler.class new file mode 100644 index 0000000..a9a5616 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameHandler.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameState.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameState.class new file mode 100644 index 0000000..e1a2100 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/GameState.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/Team.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/Team.class new file mode 100644 index 0000000..5507c9d Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/Team.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/BalanceManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/BalanceManager.class new file mode 100644 index 0000000..a6f2344 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/BalanceManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CapzoneManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CapzoneManager.class new file mode 100644 index 0000000..9ab67d8 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CapzoneManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ChatManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ChatManager.class new file mode 100644 index 0000000..7114bee Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ChatManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$1.class new file mode 100644 index 0000000..79cd13b Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$2.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$2.class new file mode 100644 index 0000000..b92b1c7 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$2.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$3.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$3.class new file mode 100644 index 0000000..39ec7dd Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$3.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$Type.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$Type.class new file mode 100644 index 0000000..e749646 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager$Type.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager.class new file mode 100644 index 0000000..7df560e Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/CooldownManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/DTRManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/DTRManager.class new file mode 100644 index 0000000..5e86ab9 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/DTRManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$1.class new file mode 100644 index 0000000..a83513c Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$2.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$2.class new file mode 100644 index 0000000..90077c3 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$2.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$3.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$3.class new file mode 100644 index 0000000..49d3096 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$3.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$4.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$4.class new file mode 100644 index 0000000..ab9e605 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager$4.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager.class new file mode 100644 index 0000000..a0cb700 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/FreezeManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ItemManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ItemManager.class new file mode 100644 index 0000000..8b5a885 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ItemManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/PointManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/PointManager.class new file mode 100644 index 0000000..3cfdaff Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/PointManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItem.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItem.class new file mode 100644 index 0000000..6fc2570 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItem.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItemType.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItemType.class new file mode 100644 index 0000000..e154e65 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager$ShopItemType.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager.class new file mode 100644 index 0000000..e7432ba Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/ShopManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamJoinManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamJoinManager.class new file mode 100644 index 0000000..40b8612 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamJoinManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamManager.class new file mode 100644 index 0000000..e8d52b8 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/game/managers/TeamManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective$1.class new file mode 100644 index 0000000..73dad67 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective.class new file mode 100644 index 0000000..7660abe Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/BufferedObjective.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$1.class new file mode 100644 index 0000000..be91e1f Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$2.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$2.class new file mode 100644 index 0000000..feba0ea Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$2.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$3.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$3.class new file mode 100644 index 0000000..c0f5c0d Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard$3.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard.class new file mode 100644 index 0000000..c363f34 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/PlayerBoard.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.class new file mode 100644 index 0000000..53e1998 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarEntry.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarEntry.class new file mode 100644 index 0000000..dd5b178 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarEntry.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarProvider.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarProvider.class new file mode 100644 index 0000000..7f9a24d Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/SidebarProvider.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.class new file mode 100644 index 0000000..3f876ad Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/DynamicTask.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/DynamicTask.class new file mode 100644 index 0000000..406644d Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/DynamicTask.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask$1.class new file mode 100644 index 0000000..9f3b0e9 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask.class new file mode 100644 index 0000000..be09bd7 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/ItemDropTask.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/PlayerItemTask.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/PlayerItemTask.class new file mode 100644 index 0000000..2290dd8 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/task/PlayerItemTask.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/BroadcastUtils.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/BroadcastUtils.class new file mode 100644 index 0000000..55e1472 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/BroadcastUtils.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil$1.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil$1.class new file mode 100644 index 0000000..74fb03b Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil$1.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil.class new file mode 100644 index 0000000..ffc778f Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ItemUtil.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/MathUtils.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/MathUtils.class new file mode 100644 index 0000000..5739791 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/MathUtils.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$BlockData.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$BlockData.class new file mode 100644 index 0000000..5bd7680 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$BlockData.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ItemData.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ItemData.class new file mode 100644 index 0000000..df76888 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ItemData.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$NoteColor.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$NoteColor.class new file mode 100644 index 0000000..77b5878 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$NoteColor.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$OrdinaryColor.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$OrdinaryColor.class new file mode 100644 index 0000000..7836dff Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$OrdinaryColor.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColor.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColor.class new file mode 100644 index 0000000..5ceac70 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColor.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColorException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColorException.class new file mode 100644 index 0000000..00be90f Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleColorException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleData.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleData.class new file mode 100644 index 0000000..af408d3 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleData.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleDataException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleDataException.class new file mode 100644 index 0000000..cd3f703 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleDataException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketInstantiationException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketInstantiationException.class new file mode 100644 index 0000000..046053b Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketInstantiationException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketSendingException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketSendingException.class new file mode 100644 index 0000000..ffc7d50 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$PacketSendingException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$VersionIncompatibleException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$VersionIncompatibleException.class new file mode 100644 index 0000000..0eda6fa Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket$VersionIncompatibleException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket.class new file mode 100644 index 0000000..bfd247c Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticlePacket.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleProperty.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleProperty.class new file mode 100644 index 0000000..aaf6e76 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleProperty.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleVersionException.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleVersionException.class new file mode 100644 index 0000000..f75b060 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect$ParticleVersionException.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect.class new file mode 100644 index 0000000..e37c218 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ParticleEffect.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$DataType.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$DataType.class new file mode 100644 index 0000000..fef4f69 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$DataType.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$PackageType.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$PackageType.class new file mode 100644 index 0000000..dd9608e Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils$PackageType.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils.class new file mode 100644 index 0000000..e820299 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/ReflectionUtils.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/RegionUtils.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/RegionUtils.class new file mode 100644 index 0000000..8b56ecf Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/utils/RegionUtils.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/ConfigManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/ConfigManager.class new file mode 100644 index 0000000..cd45b0d Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/ConfigManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/WorldManager.class b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/WorldManager.class new file mode 100644 index 0000000..c44ca27 Binary files /dev/null and b/PrevailBunkers/out/production/UHC Bunkers/com/prevailpots/bunkers/world/WorldManager.class differ diff --git a/PrevailBunkers/out/production/UHC Bunkers/plugin.yml b/PrevailBunkers/out/production/UHC Bunkers/plugin.yml new file mode 100644 index 0000000..2f72c4b --- /dev/null +++ b/PrevailBunkers/out/production/UHC Bunkers/plugin.yml @@ -0,0 +1,19 @@ +name: PrevailBunkers +main: com.prevailpots.bunkers.Core +author: s3ries +version: 1 +dependencies: [WorldEdit, PermissionsEx] +commands: + setlobbyspawn: + description: 'Sets the lobby spawn.' + aliases: [sls] + usage: '/setlobbyspawn' + team: + description: 'Team command.' + aliases: [f, t] + usage: '/team ' + forcestart: + description: 'Starts game no matter what (Might be unsafe).' + aliases: [fs] + usage: '/forcestart' + removetab: \ No newline at end of file diff --git a/PrevailBunkers/src/META-INF/MANIFEST.MF b/PrevailBunkers/src/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fbba0d5 --- /dev/null +++ b/PrevailBunkers/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: com.prevailpots.bunkers.Core + diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/Core.java b/PrevailBunkers/src/com/prevailpots/bunkers/Core.java new file mode 100644 index 0000000..ec6f216 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/Core.java @@ -0,0 +1,217 @@ +package com.prevailpots.bunkers; + +import java.io.File; +import java.util.Random; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.command.CommandExecutor; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +import com.prevailpots.bunkers.commands.ForceStart; +import com.prevailpots.bunkers.commands.LobbySpawn; +import com.prevailpots.bunkers.commands.TeamCommand; +import com.prevailpots.bunkers.config.ConfigurationService; +import com.prevailpots.bunkers.game.GameHandler; +import com.prevailpots.bunkers.game.managers.BalanceManager; +import com.prevailpots.bunkers.game.managers.ChatManager; +import com.prevailpots.bunkers.game.managers.CooldownManager; +import com.prevailpots.bunkers.game.managers.DTRManager; +import com.prevailpots.bunkers.game.managers.FreezeManager; +import com.prevailpots.bunkers.game.managers.ItemManager; +import com.prevailpots.bunkers.game.managers.PointManager; +import com.prevailpots.bunkers.game.managers.ShopManager; +import com.prevailpots.bunkers.game.managers.TeamJoinManager; +import com.prevailpots.bunkers.game.managers.TeamManager; +import com.prevailpots.bunkers.scoreboard.ScoreboardHandler; +import com.prevailpots.bunkers.world.ConfigManager; +import com.prevailpots.bunkers.world.WorldManager; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; + +public class Core extends JavaPlugin +{ + private static Core instance; + private static Plugin plugin; + private GameHandler gameHandler; + private BalanceManager balanceManager; + private PointManager pointManager; + private TeamManager teamManager; + private FreezeManager freezeManager; + private ScoreboardHandler scoreboardHandler; + private ItemManager itemManager; + private DTRManager dtrManager; + private ChatManager chatManager; + private CooldownManager cooldownManager; + private WorldEditPlugin worldEdit; + public static final Random RANDOM; + public WorldManager wm; + public ConfigManager config; + private TeamJoinManager teamjoinManager; + + static { + RANDOM = new Random(); + } + + public static Core getInstance() { + if (Core.instance == null) { + Core.instance = new Core(); + } + return Core.instance; + } + + public FreezeManager getFreezeManager() { + if (this.freezeManager == null) { + this.freezeManager = new FreezeManager(); + } + return this.freezeManager; + } + + public Core() { + this.wm = new WorldManager(); + this.config = new ConfigManager("WorldRollback", "config"); + } + + public BalanceManager getBalanceManager() { + if (this.balanceManager == null) { + this.balanceManager = new BalanceManager(); + } + return this.balanceManager; + } + + public DTRManager getDTRManager() { + if (this.dtrManager == null) { + this.dtrManager = new DTRManager(); + } + return this.dtrManager; + } + + public ChatManager getChatManager() { + if (this.chatManager == null) { + this.chatManager = new ChatManager(); + } + return this.chatManager; + } + + public ItemManager getItemManager() { + if (this.itemManager == null) { + this.itemManager = new ItemManager(); + } + return this.itemManager; + } + + public PointManager getPointManager() { + if (this.pointManager == null) { + this.pointManager = new PointManager(); + } + return this.pointManager; + } + + public ScoreboardHandler getScoreboardHandler() { + if (this.scoreboardHandler == null) { + this.scoreboardHandler = new ScoreboardHandler(getInstance()); + } + return this.scoreboardHandler; + } + + public GameHandler getGameHandler() { + if (this.gameHandler == null) { + this.gameHandler = new GameHandler(); + } + return this.gameHandler; + } + + public TeamManager getTeamManager() { + if (this.teamManager == null) { + this.teamManager = new TeamManager(); + } + return this.teamManager; + } + + public CooldownManager getCooldownManager() { + if (this.cooldownManager == null) { + this.cooldownManager = new CooldownManager(); + } + return this.cooldownManager; + } + + public void onEnable() { + Core.instance = this; + this.gameHandler = new GameHandler(); + this.balanceManager = new BalanceManager(); + this.itemManager = new ItemManager(); + this.pointManager = new PointManager(); + this.chatManager = new ChatManager(); + this.cooldownManager = new CooldownManager(); + this.freezeManager = new FreezeManager(); + this.scoreboardHandler = new ScoreboardHandler(getInstance()); + this.teamManager = new TeamManager(); + this.teamjoinManager = new TeamJoinManager(); + this.dtrManager = new DTRManager(); + final Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); + if (p instanceof WorldEditPlugin) { + this.worldEdit = (WorldEditPlugin)p; + } + ConfigurationService.init(); + this.registerEvents(); + this.registerCommands(); + Bukkit.getScheduler().runTaskTimer((Plugin)getInstance(), (Runnable)this.getGameHandler(), 20L, 20L); + Bukkit.broadcastMessage("�cThis server is running pBunkers by PrevailPots"); + Core.plugin = (Plugin)this; + if (this.config.getFile() == null) { + this.config.createFile(); + this.config.saveFile(); + } + if (this.config.getFile().getString("world") == null) { + this.config.getFile().set("world", (Object)"world"); + this.config.getFile().set("map", (Object)"_map"); + this.config.saveFile(); + } + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "The world has been refreshed for the next game!"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This network is running p-1-29-Version-BETA"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin is only licensed to prevailpots.com"); + Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin was coded by S3ries, Clipped"); + } + + + public void onDisable() { + for (final Player p : Bukkit.getOnlinePlayers()) { + p.kickPlayer("�aServer reloading, please try again later."); + final World delete = Bukkit.getWorld(this.config.getFile().getString("world")); + final File deleteFolder = delete.getWorldFolder(); + this.wm.deleteWorld(deleteFolder); + Bukkit.getServer().createWorld(new WorldCreator(this.config.getFile().getString("map"))); + final World source = Bukkit.getWorld(this.config.getFile().getString("map")); + final File sourceFolder = source.getWorldFolder(); + final World target = Bukkit.getWorld(this.config.getFile().getString("world")); + final File targetFolder = target.getWorldFolder(); + this.wm.copyWorld(sourceFolder, targetFolder); + } + } + + public WorldEditPlugin getWorldEdit() { + return this.worldEdit; + } + + private void registerEvents() { + final PluginManager pm = Bukkit.getPluginManager(); + pm.registerEvents((Listener)this.getGameHandler(), (Plugin)getInstance()); + pm.registerEvents((Listener)new ShopManager(), (Plugin)getInstance()); + pm.registerEvents((Listener)this.scoreboardHandler, (Plugin)getInstance()); + pm.registerEvents((Listener)this.freezeManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.cooldownManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.chatManager, (Plugin)getInstance()); + pm.registerEvents((Listener)this.teamjoinManager, (Plugin)getInstance()); + } + + private void registerCommands() { + this.getCommand("setlobbyspawn").setExecutor((CommandExecutor)new LobbySpawn()); + this.getCommand("team").setExecutor((CommandExecutor)new TeamCommand()); + this.getCommand("forcestart").setExecutor((CommandExecutor)new ForceStart()); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/commands/ForceStart.java b/PrevailBunkers/src/com/prevailpots/bunkers/commands/ForceStart.java new file mode 100644 index 0000000..630722c --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/commands/ForceStart.java @@ -0,0 +1,36 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; + +import ru.tehkode.permissions.bukkit.*; + +public class ForceStart implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (!PermissionsEx.getUser(player).has("uhcb.forcestart") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) { + player.sendMessage("§cThe game is already running!"); + return true; + } + Core.getInstance().getGameHandler().startGame(); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oForce started the game.§7]", "uhcb.forcestart"); + return true; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/commands/LobbySpawn.java b/PrevailBunkers/src/com/prevailpots/bunkers/commands/LobbySpawn.java new file mode 100644 index 0000000..20434b7 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/commands/LobbySpawn.java @@ -0,0 +1,31 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.utils.*; + +import ru.tehkode.permissions.bukkit.*; + +public class LobbySpawn implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (!PermissionsEx.getUser(player).has("uhcb.setlobbyspawn") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + ConfigurationService.setLobbySpawn(player.getLocation()); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the lobby spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setlobbyspawn"); + return true; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/commands/TeamCommand.java b/PrevailBunkers/src/com/prevailpots/bunkers/commands/TeamCommand.java new file mode 100644 index 0000000..e76a308 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/commands/TeamCommand.java @@ -0,0 +1,144 @@ +package com.prevailpots.bunkers.commands; + +import org.bukkit.command.*; +import org.bukkit.entity.*; +import ru.tehkode.permissions.bukkit.*; + +import org.bukkit.*; +import org.apache.commons.lang3.*; +import org.bukkit.util.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; +import com.sk89q.worldedit.bukkit.selections.*; + +public class TeamCommand implements CommandExecutor +{ + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("§c§lPLAYERS ONLY!"); + return true; + } + final Player player = (Player)sender; + if (args.length == 0) { + player.sendMessage("§cCorrect usage: " + command.getUsage()); + return true; + } + if (args[0].equalsIgnoreCase("setspawn")) { + if (!PermissionsEx.getUser(player).has("uhcb.setteamspawn") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setspawn "); + return true; + } + final String team = args[1]; + if (Team.fromString(team) == null) { + player.sendMessage("§eInvalid team."); + return true; + } + ConfigurationService.setTeamSpawn(player.getLocation(), Team.fromString(team)); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setteamspawn"); + } + else if (args[0].equalsIgnoreCase("info") || args[0].equalsIgnoreCase("stats") || args[0].equalsIgnoreCase("show") || args[0].equalsIgnoreCase("who")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team " + args[0] + " "); + return true; + } + String team = args[1]; + if (Team.fromString(team) == null) { + team = (Core.getInstance().getGameHandler().getPlayers().containsKey(team) ? StringUtils.capitalize(Core.getInstance().getGameHandler().getPlayers().get(Bukkit.getPlayer(team).getName()).toString().toLowerCase()) : "NULLBLOCK"); + } + final Team tem = Team.fromString(team); + if (tem == null) { + player.sendMessage("§eInvalid team."); + return true; + } + String toSend = ""; + toSend = String.valueOf(toSend) + "§7§m------------------------------------\n"; + toSend = String.valueOf(toSend) + "§7[" + tem.getColor().toString() + "Team " + StringUtils.capitalize(tem.toString().toLowerCase()) + "§7]\n"; + toSend = String.valueOf(toSend) + " \n"; + toSend = String.valueOf(toSend) + "§aTeam members" + tem.getColor().toString() + ":\n"; + String[] members; + for (int length = (members = Core.getInstance().getTeamManager().getMembers(tem)).length, i = 0; i < length; ++i) { + final String s = members[i]; + toSend = String.valueOf(toSend) + "§7[" + (Core.getInstance().getGameHandler().getPlayersDeadOrRespawning().contains(Bukkit.getPlayer(s).getName()) ? "§c" : "§a") + s + "§7]" + "\n"; + } + toSend = String.valueOf(toSend) + " \n"; + toSend = String.valueOf(toSend) + "§aTeam info" + tem.getColor().toString() + ":\n"; + toSend = String.valueOf(toSend) + "§aTotal team balance" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamBalanceFormatted(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team kills" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalKills(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team deaths" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalDeaths(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aTotal team points" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamPoints(tem) + "\n"; + toSend = String.valueOf(toSend) + "§aDTR" + tem.getColor().toString() + ": " + Core.getInstance().getDTRManager().getDTRFormatted(tem) + "\n"; + toSend = String.valueOf(toSend) + "§7§m------------------------------------\n"; + player.sendMessage(toSend); + } + else if (args[0].equalsIgnoreCase("setregion")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setregion "); + return true; + } + final String team = args[1]; + if (!PermissionsEx.getUser(player).has("uhcb.setteamregion") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (Team.fromString(team) == null) { + player.sendMessage("§cInvalid team."); + return true; + } + final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player); + if (s2 == null) { + player.sendMessage("§cNo region selected. Select one with WorldEdit."); + return true; + } + final Vector point1 = new Vector(s2.getMinimumPoint().getX(), 0.0, s2.getMinimumPoint().getZ()); + final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ()); + ConfigurationService.setRegions(Team.fromString(team), new Vector[] { point1, point2 }); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team region.§7]", "uhcb.setteamregion"); + } + else if (args[0].equalsIgnoreCase("setcapzone")) { + if (args.length != 2) { + player.sendMessage("§cCorrect usage: /team setcapzone "); + return true; + } + final String team = args[1]; + if (!PermissionsEx.getUser(player).has("uhcb.setteamcapzone") && !player.isOp()) { + player.sendMessage("§c§lNO PERMISSIONS..."); + return true; + } + if (Team.fromString(team) == null) { + player.sendMessage("§cInvalid team."); + return true; + } + final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player); + if (s2 == null) { + player.sendMessage("§cNo region selected. Select one with WorldEdit."); + return true; + } + final Vector point1 = new Vector(s2.getMinimumPoint().getX(), s2.getMinimumPoint().getY(), s2.getMinimumPoint().getZ()); + final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ()); + ConfigurationService.setCapzone(Team.fromString(team), new Vector[] { point1, point2 }); + BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team capzone.§7]", "uhcb.setteamcapzone"); + } + else if (args[0].equalsIgnoreCase("chat") || args[0].equalsIgnoreCase("c")) { + if (args.length != 1) { + player.sendMessage("§cCorrect usage: /team chat"); + return true; + } + if (Core.getInstance().getChatManager().isTeamChat(player)) { + Core.getInstance().getChatManager().setTeamChat(player, false); + player.sendMessage("§aYou are no longer talking in team chat."); + } + else { + Core.getInstance().getChatManager().setTeamChat(player, true); + player.sendMessage("§aYou are now talking in team chat."); + } + } + return true; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/config/ConfigurationService.java b/PrevailBunkers/src/com/prevailpots/bunkers/config/ConfigurationService.java new file mode 100644 index 0000000..f452b50 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/config/ConfigurationService.java @@ -0,0 +1,212 @@ +package com.prevailpots.bunkers.config; + +import org.bukkit.configuration.file.*; +import org.bukkit.util.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.sk89q.worldedit.Vector; + +import java.util.*; +import org.bukkit.entity.*; +import java.io.*; +import org.bukkit.*; + +public class ConfigurationService +{ + private static final File databaseFile; + private static YamlConfiguration database; + private static final File playerDatabaseFile; + private static YamlConfiguration playerDatabase; + public static final String NO_PERMISSIONS = "§c§lNO PERMISSIONS..."; + public static final String PLAYERS_ONLY = "§c§lPLAYERS ONLY!"; + public static final String PERM_SET_LOBBY_SPAWN = "uhcb.setlobbyspawn"; + public static final String PERM_SET_TEAM_SPAWN = "uhcb.setteamspawn"; + public static final String PERM_SET_TEAM_REGION = "uhcb.setteamregion"; + public static final String PERM_SET_TEAM_CAPZONE = "uhcb.setteamcapzone"; + public static final String PERM_FORCE_START = "uhcb.forcestart"; + public static final String SCOREBOARD_TITLE = "§6§lPURGE §c[UHCBunkers]"; + public static final int GAME_MAX_TIME_MINUTES = 35; + public static final int GAME_MAX_PLAYERS = 16; + public static final int GAME_MIN_PLAYERS = 4; + public static final int GAME_MAX_TEAM_SIZE = 4; + public static final int GAME_COUNTDOWN_TIME = 10; + public static final int GAME_START_FREEZE_SECONDS = 5; + public static final int GAME_DEATH_FREEZE_SECONDS = 5; + public static final double GAME_BALANCE_PER_2_SECONDS = 0.55; + public static final int GAME_COBBLESTONE_ORE_RESPAWN_SECONDS = 5; + public static final int TEAM_POINTS_TO_WIN = 125; + public static final int POINTS_LOST_ON_DEATH = 5; + public static final int POINTS_GAINED_ON_KILL = 5; + public static final double IRON_SELL_PRICE = 10.0; + public static final double GOLD_SELL_PRICE = 15.0; + public static final double DIAMOND_SELL_PRICE = 20.0; + private static Vector lobbySpawn; + private static Map teamRegions; + private static Map teamCapzones; + private static HashMap teamSpawns1; + private static HashMap statKills; + private static HashMap statDeaths; + private static Object teamSpawns; + + static { + databaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "database.yml"); + playerDatabaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "playerDatabase.yml"); + ConfigurationService.teamRegions = new HashMap(); + ConfigurationService.teamCapzones = new HashMap(); + ConfigurationService.teamSpawns1 = new HashMap(); + ConfigurationService.statKills = new HashMap(); + ConfigurationService.statDeaths = new HashMap(); + } + + public static void init() { + ConfigurationService.database = YamlConfiguration.loadConfiguration(ConfigurationService.databaseFile); + ConfigurationService.playerDatabase = YamlConfiguration.loadConfiguration(ConfigurationService.playerDatabaseFile); + registerShit(); + } + + private static void registerShit() { + ConfigurationService.lobbySpawn = new Vector(ConfigurationService.database.getDouble("lobbySpawn.x"), ConfigurationService.database.getDouble("lobbySpawn.y"), ConfigurationService.database.getDouble("lobbySpawn.z")); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + ConfigurationService.teamSpawns1.put(t, new Vector(ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".z"))); + } + for (final String s : ConfigurationService.playerDatabase.getKeys(false)) { + if (s == null) { + continue; + } + if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".kills")) { + continue; + } + if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".deaths")) { + continue; + } + ConfigurationService.statKills.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".kills")); + ConfigurationService.statDeaths.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".deaths")); + } + Team[] values2; + for (int length2 = (values2 = Team.values()).length, j = 0; j < length2; ++j) { + final Team t = values2[j]; + ConfigurationService.teamRegions.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".x"), 0.0, ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".z")) }); + ConfigurationService.teamCapzones.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".z")) }); + } + } + + public static Integer getStatKills(final Player p) { + return ConfigurationService.statKills.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statKills.get(p.getUniqueId().toString()) : 0; + } + + public static Vector[] getRegions(final Team t) { + return ConfigurationService.teamRegions.get(t); + } + + public static Vector[] getCapzone(final Team t) { + return ConfigurationService.teamCapzones.get(t); + } + + public static void setRegions(final Team t, final Vector[] vectors) { + if (ConfigurationService.teamRegions.containsKey(t)) { + ConfigurationService.teamRegions.remove(t); + } + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".x", (Object)vectors[0].getX()); + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".y", (Object)vectors[0].getY()); + ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".z", (Object)vectors[0].getZ()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".x", (Object)vectors[1].getX()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".y", (Object)vectors[1].getY()); + ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".z", (Object)vectors[1].getZ()); + saveDatabase(); + ConfigurationService.teamRegions.put(t, vectors); + } + + public static void setCapzone(final Team t, final Vector[] points) { + if (ConfigurationService.teamCapzones.containsKey(t)) { + ConfigurationService.teamCapzones.remove(t); + } + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".x", (Object)points[0].getX()); + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".y", (Object)points[0].getY()); + ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".z", (Object)points[0].getZ()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".x", (Object)points[1].getX()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".y", (Object)points[1].getY()); + ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".z", (Object)points[1].getZ()); + saveDatabase(); + ConfigurationService.teamCapzones.put(t, points); + } + + private static void saveDatabase() { + try { + ConfigurationService.database.save(ConfigurationService.databaseFile); + } + catch (IOException ex) {} + } + + private static void savePlayerDatabase() { + try { + ConfigurationService.playerDatabase.save(ConfigurationService.playerDatabaseFile); + } + catch (IOException ex) {} + } + + public static void setStatKills(final Player p, final int kills) { + if (ConfigurationService.statKills.containsKey(p.getUniqueId().toString())) { + ConfigurationService.statKills.remove(p.getUniqueId().toString()); + } + ConfigurationService.statKills.put(p.getUniqueId().toString(), kills); + ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".kills", (Object)kills); + savePlayerDatabase(); + } + + public static Integer getStatDeaths(final Player p) { + return ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statDeaths.get(p.getUniqueId().toString()) : 0; + } + + public static void setStatDeaths(final Player p, final int deaths) { + if (ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString())) { + ConfigurationService.statDeaths.remove(p.getUniqueId().toString()); + } + ConfigurationService.statDeaths.put(p.getUniqueId().toString(), deaths); + ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".deaths", (Object)deaths); + savePlayerDatabase(); + } + + public static Vector getLobbySpawn() { + return ConfigurationService.lobbySpawn; + } + + public static Vector getTeamSpawn(final Team t) { + return ConfigurationService.teamSpawns1.get(t); + } + + public static void setTeamSpawn(final Location loc, final Team team) { + if (team != null) { + if (ConfigurationService.teamSpawns1.containsKey(team)) { + ConfigurationService.teamSpawns1.remove(team); + } + ConfigurationService.teamSpawns1.put(team, new Vector(loc.getX(), loc.getY(), loc.getZ())); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".x", (Object)loc.getX()); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".y", (Object)loc.getY()); + ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".z", (Object)loc.getZ()); + saveDatabase(); + } + } + + public static void setLobbySpawn(final Location lobbySpawn) { + ConfigurationService.lobbySpawn = new Vector(lobbySpawn.getX(), lobbySpawn.getY(), lobbySpawn.getZ()); + ConfigurationService.database.set("lobbySpawn.x", (Object)lobbySpawn.getX()); + ConfigurationService.database.set("lobbySpawn.y", (Object)lobbySpawn.getY()); + ConfigurationService.database.set("lobbySpawn.z", (Object)lobbySpawn.getZ()); + saveDatabase(); + } + + public static void setCapzone(Team fromString, org.bukkit.util.Vector[] vectors) { + // TODO Auto-generated method stub + + } + + public static void setRegions(Team fromString, org.bukkit.util.Vector[] vectors) { + // TODO Auto-generated method stub + + + } + +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/GameHandler.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/GameHandler.java new file mode 100644 index 0000000..bab537e --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/GameHandler.java @@ -0,0 +1,587 @@ +package com.prevailpots.bunkers.game; +import org.apache.commons.lang3.StringUtils; +import org.bukkit.util.*; +import org.bukkit.event.*; +import org.bukkit.inventory.*; + +import java.util.*; +import org.bukkit.scheduler.*; +import org.bukkit.plugin.*; +import org.bukkit.entity.*; +import java.util.concurrent.*; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.task.*; +import com.prevailpots.bunkers.utils.*; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.bukkit.selections.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; + +public class GameHandler implements Listener, Runnable +{ + public Map players; + private List playersDeadOrRespawning; + private long actualTime; + private GameState gameState; + private int lastTeam; + public long gameStartCountdown; + private ArrayList bloq; + private Object bloq1; + + public GameHandler() { + this.players = new HashMap(); + this.playersDeadOrRespawning = new ArrayList(); + this.actualTime = 0L; + this.gameState = GameState.LOBBY; + this.lastTeam = 0; + this.gameStartCountdown = 10L; + this.bloq = new ArrayList(); + } + + public int teamSize(final Team t) { + int siz = 0; + for (final String s : this.players.keySet()) { + if (this.players.get(s).equals(t)) { + ++siz; + } + } + return siz; + } + + public Team autoAssign() { + ++this.lastTeam; + if (this.lastTeam == 5) { + this.lastTeam = 1; + } + return Team.values()[this.lastTeam - 1]; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void asyncJoin(final AsyncPlayerPreLoginEvent e) { + if (this.gameState != GameState.LOBBY) { + e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game has already started!"); + } + else if (this.players.size() > 16) { + e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game is full."); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void join(final PlayerJoinEvent e) { + e.setJoinMessage(null); + if (this.gameState == GameState.LOBBY) { + e.getPlayer().teleport(new Location(e.getPlayer().getWorld(), ConfigurationService.getLobbySpawn().getX(), ConfigurationService.getLobbySpawn().getY(), ConfigurationService.getLobbySpawn().getZ())); + e.getPlayer().setHealth(20.0); + e.getPlayer().setFoodLevel(20); + e.getPlayer().getInventory().clear(); + e.getPlayer().getInventory().setHelmet((ItemStack)null); + e.getPlayer().getInventory().setChestplate((ItemStack)null); + e.getPlayer().getActivePotionEffects().clear(); + e.getPlayer().getInventory().setLeggings((ItemStack)null); + e.getPlayer().getInventory().setBoots((ItemStack)null); + e.getPlayer().setFireTicks(0); + try { + e.getPlayer().giveExpLevels(-e.getPlayer().getExpToLevel()); + } + catch (Exception ex) {} + players.put(e.getPlayer().getName(), autoAssign()); + Core.getInstance().getItemManager().giveTeamItems(e.getPlayer()); + Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas joined the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)"); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void leave(final PlayerQuitEvent e) { + e.setQuitMessage((String)null); + if (this.gameState == GameState .LOBBY) { + if (this.players.containsKey(e.getPlayer().getName())) { + this.players.remove(e.getPlayer().getName()); + } + if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) { + this.playersDeadOrRespawning.remove(e.getPlayer().getName()); + } + Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas left the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)"); + } + else { + Bukkit.broadcastMessage(String.valueOf(this.players.get(e.getPlayer().getName()).getColor().toString()) + e.getPlayer().getName() + " §7has quit!"); + if (this.players.containsKey(e.getPlayer().getName())) { + this.players.remove(e.getPlayer().getName()); + } + if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) { + this.playersDeadOrRespawning.remove(e.getPlayer().getName()); + } + Core.getInstance().getPointManager().removePoints(e.getPlayer(), 5); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void kill(final PlayerDeathEvent e) { + e.setDeathMessage(null); + if (this.gameState != GameState.GAME) { + return; + } + new ItemDropTask(new ArrayList<>(e.getDrops()), e.getEntity().getLocation().clone()).execute(); + e.setDroppedExp(0); + e.getDrops().clear(); + e.getEntity().setHealth(20.0); + e.getEntity().setFoodLevel(20); + e.getEntity().setFireTicks(0); + final Team t = this.players.get(e.getEntity().getName()); + if (t != null) { + if (Core.getInstance().getDTRManager().isRaidable(t)) { + e.getEntity().kickPlayer("§aYour team went §4RAIDABLE§a. §aThanks for playing."); + return; + } + e.getEntity().teleport(new Location(e.getEntity().getWorld(), ConfigurationService.getTeamSpawn(t).getX(), ConfigurationService.getTeamSpawn(t).getY(), ConfigurationService.getTeamSpawn(t).getZ())); + } + Core.getInstance().getTeamManager().setDeaths(e.getEntity(), Core.getInstance().getTeamManager().getDeaths(e.getEntity()) + 1); + ConfigurationService.setStatDeaths(e.getEntity(), ConfigurationService.getStatDeaths(e.getEntity()) + 1); + this.playersDeadOrRespawning.add(e.getEntity().getName()); + Core.getInstance().getDTRManager().removeDTR(this.players.get(e.getEntity().getName()), 1.0); + Core.getInstance().getPointManager().removePoints(e.getEntity(), 5); + new BukkitRunnable() { + public void run() { + if (GameHandler.this.playersDeadOrRespawning.contains(e.getEntity().getName())) { + GameHandler.this.playersDeadOrRespawning.remove(e.getEntity().getName()); + } + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + Core.getInstance().getFreezeManager().addFrozen(e.getEntity(), 5, new PlayerItemTask(e.getEntity())); + if (e.getEntity().getKiller() == null || !(e.getEntity().getKiller() instanceof Player)) { + e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §edied" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints."); + return; + } + if (e.getEntity().getKiller() != null) { + Core.getInstance().getTeamManager().setKills(e.getEntity(), Core.getInstance().getTeamManager().getKills(e.getEntity().getKiller()) + 1); + ConfigurationService.setStatKills(e.getEntity().getKiller(), ConfigurationService.getStatKills(e.getEntity().getKiller()) + 1); + } + Core.getInstance().getPointManager().addPoints(e.getEntity().getKiller(), 5); + if (e.getEntity().getKiller() != null) { + e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §ewas slain by " + this.players.get(e.getEntity().getKiller().getName()).getColor().toString() + e.getEntity().getKiller().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getKiller().getName())) + "§7]" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints."); + } + } + + public String getTime() { + final int minutes = (int)(this.actualTime % 3600L / 60L); + final int seconds = (int)(this.actualTime % 60L); + return (this.gameState == GameState.LOBBY) ? "Pre Game" : ((this.gameState == GameState.ENDING) ? "Ending" : String.valueOf(String.valueOf(minutes) + "m " + seconds + "s")); + } + + public Map getPlayers() { + return this.players; + } + + public List getPlayersDeadOrRespawning() { + return this.playersDeadOrRespawning; + } + + public void endGame(final Team winningTeam) { + if (winningTeam == null) { + this.resetGame(); + return; + } + Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aCongratiulations to the " + winningTeam.getColor().toString() + winningTeam.name() + " §ateam for winning!"); + new BukkitRunnable() { + public void run() { + Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aThanks for playing, you will be kicked in §e10 §aseconds."); + } + }.runTaskLater((Plugin)Core.getInstance(), 60L); + new BukkitRunnable() { + public void run() { + GameHandler.this.resetGame(); + } + }.runTaskLater((Plugin)Core.getInstance(), 200L); + } + + private void resetGame() { + this.gameState = GameState.LOBBY; + for (final Player p : Bukkit.getOnlinePlayers()) { + p.kickPlayer("§aThank you for playing!"); + } + Bukkit.getServer().reload(); + } + + public void startGame() { + this.gameState = GameState.GAME; + for (final String s : this.players.keySet()) { + final Player p = Bukkit.getPlayer(s); + if (p != null) { + p.setHealth(20.0); + p.setFoodLevel(20); + p.getInventory().clear(); + p.getInventory().setHelmet((ItemStack)null); + p.setFireTicks(0); + p.getInventory().setChestplate((ItemStack)null); + p.getInventory().setLeggings((ItemStack)null); + p.getActivePotionEffects().clear(); + try { + p.giveExpLevels(-p.getExpToLevel()); + } + catch (Exception ex) {} + p.getInventory().setBoots((ItemStack)null); + p.closeInventory(); + p.teleport(new Location(p.getWorld(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getX(), ConfigurationService.getTeamSpawn(this.players.get(s)).getX() + 6.0), ConfigurationService.getTeamSpawn(this.players.get(s)).getY(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getZ(), ConfigurationService.getTeamSpawn(this.players.get(s)).getZ() + 6.0))); + Core.getInstance().getFreezeManager().addFrozen(p, 5, new PlayerItemTask(p)); + } + } + } + + @EventHandler + public void onAttack(final EntityDamageByEntityEvent e) { + if (this.gameState == GameState.LOBBY) { + if (e.getDamager() != null && e.getDamager() instanceof Player) { + e.setCancelled(true); + } + if (e.getEntity() != null && e.getEntity() instanceof Player) { + e.setCancelled(true); + } + } + + if(this.gameState == GameState.GAME) { + if(e.getDamager() instanceof Player && e.getEntity() instanceof Player) { + Player damager = (Player)e.getDamager(); + Player damaged = (Player)e.getEntity(); + + if(players.get(damager.getName()) == players.get(damaged.getName())) { + e.setCancelled(true); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockBreak(final BlockBreakEvent event) { + final Player player = event.getPlayer(); + if (player.getGameMode() != GameMode.CREATIVE && player.hasPermission("bunkers.mine")) { + final ItemStack stack = player.getItemInHand(); + if (stack != null && stack.getType() != Material.AIR && !stack.containsEnchantment(Enchantment.SILK_TOUCH)) { + final Block block = event.getBlock(); + Material dropType = null; + switch (block.getType()) { + case IRON_ORE: { + dropType = Material.IRON_INGOT; + break; + } + case GOLD_ORE: { + dropType = Material.GOLD_INGOT; + break; + } + case DIAMOND_ORE: { + dropType = Material.DIAMOND; + break; + } + default: { + return; + } + } + } + } + } + + + + + @EventHandler + public void ores(final BlockBreakEvent e) { + if (e.isCancelled()) { + return; + } + if (e.getBlock().getType().equals((Object)Material.GOLD_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.COBBLESTONE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.GOLD_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.GOLD_INGOT)); + e.getPlayer().giveExp(2); + } + else if (e.getBlock().getType().equals((Object)Material.IRON_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.IRON_ORE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.IRON_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.IRON_INGOT)); + e.getPlayer().giveExp(2); + } + else if (e.getBlock().getType().equals((Object)Material.DIAMOND_ORE) &&!e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) { + e.setCancelled(true); + e.getBlock().setType(Material.GOLD_ORE); + final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector(); + if (!this.bloq.contains(v)) { + this.bloq.addAll((Collection) v); + } + new BukkitRunnable() { + public void run() { + e.getBlock().setType(Material.DIAMOND_ORE); + if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) { + GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector()); + } + ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0); + } + }.runTaskLater((Plugin)Core.getInstance(), 100L); + e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.DIAMOND)); + e.getPlayer().giveExp(2); + } + } + + @EventHandler + public void hunger(final FoodLevelChangeEvent e) { + if (this.gameState == GameState.LOBBY) { + e.setCancelled(true); + e.setFoodLevel(20); + } + } + + @EventHandler + public void move(final PlayerMoveEvent e) { + if (this.gameState == GameState.GAME) { + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getPlayer().getWorld(), t); + if (sel.contains(e.getTo()) && !sel.contains(e.getFrom())) { + //e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e."); + e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + if (!sel.contains(e.getTo()) && sel.contains(e.getFrom())) { + e.getPlayer().sendMessage("§eNow leaving the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void place(final BlockPlaceEvent e) { + if (this.gameState != GameState.GAME) { + if (e.getPlayer() != null) { + e.setCancelled(true); + } + } + else { + final Player placer = e.getPlayer(); + final Team team = this.players.get(placer.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), team); + if (!sel.contains(e.getBlockPlaced().getLocation())) { + if(!Core.getInstance().getDTRManager().isRaidable(team)) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), t); + if (sels.contains(e.getBlockPlaced().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot place this in the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot place this here!"); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void breaak(final BlockBreakEvent e) { + if (e.getBlock() != null && this.bloq.contains(e.getBlock().getLocation().toVector())) { + e.setCancelled(true); + return; + } + if (this.gameState != GameState.GAME) { + if (e.getPlayer() != null) { + e.setCancelled(true); + } + } + else { + final Player breaker = e.getPlayer(); + final Team team = this.players.get(breaker.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), team); + if (!sel.contains(e.getBlock().getLocation())) { + if(!Core.getInstance().getDTRManager().isRaidable(team)) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), t); + if (sels.contains(e.getBlock().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot break this in the territory of " + t.getColor().toString() + t.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot break this here!"); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void bloks(final PlayerInteractEvent e) { + if (this.gameState == GameState.GAME) { + final Team t = this.players.get(e.getPlayer().getName()); + if (t != null) { + if (Core.getInstance().getDTRManager().isRaidable(t)) { + e.setCancelled(true); + } + if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) { + return; + } + if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && ItemUtil.isInteractable(e.getClickedBlock().getType())) { + final Player abuser = e.getPlayer(); + final Team team = this.players.get(abuser.getName()); + if (team == null) { + return; + } + final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), team); + if (!Core.getInstance().getDTRManager().isRaidable(team) && !sel.contains(e.getClickedBlock().getLocation())) { + e.setCancelled(true); + Team[] values; + for (int length = (values = Team.values()).length, i = 0; i < length; ++i) { + final Team t1 = values[i]; + final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), t1); + if (sels.contains(e.getClickedBlock().getLocation())) { + e.getPlayer().sendMessage("§eYou cannot use this in the territory of " + t1.getColor().toString() + t1.name() + "§e."); + return; + } + } + e.getPlayer().sendMessage("§eYou cannot use this here!"); + } + } + } + } + } + + public void run() { + this.update(); + } + + public GameState getGameState() { + return this.gameState; + } + + private Team getBestTeamToWin() { + final double[] points = new double[4]; + int i = 0; + Team[] values; + for (int length = (values = Team.values()).length, j = 0; j < length; ++j) { + final Team t = values[j]; + points[i] = Core.getInstance().getTeamManager().getTeamPoints(t); + ++i; + } + return Team.values()[MathUtils.indexOfMax(points)]; + } + + private void checkEndGame() { + if (this.players.size() == 0) { + this.endGame(null); + return; + } + final int minutes = (int)(this.actualTime % 3600L / 60L); + if (minutes >= 35) { + this.endGame(this.getBestTeamToWin()); + return; + } + final ArrayList raidable = new ArrayList(); + Team[] values; + for (int length = (values = Team.values()).length, j = 0; j < length; ++j) { + final Team t = values[j]; + if (Core.getInstance().getDTRManager().isRaidable(t)) { + raidable.add(t); + } + } + if (raidable.size() != 0 && raidable.size() >= 3) { + Team[] values2; + for (int length2 = (values2 = Team.values()).length, k = 0; k < length2; ++k) { + final Team t = values2[k]; + if (!raidable.contains(t)) { + this.endGame(t); + return; + } + } + } + final ArrayList tied = new ArrayList(); + Team[] values3; + for (int length3 = (values3 = Team.values()).length, l = 0; l < length3; ++l) { + final Team t2 = values3[l]; + if (Core.getInstance().getTeamManager().getTeamPoints(t2) >= 125.0) { + tied.add(t2); + } + } + if (tied.size() != 0) { + if (tied.size() == 1) { + this.endGame(tied.get(0)); + } + else { + final double[] leastDeaths = new double[tied.size()]; + int i = 0; + for (final Team t3 : tied) { + leastDeaths[i] = Core.getInstance().getTeamManager().getTotalDeaths(t3); + ++i; + } + Team winningTeam = tied.get(MathUtils.indexOfMin(leastDeaths)); + if (winningTeam == null) { + winningTeam = tied.get(Core.RANDOM.nextInt(tied.size())); + } + this.endGame(winningTeam); + } + } + } + + private void update() { + if (this.gameState == GameState.LOBBY && this.players.size() >= 4) { + if (this.gameStartCountdown <= 0L) { + this.startGame(); + } + else { + --this.gameStartCountdown; + } + } + if (this.gameState == GameState.GAME) { + this.checkEndGame(); + ++this.actualTime; + if (this.actualTime % 2L == 0L) { + for (final String s : this.players.keySet()) { + if (!this.playersDeadOrRespawning.contains(s)) { + final Player p = Bukkit.getPlayer(s); + if (p == null) { + continue; + } + Core.getInstance().getBalanceManager().addBalance(p, 0.55); + } + } + } + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/GameState.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/GameState.java new file mode 100644 index 0000000..8885c2e --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/GameState.java @@ -0,0 +1,11 @@ +package com.prevailpots.bunkers.game; + +public enum GameState +{ + LOBBY("LOBBY", 0), + GAME("GAME", 1), + ENDING("ENDING", 2); + + private GameState(final String s, final int n) { + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/Team.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/Team.java new file mode 100644 index 0000000..fbbde49 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/Team.java @@ -0,0 +1,32 @@ +package com.prevailpots.bunkers.game; + +import org.bukkit.*; + +public enum Team +{ + RED("RED", 0, ChatColor.RED), + GREEN("GREEN", 1, ChatColor.GREEN), + BLUE("BLUE", 2, ChatColor.BLUE), + YELLOW("YELLOW", 3, ChatColor.YELLOW); + + private ChatColor color; + + private Team(final String s, final int n, final ChatColor color) { + this.color = color; + } + + public static Team fromString(final String s) { + Team[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final Team t = values[i]; + if (t.toString().equalsIgnoreCase(s)) { + return t; + } + } + return null; + } + + public ChatColor getColor() { + return this.color; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/BalanceManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/BalanceManager.java new file mode 100644 index 0000000..296a501 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/BalanceManager.java @@ -0,0 +1,58 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.utils.*; + +public class BalanceManager +{ + public HashMap balances; + public static final String BALANCE_SYMBOL = "$"; + public static final int STARTING_BALANCE = 100; + + public BalanceManager() { + this.balances = new HashMap(); + } + + public double getBalance(final Player p) { + return this.balances.containsKey(p.getName()) ? MathUtils.round(this.balances.get(p.getName()), 2) : 100; + } + + public boolean hasEnoughMoney(final Player p, final double price) { + return this.getBalance(p) >= price; + } + + public String getBalanceFormatted(final Player p) { + return "$" + this.getBalance(p); + } + + public void addBalance(final Player p, final double bal) { + final double oldBal = this.getBalance(p); + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(oldBal + bal, 2)); + } + + public void removeBalance(final Player p, final double bal) { + final double oldBal = this.getBalance(p); + if (oldBal - bal < 0.0) { + return; + } + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(oldBal - bal, 2)); + } + + public void setBalance(final Player p, final double bal) { + if (bal < 0.0) { + return; + } + if (this.balances.containsKey(p.getName())) { + this.balances.remove(p.getName()); + } + this.balances.put(p.getName(), MathUtils.round(bal, 2)); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CapzoneManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CapzoneManager.java new file mode 100644 index 0000000..7c33a62 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CapzoneManager.java @@ -0,0 +1,5 @@ +package com.prevailpots.bunkers.game.managers; + +public class CapzoneManager +{ +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ChatManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ChatManager.java new file mode 100644 index 0000000..0019ecb --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ChatManager.java @@ -0,0 +1,54 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.entity.*; +import org.bukkit.event.player.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; + +import org.bukkit.*; + +import ru.tehkode.permissions.bukkit.*; +import java.util.*; +import org.bukkit.event.*; + +public class ChatManager implements Listener +{ + private ArrayList teamChat; + + public ChatManager() { + this.teamChat = new ArrayList(); + } + + public boolean isTeamChat(final Player p) { + return this.teamChat.contains(p.getName()); + } + + public void setTeamChat(final Player p, final boolean tc) { + if (this.teamChat.contains(p.getName())) { + this.teamChat.remove(p.getName()); + } + if (tc) { + this.teamChat.add(p.getName()); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void chat(final AsyncPlayerChatEvent e) { + if (this.isTeamChat(e.getPlayer())) { + e.setCancelled(true); + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + final Player p = Bukkit.getPlayer(s); + if (p != null) { + final Team t = Core.getInstance().getGameHandler().getPlayers().get(s); + if (t == null || !t.equals(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()))) { + continue; + } + p.sendMessage(String.valueOf(t.getColor().toString()) + "[TEAM] " + t.toString() + ": " + e.getPlayer().getName() + " - §7" + e.getMessage()); + } + } + return; + } + e.setFormat(String.valueOf(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).getColor().toString()) + "[" + Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).toString() + "] " + "§r" + PermissionsEx.getUser(e.getPlayer()).getPrefix() + ((PermissionsEx.getUser(e.getPlayer()).getPrefix() == "") ? "" : " ") + e.getPlayer().getDisplayName() + "§7: " + "§r" + e.getMessage()); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CooldownManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CooldownManager.java new file mode 100644 index 0000000..39f3c09 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/CooldownManager.java @@ -0,0 +1,200 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; + +import org.bukkit.plugin.*; +import org.bukkit.event.entity.*; +import org.bukkit.entity.*; +import org.bukkit.event.*; +import org.bukkit.event.player.*; +import org.bukkit.*; + +public class CooldownManager implements Listener +{ + private Map enderPearl; + private Map gapple; + + public CooldownManager() { + this.enderPearl = new HashMap(); + this.gapple = new HashMap(); + } + + public boolean hasCooldown(final Player p, final Type cooldownType) { + return (cooldownType == Type.GAPPLE) ? this.gapple.containsKey(p.getName()) : this.enderPearl.containsKey(p.getName()); + } + + public long getCooldown(final Player p, final Type cooldownType) { + switch (cooldownType) { + case GAPPLE: { + return this.gapple.containsKey(p.getName()) ? this.gapple.get(p.getName()) : 0L; + } + case EPEARL: { + return this.enderPearl.containsKey(p.getName()) ? this.enderPearl.get(p.getName()) : 0L; + } + default: { + return 0L; + } + } + } + + public String getCooldownFormatted(final Player p, final Type cooldownType) { + return String.valueOf(this.getCooldown(p, cooldownType)) + "s"; + } + + private void deincrementCooldown(final Player p, final Type cooldownType) { + switch (cooldownType) { + case GAPPLE: { + long old = 0L; + if (this.gapple.get(p.getName()) != null) { + old = this.gapple.get(p.getName()); + } + if (old != 0L) { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + } + this.gapple.put(p.getName(), old - 1L); + break; + } + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + break; + } + break; + } + case EPEARL: { + long old = 0L; + if (this.enderPearl.get(p.getName()) != null) { + old = this.enderPearl.get(p.getName()); + } + if (old != 0L) { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + } + this.enderPearl.put(p.getName(), old - 1L); + break; + } + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + break; + } + break; + } + } + } + + public void putCooldown(final Player p, final Type cooldownType, long cooldown) { + ++cooldown; + switch (cooldownType) { + case GAPPLE: { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + } + this.gapple.put(p.getName(), cooldown); + new BukkitRunnable() { + public void run() { + if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) { + CooldownManager.this.removeCooldown(p, cooldownType); + p.sendMessage("§aYou can now gapple."); + this.cancel(); + } + CooldownManager.this.deincrementCooldown(p, cooldownType); + } + }.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L); + break; + } + case EPEARL: { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + } + this.enderPearl.put(p.getName(), cooldown); + new BukkitRunnable() { + public void run() { + if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) { + CooldownManager.this.removeCooldown(p, cooldownType); + p.sendMessage("§aYou can now enderpearl."); + this.cancel(); + } + CooldownManager.this.deincrementCooldown(p, cooldownType); + } + }.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L); + break; + } + } + } + + public void removeCooldown(final Player p, final Type t) { + switch (t) { + case GAPPLE: { + if (this.gapple.containsKey(p.getName())) { + this.gapple.remove(p.getName()); + break; + } + break; + } + case EPEARL: { + if (this.enderPearl.containsKey(p.getName())) { + this.enderPearl.remove(p.getName()); + break; + } + break; + } + } + } + + @EventHandler + public void pearl(final ProjectileLaunchEvent e) { + if (e.getEntity() == null) { + return; + } + if (e.getEntity().getShooter() == null) { + return; + } + if (!(e.getEntity().getShooter() instanceof Player)) { + return; + } + if (!(e.getEntity() instanceof EnderPearl)) { + return; + } + if (this.hasCooldown((Player)e.getEntity().getShooter(), Type.EPEARL)) { + e.setCancelled(true); + ((Player)e.getEntity().getShooter()).sendMessage("§eYou are still on §9Enderpearl§e cooldown for another §9" + this.getCooldownFormatted((Player)e.getEntity().getShooter(), Type.EPEARL)); + return; + } + if (e.getEntity() instanceof EnderPearl && !e.isCancelled()) { + this.putCooldown((Player)e.getEntity().getShooter(), Type.EPEARL, 16L); + } + } + + @EventHandler + public void consume(final PlayerItemConsumeEvent e) { + if (e.getItem() == null) { + return; + } + if (e.getItem().getType() == null) { + return; + } + if (e.getItem().getType() != Material.GOLDEN_APPLE) { + return; + } + if (this.hasCooldown(e.getPlayer(), Type.GAPPLE)) { + e.setCancelled(true); + e.getPlayer().sendMessage("§eYou are still on §6Apple§e cooldown for another §9" + this.getCooldownFormatted(e.getPlayer(), Type.GAPPLE)); + return; + } + if (!e.isCancelled()) { + this.putCooldown(e.getPlayer(), Type.GAPPLE, 4L); + } + } + + public enum Type + { + GAPPLE("GAPPLE", 0), + EPEARL("EPEARL", 1); + + private Type(final String s, final int n) { + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/DTRManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/DTRManager.java new file mode 100644 index 0000000..2b0744a --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/DTRManager.java @@ -0,0 +1,72 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.game.*; + +public class DTRManager +{ + public HashMap dtr; + public static final double STARTING_DTR = 5.0; + + public DTRManager() { + this.dtr = new HashMap(); + } + + public double getDTR(final Team p) { + return this.dtr.containsKey(p) ? this.dtr.get(p) : 5.0; + } + + public String getDTRFormatted(final Team t) { + final double dtr = this.getDTR(t); + if (dtr <= 0.0) { + return "§4§lRAIDABLE"; + } + if (dtr >= 5.0) { + return "§a§l" + dtr; + } + if (dtr <= 2.0 && dtr > 1.0) { + return "§e§l" + dtr; + } + if (dtr <= 1.0) { + return "§c§l" + dtr; + } + return "§2§l" + dtr; + } + + public boolean isRaidable(final Team t) { + return this.getDTR(t) <= 0.0; + } + + public void addDTR(final Team p, final double dtr) { + final double oldBal = this.getDTR(p); + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, oldBal + dtr); + } + + public void removeDTR(final Team p, final double dtr) { + final double oldBal = this.getDTR(p); + if (oldBal - dtr < 0.0) { + return; + } + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, oldBal - dtr); + } + + + + public void setDTR(final Team p, final double dtr) { + if (dtr < 0.0) { + return; + } + if (this.dtr.containsKey(p)) { + this.dtr.remove(p); + } + this.dtr.put(p, dtr); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/FreezeManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/FreezeManager.java new file mode 100644 index 0000000..583e986 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/FreezeManager.java @@ -0,0 +1,159 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.task.*; + +import org.bukkit.plugin.*; +import org.bukkit.event.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; + +public class FreezeManager implements Listener +{ + private ArrayList frozen; + + public FreezeManager() { + this.frozen = new ArrayList(); + } + + private boolean isFrozen(final Player p) { + return this.frozen.contains(p.getName()); + } + + public void addFrozen(final Player p, final int seconds) { + if (p == null) { + return; + } + if (this.frozen.contains(p.getName())) { + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + return; + } + this.frozen.add(p.getName()); + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + } + + public void addFrozen(final Player p, final int seconds, final DynamicTask taskLater) { + if (p == null) { + return; + } + if (this.frozen.contains(p.getName())) { + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + taskLater.execute(); + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + return; + } + this.frozen.add(p.getName()); + new BukkitRunnable() { + public void run() { + if (FreezeManager.this.frozen.contains(p.getName())) { + FreezeManager.this.frozen.remove(p.getName()); + if (p.getInventory() != null) { + p.getInventory().clear(); + } + taskLater.execute(); + } + } + }.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds)); + } + + + + @EventHandler + public void onAttack(final EntityDamageByEntityEvent e) { + if (e.getDamager() != null && e.getDamager() instanceof Player && this.isFrozen((Player)e.getDamager())) { + e.setCancelled(true); + } + if (e.getEntity() != null && e.getEntity() instanceof Player && this.isFrozen((Player)e.getEntity())) { + e.setCancelled(true); + } + } + + @EventHandler + public void dmg(final EntityDamageEvent e) { + if (!(e.getEntity() instanceof Player)) { + return; + } + if (this.isFrozen((Player)e.getEntity())) { + e.setCancelled(true); + } + } + + @EventHandler + public void hunger(final FoodLevelChangeEvent e) { + e.setCancelled(true); + e.setFoodLevel(20); + } + + @EventHandler + public void place(final BlockPlaceEvent e) { + if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void kick(final PlayerKickEvent e) { + if (e.getReason().toLowerCase().contains("flying is not enabled")) { + e.setCancelled(true); + } + } + + @EventHandler + public void throwProjEvent(final ProjectileLaunchEvent e) { + if (e.getEntity().getShooter() instanceof Player && this.isFrozen((Player)e.getEntity().getShooter())) { + e.setCancelled(true); + } + } + + @EventHandler + public void cons(final PlayerItemConsumeEvent e) { + if (this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void drop(final PlayerDropItemEvent e) { + if (this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } + + @EventHandler + public void breaak(final BlockBreakEvent e) { + if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) { + e.setCancelled(true); + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ItemManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ItemManager.java new file mode 100644 index 0000000..57f4f27 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ItemManager.java @@ -0,0 +1,65 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.inventory.*; +import org.bukkit.inventory.meta.ItemMeta; + +import com.prevailpots.bunkers.utils.*; + +import org.bukkit.*; +import org.bukkit.entity.*; +import org.bukkit.material.Wool; + +import java.util.*; + +public class ItemManager +{ + private ArrayList starterItems; + + public ItemManager() { + (this.starterItems = new ArrayList()).add(ItemUtil.getItem("§fStarter Sword", Material.STONE_SWORD, 1, "§7Just an ordinary §8Stone Sword§7.")); + this.starterItems.add(ItemUtil.getItem("§fStarter Pick", Material.IRON_PICKAXE, 1, "§7Just an ordinary §fIron Pickaxe§7.")); + } + + public void giveStarterItems(final Player p) { + for (final ItemStack i : this.starterItems) { + p.getInventory().addItem(new ItemStack[] { i }); + } + } + + public void giveTeamItems(Player p) { + ItemStack blue, green, red, leave, yellow; + blue = new Wool(DyeColor.BLUE).toItemStack(1); + green = new Wool(DyeColor.GREEN).toItemStack(1); + red = new Wool(DyeColor.RED).toItemStack(1); + yellow = new Wool(DyeColor.YELLOW).toItemStack(1); + leave = new Wool(DyeColor.WHITE).toItemStack(1); + + //blue + ItemMeta imMeta = blue.getItemMeta(); + imMeta.setDisplayName("§bRight Click to join Blue Team!"); + blue.setItemMeta(imMeta); + //red + ItemMeta imMeta1 = red.getItemMeta(); + imMeta1.setDisplayName("§CRight Click to join Red Team!"); + red.setItemMeta(imMeta1); + //green + ItemMeta imMeta2 = green.getItemMeta(); + imMeta2.setDisplayName("§ARight Click to join GREEN Team!"); + green.setItemMeta(imMeta2); + //yellow + ItemMeta imMeta3 = yellow.getItemMeta(); + imMeta3.setDisplayName("§ERight Click to join Yellow Team!"); + yellow.setItemMeta(imMeta3); + //leave + ItemMeta imMeta4 = leave.getItemMeta(); + imMeta4.setDisplayName("§EClick here to leave the bunkers game!"); + leave.setItemMeta(imMeta4); + + p.getInventory().setItem(0, blue); // 4, 5, 6, 7 + p.getInventory().setItem(1, green); // 4, 5, 6, 7 + p.getInventory().setItem(2, red); // 4, 5, 6, 7 + p.getInventory().setItem(3, yellow); // 4, 5, 6, 7 + p.getInventory().setItem(8, leave); // 4, 5, 6, 7 + p.updateInventory(); + } +} \ No newline at end of file diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/PointManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/PointManager.java new file mode 100644 index 0000000..76a0a9b --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/PointManager.java @@ -0,0 +1,47 @@ +package com.prevailpots.bunkers.game.managers; + +import java.util.*; +import org.bukkit.entity.*; + +public class PointManager +{ + public HashMap points; + public static final int STARTING_POINTS = 5; + + public PointManager() { + this.points = new HashMap(); + } + + public int getPoints(final Player p) { + return this.points.containsKey(p.getName()) ? this.points.get(p.getName()) : 5; + } + + public void addPoints(final Player p, final int points) { + final int oldBal = this.getPoints(p); + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), oldBal + points); + } + + public void removePoints(final Player p, final int points) { + final int oldBal = this.getPoints(p); + if (oldBal - points < 0) { + return; + } + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), oldBal - points); + } + + public void setPoints(final Player p, final int points) { + if (points < 0) { + return; + } + if (this.points.containsKey(p.getName())) { + this.points.remove(p.getName()); + } + this.points.put(p.getName(), points); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ShopManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ShopManager.java new file mode 100644 index 0000000..0f5e056 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/ShopManager.java @@ -0,0 +1,289 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.potion.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.utils.*; + +import org.bukkit.enchantments.*; +import org.bukkit.*; +import org.bukkit.inventory.*; +import org.bukkit.inventory.meta.*; +import org.bukkit.entity.*; + +import java.util.*; + +import org.bukkit.event.inventory.*; +import org.bukkit.event.player.*; +import org.bukkit.event.block.*; +import org.bukkit.event.*; + +public class ShopManager implements Listener +{ + private List shopItems; + private Inventory shopGui; + + public ShopManager() { + (this.shopItems = new ArrayList()).add(new ShopItem(ItemUtil.getItem("§fDiamond Sword", Material.DIAMOND_SWORD, 1, (String[])null), 100.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Helmet", Material.DIAMOND_HELMET, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Chestplate", Material.DIAMOND_CHESTPLATE, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Leggings", Material.DIAMOND_LEGGINGS, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Boots", Material.DIAMOND_BOOTS, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bSharpness 1", Material.DIAMOND_SWORD, 1, Enchantment.DAMAGE_ALL, 1, "§bApplies sharpness 1 to your sword."), 150.0, ShopItemType.ENCHANT, Enchantment.DAMAGE_ALL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fFishing Rod", Material.FISHING_ROD, 1, (String[])null), 75.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fHealth Pot", PotionType.INSTANT_HEAL, true, 2, false, 1, (String[])null), 10.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSpeed Pot", PotionType.SPEED, false, 2, true, 1, (String[])null), 75.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fInvis Pot", PotionType.INVISIBILITY, false, 1, false, 1, (String[])null), 300.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fEnder Pearl", Material.ENDER_PEARL, 3, (String[])null), 125.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSlowness Pot", PotionType.SLOWNESS, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fPoison Pot", PotionType.POISON, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fBow", Material.BOW, 1, (String[])null), 150.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fArrow", Material.ARROW, 16, (String[])null), 50.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fGapple", Material.GOLDEN_APPLE, 1, (String[])null), 25.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getItem("§fSteak", Material.COOKED_BEEF, 16, (String[])null), 25.0, ShopItemType.ITEM)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Helmet", Material.DIAMOND_HELMET, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your helmet."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Chestplate", Material.DIAMOND_CHESTPLATE, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your chestplate."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Leggings", Material.DIAMOND_LEGGINGS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your leggings."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Boots", Material.DIAMOND_BOOTS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your boots."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1)); + this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bPower 1", Material.BOW, 1, Enchantment.ARROW_DAMAGE, 1, "§bApplies power 1 to your bow."), 150.0, ShopItemType.ENCHANT, Enchantment.ARROW_DAMAGE, 1)); + this.shopGui = Bukkit.createInventory((InventoryHolder)null, 54, "§aShop"); + int index = 10; + for (final ShopItem x : this.shopItems) { + final ItemStack ix = x.getItem(); + final ItemMeta meta = ix.getItemMeta(); + final ArrayList lore = new ArrayList(); + if (meta.getLore() != null) { + lore.addAll(meta.getLore()); + } + if (ix.getItemMeta().hasLore()) { + lore.add(" "); + } + lore.add("§7Price: $" + x.getPrice()); + meta.setLore((List)lore); + ix.setItemMeta(meta); + this.shopGui.setItem(index, ix); + if (index == 16 || index == 25 || index == 34 || index == 43 || index == 52 || index == 61 || index == 70 || index == 79 || index == 87) { + index += 2; + } + ++index; + } + this.shopGui.setItem(49, ItemUtil.getItem("§bSell items", Material.GOLD_BLOCK, 1, "§7Sells all gold, iron and diamonds", "§7in your inventory.")); + } + + private void buyItem(final Player p, final ItemStack i) { + if (this.getActualItem(i) == null) { + return; + } + if (Core.getInstance().getBalanceManager().hasEnoughMoney(p, this.getPrice(i))) { + if (this.getActualItem(i).getType().equals(ShopItemType.ITEM)) { + final ItemStack toadd = i.clone(); + final ItemMeta nigmeta = toadd.getItemMeta(); + nigmeta.setDisplayName(new ItemStack(i.getType()).getItemMeta().getDisplayName()); + nigmeta.setLore((List)Arrays.asList("§7Just a regular " + this.getActualItem(i).getItem().getItemMeta().getDisplayName())); + toadd.setItemMeta(nigmeta); + p.getInventory().addItem(new ItemStack[] { toadd }); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + } + else { + ItemStack[] contents; + for (int length = (contents = p.getInventory().getContents()).length, j = 0; j < length; ++j) { + final ItemStack x = contents[j]; + if (x != null) { + if (x.getType() != null) { + if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) { + x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + return; + } + } + } + } + ItemStack[] armorContents; + for (int length2 = (armorContents = p.getInventory().getArmorContents()).length, k = 0; k < length2; ++k) { + final ItemStack x = armorContents[k]; + if (x != null) { + if (x.getType() != null) { + if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) { + x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel); + p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a."); + Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i)); + return; + } + } + } + } + } + } + else { + p.sendMessage("§cYou don't have enough money!"); + } + } + + public void sellItems(final Player p) { + final ArrayList items = new ArrayList(); + ItemStack[] contents; + for (int length = (contents = p.getInventory().getContents()).length, k = 0; k < length; ++k) { + final ItemStack i = contents[k]; + if (i != null) { + if (i.getType().equals((Object)Material.GOLD_INGOT) || i.getType().equals((Object)Material.IRON_INGOT) || i.getType().equals((Object)Material.DIAMOND)) { + items.add(i); + } + } + } + for (final ItemStack x : items) { + if (x.getType().equals((Object)Material.GOLD_INGOT)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 15.0); + } + p.getInventory().remove(x); + } + if (x.getType().equals((Object)Material.IRON_INGOT)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 10.0); + } + p.getInventory().remove(x); + } + if (x.getType().equals((Object)Material.DIAMOND)) { + for (int j = 0; j < x.getAmount(); ++j) { + Core.getInstance().getBalanceManager().addBalance(p, 20.0); + } + p.getInventory().remove(x); + } + } + items.clear(); + } + + private double getPrice(final ItemStack i) { + return this.getActualItem(i).getPrice(); + } + + private ShopItem getActualItem(final ItemStack i) { + for (int ix = 0; ix < this.shopItems.size(); ++ix) { + if (this.shopItems.get(ix).getItem().equals((Object)i)) { + return this.shopItems.get(ix); + } + } + return null; + } + + public void openShop(final Player p) { + p.openInventory(this.shopGui); + } + + @EventHandler + public void click(final InventoryClickEvent e) { + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) { + return; + } + if (e.getInventory() == null) { + return; + } + if (e.getInventory().getHolder() != null) { + return; + } + if (!e.getInventory().getTitle().toLowerCase().contains("shop")) { + return; + } + if (e.getCurrentItem() == null) { + return; + } + if (e.getWhoClicked() == null || !(e.getWhoClicked() instanceof Player)) { + return; + } + if (!e.getCurrentItem().hasItemMeta()) { + return; + } + if (e.getClick().equals((Object)ClickType.CONTROL_DROP)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.NUMBER_KEY)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.DOUBLE_CLICK)) { + e.setCancelled(true); + return; + } + if (e.getClick().equals((Object)ClickType.DROP)) { + e.setCancelled(true); + return; + } + if (e.getClick().toString().toLowerCase().contains("shift")) { + e.setCancelled(true); + return; + } + if (!e.getSlotType().equals((Object)InventoryType.SlotType.CONTAINER) || e.getSlotType().equals((Object)InventoryType.SlotType.OUTSIDE)) { + return; + } + e.setCancelled(true); + final Player p = (Player)e.getWhoClicked(); + if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§bSell items")) { + this.sellItems(p); + } + else { + this.buyItem(p, e.getCurrentItem()); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void bloks(final PlayerInteractEvent e) { + if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) { + return; + } + if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) { + return; + } + if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && e.getClickedBlock().getType().equals((Object)Material.WORKBENCH)) { + e.setCancelled(true); + this.openShop(e.getPlayer()); + } + } + + public enum ShopItemType + { + ITEM("ITEM", 0), + ENCHANT("ENCHANT", 1); + + private ShopItemType(final String s, final int n) { + } + } + + public class ShopItem + { + private ItemStack item; + private double price; + private ShopItemType type; + public Enchantment ench; + public int enchLevel; + + public ShopItem(final ItemStack item, final double price, final ShopItemType type) { + this.item = item; + this.price = price; + this.type = type; + } + + public ShopItem(final ItemStack item, final double price, final ShopItemType type, final Enchantment ench, final int enchLevel) { + this.item = item; + this.price = price; + this.type = type; + this.ench = ench; + this.enchLevel = enchLevel; + } + + public ItemStack getItem() { + return this.item; + } + + public ShopItemType getType() { + return this.type; + } + + public double getPrice() { + return this.price; + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamJoinManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamJoinManager.java new file mode 100644 index 0000000..dfa44a0 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamJoinManager.java @@ -0,0 +1,54 @@ +package com.prevailpots.bunkers.game.managers; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.game.GameState; +import com.prevailpots.bunkers.game.Team; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.material.Wool; + +/** + * Created by Spirit on 09/08/2017. + */ +public class TeamJoinManager implements Listener { + @EventHandler + public void onInteract(PlayerInteractEvent e) { + if(Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) { + if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) { + if (e.getPlayer().getItemInHand().getType() == Material.WOOL) { + Wool wool = (Wool) e.getPlayer().getItemInHand().getData(); + // blue green red yellow + if(Core.getInstance().getGameHandler().players.containsKey(e.getPlayer().getName())) + Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName()); + // e.setCancelled(true); + if(wool.getColor() == DyeColor.BLUE) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.BLUE); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.BLUE + "Blue" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.GREEN) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.GREEN); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GREEN + "Green" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.RED) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.RED); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.RED + "Red" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.YELLOW) { + Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.YELLOW); + e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GOLD + "Yellow" + ChatColor.YELLOW + " team."); + } + if(wool.getColor() == DyeColor.WHITE) { + Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName()); + e.getPlayer().kickPlayer("§eYou have kicked yourself from the Bunkers game!"); + + } + } + } + } +} +} \ No newline at end of file diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamManager.java new file mode 100644 index 0000000..603be63 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/game/managers/TeamManager.java @@ -0,0 +1,115 @@ +package com.prevailpots.bunkers.game.managers; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; + +import org.bukkit.*; + +import java.util.*; + +public class TeamManager +{ + public HashMap kills; + public HashMap deaths; + + public TeamManager() { + this.kills = new HashMap(); + this.deaths = new HashMap(); + } + + public int getKills(final Player p) { + return this.kills.containsKey(p.getName()) ? this.kills.get(p.getName()) : 0; + } + + public int getDeaths(final Player p) { + return this.deaths.containsKey(p.getName()) ? this.deaths.get(p.getName()) : 0; + } + + public void setDeaths(final Player p, final int deaths) { + if (this.deaths.containsKey(p.getName())) { + this.deaths.remove(p.getName()); + } + this.deaths.put(p.getName(), deaths); + } + + public void setKills(final Player p, final int kills) { + if (this.kills.containsKey(p.getName())) { + this.kills.remove(p.getName()); + } + this.kills.put(p.getName(), kills); + } + + public double getTeamBalance(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getBalanceManager().getBalance(p); + } + } + } + return totalBal; + } + + public String getTeamBalanceFormatted(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getBalanceManager().getBalance(p); + } + } + } + return "$" + totalBal; + } + + public double getTeamPoints(final Team t) { + double totalBal = 0.0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalBal += Core.getInstance().getPointManager().getPoints(p); + } + } + } + return totalBal; + } + + public String[] getMembers(final Team t) { + final ArrayList members = new ArrayList(); + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + members.add(p.getName()); + } + } + } + return members.toArray(new String[0]); + } + + public int getTotalKills(final Team t) { + int totalKills = 0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalKills += this.getKills(p); + } + } + } + return totalKills; + } + + public int getTotalDeaths(final Team t) { + int totalDeaths = 0; + for (final Player p : Bukkit.getOnlinePlayers()) { + for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) { + if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) { + totalDeaths += this.getDeaths(p); + } + } + } + return totalDeaths; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/BufferedObjective.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/BufferedObjective.java new file mode 100644 index 0000000..c410d4f --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/BufferedObjective.java @@ -0,0 +1,121 @@ +package com.prevailpots.bunkers.scoreboard; + +import net.minecraft.util.gnu.trove.map.hash.*; +import org.apache.commons.lang3.*; +import net.minecraft.util.gnu.trove.procedure.*; +import org.bukkit.scoreboard.*; +import java.util.*; + +public class BufferedObjective +{ + private static final int MAX_SIDEBAR_ENTRIES = 32; + private static final int MAX_NAME_LENGTH = 32; + private static final int MAX_PREFIX_LENGTH = 32; + private static final int MAX_SUFFIX_LENGTH = 32; + private final Scoreboard scoreboard; + private Set previousLines; + private TIntObjectHashMap contents; + private boolean requiresUpdate; + private String title; + private Objective current; + private DisplaySlot displaySlot; + + public BufferedObjective(final Scoreboard scoreboard) { + this.previousLines = new HashSet(); + this.contents = (TIntObjectHashMap)new TIntObjectHashMap(); + this.requiresUpdate = false; + this.scoreboard = scoreboard; + this.title = RandomStringUtils.randomAlphabetic(4); + this.current = scoreboard.registerNewObjective("buffered", "dummy"); + } + + public void setTitle(final String title) { + if (this.title == null || !this.title.equals(title)) { + this.title = title; + this.requiresUpdate = true; + } + } + + public void setDisplaySlot(final DisplaySlot slot) { + this.displaySlot = slot; + this.current.setDisplaySlot(slot); + } + + public void setAllLines(final List lines) { + if (lines.size() != this.contents.size()) { + this.contents.clear(); + if (lines.isEmpty()) { + this.requiresUpdate = true; + return; + } + } + final int size = Math.min(32, lines.size()); + int count = 0; + for (final SidebarEntry sidebarEntry : lines) { + this.setLine(size - count++, sidebarEntry); + } + } + + public void setLine(final int lineNumber, final SidebarEntry sidebarEntry) { + final SidebarEntry value = (SidebarEntry)this.contents.get(lineNumber); + if (value == null || value != sidebarEntry) { + this.contents.put(lineNumber, (SidebarEntry)sidebarEntry); + this.requiresUpdate = true; + } + } + + public void flip() { + if (!this.requiresUpdate) { + return; + } + final Set adding = new HashSet(); + this.contents.forEachEntry((TIntObjectProcedure)new TIntObjectProcedure() { + public boolean execute(final int i, final SidebarEntry sidebarEntry) { + String name = sidebarEntry.name; + if (name.length() > 32) { + name = name.substring(0, 32); + } + Team team = BufferedObjective.this.scoreboard.getTeam(name); + if (team == null) { + team = BufferedObjective.this.scoreboard.registerNewTeam(name); + } + if (sidebarEntry.prefix != null) { + team.setPrefix((sidebarEntry.prefix.length() > 32) ? sidebarEntry.prefix.substring(0, 32) : sidebarEntry.prefix); + } + if (sidebarEntry.suffix != null) { + team.setSuffix((sidebarEntry.suffix.length() > 32) ? sidebarEntry.suffix.substring(0, 32) : sidebarEntry.suffix); + } + adding.add(name); + if (!team.hasEntry(name)) { + team.addEntry(name); + } + BufferedObjective.this.current.getScore(name).setScore(i); + return true; + } + }); + this.previousLines.removeAll(adding); + final Iterator iterator = this.previousLines.iterator(); + while (iterator.hasNext()) { + final String last = iterator.next(); + final Team team = this.scoreboard.getTeam(last); + if (team != null) { + team.removeEntry(last); + } + this.scoreboard.resetScores(last); + iterator.remove(); + } + this.previousLines = adding; + this.current.setDisplayName(this.title); + this.requiresUpdate = false; + } + + public void setVisible(final boolean value) { + if (this.displaySlot != null && !value) { + this.scoreboard.clearSlot(this.displaySlot); + this.displaySlot = null; + } + else if (this.displaySlot == null && value) { + this.current.setDisplaySlot(this.displaySlot = DisplaySlot.SIDEBAR); + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/PlayerBoard.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/PlayerBoard.java new file mode 100644 index 0000000..be9205d --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/PlayerBoard.java @@ -0,0 +1,179 @@ +package com.prevailpots.bunkers.scoreboard; + +import org.bukkit.scheduler.*; +import java.util.concurrent.atomic.*; +import org.bukkit.entity.*; +import org.bukkit.scoreboard.*; + +import com.prevailpots.bunkers.*; + +import org.bukkit.plugin.*; +import java.util.*; +import org.bukkit.*; + +public class PlayerBoard +{ + private boolean sidebarVisible; + private SidebarProvider defaultProvider; + private SidebarProvider temporaryProvider; + private BukkitRunnable runnable; + private final AtomicBoolean removed; + private final Team red; + private final Team green; + private final Team blue; + private final Team yellow; + private final BufferedObjective bufferedObjective; + private final Scoreboard scoreboard; + private final Player player; + private final Core plugin; + + public PlayerBoard(final Core plugin, final Player player) { + this.sidebarVisible = false; + this.removed = new AtomicBoolean(false); + this.plugin = plugin; + this.player = player; + this.scoreboard = plugin.getServer().getScoreboardManager().getNewScoreboard(); + this.bufferedObjective = new BufferedObjective(this.scoreboard); + (this.red = this.scoreboard.registerNewTeam("red")).setPrefix(com.prevailpots.bunkers.game.Team.RED.getColor().toString()); + this.red.setCanSeeFriendlyInvisibles(true); + (this.green = this.scoreboard.registerNewTeam("green")).setPrefix(com.prevailpots.bunkers.game.Team.GREEN.getColor().toString()); + this.green.setCanSeeFriendlyInvisibles(true); + (this.blue = this.scoreboard.registerNewTeam("blue")).setPrefix(com.prevailpots.bunkers.game.Team.BLUE.getColor().toString()); + this.blue.setCanSeeFriendlyInvisibles(true); + (this.yellow = this.scoreboard.registerNewTeam("yellow")).setPrefix(com.prevailpots.bunkers.game.Team.YELLOW.getColor().toString()); + this.yellow.setCanSeeFriendlyInvisibles(true); + player.setScoreboard(this.scoreboard); + } + + public void remove() { + if (!this.removed.getAndSet(true) && this.scoreboard != null) { + for (final Team team : this.scoreboard.getTeams()) { + team.unregister(); + } + for (final Objective objective : this.scoreboard.getObjectives()) { + objective.unregister(); + } + } + } + + public Player getPlayer() { + return this.player; + } + + public Scoreboard getScoreboard() { + return this.scoreboard; + } + + public boolean isSidebarVisible() { + return this.sidebarVisible; + } + + public void setSidebarVisible(final boolean visible) { + this.sidebarVisible = visible; + this.bufferedObjective.setDisplaySlot(visible ? DisplaySlot.SIDEBAR : null); + } + + public void setDefaultSidebar(final SidebarProvider provider, final long updateInterval) { + if (provider != this.defaultProvider) { + this.defaultProvider = provider; + if (this.runnable != null) { + this.runnable.cancel(); + } + if (provider == null) { + this.scoreboard.clearSlot(DisplaySlot.SIDEBAR); + return; + } + (this.runnable = new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + if (provider == PlayerBoard.this.defaultProvider) { + PlayerBoard.this.updateObjective(); + } + } + }).runTaskTimerAsynchronously((Plugin)this.plugin, updateInterval, updateInterval); + } + } + + public void setTemporarySidebar(final SidebarProvider provider, final long expiration) { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + this.temporaryProvider = provider; + this.updateObjective(); + new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + if (PlayerBoard.this.temporaryProvider == provider) { + PlayerBoard.access$4(PlayerBoard.this, null); + PlayerBoard.this.updateObjective(); + } + } + }.runTaskLaterAsynchronously((Plugin)this.plugin, expiration); + } + + private void updateObjective() { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + final SidebarProvider provider = (this.temporaryProvider != null) ? this.temporaryProvider : this.defaultProvider; + if (provider == null) { + this.bufferedObjective.setVisible(false); + } + else { + try { + this.bufferedObjective.setTitle(provider.getTitle()); + this.bufferedObjective.setAllLines(provider.getLines(this.player)); + this.bufferedObjective.flip(); + } + catch (Exception ex) {} + } + } + + public void addUpdate(final Player target) { + this.addUpdates(Collections.singleton(target)); + } + + public void addUpdates(final Iterable updates) { + if (this.removed.get()) { + throw new IllegalStateException("Cannot update whilst board is removed"); + } + new BukkitRunnable() { + public void run() { + if (PlayerBoard.this.removed.get()) { + this.cancel(); + return; + } + for (final Player update : updates) { + if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().containsKey(update.getName())) { + continue; + } + if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.RED)) { + PlayerBoard.this.red.addPlayer((OfflinePlayer)update); + } + else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.GREEN)) { + PlayerBoard.this.green.addPlayer((OfflinePlayer)update); + } + else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.BLUE)) { + PlayerBoard.this.blue.addPlayer((OfflinePlayer)update); + } + else { + if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.YELLOW)) { + continue; + } + PlayerBoard.this.yellow.addPlayer((OfflinePlayer)update); + } + } + } + }.runTaskAsynchronously((Plugin)this.plugin); + } + + static /* synthetic */ void access$4(final PlayerBoard playerBoard, final SidebarProvider temporaryProvider) { + playerBoard.temporaryProvider = temporaryProvider; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java new file mode 100644 index 0000000..632ddcd --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java @@ -0,0 +1,80 @@ +package com.prevailpots.bunkers.scoreboard; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.Plugin; + +import com.prevailpots.bunkers.Core; +import com.prevailpots.bunkers.scoreboard.provider.TimerSidebarProvider; + + + +public class ScoreboardHandler implements Listener +{ + private static final long UPDATE_TICK_INTERVAL = 2L; + private final Map playerBoards; + private final TimerSidebarProvider timerSidebarProvider; + private final Core plugin; + + public ScoreboardHandler(final Core plugin) { + this.playerBoards = new HashMap(); + this.plugin = plugin; + plugin.getServer().getPluginManager().registerEvents((Listener)this, (Plugin)plugin); + this.timerSidebarProvider = new TimerSidebarProvider(plugin); + final Set players = new HashSet(); + for (final Player player : players) { + this.applyBoard(player).addUpdates(players); + } + } + + @EventHandler(ignoreCancelled = true) + public void onPlayerJoin(final PlayerJoinEvent event) { + final Player player = event.getPlayer(); + for (final PlayerBoard board : this.playerBoards.values()) { + board.addUpdate(player); + } + final Set players = new HashSet(); + this.applyBoard(player).addUpdates(players); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPlayerQuit(final PlayerQuitEvent event) { + if (this.playerBoards.containsKey(event.getPlayer().getUniqueId())) { + this.playerBoards.remove(event.getPlayer().getUniqueId()).remove(); + } + } + + public PlayerBoard getPlayerBoard(final UUID uuid) { + return this.playerBoards.get(uuid); + } + + public PlayerBoard applyBoard(final Player player) { + final PlayerBoard board = new PlayerBoard(this.plugin, player); + final PlayerBoard previous = this.playerBoards.put(player.getUniqueId(), board); + if (previous != null && previous != board) { + previous.remove(); + } + board.setSidebarVisible(true); + board.setDefaultSidebar(this.timerSidebarProvider, 2L); + return board; + } + + public void clearBoards() { + final Iterator iterator = this.playerBoards.values().iterator(); + while (iterator.hasNext()) { + iterator.next().remove(); + iterator.remove(); + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarEntry.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarEntry.java new file mode 100644 index 0000000..2319513 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarEntry.java @@ -0,0 +1,67 @@ +package com.prevailpots.bunkers.scoreboard; + +public class SidebarEntry +{ + public final String name; + public String prefix; + public String suffix; + + public SidebarEntry(final String name) { + this.name = name; + } + + public SidebarEntry(final Object name) { + this.name = String.valueOf(name); + } + + public SidebarEntry(final String prefix, final String name, final String suffix) { + this.name = name; + this.prefix = prefix; + this.suffix = suffix; + } + + public SidebarEntry(final Object prefix, final Object name, final Object suffix) { + this(name); + this.prefix = String.valueOf(prefix); + this.suffix = String.valueOf(suffix); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SidebarEntry)) { + return false; + } + final SidebarEntry that = (SidebarEntry)o; + Label_0054: { + if (this.name != null) { + if (this.name.equals(that.name)) { + break Label_0054; + } + } + else if (that.name == null) { + break Label_0054; + } + return false; + } + if (this.prefix != null) { + if (this.prefix.equals(that.prefix)) { + return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null)); + } + } + else if (that.prefix == null) { + return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null)); + } + return false; + } + + @Override + public int hashCode() { + int result = (this.name != null) ? this.name.hashCode() : 0; + result = 31 * result + ((this.prefix != null) ? this.prefix.hashCode() : 0); + result = 31 * result + ((this.suffix != null) ? this.suffix.hashCode() : 0); + return result; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarProvider.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarProvider.java new file mode 100644 index 0000000..f4aa3b4 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/SidebarProvider.java @@ -0,0 +1,11 @@ +package com.prevailpots.bunkers.scoreboard; + +import org.bukkit.entity.*; +import java.util.*; + +public interface SidebarProvider +{ + String getTitle(); + + List getLines(final Player p0); +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java new file mode 100644 index 0000000..a95dfaf --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java @@ -0,0 +1,72 @@ +package com.prevailpots.bunkers.scoreboard.provider; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; +import com.prevailpots.bunkers.game.*; +import com.prevailpots.bunkers.game.managers.*; +import com.prevailpots.bunkers.scoreboard.*; + + +import java.util.*; + +import org.apache.commons.lang3.*; +import org.bukkit.*; + +public class TimerSidebarProvider implements SidebarProvider +{ + public static final String STRAIGHT_LINE; + private final Core plugin; + private boolean add; + + static { + STRAIGHT_LINE = "------------------------------------".substring(0, 14); + } + + public TimerSidebarProvider(final Core plugin) { + this.plugin = plugin; + } + + @Override + public String getTitle() { + return "§b§lPrevailPots §c[Bunkers]"; + } + + @Override + public List getLines(final Player player) { + final List lines = new ArrayList(); + if (!this.plugin.getGameHandler().getTime().equalsIgnoreCase("pre game")) { + lines.add(new SidebarEntry("", "§aGame Time§7: ", "§f" + this.plugin.getGameHandler().getTime())); + final Team t = this.plugin.getGameHandler().getPlayers().get(player.getName()); + lines.add(new SidebarEntry("", "§aTeam§7: ", t.getColor() + StringUtils.capitalize(t.toString().toLowerCase()))); + lines.add(new SidebarEntry(" §b» ", "§aKills§7: ", "§f" + this.plugin.getTeamManager().getKills(player))); + lines.add(new SidebarEntry(" §b» §aBala", "§ance§7: §f", this.plugin.getBalanceManager().getBalanceFormatted(player))); + lines.add(new SidebarEntry(" §b» ", "§aPoints§7: ", "§f" + this.plugin.getPointManager().getPoints(player))); + lines.add(new SidebarEntry(" §b» ", "§aDTR§7: ", this.plugin.getDTRManager().getDTRFormatted(Core.getInstance().getGameHandler().getPlayers().get(player.getName())))); + } + else { + if (this.plugin.getGameHandler().gameStartCountdown != 10L) { + lines.add(new SidebarEntry("", "§6Countdown§7: ", "§f" + this.plugin.getGameHandler().gameStartCountdown + "s")); + } + else { + lines.add(new SidebarEntry("", "§6Game State§7: ", "§eLobby")); + } + lines.add(new SidebarEntry("", "§6Players§7: ", "§e" + String.valueOf(this.plugin.getGameHandler().getPlayers().size()) + "/" + 16 + ":")); + lines.add(new SidebarEntry(" §b» ", "§cRed§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.RED) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§aGreen§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.GREEN) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§9Blue§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.BLUE) + "/" + 4)); + lines.add(new SidebarEntry(" §b» ", "§eYellow§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.YELLOW) + "/" + 4)); + } + if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.EPEARL)) { + lines.add(new SidebarEntry(" * ", "§9§lEnder", "pearl§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.EPEARL))); + } + if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.GAPPLE)) { + lines.add(new SidebarEntry(" * ", "§6§lApple", "§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.GAPPLE))); + } + if (!lines.isEmpty()) { + lines.add(0, new SidebarEntry(String.valueOf(ChatColor.GRAY.toString()) + ChatColor.STRIKETHROUGH.toString(), TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE)); + lines.add(lines.size(), new SidebarEntry(ChatColor.GRAY.toString(), String.valueOf(ChatColor.STRIKETHROUGH.toString()) + TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE)); + } + return lines; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/task/DynamicTask.java b/PrevailBunkers/src/com/prevailpots/bunkers/task/DynamicTask.java new file mode 100644 index 0000000..6c0cc19 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/task/DynamicTask.java @@ -0,0 +1,6 @@ +package com.prevailpots.bunkers.task; + +public interface DynamicTask +{ + void execute(); +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/task/ItemDropTask.java b/PrevailBunkers/src/com/prevailpots/bunkers/task/ItemDropTask.java new file mode 100644 index 0000000..f410784 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/task/ItemDropTask.java @@ -0,0 +1,34 @@ +package com.prevailpots.bunkers.task; + +import org.bukkit.inventory.*; +import org.bukkit.*; +import org.bukkit.scheduler.*; + +import com.prevailpots.bunkers.*; + +import java.util.*; + +import org.bukkit.plugin.*; + +public class ItemDropTask implements DynamicTask +{ + private List drops; + private Location drop; + + public ItemDropTask(final List dropd, final Location drop) { + this.drops = new ArrayList(); + this.drops = dropd; + this.drop = drop; + } + + @Override + public void execute() { + new BukkitRunnable() { + public void run() { + for (final ItemStack i : ItemDropTask.this.drops) { + ItemDropTask.this.drop.getWorld().dropItemNaturally(ItemDropTask.this.drop, i); + } + } + }.runTaskLater((Plugin)Core.getInstance(), 2L); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/task/PlayerItemTask.java b/PrevailBunkers/src/com/prevailpots/bunkers/task/PlayerItemTask.java new file mode 100644 index 0000000..a60ca8c --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/task/PlayerItemTask.java @@ -0,0 +1,19 @@ +package com.prevailpots.bunkers.task; + +import org.bukkit.entity.*; + +import com.prevailpots.bunkers.*; + +public class PlayerItemTask implements DynamicTask +{ + private Player player; + + public PlayerItemTask(final Player p) { + this.player = p; + } + + @Override + public void execute() { + Core.getInstance().getItemManager().giveStarterItems(this.player); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/BroadcastUtils.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/BroadcastUtils.java new file mode 100644 index 0000000..b59ddab --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/BroadcastUtils.java @@ -0,0 +1,17 @@ +package com.prevailpots.bunkers.utils; + +import org.bukkit.*; +import org.bukkit.entity.*; +import ru.tehkode.permissions.bukkit.*; +import java.util.*; + +public class BroadcastUtils +{ + public static void broadcastToPerm(final String msg, final String permission) { + for (final Player p : Bukkit.getOnlinePlayers()) { + if (PermissionsEx.getUser(p).has(permission) || p.isOp()) { + p.sendMessage(msg); + } +} + } +} \ No newline at end of file diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/ItemUtil.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ItemUtil.java new file mode 100644 index 0000000..7845133 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ItemUtil.java @@ -0,0 +1,184 @@ +package com.prevailpots.bunkers.utils; + +import org.bukkit.*; +import org.bukkit.inventory.*; +import java.util.*; +import org.bukkit.inventory.meta.*; +import org.bukkit.enchantments.*; +import org.bukkit.potion.*; + +public class ItemUtil +{ + public static boolean isInteractable(final Material m) { + switch (m) { + case ENCHANTMENT_TABLE: { + return true; + } + case ANVIL: { + return true; + } + case BREWING_STAND: { + return true; + } + case BREWING_STAND_ITEM: { + return true; + } + case CAULDRON: { + return true; + } + case CAULDRON_ITEM: { + return true; + } + case TRAPPED_CHEST: { + return true; + } + case TRAP_DOOR: { + return true; + } + case FENCE_GATE: { + return true; + } + case NOTE_BLOCK: { + return true; + } + case FURNACE: { + return true; + } + case JUKEBOX: { + return true; + } + case BOAT: { + return true; + } + case GOLD_PLATE: { + return true; + } + case IRON_PLATE: { + return true; + } + case STONE_PLATE: { + return true; + } + case WOOD_PLATE: { + return true; + } + case BED: { + return true; + } + case IRON_DOOR: { + return true; + } + case WOOD_DOOR: { + return true; + } + case IRON_DOOR_BLOCK: { + return true; + } + case WOODEN_DOOR: { + return true; + } + case CHEST: { + return true; + } + case WORKBENCH: { + return true; + } + case MINECART: { + return true; + } + case COMMAND_MINECART: { + return true; + } + case EXPLOSIVE_MINECART: { + return true; + } + case HOPPER_MINECART: { + return true; + } + case POWERED_MINECART: { + return true; + } + case STORAGE_MINECART: { + return true; + } + case HOPPER: { + return true; + } + case BEACON: { + return true; + } + case COMMAND: { + return true; + } + case CAKE_BLOCK: { + return true; + } + case CAKE: { + return true; + } + case WATER: { + return true; + } + case STATIONARY_WATER: { + return true; + } + case LAVA: { + return true; + } + case STATIONARY_LAVA: { + return true; + } + case BURNING_FURNACE: { + return true; + } + case LEVER: { + return true; + } + case DISPENSER: { + return true; + } + case DROPPER: { + return true; + } + default: { + return false; + } + } + } + + public static ItemStack getItem(final String displayName, final Material type, final int count, final String... lore) { + final ItemStack toReturn = new ItemStack(type, count); + final ItemMeta meta = toReturn.getItemMeta(); + meta.setDisplayName(displayName); + if (lore != null) { + meta.setLore((List)Arrays.asList(lore)); + } + toReturn.setItemMeta(meta); + return toReturn; + } + + public static ItemStack getEnchantedItem(final String displayName, final Material type, final int count, final Enchantment enchantment, final int enchLevel, final String... lore) { + final ItemStack toReturn = new ItemStack(type, count); + toReturn.addUnsafeEnchantment(enchantment, enchLevel); + final ItemMeta meta = toReturn.getItemMeta(); + meta.setDisplayName(displayName); + if (lore != null) { + meta.setLore((List)Arrays.asList(lore)); + } + toReturn.setItemMeta(meta); + return toReturn; + } + + public static ItemStack getPotion(final String displayName, final PotionType type, final boolean splash, final int level, final boolean extendDuration, final int count, final String... lore) { + final ItemStack toReturn = getItem(displayName, Material.POTION, count, lore); + final Potion pot = new Potion(1); + pot.setType(type); + if (!type.toString().toLowerCase().contains("instant") && extendDuration) { + pot.setHasExtendedDuration(true); + } + pot.setSplash(splash); + pot.setLevel(level); + pot.apply(toReturn); + return toReturn; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/MathUtils.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/MathUtils.java new file mode 100644 index 0000000..8b123b6 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/MathUtils.java @@ -0,0 +1,32 @@ +package com.prevailpots.bunkers.utils; + +import java.math.*; +import java.util.*; + +public class MathUtils +{ + public static double round(final double value, final int places) { + if (places < 0) { + throw new IllegalArgumentException(); + } + BigDecimal bd = new BigDecimal(value); + bd = bd.setScale(places, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + + public static int indexOfMax(final double[] array) { + final List list = new ArrayList(); + for (int i = 0; i < array.length; ++i) { + list.add(array[i]); + } + return list.indexOf(Collections.max(null)); + } + + public static int indexOfMin(final double[] array) { + final List list = new ArrayList(); + for (int i = 0; i < array.length; ++i) { + list.add(array[i]); + } + return list.indexOf(Collections.min(null)); + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/ParticleEffect.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ParticleEffect.java new file mode 100644 index 0000000..be417a3 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ParticleEffect.java @@ -0,0 +1,674 @@ +package com.prevailpots.bunkers.utils; + +import java.util.*; +import org.bukkit.entity.*; +import org.bukkit.util.*; + +import com.sk89q.worldedit.Vector; + +import java.lang.reflect.*; +import org.bukkit.*; + +public enum ParticleEffect +{ + EXPLOSION_NORMAL("EXPLOSION_NORMAL", 0, "explode", 0, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + EXPLOSION_LARGE("EXPLOSION_LARGE", 1, "largeexplode", 1, -1, new ParticleProperty[0]), + EXPLOSION_HUGE("EXPLOSION_HUGE", 2, "hugeexplosion", 2, -1, new ParticleProperty[0]), + FIREWORKS_SPARK("FIREWORKS_SPARK", 3, "fireworksSpark", 3, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + WATER_BUBBLE("WATER_BUBBLE", 4, "bubble", 4, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER }), + WATER_SPLASH("WATER_SPLASH", 5, "splash", 5, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + WATER_WAKE("WATER_WAKE", 6, "wake", 6, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SUSPENDED("SUSPENDED", 7, "suspended", 7, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_WATER }), + SUSPENDED_DEPTH("SUSPENDED_DEPTH", 8, "depthSuspend", 8, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + CRIT("CRIT", 9, "crit", 9, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + CRIT_MAGIC("CRIT_MAGIC", 10, "magicCrit", 10, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SMOKE_NORMAL("SMOKE_NORMAL", 11, "smoke", 11, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SMOKE_LARGE("SMOKE_LARGE", 12, "largesmoke", 12, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SPELL("SPELL", 13, "spell", 13, -1, new ParticleProperty[0]), + SPELL_INSTANT("SPELL_INSTANT", 14, "instantSpell", 14, -1, new ParticleProperty[0]), + SPELL_MOB("SPELL_MOB", 15, "mobSpell", 15, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SPELL_MOB_AMBIENT("SPELL_MOB_AMBIENT", 16, "mobSpellAmbient", 16, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SPELL_WITCH("SPELL_WITCH", 17, "witchMagic", 17, -1, new ParticleProperty[0]), + DRIP_WATER("DRIP_WATER", 18, "dripWater", 18, -1, new ParticleProperty[0]), + DRIP_LAVA("DRIP_LAVA", 19, "dripLava", 19, -1, new ParticleProperty[0]), + VILLAGER_ANGRY("VILLAGER_ANGRY", 20, "angryVillager", 20, -1, new ParticleProperty[0]), + VILLAGER_HAPPY("VILLAGER_HAPPY", 21, "happyVillager", 21, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + TOWN_AURA("TOWN_AURA", 22, "townaura", 22, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + NOTE("NOTE", 23, "note", 23, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + PORTAL("PORTAL", 24, "portal", 24, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + ENCHANTMENT_TABLE("ENCHANTMENT_TABLE", 25, "enchantmenttable", 25, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + FLAME("FLAME", 26, "flame", 26, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + LAVA("LAVA", 27, "lava", 27, -1, new ParticleProperty[0]), + FOOTSTEP("FOOTSTEP", 28, "footstep", 28, -1, new ParticleProperty[0]), + CLOUD("CLOUD", 29, "cloud", 29, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + REDSTONE("REDSTONE", 30, "reddust", 30, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }), + SNOWBALL("SNOWBALL", 31, "snowballpoof", 31, -1, new ParticleProperty[0]), + SNOW_SHOVEL("SNOW_SHOVEL", 32, "snowshovel", 32, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }), + SLIME("SLIME", 33, "slime", 33, -1, new ParticleProperty[0]), + HEART("HEART", 34, "heart", 34, -1, new ParticleProperty[0]), + BARRIER("BARRIER", 35, "barrier", 35, 8, new ParticleProperty[0]), + ITEM_CRACK("ITEM_CRACK", 36, "iconcrack", 36, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }), + BLOCK_CRACK("BLOCK_CRACK", 37, "blockcrack", 37, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_DATA }), + BLOCK_DUST("BLOCK_DUST", 38, "blockdust", 38, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }), + WATER_DROP("WATER_DROP", 39, "droplet", 39, 8, new ParticleProperty[0]), + ITEM_TAKE("ITEM_TAKE", 40, "take", 40, 8, new ParticleProperty[0]), + MOB_APPEARANCE("MOB_APPEARANCE", 41, "mobappearance", 41, 8, new ParticleProperty[0]); + + private static final Map NAME_MAP; + private static final Map ID_MAP; + private final String name; + private final int id; + private final int requiredVersion; + private final List properties; + + static { + NAME_MAP = new HashMap(); + ID_MAP = new HashMap(); + ParticleEffect[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final ParticleEffect effect = values[i]; + ParticleEffect.NAME_MAP.put(effect.name, effect); + ParticleEffect.ID_MAP.put(effect.id, effect); + } + } + + private ParticleEffect(final String s, final int n, final String name, final int id, final int requiredVersion, final ParticleProperty... properties) { + this.name = name; + this.id = id; + this.requiredVersion = requiredVersion; + this.properties = Arrays.asList(properties); + } + + public String getName() { + return this.name; + } + + public int getId() { + return this.id; + } + + public int getRequiredVersion() { + return this.requiredVersion; + } + + public boolean hasProperty(final ParticleProperty property) { + return this.properties.contains(property); + } + + public boolean isSupported() { + return this.requiredVersion == -1 || ParticlePacket.getVersion() >= this.requiredVersion; + } + + public static ParticleEffect fromName(final String name) { + for (final Map.Entry entry : ParticleEffect.NAME_MAP.entrySet()) { + if (!entry.getKey().equalsIgnoreCase(name)) { + continue; + } + return entry.getValue(); + } + return null; + } + + public static ParticleEffect fromId(final int id) { + for (final Map.Entry entry : ParticleEffect.ID_MAP.entrySet()) { + if (entry.getKey() != id) { + continue; + } + return entry.getValue(); + } + return null; + } + + private static boolean isWater(final Location location) { + final Material material = location.getBlock().getType(); + return material == Material.WATER || material == Material.STATIONARY_WATER; + } + + private static boolean isLongDistance(final Location location, final List players) { + final String world = location.getWorld().getName(); + for (final Player player : players) { + final Location playerLocation = player.getLocation(); + if (world.equals(playerLocation.getWorld().getName())) { + if (playerLocation.distanceSquared(location) < 65536.0) { + continue; + } + return true; + } + } + return false; + } + + private static boolean isDataCorrect(final ParticleEffect effect, final ParticleData data) { + return ((effect == ParticleEffect.BLOCK_CRACK || effect == ParticleEffect.BLOCK_DUST) && data instanceof BlockData) || (effect == ParticleEffect.ITEM_CRACK && data instanceof ItemData); + } + + private static boolean isColorCorrect(final ParticleEffect effect, final ParticleColor color) { + return ((effect == ParticleEffect.SPELL_MOB || effect == ParticleEffect.SPELL_MOB_AMBIENT || effect == ParticleEffect.REDSTONE) && color instanceof OrdinaryColor) || (effect == ParticleEffect.NOTE && color instanceof NoteColor); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, null).sendTo(center, range); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players); + } + + public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + this.display(offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players)); + } + + public void display(final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) { + throw new IllegalArgumentException("This particle effect is not directional"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, direction, speed, range > 256.0, null).sendTo(center, range); + } + + public void display(final Vector direction, final float speed, final Location center, final List players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect requires additional data"); + } + if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) { + throw new IllegalArgumentException("This particle effect is not directional"); + } + if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) { + throw new IllegalArgumentException("There is no water at the center location"); + } + new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players); + } + + public void display(final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException { + this.display(direction, speed, center, Arrays.asList(players)); + } + + public void display(final ParticleColor color, final Location center, final double range) throws ParticleVersionException, ParticleColorException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.COLORABLE)) { + throw new ParticleColorException("This particle effect is not colorable"); + } + if (!isColorCorrect(this, color)) { + throw new ParticleColorException("The particle color type is incorrect"); + } + new ParticlePacket(this, color, range > 256.0).sendTo(center, range); + } + + public void display(final ParticleColor color, final Location center, final List players) throws ParticleVersionException, ParticleColorException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.COLORABLE)) { + throw new ParticleColorException("This particle effect is not colorable"); + } + if (!isColorCorrect(this, color)) { + throw new ParticleColorException("The particle color type is incorrect"); + } + new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players); + } + + public void display(final ParticleColor color, final Location center, final Player... players) throws ParticleVersionException, ParticleColorException { + this.display(color, center, Arrays.asList(players)); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, data).sendTo(center, range); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List players) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players); + } + + public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException { + this.display(data, offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players)); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, direction, speed, range > 256.0, data).sendTo(center, range); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final List players) throws ParticleVersionException, ParticleDataException { + if (!this.isSupported()) { + throw new ParticleVersionException("This particle effect is not supported by your server version"); + } + if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) { + throw new ParticleDataException("This particle effect does not require additional data"); + } + if (!isDataCorrect(this, data)) { + throw new ParticleDataException("The particle data type is incorrect"); + } + new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players); + } + + public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException { + this.display(data, direction, speed, center, Arrays.asList(players)); + } + + public enum ParticleProperty + { + REQUIRES_WATER("REQUIRES_WATER", 0), + REQUIRES_DATA("REQUIRES_DATA", 1), + DIRECTIONAL("DIRECTIONAL", 2), + COLORABLE("COLORABLE", 3); + + private ParticleProperty(final String s, final int n) { + } + } + + public abstract static class ParticleData + { + private final Material material; + private final byte data; + private final int[] packetData; + + public ParticleData(final Material material, final byte data) { + this.material = material; + this.data = data; + this.packetData = new int[] { material.getId(), data }; + } + + public Material getMaterial() { + return this.material; + } + + public byte getData() { + return this.data; + } + + public int[] getPacketData() { + return this.packetData; + } + + public String getPacketDataString() { + return "_" + this.packetData[0] + "_" + this.packetData[1]; + } + } + + public static final class ItemData extends ParticleData + { + public ItemData(final Material material, final byte data) { + super(material, data); + } + } + + public static final class BlockData extends ParticleData + { + public BlockData(final Material material, final byte data) throws IllegalArgumentException { + super(material, data); + if (!material.isBlock()) { + throw new IllegalArgumentException("The material is not a block"); + } + } + } + + public abstract static class ParticleColor + { + public abstract float getValueX(); + + public abstract float getValueY(); + + public abstract float getValueZ(); + } + + public static final class OrdinaryColor extends ParticleColor + { + private final int red; + private final int green; + private final int blue; + + public OrdinaryColor(final int red, final int green, final int blue) throws IllegalArgumentException { + if (red < 0) { + throw new IllegalArgumentException("The red value is lower than 0"); + } + if (red > 255) { + throw new IllegalArgumentException("The red value is higher than 255"); + } + this.red = red; + if (green < 0) { + throw new IllegalArgumentException("The green value is lower than 0"); + } + if (green > 255) { + throw new IllegalArgumentException("The green value is higher than 255"); + } + this.green = green; + if (blue < 0) { + throw new IllegalArgumentException("The blue value is lower than 0"); + } + if (blue > 255) { + throw new IllegalArgumentException("The blue value is higher than 255"); + } + this.blue = blue; + } + + public OrdinaryColor(final Color color) { + this(color.getRed(), color.getGreen(), color.getBlue()); + } + + public int getRed() { + return this.red; + } + + public int getGreen() { + return this.green; + } + + public int getBlue() { + return this.blue; + } + + @Override + public float getValueX() { + return this.red / 255.0f; + } + + @Override + public float getValueY() { + return this.green / 255.0f; + } + + @Override + public float getValueZ() { + return this.blue / 255.0f; + } + } + + public static final class NoteColor extends ParticleColor + { + private final int note; + + public NoteColor(final int note) throws IllegalArgumentException { + if (note < 0) { + throw new IllegalArgumentException("The note value is lower than 0"); + } + if (note > 24) { + throw new IllegalArgumentException("The note value is higher than 24"); + } + this.note = note; + } + + @Override + public float getValueX() { + return this.note / 24.0f; + } + + @Override + public float getValueY() { + return 0.0f; + } + + @Override + public float getValueZ() { + return 0.0f; + } + } + + private static final class ParticleDataException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleDataException(final String message) { + super(message); + } + } + + private static final class ParticleColorException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleColorException(final String message) { + super(message); + } + } + + private static final class ParticleVersionException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public ParticleVersionException(final String message) { + super(message); + } + } + + public static final class ParticlePacket + { + private static int version; + private static Class enumParticle; + private static Constructor packetConstructor; + private static Method getHandle; + private static Field playerConnection; + private static Method sendPacket; + private static boolean initialized; + private final ParticleEffect effect; + private float offsetX; + private final float offsetY; + private final float offsetZ; + private final float speed; + private final int amount; + private final boolean longDistance; + private final ParticleData data; + private Object packet; + + public ParticlePacket(final ParticleEffect effect, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final boolean longDistance, final ParticleData data) throws IllegalArgumentException { + initialize(); + if (speed < 0.0f) { + throw new IllegalArgumentException("The speed is lower than 0"); + } + if (amount < 0) { + throw new IllegalArgumentException("The amount is lower than 0"); + } + this.effect = effect; + this.offsetX = offsetX; + this.offsetY = offsetY; + this.offsetZ = offsetZ; + this.speed = speed; + this.amount = amount; + this.longDistance = longDistance; + this.data = data; + } + + public ParticlePacket(final ParticleEffect effect, final Vector direction, final float speed, final boolean longDistance, final ParticleData data) throws IllegalArgumentException { + this(effect, (float)direction.getX(), (float)direction.getY(), (float)direction.getZ(), speed, 0, longDistance, data); + } + + public ParticlePacket(final ParticleEffect effect, final ParticleColor color, final boolean longDistance) { + this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1.0f, 0, longDistance, null); + if (effect == ParticleEffect.REDSTONE && color instanceof OrdinaryColor && ((OrdinaryColor)color).getRed() == 0) { + this.offsetX = Float.MIN_NORMAL; + } + } + + public static void initialize() throws VersionIncompatibleException { + if (ParticlePacket.initialized) { + return; + } + try { + ParticlePacket.version = Integer.parseInt(Character.toString(ReflectionUtils.PackageType.getServerVersion().charAt(3))); + if (ParticlePacket.version > 7) { + ParticlePacket.enumParticle = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("EnumParticle"); + } + final Class packetClass = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass((ParticlePacket.version < 7) ? "Packet63WorldParticles" : "PacketPlayOutWorldParticles"); + ParticlePacket.packetConstructor = ReflectionUtils.getConstructor(packetClass, (Class[])new Class[0]); + ParticlePacket.getHandle = ReflectionUtils.getMethod("CraftPlayer", ReflectionUtils.PackageType.CRAFTBUKKIT_ENTITY, "getHandle", (Class[])new Class[0]); + ParticlePacket.playerConnection = ReflectionUtils.getField("EntityPlayer", ReflectionUtils.PackageType.MINECRAFT_SERVER, false, "playerConnection"); + ParticlePacket.sendPacket = ReflectionUtils.getMethod(ParticlePacket.playerConnection.getType(), "sendPacket", ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("Packet")); + } + catch (Exception exception) { + throw new VersionIncompatibleException("Your current bukkit version seems to be incompatible with this library", exception); + } + ParticlePacket.initialized = true; + } + + public static int getVersion() { + if (!ParticlePacket.initialized) { + initialize(); + } + return ParticlePacket.version; + } + + public static boolean isInitialized() { + return ParticlePacket.initialized; + } + + private void initializePacket(final Location center) throws PacketInstantiationException { + if (this.packet != null) { + return; + } + try { + this.packet = ParticlePacket.packetConstructor.newInstance(new Object[0]); + if (ParticlePacket.version < 8) { + String name = this.effect.getName(); + if (this.data != null) { + name = String.valueOf(name) + this.data.getPacketDataString(); + } + ReflectionUtils.setValue(this.packet, true, "a", name); + } + else { + ReflectionUtils.setValue(this.packet, true, "a", ParticlePacket.enumParticle.getEnumConstants()[this.effect.getId()]); + ReflectionUtils.setValue(this.packet, true, "j", this.longDistance); + if (this.data != null) { + final int[] packetData = this.data.getPacketData(); + final Object packet = this.packet; + final boolean declared = true; + final String fieldName = "k"; + int[] value = null; + if (this.effect != ParticleEffect.ITEM_CRACK) { + value = new int[] { packetData[0] | packetData[1] << 12 }; + } + ReflectionUtils.setValue(packet, declared, fieldName, value); + } + } + ReflectionUtils.setValue(this.packet, true, "b", (float)center.getX()); + ReflectionUtils.setValue(this.packet, true, "c", (float)center.getY()); + ReflectionUtils.setValue(this.packet, true, "d", (float)center.getZ()); + ReflectionUtils.setValue(this.packet, true, "e", this.offsetX); + ReflectionUtils.setValue(this.packet, true, "f", this.offsetY); + ReflectionUtils.setValue(this.packet, true, "g", this.offsetZ); + ReflectionUtils.setValue(this.packet, true, "h", this.speed); + ReflectionUtils.setValue(this.packet, true, "i", this.amount); + } + catch (Exception exception) { + throw new PacketInstantiationException("Packet instantiation failed", exception); + } + } + + public void sendTo(final Location center, final Player player) throws PacketInstantiationException, PacketSendingException { + this.initializePacket(center); + try { + ParticlePacket.sendPacket.invoke(ParticlePacket.playerConnection.get(ParticlePacket.getHandle.invoke(player, new Object[0])), this.packet); + } + catch (Exception exception) { + throw new PacketSendingException("Failed to send the packet to player '" + player.getName() + "'", exception); + } + } + + public void sendTo(final Location center, final List players) throws IllegalArgumentException { + if (players.isEmpty()) { + throw new IllegalArgumentException("The player list is empty"); + } + for (final Player player : players) { + this.sendTo(center, player); + } + } + + public void sendTo(final Location center, final double range) throws IllegalArgumentException { + if (range < 1.0) { + throw new IllegalArgumentException("The range is lower than 1"); + } + final String worldName = center.getWorld().getName(); + final double squared = range * range; + for (final Player player : Bukkit.getOnlinePlayers()) { + if (player.getWorld().getName().equals(worldName)) { + if (player.getLocation().distanceSquared(center) > squared) { + continue; + } + this.sendTo(center, player); + } + } + } + + private static final class VersionIncompatibleException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public VersionIncompatibleException(final String message, final Throwable cause) { + super(message, cause); + } + } + + private static final class PacketInstantiationException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public PacketInstantiationException(final String message, final Throwable cause) { + super(message, cause); + } + } + + private static final class PacketSendingException extends RuntimeException + { + private static final long serialVersionUID = 3203085387160737484L; + + public PacketSendingException(final String message, final Throwable cause) { + super(message, cause); + } + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/ReflectionUtils.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ReflectionUtils.java new file mode 100644 index 0000000..a672285 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/ReflectionUtils.java @@ -0,0 +1,248 @@ +package com.prevailpots.bunkers.utils; + +import java.lang.reflect.*; +import java.util.*; +import org.bukkit.*; + +public final class ReflectionUtils +{ + public static Constructor getConstructor(final Class clazz, final Class... parameterTypes) throws NoSuchMethodException { + final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); + Constructor[] constructors; + for (int length = (constructors = clazz.getConstructors()).length, i = 0; i < length; ++i) { + final Constructor constructor = constructors[i]; + if (DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) { + return constructor; + } + } + throw new NoSuchMethodException("There is no such constructor in this class with the specified parameter types"); + } + + public static Constructor getConstructor(final String className, final PackageType packageType, final Class... parameterTypes) throws NoSuchMethodException, ClassNotFoundException { + return getConstructor(packageType.getClass(className), parameterTypes); + } + + public static Object instantiateObject(final Class clazz, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getConstructor(clazz, DataType.getPrimitive(arguments)).newInstance(arguments); + } + + public static Object instantiateObject(final String className, final PackageType packageType, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { + return instantiateObject(packageType.getClass(className), arguments); + } + + public static Method getMethod(final Class clazz, final String methodName, final Class... parameterTypes) throws NoSuchMethodException { + final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes); + Method[] methods; + for (int length = (methods = clazz.getMethods()).length, i = 0; i < length; ++i) { + final Method method = methods[i]; + if (method.getName().equals(methodName) && DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) { + return method; + } + } + throw new NoSuchMethodException("There is no such method in this class with the specified name and parameter types"); + } + + public static Method getMethod(final String className, final PackageType packageType, final String methodName, final Class... parameterTypes) throws NoSuchMethodException, ClassNotFoundException { + return getMethod(packageType.getClass(className), methodName, parameterTypes); + } + + public static Object invokeMethod(final Object instance, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getMethod(instance.getClass(), methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments); + } + + public static Object invokeMethod(final Object instance, final Class clazz, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { + return getMethod(clazz, methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments); + } + + public static Object invokeMethod(final Object instance, final String className, final PackageType packageType, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { + return invokeMethod(instance, packageType.getClass(className), methodName, arguments); + } + + public static Field getField(final Class clazz, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException { + final Field field = declared ? clazz.getDeclaredField(fieldName) : clazz.getField(fieldName); + field.setAccessible(true); + return field; + } + + public static Field getField(final String className, final PackageType packageType, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException, ClassNotFoundException { + return getField(packageType.getClass(className), declared, fieldName); + } + + public static Object getValue(final Object instance, final Class clazz, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + return getField(clazz, declared, fieldName).get(instance); + } + + public static Object getValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { + return getValue(instance, packageType.getClass(className), declared, fieldName); + } + + public static Object getValue(final Object instance, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + return getValue(instance, instance.getClass(), declared, fieldName); + } + + public static void setValue(final Object instance, final Class clazz, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + getField(clazz, declared, fieldName).set(instance, value); + } + + public static void setValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException { + setValue(instance, packageType.getClass(className), declared, fieldName, value); + } + + public static void setValue(final Object instance, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + setValue(instance, instance.getClass(), declared, fieldName, value); + } + + public enum DataType + { + BYTE((Class)Byte.TYPE, (Class)Byte.class), + SHORT((Class)Short.TYPE, (Class)Short.class), + INTEGER((Class)Integer.TYPE, (Class)Integer.class), + LONG((Class)Long.TYPE, (Class)Long.class), + CHARACTER((Class)Character.TYPE, (Class)Character.class), + FLOAT((Class)Float.TYPE, (Class)Float.class), + DOUBLE((Class)Double.TYPE, (Class)Double.class), + BOOLEAN((Class)Boolean.TYPE, (Class)Boolean.class); + + private static final Map, DataType> CLASS_MAP; + private final Class primitive; + private final Class reference; + + static { + CLASS_MAP = new HashMap, DataType>(); + DataType[] values; + for (int length = (values = values()).length, i = 0; i < length; ++i) { + final DataType type = values[i]; + DataType.CLASS_MAP.put(type.primitive, type); + DataType.CLASS_MAP.put(type.reference, type); + } + } + + private DataType(final Class primitive, final Class reference) { + this.primitive = primitive; + this.reference = reference; + } + + public Class getPrimitive() { + return this.primitive; + } + + public Class getReference() { + return this.reference; + } + + public static DataType fromClass(final Class clazz) { + return DataType.CLASS_MAP.get(clazz); + } + + public static Class getPrimitive(final Class clazz) { + final DataType type = fromClass(clazz); + return (type == null) ? clazz : type.getPrimitive(); + } + + public static Class getReference(final Class clazz) { + final DataType type = fromClass(clazz); + return (type == null) ? clazz : type.getReference(); + } + + public static Class[] getPrimitive(final Class[] classes) { + final int length = (classes == null) ? 0 : classes.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getPrimitive(classes[index]); + } + return (Class[])types; + } + + public static Class[] getReference(final Class[] classes) { + final int length = (classes == null) ? 0 : classes.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getReference(classes[index]); + } + return (Class[])types; + } + + public static Class[] getPrimitive(final Object[] objects) { + final int length = (objects == null) ? 0 : objects.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getPrimitive(objects[index].getClass()); + } + return (Class[])types; + } + + public static Class[] getReference(final Object[] objects) { + final int length = (objects == null) ? 0 : objects.length; + final Class[] types = new Class[length]; + for (int index = 0; index < length; ++index) { + types[index] = getReference(objects[index].getClass()); + } + return (Class[])types; + } + + public static boolean compare(final Class[] primary, final Class[] secondary) { + if (primary == null || secondary == null || primary.length != secondary.length) { + return false; + } + for (int index = 0; index < primary.length; ++index) { + final Class primaryClass = primary[index]; + final Class secondaryClass = secondary[index]; + if (!primaryClass.equals(secondaryClass) && !primaryClass.isAssignableFrom(secondaryClass)) { + return false; + } + } + return true; + } + } + + public enum PackageType + { + MINECRAFT_SERVER("MINECRAFT_SERVER", 0, "net.minecraft.server." + getServerVersion()), + CRAFTBUKKIT("CRAFTBUKKIT", 1, "org.bukkit.craftbukkit." + getServerVersion()), + CRAFTBUKKIT_BLOCK("CRAFTBUKKIT_BLOCK", 2, PackageType.CRAFTBUKKIT, "block"), + CRAFTBUKKIT_CHUNKIO("CRAFTBUKKIT_CHUNKIO", 3, PackageType.CRAFTBUKKIT, "chunkio"), + CRAFTBUKKIT_COMMAND("CRAFTBUKKIT_COMMAND", 4, PackageType.CRAFTBUKKIT, "command"), + CRAFTBUKKIT_CONVERSATIONS("CRAFTBUKKIT_CONVERSATIONS", 5, PackageType.CRAFTBUKKIT, "conversations"), + CRAFTBUKKIT_ENCHANTMENS("CRAFTBUKKIT_ENCHANTMENS", 6, PackageType.CRAFTBUKKIT, "enchantments"), + CRAFTBUKKIT_ENTITY("CRAFTBUKKIT_ENTITY", 7, PackageType.CRAFTBUKKIT, "entity"), + CRAFTBUKKIT_EVENT("CRAFTBUKKIT_EVENT", 8, PackageType.CRAFTBUKKIT, "event"), + CRAFTBUKKIT_GENERATOR("CRAFTBUKKIT_GENERATOR", 9, PackageType.CRAFTBUKKIT, "generator"), + CRAFTBUKKIT_HELP("CRAFTBUKKIT_HELP", 10, PackageType.CRAFTBUKKIT, "help"), + CRAFTBUKKIT_INVENTORY("CRAFTBUKKIT_INVENTORY", 11, PackageType.CRAFTBUKKIT, "inventory"), + CRAFTBUKKIT_MAP("CRAFTBUKKIT_MAP", 12, PackageType.CRAFTBUKKIT, "map"), + CRAFTBUKKIT_METADATA("CRAFTBUKKIT_METADATA", 13, PackageType.CRAFTBUKKIT, "metadata"), + CRAFTBUKKIT_POTION("CRAFTBUKKIT_POTION", 14, PackageType.CRAFTBUKKIT, "potion"), + CRAFTBUKKIT_PROJECTILES("CRAFTBUKKIT_PROJECTILES", 15, PackageType.CRAFTBUKKIT, "projectiles"), + CRAFTBUKKIT_SCHEDULER("CRAFTBUKKIT_SCHEDULER", 16, PackageType.CRAFTBUKKIT, "scheduler"), + CRAFTBUKKIT_SCOREBOARD("CRAFTBUKKIT_SCOREBOARD", 17, PackageType.CRAFTBUKKIT, "scoreboard"), + CRAFTBUKKIT_UPDATER("CRAFTBUKKIT_UPDATER", 18, PackageType.CRAFTBUKKIT, "updater"), + CRAFTBUKKIT_UTIL("CRAFTBUKKIT_UTIL", 19, PackageType.CRAFTBUKKIT, "util"); + + private final String path; + + private PackageType(final String s, final int n, final String path) { + this.path = path; + } + + private PackageType(final String s, final int n, final PackageType parent, final String path) { + this(s, n, parent + "." + path); + } + + public String getPath() { + return this.path; + } + + public Class getClass(final String className) throws ClassNotFoundException { + return Class.forName(this + "." + className); + } + + @Override + public String toString() { + return this.path; + } + + public static String getServerVersion() { + return Bukkit.getServer().getClass().getPackage().getName().substring(23); + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/utils/RegionUtils.java b/PrevailBunkers/src/com/prevailpots/bunkers/utils/RegionUtils.java new file mode 100644 index 0000000..71d2fb4 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/utils/RegionUtils.java @@ -0,0 +1,17 @@ +package com.prevailpots.bunkers.utils; + +import com.prevailpots.bunkers.config.*; +import com.prevailpots.bunkers.game.*; +import com.sk89q.worldedit.bukkit.selections.*; + +import org.bukkit.*; + +public class RegionUtils +{ + public static CuboidSelection getSelectionFromRegion(final World w, final Team team) { + final Location p1 = new Location(w, ConfigurationService.getRegions(team)[0].getX(), 0.0, ConfigurationService.getRegions(team)[0].getZ()); + final Location p2 = new Location(w, ConfigurationService.getRegions(team)[1].getX(), 255.0, ConfigurationService.getRegions(team)[1].getZ()); + final CuboidSelection sel = new CuboidSelection(w, p1, p2); + return sel; + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/world/ConfigManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/world/ConfigManager.java new file mode 100644 index 0000000..4228bd0 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/world/ConfigManager.java @@ -0,0 +1,43 @@ +package com.prevailpots.bunkers.world; + +import org.bukkit.configuration.file.*; +import java.io.*; + +public class ConfigManager +{ + String path; + String plugin; + File Data; + FileConfiguration DataFile; + + public ConfigManager(final String plugin, final String path) { + this.path = null; + this.plugin = null; + this.path = path; + this.plugin = plugin; + this.Data = new File("plugins/" + plugin + "/" + path + ".yml"); + this.DataFile = (FileConfiguration)YamlConfiguration.loadConfiguration(this.Data); + } + + public void createFile() { + try { + this.Data.createNewFile(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + public FileConfiguration getFile() { + return this.DataFile; + } + + public void saveFile() { + try { + this.getFile().save(this.Data); + } + catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/PrevailBunkers/src/com/prevailpots/bunkers/world/WorldManager.java b/PrevailBunkers/src/com/prevailpots/bunkers/world/WorldManager.java new file mode 100644 index 0000000..f444050 --- /dev/null +++ b/PrevailBunkers/src/com/prevailpots/bunkers/world/WorldManager.java @@ -0,0 +1,62 @@ +package com.prevailpots.bunkers.world; + +import org.bukkit.*; +import java.util.*; +import java.io.*; + +public class WorldManager +{ + public void unloadWorld(final World world) { + if (!world.equals(null)) { + Bukkit.getServer().unloadWorld(world, true); + } + } + + public boolean deleteWorld(final File path) { + if (path.exists()) { + final File[] files = path.listFiles(); + for (int i = 0; i < files.length; ++i) { + if (files[i].isDirectory()) { + this.deleteWorld(files[i]); + } + else { + files[i].delete(); + } + } + } + return path.delete(); + } + + public void copyWorld(final File source, final File target) { + try { + final ArrayList ignore = new ArrayList(Arrays.asList("uid.dat", "session.lock")); + if (!ignore.contains(source.getName())) { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdirs(); + } + final String[] files = source.list(); + String[] array; + for (int length2 = (array = files).length, i = 0; i < length2; ++i) { + final String file = array[i]; + final File srcFile = new File(source, file); + final File destFile = new File(target, file); + this.copyWorld(srcFile, destFile); + } + } + else { + final InputStream in = new FileInputStream(source); + final OutputStream out = new FileOutputStream(target); + final byte[] buffer = new byte[1024]; + int length; + while ((length = in.read(buffer)) > 0) { + out.write(buffer, 0, length); + } + in.close(); + out.close(); + } + } + } + catch (IOException ex) {} + } +} diff --git a/PrevailBunkers/src/plugin.yml b/PrevailBunkers/src/plugin.yml new file mode 100644 index 0000000..2f72c4b --- /dev/null +++ b/PrevailBunkers/src/plugin.yml @@ -0,0 +1,19 @@ +name: PrevailBunkers +main: com.prevailpots.bunkers.Core +author: s3ries +version: 1 +dependencies: [WorldEdit, PermissionsEx] +commands: + setlobbyspawn: + description: 'Sets the lobby spawn.' + aliases: [sls] + usage: '/setlobbyspawn' + team: + description: 'Team command.' + aliases: [f, t] + usage: '/team ' + forcestart: + description: 'Starts game no matter what (Might be unsafe).' + aliases: [fs] + usage: '/forcestart' + removetab: \ No newline at end of file diff --git a/PrevailHCF/.classpath b/PrevailHCF/.classpath new file mode 100644 index 0000000..eb1b5bf --- /dev/null +++ b/PrevailHCF/.classpath @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/PrevailHCF/.idea/compiler.xml b/PrevailHCF/.idea/compiler.xml new file mode 100644 index 0000000..54ddc25 --- /dev/null +++ b/PrevailHCF/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/encodings.xml b/PrevailHCF/.idea/encodings.xml new file mode 100644 index 0000000..b26911b --- /dev/null +++ b/PrevailHCF/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml b/PrevailHCF/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml new file mode 100644 index 0000000..30ff5cb --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__cglib_cglib_nodep_2_2_2.xml b/PrevailHCF/.idea/libraries/Maven__cglib_cglib_nodep_2_2_2.xml new file mode 100644 index 0000000..5145a35 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__cglib_cglib_nodep_2_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_comphenix_executors_BukkitExecutors_1_1_SNAPSHOT.xml b/PrevailHCF/.idea/libraries/Maven__com_comphenix_executors_BukkitExecutors_1_1_SNAPSHOT.xml new file mode 100644 index 0000000..0832d01 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_comphenix_executors_BukkitExecutors_1_1_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_3_6_4.xml b/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_3_6_4.xml new file mode 100644 index 0000000..72a9e3a --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_3_6_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_API_4_2_1.xml b/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_API_4_2_1.xml new file mode 100644 index 0000000..8589592 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_comphenix_protocol_ProtocolLib_API_4_2_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml new file mode 100644 index 0000000..0b4110e --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml new file mode 100644 index 0000000..dd95d35 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml new file mode 100644 index 0000000..83e4ab9 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_google_guava_guava_18_0.xml b/PrevailHCF/.idea/libraries/Maven__com_google_guava_guava_18_0.xml new file mode 100644 index 0000000..bbd71d7 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_google_guava_guava_18_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_googlecode_javaewah_JavaEWAH_0_7_9.xml b/PrevailHCF/.idea/libraries/Maven__com_googlecode_javaewah_JavaEWAH_0_7_9.xml new file mode 100644 index 0000000..10a0400 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_googlecode_javaewah_JavaEWAH_0_7_9.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_intellij_annotations_12_0.xml b/PrevailHCF/.idea/libraries/Maven__com_intellij_annotations_12_0.xml new file mode 100644 index 0000000..a5eed72 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_intellij_annotations_12_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_jcraft_jsch_0_1_50.xml b/PrevailHCF/.idea/libraries/Maven__com_jcraft_jsch_0_1_50.xml new file mode 100644 index 0000000..9784d1d --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_jcraft_jsch_0_1_50.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__com_sk89q_worldedit_5_6_3.xml b/PrevailHCF/.idea/libraries/Maven__com_sk89q_worldedit_5_6_3.xml new file mode 100644 index 0000000..d187baa --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__com_sk89q_worldedit_5_6_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__commons_codec_commons_codec_1_4.xml b/PrevailHCF/.idea/libraries/Maven__commons_codec_commons_codec_1_4.xml new file mode 100644 index 0000000..2b149c4 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__commons_codec_commons_codec_1_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml b/PrevailHCF/.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml new file mode 100644 index 0000000..b770f56 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__de_schlichtherle_truezip_6_8_3.xml b/PrevailHCF/.idea/libraries/Maven__de_schlichtherle_truezip_6_8_3.xml new file mode 100644 index 0000000..31ae2cd --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__de_schlichtherle_truezip_6_8_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml b/PrevailHCF/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml new file mode 100644 index 0000000..e367958 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__javax_enterprise_cdi_api_1_0.xml b/PrevailHCF/.idea/libraries/Maven__javax_enterprise_cdi_api_1_0.xml new file mode 100644 index 0000000..e0d795e --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__javax_enterprise_cdi_api_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__javax_inject_javax_inject_1.xml b/PrevailHCF/.idea/libraries/Maven__javax_inject_javax_inject_1.xml new file mode 100644 index 0000000..93cf65a --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__javax_inject_javax_inject_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__joda_time_joda_time_2_7.xml b/PrevailHCF/.idea/libraries/Maven__joda_time_joda_time_2_7.xml new file mode 100644 index 0000000..1259eca --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__joda_time_joda_time_2_7.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_0.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_0.xml new file mode 100644 index 0000000..28cee2a --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml new file mode 100644 index 0000000..2970b5e --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_1_3.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_1_3.xml new file mode 100644 index 0000000..1fe25f7 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_1_4.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_1_4.xml new file mode 100644 index 0000000..02876d5 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_1_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_aether_provider_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_aether_provider_3_1_1.xml new file mode 100644 index 0000000..9dc3833 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_aether_provider_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_artifact_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_artifact_3_1_1.xml new file mode 100644 index 0000000..8e78951 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_artifact_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_core_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_core_3_1_1.xml new file mode 100644 index 0000000..7702e3c --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_core_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_3_1_1.xml new file mode 100644 index 0000000..2e0b0b2 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_builder_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_builder_3_1_1.xml new file mode 100644 index 0000000..3ed9c88 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_model_builder_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_plugin_api_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_plugin_api_3_1_1.xml new file mode 100644 index 0000000..38c3f8f --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_plugin_api_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_repository_metadata_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_repository_metadata_3_1_1.xml new file mode 100644 index 0000000..ad2ff46 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_repository_metadata_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_3_1_1.xml new file mode 100644 index 0000000..355b4c1 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_builder_3_1_1.xml b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_builder_3_1_1.xml new file mode 100644 index 0000000..5078a19 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_apache_maven_maven_settings_builder_3_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_classworlds_2_5_1.xml b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_classworlds_2_5_1.xml new file mode 100644 index 0000000..b000b46 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_classworlds_2_5_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_component_annotations_1_5_5.xml b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_component_annotations_1_5_5.xml new file mode 100644 index 0000000..9292317 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_component_annotations_1_5_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_interpolation_1_19.xml b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_interpolation_1_19.xml new file mode 100644 index 0000000..ea66ee8 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_interpolation_1_19.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_utils_3_0_15.xml b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_utils_3_0_15.xml new file mode 100644 index 0000000..04f7a21 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_codehaus_plexus_plexus_utils_3_0_15.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_api_0_9_0_M2.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_api_0_9_0_M2.xml new file mode 100644 index 0000000..6f25aee --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_api_0_9_0_M2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_impl_0_9_0_M2.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_impl_0_9_0_M2.xml new file mode 100644 index 0000000..22ae323 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_impl_0_9_0_M2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_spi_0_9_0_M2.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_spi_0_9_0_M2.xml new file mode 100644 index 0000000..510e90b --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_spi_0_9_0_M2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_util_0_9_0_M2.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_util_0_9_0_M2.xml new file mode 100644 index 0000000..459a75f --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_aether_aether_util_0_9_0_M2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_3_7_0_201502260915_r.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_3_7_0_201502260915_r.xml new file mode 100644 index 0000000..f331838 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_jgit_org_eclipse_jgit_3_7_0_201502260915_r.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_inject_0_0_0_M5.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_inject_0_0_0_M5.xml new file mode 100644 index 0000000..d9455fa --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_inject_0_0_0_M5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_plexus_0_0_0_M5.xml b/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_plexus_0_0_0_M5.xml new file mode 100644 index 0000000..d881df1 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_plexus_0_0_0_M5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_2.xml b/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_2.xml new file mode 100644 index 0000000..9fd4899 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_2.xml b/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_2.xml new file mode 100644 index 0000000..f6acf2b --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_mongodb_mongo_java_driver_3_4_0.xml b/PrevailHCF/.idea/libraries/Maven__org_mongodb_mongo_java_driver_3_4_0.xml new file mode 100644 index 0000000..e670f92 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_mongodb_mongo_java_driver_3_4_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_projectlombok_lombok_1_16_12.xml b/PrevailHCF/.idea/libraries/Maven__org_projectlombok_lombok_1_16_12.xml new file mode 100644 index 0000000..0efd40f --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_projectlombok_lombok_1_16_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_12.xml b/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_12.xml new file mode 100644 index 0000000..411efc6 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_12.xml b/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_12.xml new file mode 100644 index 0000000..c3888fb --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_cipher_1_4.xml b/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_cipher_1_4.xml new file mode 100644 index 0000000..7316193 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_cipher_1_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_sec_dispatcher_1_3.xml b/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_sec_dispatcher_1_3.xml new file mode 100644 index 0000000..bb61d0e --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_sonatype_plexus_plexus_sec_dispatcher_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_sonatype_sisu_sisu_guice_no_aop_3_1_0.xml b/PrevailHCF/.idea/libraries/Maven__org_sonatype_sisu_sisu_guice_no_aop_3_1_0.xml new file mode 100644 index 0000000..176a83f --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_sonatype_sisu_sisu_guice_no_aop_3_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__org_spigotmc_spigot_api_1_7_10_R0_1_SNAPSHOT.xml b/PrevailHCF/.idea/libraries/Maven__org_spigotmc_spigot_api_1_7_10_R0_1_SNAPSHOT.xml new file mode 100644 index 0000000..25020bc --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__org_spigotmc_spigot_api_1_7_10_R0_1_SNAPSHOT.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__pl_project13_maven_git_commit_id_plugin_2_1_15.xml b/PrevailHCF/.idea/libraries/Maven__pl_project13_maven_git_commit_id_plugin_2_1_15.xml new file mode 100644 index 0000000..bf5829c --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__pl_project13_maven_git_commit_id_plugin_2_1_15.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml b/PrevailHCF/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml new file mode 100644 index 0000000..f12195b --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__redis_clients_jedis_2_8_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/libraries/Maven__rhino_js_1_7R2.xml b/PrevailHCF/.idea/libraries/Maven__rhino_js_1_7R2.xml new file mode 100644 index 0000000..73d4473 --- /dev/null +++ b/PrevailHCF/.idea/libraries/Maven__rhino_js_1_7R2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/misc.xml b/PrevailHCF/.idea/misc.xml new file mode 100644 index 0000000..0f82c90 --- /dev/null +++ b/PrevailHCF/.idea/misc.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + 1.8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/modules.xml b/PrevailHCF/.idea/modules.xml new file mode 100644 index 0000000..65f08b0 --- /dev/null +++ b/PrevailHCF/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.idea/workspace.xml b/PrevailHCF/.idea/workspace.xml new file mode 100644 index 0000000..d146f56 --- /dev/null +++ b/PrevailHCF/.idea/workspace.xml @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + com.customhcf + + + + com.customhcf + + + C:\Users\Ãlvaro Mariano\OneDrive\HCF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496080324954 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PrevailHCF/.project b/PrevailHCF/.project new file mode 100644 index 0000000..bbf8d9a --- /dev/null +++ b/PrevailHCF/.project @@ -0,0 +1,17 @@ + + + PrevailHCF + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/PrevailHCF/.settings/org.eclipse.jdt.core.prefs b/PrevailHCF/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/PrevailHCF/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/PrevailHCF/bin/balances.yml b/PrevailHCF/bin/balances.yml new file mode 100644 index 0000000..e69de29 diff --git a/PrevailHCF/bin/com/alexandeh/kraken/Kraken$1.class b/PrevailHCF/bin/com/alexandeh/kraken/Kraken$1.class new file mode 100644 index 0000000..e04f0c9 Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/Kraken$1.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/Kraken$2.class b/PrevailHCF/bin/com/alexandeh/kraken/Kraken$2.class new file mode 100644 index 0000000..13ade62 Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/Kraken$2.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/Kraken.class b/PrevailHCF/bin/com/alexandeh/kraken/Kraken.class new file mode 100644 index 0000000..86baa0c Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/Kraken.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/KrakenOptions.class b/PrevailHCF/bin/com/alexandeh/kraken/KrakenOptions.class new file mode 100644 index 0000000..3c3fca3 Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/KrakenOptions.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/tab/PlayerTab.class b/PrevailHCF/bin/com/alexandeh/kraken/tab/PlayerTab.class new file mode 100644 index 0000000..f68d5ea Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/tab/PlayerTab.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/tab/TabEntry.class b/PrevailHCF/bin/com/alexandeh/kraken/tab/TabEntry.class new file mode 100644 index 0000000..75fd1c7 Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/tab/TabEntry.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.class b/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.class new file mode 100644 index 0000000..19b529c Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.class differ diff --git a/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.class b/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.class new file mode 100644 index 0000000..341d324 Binary files /dev/null and b/PrevailHCF/bin/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/ConfigurationService.class b/PrevailHCF/bin/com/prevailpots/hcf/ConfigurationService.class new file mode 100644 index 0000000..447c20e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/ConfigurationService.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/Cooldowns.class b/PrevailHCF/bin/com/prevailpots/hcf/Cooldowns.class new file mode 100644 index 0000000..3f63b33 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/Cooldowns.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$1.class b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$1.class new file mode 100644 index 0000000..4cf597e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$2.class b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$2.class new file mode 100644 index 0000000..b5d2cb1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats.class b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats.class new file mode 100644 index 0000000..e3fa11e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/DateTimeFormats.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCF$1.class b/PrevailHCF/bin/com/prevailpots/hcf/HCF$1.class new file mode 100644 index 0000000..fb23056 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCF$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCF$2.class b/PrevailHCF/bin/com/prevailpots/hcf/HCF$2.class new file mode 100644 index 0000000..b39e9d0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCF$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCF$3$1.class b/PrevailHCF/bin/com/prevailpots/hcf/HCF$3$1.class new file mode 100644 index 0000000..9856821 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCF$3$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCF$3.class b/PrevailHCF/bin/com/prevailpots/hcf/HCF$3.class new file mode 100644 index 0000000..b687e0d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCF$3.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCF.class b/PrevailHCF/bin/com/prevailpots/hcf/HCF.class new file mode 100644 index 0000000..9641d1a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCF.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/HCFHandler.class b/PrevailHCF/bin/com/prevailpots/hcf/HCFHandler.class new file mode 100644 index 0000000..4149c02 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/HCFHandler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/Message.class b/PrevailHCF/bin/com/prevailpots/hcf/Message.class new file mode 100644 index 0000000..ba5c3ee Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/Message.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyCommand.class new file mode 100644 index 0000000..240b091 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyManager.class b/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyManager.class new file mode 100644 index 0000000..d7cfcdf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/balance/EconomyManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/balance/FlatFileEconomyManager.class b/PrevailHCF/bin/com/prevailpots/hcf/balance/FlatFileEconomyManager.class new file mode 100644 index 0000000..9804632 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/balance/FlatFileEconomyManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/balance/PayCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/balance/PayCommand.class new file mode 100644 index 0000000..66afe7e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/balance/PayCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/balance/ShopSignListener.class b/PrevailHCF/bin/com/prevailpots/hcf/balance/ShopSignListener.class new file mode 100644 index 0000000..253d060 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/balance/ShopSignListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/ClassType.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/ClassType.class new file mode 100644 index 0000000..e23e53e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/ClassType.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClass.class new file mode 100644 index 0000000..1cd9bb9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClassManager.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClassManager.class new file mode 100644 index 0000000..60d0081 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/PvpClassManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.class new file mode 100644 index 0000000..7f82b9d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.class new file mode 100644 index 0000000..aaf47c0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/listener/AttemptEquip.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/listener/AttemptEquip.class new file mode 100644 index 0000000..3f09f84 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/listener/AttemptEquip.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass$1.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass$1.class new file mode 100644 index 0000000..1db758f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass.class new file mode 100644 index 0000000..cb18759 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/archer/ArcherClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass$1.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass$1.class new file mode 100644 index 0000000..5457204 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass.class new file mode 100644 index 0000000..af7abdb Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardData.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardData.class new file mode 100644 index 0000000..115ed86 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardData.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardEffect.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardEffect.class new file mode 100644 index 0000000..4134cab Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardEffect.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardRestorer.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardRestorer.class new file mode 100644 index 0000000..3e6b272 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/bard/BardRestorer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$1.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$1.class new file mode 100644 index 0000000..ff70612 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$2.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$2.class new file mode 100644 index 0000000..1944baa Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass.class new file mode 100644 index 0000000..bdc3be4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/AssassinClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass$1.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass$1.class new file mode 100644 index 0000000..b8980a0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass.class new file mode 100644 index 0000000..bced12b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/chain/RogueClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/classes/type/miner/MinerClass.class b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/miner/MinerClass.class new file mode 100644 index 0000000..35158ff Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/classes/type/miner/MinerClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogEntry.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogEntry.class new file mode 100644 index 0000000..3634095 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogEntry.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener$LoggerRemovable.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener$LoggerRemovable.class new file mode 100644 index 0000000..dd14b61 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener$LoggerRemovable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener.class new file mode 100644 index 0000000..73fdb22 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CombatLogListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CustomEntityRegistration.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CustomEntityRegistration.class new file mode 100644 index 0000000..4f7d902 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/CustomEntityRegistration.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerDeathEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerDeathEvent.class new file mode 100644 index 0000000..f672f68 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerDeathEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$1.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$1.class new file mode 100644 index 0000000..78fbafa Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$PlayerNmsResult.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$PlayerNmsResult.class new file mode 100644 index 0000000..3c9898b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity$PlayerNmsResult.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity.class new file mode 100644 index 0000000..3156228 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerEntity.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.class new file mode 100644 index 0000000..8fceded Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/AlphaRevives.class b/PrevailHCF/bin/com/prevailpots/hcf/command/AlphaRevives.class new file mode 100644 index 0000000..197d458 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/AlphaRevives.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/CobblestoneCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/CobblestoneCommand.class new file mode 100644 index 0000000..cefaad1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/CobblestoneCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/CoordsCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/CoordsCommand.class new file mode 100644 index 0000000..907a667 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/CoordsCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/CrowbarCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/CrowbarCommand.class new file mode 100644 index 0000000..18575a5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/CrowbarCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/FocusCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/FocusCommand.class new file mode 100644 index 0000000..414e039 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/FocusCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/GoppleCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/GoppleCommand.class new file mode 100644 index 0000000..e4dd72e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/GoppleCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/HelpCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/HelpCommand.class new file mode 100644 index 0000000..52783b7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/HelpCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/KitCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/KitCommand.class new file mode 100644 index 0000000..94d304c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/KitCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ListCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ListCommand.class new file mode 100644 index 0000000..9f34187 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ListCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/LivesCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/LivesCommand.class new file mode 100644 index 0000000..0163eb7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/LivesCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/LocationCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/LocationCommand.class new file mode 100644 index 0000000..c323159 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/LocationCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/LogoutCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/LogoutCommand.class new file mode 100644 index 0000000..661497b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/LogoutCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/MapKitCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/MapKitCommand.class new file mode 100644 index 0000000..841d2ef Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/MapKitCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/MobdropsCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/MobdropsCommand.class new file mode 100644 index 0000000..5689694 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/MobdropsCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/PexPermissionFixCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/PexPermissionFixCommand.class new file mode 100644 index 0000000..e511b36 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/PexPermissionFixCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/PlayerStatsCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/PlayerStatsCommand.class new file mode 100644 index 0000000..46e4286 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/PlayerStatsCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/PvpTimerCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/PvpTimerCommand.class new file mode 100644 index 0000000..b3e1ccd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/PvpTimerCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/RandomCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/RandomCommand.class new file mode 100644 index 0000000..24edf77 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/RandomCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand$Rank.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand$Rank.class new file mode 100644 index 0000000..783f544 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand$Rank.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand.class new file mode 100644 index 0000000..8304de5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ReclaimCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/RefundCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/RefundCommand.class new file mode 100644 index 0000000..218a39c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/RefundCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand$1.class b/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand$1.class new file mode 100644 index 0000000..9b632f6 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand.class new file mode 100644 index 0000000..e1a1a06 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/RemoveTabCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/SOTWCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/SOTWCommand.class new file mode 100644 index 0000000..928f324 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/SOTWCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ServerTimeCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ServerTimeCommand.class new file mode 100644 index 0000000..c429615 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ServerTimeCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/SetBorderCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/SetBorderCommand.class new file mode 100644 index 0000000..edcce7f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/SetBorderCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/SpawnCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/SpawnCommand.class new file mode 100644 index 0000000..10c63d1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/SpawnCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/TabCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/TabCommand.class new file mode 100644 index 0000000..ec3724b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/TabCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleDonorOnly.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleDonorOnly.class new file mode 100644 index 0000000..7dc54cc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleDonorOnly.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleEndCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleEndCommand.class new file mode 100644 index 0000000..fb6df54 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/command/ToggleEndCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/crowbar/Crowbar.class b/PrevailHCF/bin/com/prevailpots/hcf/crowbar/Crowbar.class new file mode 100644 index 0000000..e33949b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/crowbar/Crowbar.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/Deathban.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/Deathban.class new file mode 100644 index 0000000..0339a4b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/Deathban.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$1.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$1.class new file mode 100644 index 0000000..5a12253 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$LoginMessageRunnable.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$LoginMessageRunnable.class new file mode 100644 index 0000000..15990d8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener$LoginMessageRunnable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener.class new file mode 100644 index 0000000..ce94989 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanManager.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanManager.class new file mode 100644 index 0000000..da9f283 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/DeathbanManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.class b/PrevailHCF/bin/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.class new file mode 100644 index 0000000..ee97a65 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionExecutor.class new file mode 100644 index 0000000..c4dfdd4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionManager.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionManager.class new file mode 100644 index 0000000..a199e11 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionMember.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionMember.class new file mode 100644 index 0000000..5355889 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/FactionMember.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager$1.class new file mode 100644 index 0000000..60a9bd1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager.class new file mode 100644 index 0000000..b167b3c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/FlatFileFactionManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/LandMap.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/LandMap.class new file mode 100644 index 0000000..a4ba900 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/LandMap.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument$1.class new file mode 100644 index 0000000..250e552 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.class new file mode 100644 index 0000000..23ae45e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAllyArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAllyArgument.class new file mode 100644 index 0000000..8503ddc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAllyArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.class new file mode 100644 index 0000000..8dbe4d6 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionChatArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionChatArgument.class new file mode 100644 index 0000000..e6af1c4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionChatArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimArgument.class new file mode 100644 index 0000000..de7ad20 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.class new file mode 100644 index 0000000..b75f172 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.class new file mode 100644 index 0000000..5d402b4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument$1.class new file mode 100644 index 0000000..8dd0235 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument.class new file mode 100644 index 0000000..322c478 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionCreateArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.class new file mode 100644 index 0000000..f8eb4dc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDepositArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDepositArgument.class new file mode 100644 index 0000000..cdffcaa Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDepositArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.class new file mode 100644 index 0000000..db4cf2e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHelpArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHelpArgument.class new file mode 100644 index 0000000..7947b0b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHelpArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHomeArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHomeArgument.class new file mode 100644 index 0000000..06bdc94 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionHomeArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInviteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInviteArgument.class new file mode 100644 index 0000000..bf9e296 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInviteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.class new file mode 100644 index 0000000..e93b4de Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionKickArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionKickArgument.class new file mode 100644 index 0000000..67ba5a0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionKickArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.class new file mode 100644 index 0000000..ecaa5b2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument$1.class new file mode 100644 index 0000000..843a948 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.class new file mode 100644 index 0000000..d12372b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument$1.class new file mode 100644 index 0000000..9f23cfc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument.class new file mode 100644 index 0000000..8315e8b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionListArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMapArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMapArgument.class new file mode 100644 index 0000000..bac2f0d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMapArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMessageArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMessageArgument.class new file mode 100644 index 0000000..3d93669 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionMessageArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionOpenArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionOpenArgument.class new file mode 100644 index 0000000..952040f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionOpenArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.class new file mode 100644 index 0000000..e3c7f29 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionRenameArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionRenameArgument.class new file mode 100644 index 0000000..0d9a286 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionRenameArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.class new file mode 100644 index 0000000..5dad7a7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionShowArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionShowArgument.class new file mode 100644 index 0000000..56c9514 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionShowArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionStuckArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionStuckArgument.class new file mode 100644 index 0000000..61300c2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionStuckArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.class new file mode 100644 index 0000000..5d0bbb1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.class new file mode 100644 index 0000000..ab01732 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.class new file mode 100644 index 0000000..9ffd5f3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionVersionArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionVersionArgument.class new file mode 100644 index 0000000..16e6b98 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionVersionArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.class new file mode 100644 index 0000000..97146e9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.class new file mode 100644 index 0000000..0eacbdc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.class new file mode 100644 index 0000000..86f8a77 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument$ClaimClearAllPrompt.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument$ClaimClearAllPrompt.class new file mode 100644 index 0000000..66adeaf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument$ClaimClearAllPrompt.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.class new file mode 100644 index 0000000..f80e839 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.class new file mode 100644 index 0000000..9e294dc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.class new file mode 100644 index 0000000..fb1809e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.class new file mode 100644 index 0000000..5141c03 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.class new file mode 100644 index 0000000..2fc381b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.class new file mode 100644 index 0000000..225f234 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument$FactionPrompt.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument$FactionPrompt.class new file mode 100644 index 0000000..98fbe98 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument$FactionPrompt.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.class new file mode 100644 index 0000000..86d7a3a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.class new file mode 100644 index 0000000..9484eb2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument$RemoveAllPrompt.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument$RemoveAllPrompt.class new file mode 100644 index 0000000..efbe64f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument$RemoveAllPrompt.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.class new file mode 100644 index 0000000..4c0946d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.class new file mode 100644 index 0000000..234610b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.class new file mode 100644 index 0000000..366be40 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.class new file mode 100644 index 0000000..acd1cdd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.class new file mode 100644 index 0000000..6afc2b9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Claim.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Claim.class new file mode 100644 index 0000000..44a15a9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Claim.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimHandler.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimHandler.class new file mode 100644 index 0000000..63669cb Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimHandler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimSelection.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimSelection.class new file mode 100644 index 0000000..11e15a9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimSelection.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$1.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$1.class new file mode 100644 index 0000000..a988728 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$2.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$2.class new file mode 100644 index 0000000..8dc05c9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener.class new file mode 100644 index 0000000..f0b79a7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/ClaimWandListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Subclaim.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Subclaim.class new file mode 100644 index 0000000..dfd884f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/claim/Subclaim.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.class new file mode 100644 index 0000000..9abbcec Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.class new file mode 100644 index 0000000..3dc6c76 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionChatEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionChatEvent.class new file mode 100644 index 0000000..3ecd7e1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionChatEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.class new file mode 100644 index 0000000..58795fd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.class new file mode 100644 index 0000000..d48a4f5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionCreateEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionCreateEvent.class new file mode 100644 index 0000000..92780e0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionCreateEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent$DtrUpdateCause.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent$DtrUpdateCause.class new file mode 100644 index 0000000..6c15464 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent$DtrUpdateCause.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.class new file mode 100644 index 0000000..dc8ae23 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionEvent.class new file mode 100644 index 0000000..42ff21d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.class new file mode 100644 index 0000000..68809fc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.class new file mode 100644 index 0000000..7c85d21 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.class new file mode 100644 index 0000000..8f98b30 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRemoveEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRemoveEvent.class new file mode 100644 index 0000000..2d65d08 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRemoveEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRenameEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRenameEvent.class new file mode 100644 index 0000000..9475e67 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/FactionRenameEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent$EnterCause.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent$EnterCause.class new file mode 100644 index 0000000..b364aef Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent$EnterCause.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.class new file mode 100644 index 0000000..d04f6ab Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.class new file mode 100644 index 0000000..b1a2eee Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.class new file mode 100644 index 0000000..3ce32d7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.class new file mode 100644 index 0000000..8a46dbf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.class new file mode 100644 index 0000000..be80c55 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.class new file mode 100644 index 0000000..290e755 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.class new file mode 100644 index 0000000..fce116c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/ChatChannel.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/ChatChannel.class new file mode 100644 index 0000000..e50dd86 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/ChatChannel.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Raidable.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Raidable.class new file mode 100644 index 0000000..f7661bc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Raidable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/RegenStatus.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/RegenStatus.class new file mode 100644 index 0000000..43211da Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/RegenStatus.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Relation.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Relation.class new file mode 100644 index 0000000..0acd0b2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Relation.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Role.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Role.class new file mode 100644 index 0000000..cde12b9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/struct/Role.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/ClaimableFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/ClaimableFaction.class new file mode 100644 index 0000000..daf087f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/ClaimableFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/EndPortalFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/EndPortalFaction.class new file mode 100644 index 0000000..e19596c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/EndPortalFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/Faction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/Faction.class new file mode 100644 index 0000000..eded266 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/Faction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/PlayerFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/PlayerFaction.class new file mode 100644 index 0000000..c9d6a28 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/PlayerFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$EastRoadFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$EastRoadFaction.class new file mode 100644 index 0000000..9b68543 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$EastRoadFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$NorthRoadFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$NorthRoadFaction.class new file mode 100644 index 0000000..512d086 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$NorthRoadFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$SouthRoadFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$SouthRoadFaction.class new file mode 100644 index 0000000..9eaea06 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$SouthRoadFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$WestRoadFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$WestRoadFaction.class new file mode 100644 index 0000000..ba6d2e9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction$WestRoadFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction.class new file mode 100644 index 0000000..a3f9f4b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/RoadFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/SpawnFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/SpawnFaction.class new file mode 100644 index 0000000..502db5c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/SpawnFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WarzoneFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WarzoneFaction.class new file mode 100644 index 0000000..74dbba0 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WarzoneFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WildernessFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WildernessFaction.class new file mode 100644 index 0000000..6d26bf8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/faction/type/WildernessFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.class new file mode 100644 index 0000000..7fb15a8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockHitFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockHitFixListener.class new file mode 100644 index 0000000..b3efed6 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockHitFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.class new file mode 100644 index 0000000..d7d4b17 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/BoatGlitchFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BoatGlitchFixListener.class new file mode 100644 index 0000000..9ef33c9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/BoatGlitchFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/DupeFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/DupeFixListener.class new file mode 100644 index 0000000..cd0a6d1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/DupeFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnchantLimitListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnchantLimitListener.class new file mode 100644 index 0000000..fae28ec Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnchantLimitListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnderChestRemovalListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnderChestRemovalListener.class new file mode 100644 index 0000000..e9ac67c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/EnderChestRemovalListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/HungerFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/HungerFixListener.class new file mode 100644 index 0000000..8a91868 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/HungerFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/InfinityArrowFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/InfinityArrowFixListener.class new file mode 100644 index 0000000..13cc8f7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/InfinityArrowFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/NoPermissionClickListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/NoPermissionClickListener.class new file mode 100644 index 0000000..f0bcd3d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/NoPermissionClickListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/PearlGlitchFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PearlGlitchFixListener.class new file mode 100644 index 0000000..932d8a5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PearlGlitchFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/PexCrashFix.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PexCrashFix.class new file mode 100644 index 0000000..2d8f14f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PexCrashFix.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/PhaseListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PhaseListener.class new file mode 100644 index 0000000..9d0a484 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PhaseListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/PortalTrapFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PortalTrapFixListener.class new file mode 100644 index 0000000..3d6b81f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PortalTrapFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/PotionLimitListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PotionLimitListener.class new file mode 100644 index 0000000..f5bcc9b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/PotionLimitListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/ServerSecurityListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/ServerSecurityListener.class new file mode 100644 index 0000000..d8daa1b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/ServerSecurityListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/VoidGlitchFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/VoidGlitchFixListener.class new file mode 100644 index 0000000..bff9f04 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/VoidGlitchFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/fixes/WeatherFixListener.class b/PrevailHCF/bin/com/prevailpots/hcf/fixes/WeatherFixListener.class new file mode 100644 index 0000000..ee8aff3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/fixes/WeatherFixListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/EnderChestKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/EnderChestKey.class new file mode 100644 index 0000000..4905dab Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/EnderChestKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/Key.class b/PrevailHCF/bin/com/prevailpots/hcf/key/Key.class new file mode 100644 index 0000000..f86571c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/Key.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/KeyListener.class b/PrevailHCF/bin/com/prevailpots/hcf/key/KeyListener.class new file mode 100644 index 0000000..00553ae Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/KeyListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/KeyManager.class b/PrevailHCF/bin/com/prevailpots/hcf/key/KeyManager.class new file mode 100644 index 0000000..3b40e2a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/KeyManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/LootExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/key/LootExecutor.class new file mode 100644 index 0000000..2a126b9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/LootExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/RewardableItemStack.class b/PrevailHCF/bin/com/prevailpots/hcf/key/RewardableItemStack.class new file mode 100644 index 0000000..a703bb2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/RewardableItemStack.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootAddArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootAddArgument.class new file mode 100644 index 0000000..79e9a9f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootAddArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootCreateArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootCreateArgument.class new file mode 100644 index 0000000..869e452 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootCreateArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootGiveArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootGiveArgument.class new file mode 100644 index 0000000..e41b487 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootGiveArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootRollsArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootRollsArgument.class new file mode 100644 index 0000000..39b2319 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/argument/LootRollsArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/ConquestKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/ConquestKey.class new file mode 100644 index 0000000..95c6e49 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/ConquestKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/CustomKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/CustomKey.class new file mode 100644 index 0000000..4249dfe Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/CustomKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/ExoKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/ExoKey.class new file mode 100644 index 0000000..3f8e6b8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/ExoKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/GodKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/GodKey.class new file mode 100644 index 0000000..658214f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/GodKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/KothKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/KothKey.class new file mode 100644 index 0000000..2dcb0b3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/KothKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/key/type/LegendKey.class b/PrevailHCF/bin/com/prevailpots/hcf/key/type/LegendKey.class new file mode 100644 index 0000000..09e5487 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/key/type/LegendKey.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/CaptureZone.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/CaptureZone.class new file mode 100644 index 0000000..e631aed Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/CaptureZone.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventExecutor.class new file mode 100644 index 0000000..714481e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventScheduler.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventScheduler.class new file mode 100644 index 0000000..8f79c1f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventScheduler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventSignListener.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventSignListener.class new file mode 100644 index 0000000..4699839 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventSignListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer$1.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer$1.class new file mode 100644 index 0000000..f800280 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer.class new file mode 100644 index 0000000..2c93d2d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventType.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventType.class new file mode 100644 index 0000000..59e8328 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/EventType.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/NewEventScheduler.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/NewEventScheduler.class new file mode 100644 index 0000000..c15a1f4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/NewEventScheduler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/RefillBox.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/RefillBox.class new file mode 100644 index 0000000..5c93c0a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/RefillBox.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.class new file mode 100644 index 0000000..f36bc43 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.class new file mode 100644 index 0000000..208e528 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.class new file mode 100644 index 0000000..adc1097 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.class new file mode 100644 index 0000000..0bb5cf8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.class new file mode 100644 index 0000000..958c806 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetAreaArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetAreaArgument.class new file mode 100644 index 0000000..3c5754a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetAreaArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetCapzoneArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetCapzoneArgument.class new file mode 100644 index 0000000..c3d33f8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameSetCapzoneArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameStartArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameStartArgument.class new file mode 100644 index 0000000..7887577 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameStartArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameUptimeArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameUptimeArgument.class new file mode 100644 index 0000000..a456f6f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/GameUptimeArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneExecutor.class new file mode 100644 index 0000000..5f74a47 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetAreaArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetAreaArgument.class new file mode 100644 index 0000000..28568bb Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetAreaArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetTimeArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetTimeArgument.class new file mode 100644 index 0000000..ba9a11f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneSetTimeArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneStartArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneStartArgument.class new file mode 100644 index 0000000..686059e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/argument/glowstone/GlowstoneStartArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestExecutor.class new file mode 100644 index 0000000..b126da3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestSetpointsArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestSetpointsArgument.class new file mode 100644 index 0000000..8b17358 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/conquest/ConquestSetpointsArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler$EotwRunnable.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler$EotwRunnable.class new file mode 100644 index 0000000..ea86559 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler$EotwRunnable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler.class new file mode 100644 index 0000000..4158d3a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EOTWHandler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand$EotwPrompt.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand$EotwPrompt.class new file mode 100644 index 0000000..0a8ffe4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand$EotwPrompt.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand.class new file mode 100644 index 0000000..01d4397 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwListener.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwListener.class new file mode 100644 index 0000000..09aba98 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/eotw/EotwListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/CapturableFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/CapturableFaction.class new file mode 100644 index 0000000..71932e5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/CapturableFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction$ConquestZone.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction$ConquestZone.class new file mode 100644 index 0000000..227782c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction$ConquestZone.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction.class new file mode 100644 index 0000000..05a7385 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/ConquestFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/EventFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/EventFaction.class new file mode 100644 index 0000000..f4af5c9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/EventFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/GlowstoneFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/GlowstoneFaction.class new file mode 100644 index 0000000..47efb4c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/GlowstoneFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/KothFaction.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/KothFaction.class new file mode 100644 index 0000000..ce0fb0f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/faction/KothFaction.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener$1.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener$1.class new file mode 100644 index 0000000..d6419dd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener.class new file mode 100644 index 0000000..b54b295 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/glowstone/GlowstoneListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/KothExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/KothExecutor.class new file mode 100644 index 0000000..5744919 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/KothExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothNextArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothNextArgument.class new file mode 100644 index 0000000..2239f53 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothNextArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothScheduleArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothScheduleArgument.class new file mode 100644 index 0000000..acb3a37 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothScheduleArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothSetCapDelayArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothSetCapDelayArgument.class new file mode 100644 index 0000000..6aad896 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothSetCapDelayArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothShowArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothShowArgument.class new file mode 100644 index 0000000..bb4cef5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/koth/argument/KothShowArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/ConquestTracker.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/ConquestTracker.class new file mode 100644 index 0000000..9109353 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/ConquestTracker.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/EventTracker.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/EventTracker.class new file mode 100644 index 0000000..934f3db Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/EventTracker.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/KothTracker.class b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/KothTracker.class new file mode 100644 index 0000000..cf918a5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/kothgame/tracker/KothTracker.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/AntiPexCrash.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/AntiPexCrash.class new file mode 100644 index 0000000..214173e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/AntiPexCrash.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/AutoSmeltOreListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/AutoSmeltOreListener.class new file mode 100644 index 0000000..3404d4e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/AutoSmeltOreListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/BookDeenchantListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/BookDeenchantListener.class new file mode 100644 index 0000000..70da2a2 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/BookDeenchantListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/BorderListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/BorderListener.class new file mode 100644 index 0000000..3f17ee9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/BorderListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/BottledExpListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/BottledExpListener.class new file mode 100644 index 0000000..da15d14 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/BottledExpListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ChatListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ChatListener.class new file mode 100644 index 0000000..7d7d410 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ChatListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/CoreListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/CoreListener.class new file mode 100644 index 0000000..246634b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/CoreListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/CrowbarListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/CrowbarListener.class new file mode 100644 index 0000000..c822af7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/CrowbarListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathListener.class new file mode 100644 index 0000000..bef6adf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathMessageListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathMessageListener.class new file mode 100644 index 0000000..0701ab9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathMessageListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathSignListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathSignListener.class new file mode 100644 index 0000000..29fd0d9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/DeathSignListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/DonorOnlyListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/DonorOnlyListener.class new file mode 100644 index 0000000..f2dff21 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/DonorOnlyListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ElevatorClass.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ElevatorClass.class new file mode 100644 index 0000000..ba35747 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ElevatorClass.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/EndListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/EndListener.class new file mode 100644 index 0000000..3ea13cd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/EndListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/EntityLimitListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/EntityLimitListener.class new file mode 100644 index 0000000..d19e040 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/EntityLimitListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ExpMultiplierListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ExpMultiplierListener.class new file mode 100644 index 0000000..f4b6938 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ExpMultiplierListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionListener.class new file mode 100644 index 0000000..d1cad55 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionsCoreListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionsCoreListener.class new file mode 100644 index 0000000..8697e0e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FactionsCoreListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FastSmeltListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FastSmeltListener.class new file mode 100644 index 0000000..f9bc9c7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FastSmeltListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FocusListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FocusListener.class new file mode 100644 index 0000000..da3ce9e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FocusListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FoundDiamondsListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FoundDiamondsListener.class new file mode 100644 index 0000000..198db10 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FoundDiamondsListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/FurnaceSmeltSpeederListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/FurnaceSmeltSpeederListener.class new file mode 100644 index 0000000..df1612b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/FurnaceSmeltSpeederListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemFilterListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemFilterListener.class new file mode 100644 index 0000000..087e275 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemFilterListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemStatTrackingListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemStatTrackingListener.class new file mode 100644 index 0000000..cd91ea9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ItemStatTrackingListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/KitListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/KitListener.class new file mode 100644 index 0000000..995eb52 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/KitListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/KitsCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/KitsCommand.class new file mode 100644 index 0000000..82e4c43 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/KitsCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/MOTDListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/MOTDListener.class new file mode 100644 index 0000000..8bdbbef Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/MOTDListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand$1.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand$1.class new file mode 100644 index 0000000..79896a1 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand.class new file mode 100644 index 0000000..07c2760 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/ReloadTabCommand.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/SignSubclaimListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/SignSubclaimListener.class new file mode 100644 index 0000000..a21847c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/SignSubclaimListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/SkullListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/SkullListener.class new file mode 100644 index 0000000..5447c45 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/SkullListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/UnRepairableListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/UnRepairableListener.class new file mode 100644 index 0000000..df5fd99 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/UnRepairableListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/listener/WorldListener.class b/PrevailHCF/bin/com/prevailpots/hcf/listener/WorldListener.class new file mode 100644 index 0000000..75b62de Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/listener/WorldListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesExecutor.class new file mode 100644 index 0000000..60205e8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesType.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesType.class new file mode 100644 index 0000000..2bb5cf6 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/LivesType.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesCheckDeathban.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesCheckDeathban.class new file mode 100644 index 0000000..306b139 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesCheckDeathban.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesClearDeathbansArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesClearDeathbansArgument.class new file mode 100644 index 0000000..0fe6571 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesClearDeathbansArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesGiveArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesGiveArgument.class new file mode 100644 index 0000000..f4498a4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesGiveArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesReviveArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesReviveArgument.class new file mode 100644 index 0000000..a507173 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesReviveArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetArgument.class new file mode 100644 index 0000000..6227bf9 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetDeathbanTimeArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetDeathbanTimeArgument.class new file mode 100644 index 0000000..d06436c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/lives/argument/LivesSetDeathbanTimeArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoManager.class b/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoManager.class new file mode 100644 index 0000000..d6319ab Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoUser.class b/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoUser.class new file mode 100644 index 0000000..0711e91 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/mongo/MongoUser.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective$1.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective$1.class new file mode 100644 index 0000000..d0e12bd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective.class new file mode 100644 index 0000000..22846c4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/BufferedObjective.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$1.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$1.class new file mode 100644 index 0000000..b3e6f21 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$2.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$2.class new file mode 100644 index 0000000..73a8d89 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$3.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$3.class new file mode 100644 index 0000000..68b5c53 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard$3.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard.class new file mode 100644 index 0000000..a0ae6da Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/PlayerBoard.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/ScoreboardHandler.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/ScoreboardHandler.class new file mode 100644 index 0000000..2d8cc5f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/ScoreboardHandler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarEntry.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarEntry.class new file mode 100644 index 0000000..cf720e3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarEntry.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarProvider.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarProvider.class new file mode 100644 index 0000000..9329225 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/SidebarProvider.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider$1.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider$1.class new file mode 100644 index 0000000..ced8e14 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider.class b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider.class new file mode 100644 index 0000000..6e5b183 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/scoreboard/provider/TimerSidebarProvider.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener$TabUpdateTask.class b/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener$TabUpdateTask.class new file mode 100644 index 0000000..80bb350 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener$TabUpdateTask.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener.class b/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener.class new file mode 100644 index 0000000..da3ef37 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/tab/TabListener.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/task/SaveDataTask.class b/PrevailHCF/bin/com/prevailpots/hcf/task/SaveDataTask.class new file mode 100644 index 0000000..6b49009 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/task/SaveDataTask.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/GlobalTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/GlobalTimer.class new file mode 100644 index 0000000..bb08442 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/GlobalTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/PlayerTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/PlayerTimer.class new file mode 100644 index 0000000..88b8f86 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/PlayerTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/Timer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/Timer.class new file mode 100644 index 0000000..048ec44 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/Timer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerExecutor.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerExecutor.class new file mode 100644 index 0000000..7d3f749 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerExecutor.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerManager.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerManager.class new file mode 100644 index 0000000..ad36c4b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable$1.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable$1.class new file mode 100644 index 0000000..2fc52ea Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable.class new file mode 100644 index 0000000..1dcb3a8 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/TimerRunnable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerCheckArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerCheckArgument.class new file mode 100644 index 0000000..e5f1fdf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerCheckArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$1.class new file mode 100644 index 0000000..bb9d1fe Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$2.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$2.class new file mode 100644 index 0000000..9ed907f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument.class new file mode 100644 index 0000000..320b196 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerClearArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$1.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$1.class new file mode 100644 index 0000000..e6bd3a4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$2.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$2.class new file mode 100644 index 0000000..ab9feff Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument.class new file mode 100644 index 0000000..5c8192b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerSetArgument.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$1.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$1.class new file mode 100644 index 0000000..d014100 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$2.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$2.class new file mode 100644 index 0000000..ea03dec Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment.class new file mode 100644 index 0000000..9fb07fa Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/argument/TimerStartArugment.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerClearEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerClearEvent.class new file mode 100644 index 0000000..c1b5f6d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerClearEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExpireEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExpireEvent.class new file mode 100644 index 0000000..bcef77a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExpireEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExtendEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExtendEvent.class new file mode 100644 index 0000000..81b29f3 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerExtendEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerPauseEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerPauseEvent.class new file mode 100644 index 0000000..258eb7b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerPauseEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerStartEvent.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerStartEvent.class new file mode 100644 index 0000000..74e3529 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/event/TimerStartEvent.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/ArcherTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/ArcherTimer.class new file mode 100644 index 0000000..abb856b Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/ArcherTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$1.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$1.class new file mode 100644 index 0000000..c7ddb43 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$PearlNameFaker.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$PearlNameFaker.class new file mode 100644 index 0000000..b40d817 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer$PearlNameFaker.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer.class new file mode 100644 index 0000000..fb8d7d7 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/EnderPearlTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/LogoutTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/LogoutTimer.class new file mode 100644 index 0000000..d54fa7e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/LogoutTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/NotchAppleTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/NotchAppleTimer.class new file mode 100644 index 0000000..9cebe39 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/NotchAppleTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/PvpProtectionTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/PvpProtectionTimer.class new file mode 100644 index 0000000..b2c5bbf Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/PvpProtectionTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/RestartTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/RestartTimer.class new file mode 100644 index 0000000..5ace4d4 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/RestartTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SOTWTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SOTWTimer.class new file mode 100644 index 0000000..f53b71a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SOTWTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SandDuneTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SandDuneTimer.class new file mode 100644 index 0000000..63398de Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SandDuneTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SpawnTagTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SpawnTagTimer.class new file mode 100644 index 0000000..2e175fc Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/SpawnTagTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/StuckTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/StuckTimer.class new file mode 100644 index 0000000..c53d129 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/StuckTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/timer/type/TeleportTimer.class b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/TeleportTimer.class new file mode 100644 index 0000000..6fb5602 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/timer/type/TeleportTimer.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/user/FactionUser.class b/PrevailHCF/bin/com/prevailpots/hcf/user/FactionUser.class new file mode 100644 index 0000000..d027038 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/user/FactionUser.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/user/GUIManager.class b/PrevailHCF/bin/com/prevailpots/hcf/user/GUIManager.class new file mode 100644 index 0000000..702fb55 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/user/GUIManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/user/UserManager.class b/PrevailHCF/bin/com/prevailpots/hcf/user/UserManager.class new file mode 100644 index 0000000..5a4a408 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/user/UserManager.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/BlockFiller.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/BlockFiller.class new file mode 100644 index 0000000..54edfcd Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/BlockFiller.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1$1.class new file mode 100644 index 0000000..721cf52 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1.class new file mode 100644 index 0000000..167e70c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$2.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$2.class new file mode 100644 index 0000000..a6996a5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook.class new file mode 100644 index 0000000..e8a9377 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/ProtocolLibHook.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlock.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlock.class new file mode 100644 index 0000000..f97ed69 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlock.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlockData.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlockData.class new file mode 100644 index 0000000..961b33d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualBlockData.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1$1.class new file mode 100644 index 0000000..63e3c85 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1.class new file mode 100644 index 0000000..1d68e39 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2$1.class new file mode 100644 index 0000000..d5f327e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2.class new file mode 100644 index 0000000..409868f Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$2.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3$1.class new file mode 100644 index 0000000..5a93e4c Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3.class new file mode 100644 index 0000000..e186dd5 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$3.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4$1.class new file mode 100644 index 0000000..1bc2a03 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4.class new file mode 100644 index 0000000..4ccf202 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$4.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5$1.class new file mode 100644 index 0000000..d219b61 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5.class new file mode 100644 index 0000000..3a9e2ef Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType$5.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType.class new file mode 100644 index 0000000..a2b097a Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualType.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler$1.class new file mode 100644 index 0000000..b55d64e Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler.class new file mode 100644 index 0000000..e162230 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/VisualiseHandler.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$1.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$1.class new file mode 100644 index 0000000..c300309 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$1.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$WarpTimerRunnable.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$WarpTimerRunnable.class new file mode 100644 index 0000000..f3f215d Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener$WarpTimerRunnable.class differ diff --git a/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener.class b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener.class new file mode 100644 index 0000000..b28b882 Binary files /dev/null and b/PrevailHCF/bin/com/prevailpots/hcf/visualise/WallBorderListener.class differ diff --git a/PrevailHCF/bin/config.yml b/PrevailHCF/bin/config.yml new file mode 100644 index 0000000..a7511bc --- /dev/null +++ b/PrevailHCF/bin/config.yml @@ -0,0 +1,43 @@ +#1000 = 1 second NO COMMAS | 10000 = 10 Seconds (Its in miliseconds) +Timer: + Archer: 10000 + EnderPearl: 16000 + Logout: 30000 +#6 hours = 21600000 + Gapple: 21600000 + PvpProt: 1800000 + SpawnTag: 30000 + Stuck: 300000 +Scoreboard: + lines: true + title: "&aServerName &a[Map &c%MAP%&a]" +classes: + miner: + enabled: true + archer: + enabled: true + bard: + enabled: true + assassin: + enabled: true + rouge: + enabled: true +#Must be lowercase +Disabled-Faction-Names: +- 'kohieotw' +- 'paraeotw' +- 'hcteamseotw' +Help: +- ' &aNigger&bOvidPvP&cNigger' +- ' Nigger' +Coords: +- ' &a300 Nigger' +- ' CuntSlayer' +# Supports color codes - Use {reviver} for the player that revived, use {revived} for the player that got revived +AlphaBroadcast: '{reviver} revived {revived} with their alpha rank!' +#Server IP - If not localhost you're going to have to alowed remote connections in Redis Config +redis-server: 'localhost' +#Redis Port - Default is 6379 +redis-port: 6379 +version: 7.2 +DonateLink: 'http://www.anal.com' diff --git a/PrevailHCF/bin/enderdragon-art-old.png b/PrevailHCF/bin/enderdragon-art-old.png new file mode 100644 index 0000000..e33ffd6 Binary files /dev/null and b/PrevailHCF/bin/enderdragon-art-old.png differ diff --git a/PrevailHCF/bin/enderdragon-art.png b/PrevailHCF/bin/enderdragon-art.png new file mode 100644 index 0000000..31c18b3 Binary files /dev/null and b/PrevailHCF/bin/enderdragon-art.png differ diff --git a/PrevailHCF/bin/event-schedules.txt b/PrevailHCF/bin/event-schedules.txt new file mode 100644 index 0000000..740b742 --- /dev/null +++ b/PrevailHCF/bin/event-schedules.txt @@ -0,0 +1,17 @@ +#year, month, day, hour, minute: eventName +#2015,3,8,5,15:Rubber +#2015,3,8,15,30:Smooth +#2015,3,8,19,45:City +2016,2,21,12,30:Castle +2016,2,21,15,00:Tree +2016,2,21,17,30:Fortress +2016,2,22,12,00:Dome +2016,2,22,18,00:End +2016,2,23,12,00:Castle +2016,2,23,18,00:Tree +2016,2,24,12,00:Fortress +2016,2,24,18,00:Dome +2016,2,25,12,00:End +2016,2,25,18,00:Castle +2016,2,26,12,00:Tree +2016,2,26,18,00:Fortress \ No newline at end of file diff --git a/PrevailHCF/bin/gopple-art.png b/PrevailHCF/bin/gopple-art.png new file mode 100644 index 0000000..08c061a Binary files /dev/null and b/PrevailHCF/bin/gopple-art.png differ diff --git a/PrevailHCF/bin/items.csv b/PrevailHCF/bin/items.csv new file mode 100644 index 0000000..d9c41b2 --- /dev/null +++ b/PrevailHCF/bin/items.csv @@ -0,0 +1,7449 @@ +#version: TeamCity +#If you change this file, it will not be automatically updated after the next release. +#item,id,metadata +stone,1,0 +sstone,1,0 +smoothstone,1,0 +rock,1,0 +grass,2,0 +greendirt,2,0 +greenearth,2,0 +greenland,2,0 +dirt,3,0 +earth,3,0 +land,3,0 +grasslessdirt,3,1 +grasslessearth,3,1 +grasslessland,3,1 +podzol,3,2 +cobblestone,4,0 +cstone,4,0 +cobble,4,0 +wood,5,0 +plank,5,0 +woodenplank,5,0 +woodplank,5,0 +wplank,5,0 +plankwooden,5,0 +plankwood,5,0 +plankw,5,0 +oakplank,5,0 +oakwoodenplank,5,0 +oakwoodplank,5,0 +oakwplank,5,0 +oakplankwooden,5,0 +oakplankwood,5,0 +oakplankw,5,0 +oplank,5,0 +owoodenplank,5,0 +owoodplank,5,0 +owplank,5,0 +oplankwooden,5,0 +oplankwood,5,0 +oplankw,5,0 +pineplank,5,1 +pinewoodenplank,5,1 +pinewoodplank,5,1 +pinewplank,5,1 +pineplankwooden,5,1 +pineplankwood,5,1 +pineplankw,5,1 +pplank,5,1 +pwoodenplank,5,1 +pwoodplank,5,1 +pwplank,5,1 +pplankwooden,5,1 +pplankwood,5,1 +pplankw,5,1 +darkplank,5,1 +darkwoodenplank,5,1 +darkwoodplank,5,1 +darkwplank,5,1 +darkplankwooden,5,1 +darkplankwood,5,1 +darkplankw,5,1 +dplank,5,1 +dwoodenplank,5,1 +dwoodplank,5,1 +dwplank,5,1 +dplankwooden,5,1 +dplankwood,5,1 +dplankw,5,1 +spruceplank,5,1 +sprucewoodenplank,5,1 +sprucewoodplank,5,1 +sprucewplank,5,1 +spruceplankwooden,5,1 +spruceplankwood,5,1 +spruceplankw,5,1 +splank,5,1 +swoodenplank,5,1 +swoodplank,5,1 +swplank,5,1 +splankwooden,5,1 +splankwood,5,1 +splankw,5,1 +birchplank,5,2 +birchwoodenplank,5,2 +birchwoodplank,5,2 +birchwplank,5,2 +birchplankwooden,5,2 +birchplankwood,5,2 +birchplankw,5,2 +bplank,5,2 +bwoodenplank,5,2 +bwoodplank,5,2 +bwplank,5,2 +bplankwooden,5,2 +bplankwood,5,2 +bplankw,5,2 +lightplank,5,2 +lightwoodenplank,5,2 +lightwoodplank,5,2 +lightwplank,5,2 +lightplankwooden,5,2 +lightplankwood,5,2 +lightplankw,5,2 +lplank,5,2 +lwoodenplank,5,2 +lwoodplank,5,2 +lwplank,5,2 +lplankwooden,5,2 +lplankwood,5,2 +lplankw,5,2 +whiteplank,5,2 +whitewoodenplank,5,2 +whitewoodplank,5,2 +whitewplank,5,2 +whiteplankwooden,5,2 +whiteplankwood,5,2 +whiteplankw,5,2 +wwoodenplank,5,2 +wwoodplank,5,2 +wwplank,5,2 +wplankwooden,5,2 +wplankwood,5,2 +wplankw,5,2 +jungleplank,5,3 +junglewoodenplank,5,3 +junglewoodplank,5,3 +junglewplank,5,3 +jungleplankwooden,5,3 +jungleplankwood,5,3 +jungleplankw,5,3 +jplank,5,3 +jwoodenplank,5,3 +jwoodplank,5,3 +jwplank,5,3 +jplankwooden,5,3 +jplankwood,5,3 +jplankw,5,3 +forestplank,5,3 +forestwoodenplank,5,3 +forestwoodplank,5,3 +forestwplank,5,3 +forestplankwooden,5,3 +forestplankwood,5,3 +forestplankw,5,3 +fplank,5,3 +fwoodenplank,5,3 +fwoodplank,5,3 +fwplank,5,3 +fplankwooden,5,3 +fplankwood,5,3 +fplankw,5,3 +acaciaplank,5,4 +acaciawoodenplank,5,4 +acaciawoodplank,5,4 +acaciawplank,5,4 +acaciaplankwooden,5,4 +acaciaplankwood,5,4 +acaciaplankw,5,4 +aplank,5,4 +awoodenplank,5,4 +awoodplank,5,4 +awplank,5,4 +aplankwooden,5,4 +aplankwood,5,4 +aplankw,5,4 +darkoakplank,5,5 +darkoakwoodenplank,5,5 +darkoakwoodplank,5,5 +darkoakwplank,5,5 +darkoakplankwooden,5,5 +darkoakplankwood,5,5 +darkoakplankw,5,5 +doakplank,5,5 +doakwoodenplank,5,5 +doakwoodplank,5,5 +doakwplank,5,5 +doakplankwooden,5,5 +doakplankwood,5,5 +doakplankw,5,5 +doplank,5,5 +dowoodenplank,5,5 +dowoodplank,5,5 +dowplank,5,5 +doplankwooden,5,5 +doplankwood,5,5 +doplankw,5,5 +sapling,6,0 +treesapling,6,0 +logsapling,6,0 +trunksapling,6,0 +woodsapling,6,0 +oaktreesapling,6,0 +oaklogsapling,6,0 +oaktrunksapling,6,0 +oakwoodsapling,6,0 +osapling,6,0 +otreesapling,6,0 +ologsapling,6,0 +otrunksapling,6,0 +owoodsapling,6,0 +darksapling,6,1 +darktreesapling,6,1 +darklogsapling,6,1 +darktrunksapling,6,1 +darkwoodsapling,6,1 +sprucesapling,6,1 +sprucetreesapling,6,1 +sprucelogsapling,6,1 +sprucetrunksapling,6,1 +sprucewoodsapling,6,1 +pinesapling,6,1 +pinetreesapling,6,1 +pinelogsapling,6,1 +pinetrunksapling,6,1 +pinewoodsapling,6,1 +dsapling,6,1 +dtreesapling,6,1 +dlogsapling,6,1 +dtrunksapling,6,1 +dwoodsapling,6,1 +ssapling,6,1 +streesapling,6,1 +slogsapling,6,1 +strunksapling,6,1 +swoodsapling,6,1 +psapling,6,1 +ptreesapling,6,1 +plogsapling,6,1 +ptrunksapling,6,1 +pwoodsapling,6,1 +birchsapling,6,2 +birchtreesapling,6,2 +birchlogsapling,6,2 +birchtrunksapling,6,2 +birchwoodsapling,6,2 +lightsapling,6,2 +lighttreesapling,6,2 +lightlogsapling,6,2 +lighttrunksapling,6,2 +lightwoodsapling,6,2 +whitesapling,6,2 +whitetreesapling,6,2 +whitelogsapling,6,2 +whitetrunksapling,6,2 +whitewoodsapling,6,2 +bsapling,6,2 +btreesapling,6,2 +blogsapling,6,2 +btrunksapling,6,2 +bwoodsapling,6,2 +lsapling,6,2 +ltreesapling,6,2 +llogsapling,6,2 +ltrunksapling,6,2 +lwoodsapling,6,2 +wsapling,6,2 +wtreesapling,6,2 +wlogsapling,6,2 +wtrunksapling,6,2 +wwoodsapling,6,2 +junglesapling,6,3 +jungletreesapling,6,3 +junglelogsapling,6,3 +jungletrunksapling,6,3 +junglewoodsapling,6,3 +forestsapling,6,3 +foresttreesapling,6,3 +forestlogsapling,6,3 +foresttrunksapling,6,3 +forestwoodsapling,6,3 +jsapling,6,3 +jtreesapling,6,3 +jlogsapling,6,3 +jtrunksapling,6,3 +jwoodsapling,6,3 +fsapling,6,3 +ftreesapling,6,3 +flogsapling,6,3 +ftrunksapling,6,3 +fwoodsapling,6,3 +acaciasapling,6,4 +acaciatreesapling,6,4 +acacialogsapling,6,4 +acaciatrunksapling,6,4 +acaciawoodsapling,6,4 +asapling,6,4 +atreesapling,6,4 +alogsapling,6,4 +atrunksapling,6,4 +awoodsapling,6,4 +darkoaksapling,6,5 +darkoaktreesapling,6,5 +darkoaklogsapling,6,5 +darkoaktrunksapling,6,5 +darkoakwoodsapling,6,5 +doaksapling,6,5 +doaktreesapling,6,5 +doaklogsapling,6,5 +doaktrunksapling,6,5 +dosapling,6,5 +dowoodsapling,6,5 +dotreesapling,6,5 +dologsapling,6,5 +dotrunksapling,6,5 +bedrock,7,0 +oprock,7,0 +opblock,7,0 +adminblock,7,0 +adminrock,7,0 +adminium,7,0 +water,8,0 +stationarywater,9,0 +stillwater,9,0 +swater,9,0 +lava,10,0 +stationarylava,11,0 +stilllava,11,0 +slava,11,0 +sand,12,0 +redsand,12,1 +rsand,12,1 +gravel,13,0 +goldore,14,0 +oregold,14,0 +gore,14,0 +oreg,14,0 +ogold,14,0 +goldo,14,0 +ironore,15,0 +oreiron,15,0 +irono,15,0 +oiron,15,0 +steelore,15,0 +oresteel,15,0 +steelo,15,0 +osteel,15,0 +iore,15,0 +orei,15,0 +sore,15,0 +ores,15,0 +coalore,16,0 +orecoal,16,0 +coalo,16,0 +ocoal,16,0 +core,16,0 +tree,17,0 +log,17,0 +trunk,17,0 +oak,17,0 +oaktree,17,0 +oaklog,17,0 +oaktrunk,17,0 +oakwood,17,0 +otree,17,0 +olog,17,0 +otrunk,17,0 +owood,17,0 +pine,17,1 +pinetree,17,1 +pinelog,17,1 +pinetrunk,17,1 +pinewood,17,1 +darktree,17,1 +darklog,17,1 +darktrunk,17,1 +darkwood,17,1 +spruce,17,1 +sprucetree,17,1 +sprucelog,17,1 +sprucetrunk,17,1 +sprucewood,17,1 +dtree,17,1 +dlog,17,1 +dtrunk,17,1 +dwood,17,1 +stree,17,1 +slog,17,1 +strunk,17,1 +swood,17,1 +ptree,17,1 +plog,17,1 +ptrunk,17,1 +pwood,17,1 +birch,17,2 +birchtree,17,2 +birchlog,17,2 +birchtrunk,17,2 +birchwood,17,2 +whitetree,17,2 +whitelog,17,2 +whitetrunk,17,2 +whitewood,17,2 +lighttree,17,2 +lightlog,17,2 +lighttrunk,17,2 +lightwood,17,2 +btree,17,2 +blog,17,2 +btrunk,17,2 +bwood,17,2 +wtree,17,2 +wlog,17,2 +wtrunk,17,2 +wwood,17,2 +ltree,17,2 +llog,17,2 +ltrunk,17,2 +lwood,17,2 +jungletree,17,3 +junglelog,17,3 +jungletrunk,17,3 +junglewood,17,3 +jungle,17,3 +forest,17,3 +foresttree,17,3 +forestlog,17,3 +foresttrunk,17,3 +forestwood,17,3 +jtree,17,3 +jlog,17,3 +jtrunk,17,3 +jwood,17,3 +ftree,17,3 +flog,17,3 +ftrunk,17,3 +fwood,17,3 +leaves,18,0 +leaf,18,0 +treeleaves,18,0 +logleaves,18,0 +trunkleaves,18,0 +woodleaves,18,0 +oakleaves,18,0 +oakleaf,18,0 +oleaves,18,0 +oleaf,18,0 +oaktreeleaves,18,0 +oaklogleaves,18,0 +oaktrunkleaves,18,0 +oakwoodleaves,18,0 +otreeleaves,18,0 +ologleaves,18,0 +otrunkleaves,18,0 +owoodleaves,18,0 +treeleaf,18,0 +logleaf,18,0 +trunkleaf,18,0 +woodleaf,18,0 +oaktreeleaf,18,0 +oaklogleaf,18,0 +oaktrunkleaf,18,0 +oakwoodleaf,18,0 +otreeleaf,18,0 +ologleaf,18,0 +otrunkleaf,18,0 +owoodleaf,18,0 +pineleaves,18,1 +pineleaf,18,1 +pleaves,18,1 +pleaf,18,1 +pinetreeleaves,18,1 +pinelogleaves,18,1 +pinetrunkleaves,18,1 +pinewoodleaves,18,1 +ptreeleaves,18,1 +plogleaves,18,1 +ptrunkleaves,18,1 +pwoodleaves,18,1 +spruceleaves,18,1 +spruceleaf,18,1 +sleaves,18,1 +sleaf,18,1 +sprucetreeleaves,18,1 +sprucelogleaves,18,1 +sprucetrunkleaves,18,1 +sprucewoodleaves,18,1 +streeleaves,18,1 +slogleaves,18,1 +strunkleaves,18,1 +swoodleaves,18,1 +darkleaves,18,1 +darkleaf,18,1 +dleaves,18,1 +dleaf,18,1 +darktreeleaves,18,1 +darklogleaves,18,1 +darktrunkleaves,18,1 +darkwoodleaves,18,1 +dtreeleaves,18,1 +dlogleaves,18,1 +dtrunkleaves,18,1 +dwoodleaves,18,1 +sprucetreeleaf,18,1 +sprucelogleaf,18,1 +sprucetrunkleaf,18,1 +sprucewoodleaf,18,1 +streeleaf,18,1 +slogleaf,18,1 +strunkleaf,18,1 +swoodleaf,18,1 +pinetreeleaf,18,1 +pinelogleaf,18,1 +pinetrunkleaf,18,1 +pinewoodleaf,18,1 +ptreeleaf,18,1 +plogleaf,18,1 +ptrunkleaf,18,1 +pwoodleaf,18,1 +darktreeleaf,18,1 +darklogleaf,18,1 +darktrunkleaf,18,1 +darkwoodleaf,18,1 +dtreeleaf,18,1 +dlogleaf,18,1 +dtrunkleaf,18,1 +dwoodleaf,18,1 +birchleaves,18,2 +birchleaf,18,2 +bleaves,18,2 +bleaf,18,2 +birchtreeleaves,18,2 +birchlogleaves,18,2 +birchtrunkleaves,18,2 +birchwoodleaves,18,2 +btreeleaves,18,2 +blogleaves,18,2 +btrunkleaves,18,2 +bwoodleaves,18,2 +lightleaves,18,2 +lightleaf,18,2 +lleaves,18,2 +lleaf,18,2 +lighttreeleaves,18,2 +lightlogleaves,18,2 +lighttrunkleaves,18,2 +lightwoodleaves,18,2 +ltreeleaves,18,2 +llogleaves,18,2 +ltrunkleaves,18,2 +lwoodleaves,18,2 +whiteleaves,18,2 +whiteleaf,18,2 +wleaves,18,2 +wleaf,18,2 +whitetreeleaves,18,2 +whitelogleaves,18,2 +whitetrunkleaves,18,2 +whitewoodleaves,18,2 +wtreeleaves,18,2 +wlogleaves,18,2 +wtrunkleaves,18,2 +wwoodleaves,18,2 +birchtreeleaf,18,2 +birchlogleaf,18,2 +birchtrunkleaf,18,2 +birchwoodleaf,18,2 +btreeleaf,18,2 +blogleaf,18,2 +btrunkleaf,18,2 +bwoodleaf,18,2 +lighttreeleaf,18,2 +lightlogleaf,18,2 +lighttrunkleaf,18,2 +lightwoodleaf,18,2 +ltreeleaf,18,2 +llogleaf,18,2 +ltrunkleaf,18,2 +lwoodleaf,18,2 +whitetreeleaf,18,2 +whitelogleaf,18,2 +whitetrunkleaf,18,2 +whitewoodleaf,18,2 +wtreeleaf,18,2 +wlogleaf,18,2 +wtrunkleaf,18,2 +wwoodleaf,18,2 +jungleleaves,18,3 +jungleleaf,18,3 +jleaves,18,3 +jleaf,18,3 +jungletreeleaves,18,3 +junglelogleaves,18,3 +jungletrunkleaves,18,3 +junglewoodleaves,18,3 +jtreeleaves,18,3 +jlogleaves,18,3 +jtrunkleaves,18,3 +jwoodleaves,18,3 +forestleaves,18,3 +forestleaf,18,3 +fleaves,18,3 +fleaf,18,3 +foresttreeleaves,18,3 +forestlogleaves,18,3 +foresttrunkleaves,18,3 +forestwoodleaves,18,3 +ftreeleaves,18,3 +flogleaves,18,3 +ftrunkleaves,18,3 +fwoodleaves,18,3 +jungletreeleaf,18,3 +junglelogleaf,18,3 +jungletrunkleaf,18,3 +junglewoodleaf,18,3 +jtreeleaf,18,3 +jlogleaf,18,3 +jtrunkleaf,18,3 +jwoodleaf,18,3 +foresttreeleaf,18,3 +forestlogleaf,18,3 +foresttrunkleaf,18,3 +forestwoodleaf,18,3 +ftreeleaf,18,3 +flogleaf,18,3 +ftrunkleaf,18,3 +fwoodleaf,18,3 +sponge,19,0 +glass,20,0 +blockglass,20,0 +glassblock,20,0 +lapislazuliore,21,0 +lapislazulio,21,0 +orelapislazuli,21,0 +olapislazuli,21,0 +lapisore,21,0 +lapiso,21,0 +orelapis,21,0 +olapis,21,0 +lore,21,0 +orel,21,0 +lapislazuliblock,22,0 +blocklapislazuli,22,0 +lapisblock,22,0 +blocklapis,22,0 +lblock,22,0 +blockl,22,0 +dispenser,23,0 +dispense,23,0 +sandstone,24,0 +sastone,24,0 +creepersandstone,24,1 +creepersastone,24,1 +creepsandstone,24,1 +creepsastone,24,1 +csandstone,24,1 +csastone,24,1 +hieroglyphicsandstone,24,1 +hieroglyphicsastone,24,1 +hieroglyphsandstone,24,1 +hieroglyphsastone,24,1 +hsandstone,24,1 +hsastone,24,1 +pyramidsandstone,24,1 +pyramidsastone,24,1 +psandstone,24,1 +psastone,24,1 +chiseledsandstone,24,1 +chiseledsastone,24,1 +chiselsandstone,24,1 +chiselsastone,24,1 +smoothsandstone,24,2 +smoothsastone,24,2 +ssandstone,24,2 +smsastone,24,2 +ssastone,24,2 +noteblock,25,0 +musicblock,25,0 +nblock,25,0 +mblock,25,0 +poweredtrack,27,0 +poweredrails,27,0 +poweredrail,27,0 +boostertrack,27,0 +boosterrails,27,0 +boosterrail,27,0 +powertrack,27,0 +powerrails,27,0 +powerrail,27,0 +boosttrack,27,0 +boostrails,27,0 +boostrail,27,0 +ptrack,27,0 +prails,27,0 +prail,27,0 +btrack,27,0 +brails,27,0 +brail,27,0 +detectortrack,28,0 +detectorrails,28,0 +detectorrail,28,0 +detectingtrack,28,0 +detectingrails,28,0 +detectingrail,28,0 +detecttrack,28,0 +detectrails,28,0 +detectrail,28,0 +dtrack,28,0 +drails,28,0 +drail,28,0 +stickypistonbase,29,0 +stickypiston,29,0 +stickpistonbase,29,0 +stickpiston,29,0 +stickyp,29,0 +spistonbase,29,0 +spiston,29,0 +pistonstickybase,29,0 +pistonsticky,29,0 +pistonstickbase,29,0 +pistonstick,29,0 +pistonsbase,29,0 +pistons,29,0 +psticky,29,0 +pstick,29,0 +spiderweb,30,0 +cobweb,30,0 +sweb,30,0 +cweb,30,0 +web,30,0 +longgrass,31,1 +tallgrass,31,1 +wildgrass,31,1 +grasslong,31,1 +grasstall,31,1 +grasswild,31,1 +lgrass,31,1 +tgrass,31,1 +wgrass,31,1 +fern,31,2 +bush,31,2 +deadshrub,32,0 +dshrub,32,0 +deadbush,32,0 +dbush,32,0 +deadsapling,32,0 +piston,33,0 +pistonbase,33,0 +pistonblock,33,0 +whitewool,35,0 +whitecloth,35,0 +whitecotton,35,0 +wcloth,35,0 +wwool,35,0 +wcotton,35,0 +cloth,35,0 +wool,35,0 +cotton,35,0 +orangewool,35,1 +orangecloth,35,1 +orangecotton,35,1 +ocloth,35,1 +owool,35,1 +ocotton,35,1 +magentawool,35,2 +magentacloth,35,2 +magentacotton,35,2 +mcloth,35,2 +mwool,35,2 +mcotton,35,2 +lightbluewool,35,3 +lightbluecloth,35,3 +lightbluecotton,35,3 +lbluecloth,35,3 +lbluewool,35,3 +lbluecotton,35,3 +lightblucloth,35,3 +lightbluwool,35,3 +lightblucotton,35,3 +lblucloth,35,3 +lbluwool,35,3 +lblucotton,35,3 +lbcloth,35,3 +lbwool,35,3 +lbcotton,35,3 +WHITEwool,35,4 +WHITEcloth,35,4 +WHITEcotton,35,4 +ycloth,35,4 +ywool,35,4 +ycotton,35,4 +lightgreenwool,35,5 +lightgreencloth,35,5 +lightgreencotton,35,5 +lgreencloth,35,5 +lgreenwool,35,5 +lgreencotton,35,5 +lightgrecloth,35,5 +lightgrewool,35,5 +lightgrecotton,35,5 +lgrecloth,35,5 +lgrewool,35,5 +lgrecotton,35,5 +limecloth,35,5 +limewool,35,5 +limecotton,35,5 +lcloth,35,5 +lwool,35,5 +lcotton,35,5 +pinkwool,35,6 +pinkcloth,35,6 +pinkcotton,35,6 +picloth,35,6 +piwool,35,6 +picotton,35,6 +darkgraywool,35,7 +darkgraycloth,35,7 +darkgraycotton,35,7 +darkgreywool,35,7 +darkgreycloth,35,7 +darkgreycotton,35,7 +dgraycloth,35,7 +dgraywool,35,7 +dgraycotton,35,7 +dgreycloth,35,7 +dgreywool,35,7 +dgreycotton,35,7 +darkgracloth,35,7 +darkgrawool,35,7 +darkgracotton,35,7 +dgracloth,35,7 +dgrawool,35,7 +dgracotton,35,7 +graycloth,35,7 +graywool,35,7 +graycotton,35,7 +greycloth,35,7 +greywool,35,7 +greycotton,35,7 +gracloth,35,7 +grawool,35,7 +gracotton,35,7 +lightgraywool,35,8 +lightgraycloth,35,8 +lightgraycotton,35,8 +lgraycloth,35,8 +lgraywool,35,8 +lgraycotton,35,8 +lightgreywool,35,8 +lightgreycloth,35,8 +lightgreycotton,35,8 +lgreycloth,35,8 +lgreywool,35,8 +lgreycotton,35,8 +lightgracloth,35,8 +lightgrawool,35,8 +lightgracotton,35,8 +lgracloth,35,8 +lgrawool,35,8 +lgracotton,35,8 +silvercloth,35,8 +silverwool,35,8 +silvercotton,35,8 +sicloth,35,8 +siawool,35,8 +siacotton,35,8 +cyanwool,35,9 +cyancloth,35,9 +cyancotton,35,9 +ccloth,35,9 +cwool,35,9 +ccotton,35,9 +purplewool,35,10 +purplecloth,35,10 +purplecotton,35,10 +pucloth,35,10 +puwool,35,10 +pucotton,35,10 +bluewool,35,11 +bluecloth,35,11 +bluecotton,35,11 +blucloth,35,11 +bluwool,35,11 +blucotton,35,11 +brownwool,35,12 +browncloth,35,12 +browncotton,35,12 +brocloth,35,12 +browool,35,12 +brocotton,35,12 +darkgreenwool,35,13 +darkgreencloth,35,13 +darkgreencotton,35,13 +dgreencloth,35,13 +dgreenwool,35,13 +dgreencotton,35,13 +greencloth,35,13 +greenwool,35,13 +greencotton,35,13 +darkgrecloth,35,13 +darkgrewool,35,13 +darkgrecotton,35,13 +dgrecloth,35,13 +dgrewool,35,13 +dgrecotton,35,13 +grecloth,35,13 +grewool,35,13 +grecotton,35,13 +redwool,35,14 +redcloth,35,14 +redcotton,35,14 +rcloth,35,14 +rwool,35,14 +rcotton,35,14 +blackwool,35,15 +blackcloth,35,15 +blackcotton,35,15 +blacloth,35,15 +blawool,35,15 +blacotton,35,15 +dandelion,37,0 +WHITEdandelion,37,0 +ydandelion,37,0 +WHITEflower,37,0 +yflower,37,0 +flower,37,0 +rose,38,0 +redrose,38,0 +rrose,38,0 +redflower,38,0 +rflower,38,0 +poppy,38,0 +redpoppy,38,0 +blueorchid,38,1 +cyanorchid,38,1 +lightblueorchid,38,1 +lblueorchid,38,1 +orchid,38,1 +allium,38,2 +magentaallium,38,2 +azurebluet,38,3 +whiteazurebluet,38,3 +abluet,38,3 +azureb,38,3 +houstonia,38,3 +redtulip,38,4 +tulipred,38,4 +rtulip,38,4 +tulipr,38,4 +orangetulip,38,5 +tuliporange,38,5 +otulip,38,5 +tulipo,38,5 +whitetulip,38,6 +tulipwhite,38,6 +wtulip,38,6 +tulipw,38,6 +pinktulip,38,7 +tulippink,38,7 +ptulip,38,7 +tulipp,38,7 +oxeye,38,8 +daisy,38,8 +oxeyedaisy,38,8 +daisyoxeye,38,8 +moondaisy,38,8 +daisymoon,38,8 +lightgrayoxeye,38,8 +lgrayoxeye,38,8 +lightgreyoxeye,38,8 +lgreyoxeye,38,8 +brownmushroom,39,0 +brownshroom,39,0 +brownmush,39,0 +bmushroom,39,0 +bshroom,39,0 +bmush,39,0 +redmushroom,40,0 +redshroom,40,0 +redmush,40,0 +rmushroom,40,0 +rshroom,40,0 +rmush,40,0 +goldblock,41,0 +blockgold,41,0 +gblock,41,0 +blockg,41,0 +ironblock,42,0 +steelblock,42,0 +blockiron,42,0 +blocksteel,42,0 +iblock,42,0 +stblock,42,0 +blocki,42,0 +blockst,42,0 +stonedoublestep,43,0 +stonedstep,43,0 +sdoublestep,43,0 +sdstep,43,0 +doublestonestep,43,0 +dstonestep,43,0 +doublesstep,43,0 +doublestep,43,0 +dstep,43,0 +stonedoubleslab,43,0 +stonedslab,43,0 +sdoubleslab,43,0 +sdslab,43,0 +doublestoneslab,43,0 +dstoneslab,43,0 +doublesslab,43,0 +doubleslab,43,0 +dslab,43,0 +stonedoublehalfblock,43,0 +stonedhalfblock,43,0 +sdoublehalfblock,43,0 +sdhalfblock,43,0 +doublestonehalfblock,43,0 +dstonehalfblock,43,0 +doubleshalfblock,43,0 +doublehalfblock,43,0 +dhalfblock,43,0 +sandstonedoublestep,43,1 +sandstonedstep,43,1 +sstonedoublestep,43,1 +sstonedstep,43,1 +ssdoublestep,43,1 +ssdstep,43,1 +doublesandstonestep,43,1 +dsandstonestep,43,1 +doublesstonestep,43,1 +dsstonestep,43,1 +doublessstep,43,1 +dsstep,43,1 +sandstonedoubleslab,43,1 +sandstonedslab,43,1 +sstonedoubleslab,43,1 +sstonedslab,43,1 +ssdoubleslab,43,1 +ssdslab,43,1 +doublesandstoneslab,43,1 +dsandstoneslab,43,1 +doublesstoneslab,43,1 +dsstoneslab,43,1 +doublessslab,43,1 +dsslab,43,1 +sandstonedoublehalfblock,43,1 +sandstonedhalfblock,43,1 +sstonedoublehalfblock,43,1 +sstonedhalfblock,43,1 +ssdoublehalfblock,43,1 +ssdhalfblock,43,1 +doublesandstonehalfblock,43,1 +dsandstonehalfblock,43,1 +doublesstonehalfblock,43,1 +dsstonehalfblock,43,1 +doublesshalfblock,43,1 +dsshalfblock,43,1 +plankstonedoublestep,43,2 +woodenstonedoublestep,43,2 +woodenstonedstep,43,2 +woodstonedoublestep,43,2 +woodstonedstep,43,2 +wstonedoublestep,43,2 +wstonedstep,43,2 +doublewoodenstonestep,43,2 +dwoodenstonestep,43,2 +doublewoodstonestep,43,2 +dwoodstonestep,43,2 +doublewstonestep,43,2 +dwstonestep,43,2 +woodenstonedoubleslab,43,2 +woodenstonedslab,43,2 +woodstonedoubleslab,43,2 +woodstonedslab,43,2 +wstonedoubleslab,43,2 +wstonedslab,43,2 +doublewoodenstoneslab,43,2 +dwoodenstoneslab,43,2 +doublewoodstoneslab,43,2 +dwoodstoneslab,43,2 +doublewstoneslab,43,2 +dwstoneslab,43,2 +woodenstonedoublehalfblock,43,2 +woodenstonedhalfblock,43,2 +woodstonedoublehalfblock,43,2 +woodstonedhalfblock,43,2 +wstonedoublehalfblock,43,2 +wstonedhalfblock,43,2 +doublewoodenstonehalfblock,43,2 +dwoodenstonehalfblock,43,2 +doublewoodstonehalfblock,43,2 +dwoodstonehalfblock,43,2 +doublewstonehalfblock,43,2 +dwstonehalfblock,43,2 +cobblestonedoublestep,43,3 +cobblestonedstep,43,3 +cobbledoublestep,43,3 +cobbledstep,43,3 +cstonedoublestep,43,3 +cstonedstep,43,3 +csdoublestep,43,3 +csdstep,43,3 +doublecobblestonestep,43,3 +dcobblestonestep,43,3 +doublecobblestep,43,3 +dcobblestep,43,3 +doublecstonestep,43,3 +dcstonestep,43,3 +doublecsstep,43,3 +dcsstep,43,3 +cobblestonedoubleslab,43,3 +cobblestonedslab,43,3 +cobbledoubleslab,43,3 +cobbledslab,43,3 +cstonedoubleslab,43,3 +cstonedslab,43,3 +csdoubleslab,43,3 +csdslab,43,3 +doublecobblestoneslab,43,3 +dcobblestoneslab,43,3 +doublecobbleslab,43,3 +dcobbleslab,43,3 +doublecstoneslab,43,3 +dcstoneslab,43,3 +doublecsslab,43,3 +dcsslab,43,3 +cobblestonedoublehalfblock,43,3 +cobblestonedhalfblock,43,3 +cobbledoublehalfblock,43,3 +cobbledhalfblock,43,3 +cstonedoublehalfblock,43,3 +cstonedhalfblock,43,3 +csdoublehalfblock,43,3 +csdhalfblock,43,3 +doublecobblestonehalfblock,43,3 +dcobblestonehalfblock,43,3 +doublecobblehalfblock,43,3 +dcobblehalfblock,43,3 +doublecstonehalfblock,43,3 +dcstonehalfblock,43,3 +doublecshalfblock,43,3 +dcshalfblock,43,3 +brickdoublestep,43,4 +brickdstep,43,4 +bdoublestep,43,4 +bdstep,43,4 +brickdoubleslab,43,4 +brickdslab,43,4 +bdoubleslab,43,4 +bdslab,43,4 +doublebrickstep,43,4 +dbrickstep,43,4 +doublebstep,43,4 +dbstep,43,4 +doublebrickslab,43,4 +dbrickslab,43,4 +doublebslab,43,4 +dbslab,43,4 +brickdoublehalfblock,43,4 +brickdhalfblock,43,4 +bdoublehalfblock,43,4 +bdhalfblock,43,4 +doublebrickhalfblock,43,4 +dbrickhalfblock,43,4 +doublebhalfblock,43,4 +dbhalfblock,43,4 +stonebrickdoublestep,43,5 +stonebrickdstep,43,5 +stonebdoublestep,43,5 +stonebdstep,43,5 +sbrickdoublestep,43,5 +sbrickdstep,43,5 +sbdoublestep,43,5 +sbdstep,43,5 +stonebrickdoubleslab,43,5 +stonebrickdslab,43,5 +stonebdoubleslab,43,5 +stonebdslab,43,5 +sbrickdoubleslab,43,5 +sbrickdslab,43,5 +sbdoubleslab,43,5 +sbdslab,43,5 +doublestonebrickstep,43,5 +dstonebrickstep,43,5 +doublestonebstep,43,5 +dstonebstep,43,5 +doublesbrickstep,43,5 +dsbrickstep,43,5 +doublesbstep,43,5 +dsbstep,43,5 +doublestonebrickslab,43,5 +dstonebrickslab,43,5 +doublestonebslab,43,5 +dstonebslab,43,5 +doublesbrickslab,43,5 +dsbrickdslab,43,5 +doublesbslab,43,5 +dsbslab,43,5 +stonebrickdoublehalfblock,43,5 +stonebrickdhalfblock,43,5 +stonebdoublehalfblock,43,5 +stonebdhalfblock,43,5 +sbrickdoublehalfblock,43,5 +sbrickdhalfblock,43,5 +sbdoublehalfblock,43,5 +sbdhalfblock,43,5 +doublestonebrickhalfblock,43,5 +dstonebrickhalfblock,43,5 +doublestonebhalfblock,43,5 +dstonebhalfblock,43,5 +doublesbrickhalfblock,43,5 +dsbrickhalfblock,43,5 +doublesbhalfblock,43,5 +dsbhalfblock,43,5 +netherbrickdoubleslab,43,6 +hellbrickdoubleslab,43,6 +nbrickdoubleslab,43,6 +hbrickdoubleslab,43,6 +netherdoubleslab,43,6 +helldoubleslab,43,6 +nbdoubleslab,43,6 +hbdoubleslab,43,6 +hdoubleslab,43,6 +ndoubleslab,43,6 +netherbrickdoublestep,43,6 +hellbrickdoublestep,43,6 +nbrickdoublestep,43,6 +hbrickdoublestep,43,6 +netherdoublestep,43,6 +helldoublestep,43,6 +nbdoublestep,43,6 +hbdoublestep,43,6 +ndoublestep,43,6 +hdoublestep,43,6 +netherbrickdoublehalfblock,43,6 +hellbrickdoublehalfblock,43,6 +nbrickdoublehalfblock,43,6 +hbrickdoublehalfblock,43,6 +netherdoublehalfblock,43,6 +helldoublehalfblock,43,6 +nbdoublehalfblock,43,6 +hbdoublehalfblock,43,6 +ndoublehalfblock,43,6 +hdoublehalfblock,43,6 +netherbrickdslab,43,6 +hellbrickdslab,43,6 +nbrickdslab,43,6 +hbrickdslab,43,6 +netherdslab,43,6 +helldslab,43,6 +nbdslab,43,6 +hbdslab,43,6 +hdslab,43,6 +ndslab,43,6 +netherbrickdstep,43,6 +hellbrickdstep,43,6 +nbrickdstep,43,6 +hbrickdstep,43,6 +netherdstep,43,6 +helldstep,43,6 +nbdstep,43,6 +hbdstep,43,6 +ndstep,43,6 +hdstep,43,6 +netherbrickdhalfblock,43,6 +hellbrickdhalfblock,43,6 +nbrickdhalfblock,43,6 +hbrickdhalfblock,43,6 +netherdhalfblock,43,6 +helldhalfblock,43,6 +nbdhalfblock,43,6 +hbdhalfblock,43,6 +ndhalfblock,43,6 +hdhalfblock,43,6 +doublenetherbrickslab,43,6 +doublehellbrickslab,43,6 +doublenbrickslab,43,6 +doublehbrickslab,43,6 +doublenetherslab,43,6 +doublehellslab,43,6 +doublenbslab,43,6 +doublehbslab,43,6 +doublehslab,43,6 +doublenslab,43,6 +doublenetherbrickstep,43,6 +doublehellbrickstep,43,6 +doublenbrickstep,43,6 +doublehbrickstep,43,6 +doublenetherstep,43,6 +doublehellstep,43,6 +doublenbstep,43,6 +doublehbstep,43,6 +doublenstep,43,6 +doublehstep,43,6 +doublenetherbrickhalfblock,43,6 +doublehellbrickhalfblock,43,6 +doublenbrickhalfblock,43,6 +doublehbrickhalfblock,43,6 +doublenetherhalfblock,43,6 +doublehellhalfblock,43,6 +doublenbhalfblock,43,6 +doublehbhalfblock,43,6 +doublenhalfblock,43,6 +doublehhalfblock,43,6 +dnetherbrickslab,43,6 +dhellbrickslab,43,6 +dnbrickslab,43,6 +dhbrickslab,43,6 +dnetherslab,43,6 +dhellslab,43,6 +dnbslab,43,6 +dhbslab,43,6 +dhslab,43,6 +dnslab,43,6 +dnetherbrickstep,43,6 +dhellbrickstep,43,6 +dnbrickstep,43,6 +dhbrickstep,43,6 +dnetherstep,43,6 +dhellstep,43,6 +dnbstep,43,6 +dhbstep,43,6 +dnstep,43,6 +dhstep,43,6 +dnetherbrickhalfblock,43,6 +dhellbrickhalfblock,43,6 +dnbrickhalfblock,43,6 +dhbrickhalfblock,43,6 +dnetherhalfblock,43,6 +dhellhalfblock,43,6 +dnbhalfblock,43,6 +dhbhalfblock,43,6 +dnhalfblock,43,6 +dhhalfblock,43,6 +netherquartzdoublestep,43,7 +hellquartzdoublestep,43,7 +deathquartzdoublestep,43,7 +nquartzdoublestep,43,7 +hquartzdoublestep,43,7 +dquartzdoublestep,43,7 +quartzdoublestep,43,7 +nqdoublestep,43,7 +hqdoublestep,43,7 +dqdoublestep,43,7 +qdoublestep,43,7 +netherquartzdoubleslab,43,7 +hellquartzdoubleslab,43,7 +deathquartzdoubleslab,43,7 +nquartzdoubleslab,43,7 +hquartzdoubleslab,43,7 +dquartzdoubleslab,43,7 +quartzdoubleslab,43,7 +nqdoubleslab,43,7 +hqdoubleslab,43,7 +dqdoubleslab,43,7 +qdoubleslab,43,7 +netherquartzdoublehalfblock,43,7 +hellquartzdoublehalfblock,43,7 +deathquartzdoublehalfblock,43,7 +nquartzdoublehalfblock,43,7 +hquartzdoublehalfblock,43,7 +dquartzdoublehalfblock,43,7 +quartzdoublehalfblock,43,7 +nqdoublehalfblock,43,7 +hqdoublehalfblock,43,7 +dqdoublehalfblock,43,7 +qdoublehalfblock,43,7 +netherquartzdslab,43,7 +hellquartzdslab,43,7 +deathquartzdslab,43,7 +nquartzdslab,43,7 +hquartzdslab,43,7 +dquartzdslab,43,7 +quartzdslab,43,7 +nqdslab,43,7 +hqdslab,43,7 +dqdslab,43,7 +qdslab,43,7 +netherquartzdstep,43,7 +hellquartzdstep,43,7 +deathquartzdstep,43,7 +nquartzdstep,43,7 +hquartzdstep,43,7 +dquartzdstep,43,7 +quartzdstep,43,7 +nqdstep,43,7 +hqdstep,43,7 +dqdstep,43,7 +qdstep,43,7 +netherquartzdhalfblock,43,7 +hellquartzdhalfblock,43,7 +deathquartzdhalfblock,43,7 +nquartzdhalfblock,43,7 +hquartzdhalfblock,43,7 +dquartzdhalfblock,43,7 +quartzdhalfblock,43,7 +nqdhalfblock,43,7 +hqdhalfblock,43,7 +dqdhalfblock,43,7 +qdhalfblock,43,7 +doublenetherquartzslab,43,7 +doublehellquartzslab,43,7 +doubledeathquartzslab,43,7 +doublenquartzslab,43,7 +doublehquartzslab,43,7 +doubledquartzslab,43,7 +doublequartzslab,43,7 +doublenqslab,43,7 +doublehqslab,43,7 +doubledqslab,43,7 +doubleqslab,43,7 +doublenetherquartzstep,43,7 +doublehellquartzstep,43,7 +doubledeathquartzstep,43,7 +doublenquartzstep,43,7 +doublehquartzstep,43,7 +doubledquartzstep,43,7 +doublequartzstep,43,7 +doublenqstep,43,7 +doublehqstep,43,7 +doubledqstep,43,7 +doubleqstep,43,7 +doublenetherquartzhalfblock,43,7 +doublehellquartzhalfblock,43,7 +doubledeathquartzhalfblock,43,7 +doublenquartzhalfblock,43,7 +doublehquartzhalfblock,43,7 +doubledquartzhalfblock,43,7 +doublequartzhalfblock,43,7 +doublenqhalfblock,43,7 +doublehqhalfblock,43,7 +doubledqhalfblock,43,7 +doubleqhalfblock,43,7 +dnetherquartzslab,43,7 +dhellquartzslab,43,7 +ddeathquartzslab,43,7 +dnquartzslab,43,7 +dhquartzslab,43,7 +ddquartzslab,43,7 +dnqslab,43,7 +dhqslab,43,7 +ddqslab,43,7 +dnetherquartzstep,43,7 +dhellquartzstep,43,7 +ddeathquartzstep,43,7 +dnquartzstep,43,7 +dhquartzstep,43,7 +ddquartzstep,43,7 +dnqstep,43,7 +dhqstep,43,7 +ddqstep,43,7 +dnetherquartzhalfblock,43,7 +dhellquartzhalfblock,43,7 +ddeathquartzhalfblock,43,7 +dnquartzhalfblock,43,7 +dhquartzhalfblock,43,7 +ddquartzhalfblock,43,7 +dnqhalfblock,43,7 +dhqhalfblock,43,7 +ddqhalfblock,43,7 +smoothstonedoubleslab,43,8 +smoothstonedoublestep,43,8 +smoothstonedoublehalfblock,43,8 +smoothstonedslab,43,8 +smoothstonedstep,43,8 +smoothstonedhalfblock,43,8 +doublesmoothstoneslab,43,8 +doublesmoothstonestep,43,8 +doublesmoothstonehalfblock,43,8 +dsmoothstoneslab,43,8 +dsmoothstonestep,43,8 +dsmoothstonehalfblock,43,8 +smoothsandstonedoubleslab,43,9 +ssandstonedoubleslab,43,9 +ssstonedoubleslab,43,9 +sssdoubleslab,43,9 +smoothsandstonedoublestep,43,9 +ssandstonedoublestep,43,9 +ssstonedoublestep,43,9 +sssdoublestep,43,9 +smoothsandstonedoublehalfblock,43,9 +ssandstonedoublehalfblock,43,9 +ssstonedoublehalfblock,43,9 +sssdoublehalfblock,43,9 +smoothsandstonedslab,43,9 +ssandstonedslab,43,9 +ssstonedslab,43,9 +sssdslab,43,9 +smoothsandstonedstep,43,9 +ssandstonedstep,43,9 +ssstonedstep,43,9 +sssdstep,43,9 +smoothsandstonedhalfblock,43,9 +ssandstonedhalfblock,43,9 +ssstonedhalfblock,43,9 +sssdhalfblock,43,9 +doublesmoothsandstoneslab,43,9 +doublessandstoneslab,43,9 +doublessstoneslab,43,9 +doublesssslab,43,9 +doublesmoothsandstonestep,43,9 +doublessandstonestep,43,9 +doublessstonestep,43,9 +doublesssstep,43,9 +doublesmoothsandstonehalfblock,43,9 +doublessandstonehalfblock,43,9 +doublessstonehalfblock,43,9 +doublessshalfblock,43,9 +dsmoothsandstoneslab,43,9 +dssandstoneslab,43,9 +dssstoneslab,43,9 +dsssslab,43,9 +dsmoothsandstonestep,43,9 +dssandstonestep,43,9 +dssstonestep,43,9 +dsssstep,43,9 +dsmoothsandstonehalfblock,43,9 +dssandstonehalfblock,43,9 +dssstonehalfblock,43,9 +dssshalfblock,43,9 +smoothstonestep,44,0 +stonestep,44,0 +sstep,44,0 +step,44,0 +smoothstoneslab,44,0 +stoneslab,44,0 +sslab,44,0 +slab,44,0 +smoothstonehalfblock,44,0 +stonehalfblock,44,0 +shalfblock,44,0 +halfblock,44,0 +sandstonestep,44,1 +sstonestep,44,1 +ssstep,44,1 +sandstoneslab,44,1 +sstoneslab,44,1 +ssslab,44,1 +sandstonehalfblock,44,1 +sstonehalfblock,44,1 +sshalfblock,44,1 +woodenstonestep,44,2 +woodstonestep,44,2 +wstonestep,44,2 +woodenstoneslab,44,2 +woodstoneslab,44,2 +wstoneslab,44,2 +woodenstonehalfblock,44,2 +woodstonehalfblock,44,2 +wstonehalfblock,44,2 +cobblestonestep,44,3 +cobblestep,44,3 +cstonestep,44,3 +csstep,44,3 +cobblestoneslab,44,3 +cobbleslab,44,3 +cstoneslab,44,3 +csslab,44,3 +cobblestonehalfblock,44,3 +cobblehalfblock,44,3 +cstonehalfblock,44,3 +cshalfblock,44,3 +brickstep,44,4 +bstep,44,4 +brickslab,44,4 +bslab,44,4 +brickhalfblock,44,4 +bhalfblock,44,4 +stonebrickstep,44,5 +stonebstep,44,5 +sbrickstep,44,5 +sbstep,44,5 +stonebrickslab,44,5 +stonebslab,44,5 +sbrickslab,44,5 +sbslab,44,5 +stonebrickhalfblock,44,5 +stonebhalfblock,44,5 +sbrickhalfblock,44,5 +sbhalfblock,44,5 +netherbrickslab,44,6 +hellbrickslab,44,6 +nbrickslab,44,6 +hbrickslab,44,6 +netherslab,44,6 +hellslab,44,6 +nbslab,44,6 +hbslab,44,6 +hslab,44,6 +nslab,44,6 +netherbrickstep,44,6 +hellbrickstep,44,6 +nbrickstep,44,6 +hbrickstep,44,6 +netherstep,44,6 +hellstep,44,6 +nbstep,44,6 +hbstep,44,6 +nstep,44,6 +hstep,44,6 +netherbrickhalfblock,44,6 +hellbrickhalfblock,44,6 +nbrickhalfblock,44,6 +hbrickhalfblock,44,6 +netherhalfblock,44,6 +hellhalfblock,44,6 +nbhalfblock,44,6 +hbhalfblock,44,6 +nhalfblock,44,6 +hhalfblock,44,6 +netherquartzstep,44,7 +hellquartzstep,44,7 +deathquartzstep,44,7 +nquartzstep,44,7 +hquartzstep,44,7 +dquartzstep,44,7 +quartzstep,44,7 +nqstep,44,7 +hqstep,44,7 +dqstep,44,7 +qstep,44,7 +netherquartzslab,44,7 +hellquartzslab,44,7 +deathquartzslab,44,7 +nquartzslab,44,7 +hquartzslab,44,7 +dquartzslab,44,7 +quartzslab,44,7 +nqslab,44,7 +hqslab,44,7 +dqslab,44,7 +qslab,44,7 +netherquartzhalfblock,44,7 +hellquartzhalfblock,44,7 +deathquartzhalfblock,44,7 +nquartzhalfblock,44,7 +hquartzhalfblock,44,7 +dquartzhalfblock,44,7 +quartzhalfblock,44,7 +nqhalfblock,44,7 +hqhalfblock,44,7 +dqhalfblock,44,7 +qhalfblock,44,7 +brickblock,45,0 +blockbrick,45,0 +bblock,45,0 +blockb,45,0 +tnt,46,0 +tntblock,46,0 +blocktnt,46,0 +bombblock,46,0 +blockbomb,46,0 +dynamiteblock,46,0 +blockdynamite,46,0 +bomb,46,0 +dynamite,46,0 +bookcase,47,0 +casebook,47,0 +bookshelf,47,0 +shelfbook,47,0 +bookblock,47,0 +blockbook,47,0 +mossycobblestone,48,0 +mosscobblestone,48,0 +mcobblestone,48,0 +mossycobble,48,0 +mosscobble,48,0 +mcobble,48,0 +mossstone,48,0 +mossystone,48,0 +mstone,48,0 +obsidian,49,0 +obsi,49,0 +obby,49,0 +torch,50,0 +burningstick,50,0 +burnstick,50,0 +fire,51,0 +flame,51,0 +flames,51,0 +mobspawner,52,0 +mobcage,52,0 +monsterspawner,52,0 +monstercage,52,0 +mspawner,52,0 +mcage,52,0 +spawner,52,0 +cage,52,0 +woodenstairs,53,0 +woodstairs,53,0 +wstairs,53,0 +woodenstair,53,0 +woodstair,53,0 +wstair,53,0 +chest,54,0 +container,54,0 +diamondore,56,0 +crystalore,56,0 +orediamond,56,0 +orecrystal,56,0 +dore,56,0 +ored,56,0 +diamondblock,57,0 +blockdiamond,57,0 +crystalblock,57,0 +blockcrystal,57,0 +dblock,57,0 +blockd,57,0 +workbench,58,0 +craftingbench,58,0 +crafterbench,58,0 +craftbench,58,0 +worktable,58,0 +craftingtable,58,0 +craftertable,58,0 +crafttable,58,0 +wbench,58,0 +cbench,58,0 +soil,60,0 +furnace,61,0 +litfurnace,62,0 +lfurnace,62,0 +burningfurnace,62,0 +burnfurnace,62,0 +bfurnace,62,0 +ladder,65,0 +minecarttrack,66,0 +minecartrails,66,0 +minecartrail,66,0 +mcarttrack,66,0 +mcartrails,66,0 +mcartrail,66,0 +mctrack,66,0 +mcrails,66,0 +mcrail,66,0 +track,66,0 +rails,66,0 +rail,66,0 +cobblestonestairs,67,0 +cstonestairs,67,0 +stonestairs,67,0 +cobblestairs,67,0 +csstairs,67,0 +sstairs,67,0 +cstairs,67,0 +cobblestonestair,67,0 +cstonestair,67,0 +stonestair,67,0 +cobblestair,67,0 +csstair,67,0 +sstair,67,0 +cstair,67,0 +lever,69,0 +stonepressureplate,70,0 +stonepressplate,70,0 +stonepplate,70,0 +stoneplate,70,0 +spressureplate,70,0 +spressplate,70,0 +spplate,70,0 +splate,70,0 +smoothstonepressureplate,70,0 +smoothstonepressplate,70,0 +smoothstonepplate,70,0 +smoothstoneplate,70,0 +sstonepressureplate,70,0 +sstonepressplate,70,0 +sstonepplate,70,0 +sstoneplate,70,0 +woodenpressureplate,72,0 +woodenpressplate,72,0 +woodenpplate,72,0 +woodenplate,72,0 +woodpressureplate,72,0 +woodpressplate,72,0 +woodpplate,72,0 +woodplate,72,0 +wpressureplate,72,0 +wpressplate,72,0 +wpplate,72,0 +wplate,72,0 +redstoneore,73,0 +redsore,73,0 +redore,73,0 +rstoneore,73,0 +rsore,73,0 +rore,73,0 +oreredstone,73,0 +orereds,73,0 +orered,73,0 +orerstone,73,0 +orers,73,0 +orer,73,0 +redstonetorch,76,0 +rstonetorch,76,0 +redstorch,76,0 +redtorch,76,0 +rstorch,76,0 +stonebutton,77,0 +smoothstonebutton,77,0 +sstonebutton,77,0 +sbutton,77,0 +button,77,0 +snowcover,78,0 +snowcovering,78,0 +scover,78,0 +ice,79,0 +frozenwater,79,0 +waterfrozen,79,0 +freezewater,79,0 +waterfreeze,79,0 +snowblock,80,0 +blocksnow,80,0 +sblock,80,0 +blocks,80,0 +cactus,81,0 +cactuses,81,0 +cacti,81,0 +clayblock,82,0 +blockclay,82,0 +cblock,82,0 +blockc,82,0 +jukebox,84,0 +jbox,84,0 +woodenfence,85,0 +fence,85,0 +woodfence,85,0 +wfence,85,0 +fencewooden,85,0 +fencewood,85,0 +fencew,85,0 +pumpkin,86,0 +netherrack,87,0 +netherrock,87,0 +netherstone,87,0 +hellrack,87,0 +hellrock,87,0 +hellstone,87,0 +deathrack,87,0 +deathrock,87,0 +deathstone,87,0 +nrack,87,0 +nrock,87,0 +nstone,87,0 +hrack,87,0 +hrock,87,0 +hstone,87,0 +drack,87,0 +drock,87,0 +dstone,87,0 +soulsand,88,0 +slowsand,88,0 +slowmud,88,0 +ssand,88,0 +smud,88,0 +mud,88,0 +glowstone,89,0 +glowingstoneblock,89,0 +lightstoneblock,89,0 +glowstoneblock,89,0 +blockglowingstone,89,0 +blocklightstone,89,0 +blockglowstone,89,0 +glowingstone,89,0 +lightstone,89,0 +glowingblock,89,0 +lightblock,89,0 +glowblock,89,0 +lstone,89,0 +gstone,89,0 +portal,90,0 +jackolantern,91,0 +pumpkinlantern,91,0 +glowingpumpkin,91,0 +lightpumpkin,91,0 +jpumpkin,91,0 +plantren,91,0 +glowpumpkin,91,0 +gpumpkin,91,0 +lpumpkin,91,0 +lockedchest,95,0 +lockchest,95,0 +jokechest,95,0 +whiteglass,95,0 +whitesglass,95,0 +whitestainedglass,95,0 +wglass,95,0 +wsglass,95,0 +wstainedglass,95,0 +sglass,95,0 +stainedglass,95,0 +orangeglass,95,1 +orangesglass,95,1 +orangestainedglass,95,1 +oglass,95,1 +osglass,95,1 +ostainedglass,95,1 +magentaglass,95,2 +magentasglass,95,2 +magentastainedglass,95,2 +mglass,95,2 +msglass,95,2 +mstainedglass,95,2 +lightblueglass,95,3 +lightbluesglass,95,3 +lightbluestainedglass,95,3 +lblueglass,95,3 +lbluesglass,95,3 +lbluestainedglass,95,3 +lightbluglass,95,3 +lightblusglass,95,3 +lightblustainedglass,95,3 +lbluglass,95,3 +lblusglass,95,3 +lblustainedglass,95,3 +lbglass,95,3 +lbsglass,95,3 +lbstainedglass,95,3 +WHITEglass,95,4 +WHITEsglass,95,4 +WHITEstainedglass,95,4 +yglass,95,4 +ysglass,95,4 +ystainedglass,95,4 +lightgreenglass,95,5 +lightgreensglass,95,5 +lightgreenstainedglass,95,5 +lgreenglass,95,5 +lgreensglass,95,5 +lgreenstainedglass,95,5 +lightgreglass,95,5 +lightgresglass,95,5 +lightgrestainedglass,95,5 +lgreglass,95,5 +lgresglass,95,5 +lgrestainedglass,95,5 +limeglass,95,5 +limesglass,95,5 +limestainedglass,95,5 +lglass,95,5 +lsglass,95,5 +lstainedglass,95,5 +pinkglass,95,6 +pinksglass,95,6 +pinkstainedglass,95,6 +piglass,95,6 +pisglass,95,6 +pistainedglass,95,6 +darkgrayglass,95,7 +darkgraysglass,95,7 +darkgraystainedglass,95,7 +dgrayglass,95,7 +dgraysglass,95,7 +dgraystainedglass,95,7 +darkgreyglass,95,7 +darkgreysglass,95,7 +darkgreystainedglass,95,7 +dgreyglass,95,7 +dgreysglass,95,7 +dgreystainedglass,95,7 +darkgraglass,95,7 +darkgrasglass,95,7 +darkgrastainedglass,95,7 +dgraglass,95,7 +dgrasglass,95,7 +dgrastainedglass,95,7 +grayglass,95,7 +graysglass,95,7 +graystainedglass,95,7 +greyglass,95,7 +greysglass,95,7 +greystainedglass,95,7 +graglass,95,7 +grasglass,95,7 +grastainedglass,95,7 +lightgrayglass,95,8 +lightgraysglass,95,8 +lightgraystainedglass,95,8 +lgrayglass,95,8 +lgraysglass,95,8 +lgraystainedglass,95,8 +lightgreyglass,95,8 +lightgreysglass,95,8 +lightgreystainedglass,95,8 +lgreyglass,95,8 +lgreysglass,95,8 +lgreystainedglass,95,8 +lightgraglass,95,8 +lightgrasglass,95,8 +lightgrastainedglass,95,8 +lgraglass,95,8 +lgrasglass,95,8 +lgrastainedglass,95,8 +silverglass,95,8 +silversglass,95,8 +silverstainedglass,95,8 +siglass,95,8 +siasglass,95,8 +siastainedglass,95,8 +cyanglass,95,9 +cyansglass,95,9 +cyanstainedglass,95,9 +cglass,95,9 +csglass,95,9 +cstainedglass,95,9 +purpleglass,95,10 +purplesglass,95,10 +purplestainedglass,95,10 +puglass,95,10 +pusglass,95,10 +pustainedglass,95,10 +blueglass,95,11 +bluesglass,95,11 +bluestainedglass,95,11 +bluglass,95,11 +blusglass,95,11 +blustainedglass,95,11 +brownglass,95,12 +brownsglass,95,12 +brownstainedglass,95,12 +broglass,95,12 +brosglass,95,12 +brostainedglass,95,12 +darkgreenglass,95,13 +darkgreensglass,95,13 +darkgreenstainedglass,95,13 +dgreenglass,95,13 +dgreensglass,95,13 +dgreenstainedglass,95,13 +greenglass,95,13 +greensglass,95,13 +greenstainedglass,95,13 +darkgreglass,95,13 +darkgresglass,95,13 +darkgrestainedglass,95,13 +dgreglass,95,13 +dgresglass,95,13 +dgrestainedglass,95,13 +greglass,95,13 +gresglass,95,13 +grestainedglass,95,13 +redglass,95,14 +redsglass,95,14 +redstainedglass,95,14 +rglass,95,14 +rsglass,95,14 +rstainedglass,95,14 +blackglass,95,15 +blacksglass,95,15 +blackstainedglass,95,15 +blaglass,95,15 +blasglass,95,15 +blastainedglass,95,15 +trapdoor,96,0 +doortrap,96,0 +hatch,96,0 +tdoor,96,0 +doort,96,0 +trapd,96,0 +dtrap,96,0 +silverfish,97,0 +silverfishsmoothstone,97,0 +silverfishsstone,97,0 +sfishsmoothstone,97,0 +sfishsstone,97,0 +fishsmoothstone,97,0 +fishsstone,97,0 +sfsmoothstone,97,0 +sfsstone,97,0 +trapsmoothstone,97,0 +trapsstone,97,0 +monsteregg,97,0 +monstereggsmoothstone,97,0 +monstereggsstone,97,0 +meggsmoothstone,97,0 +meggsstone,97,0 +mesmoothstone,97,0 +messtone,97,0 +silverfishcobblestone,97,1 +silverfishcstone,97,1 +sfishcobblestone,97,1 +sfishcstone,97,1 +fishcobblestone,97,1 +fishcstone,97,1 +sfcobblestone,97,1 +sfcstone,97,1 +trapcobblestone,97,1 +trapcstone,97,1 +monstereggcobblestone,97,1 +monstereggcstone,97,1 +meggcobblestone,97,1 +meggcstone,97,1 +mecobblestone,97,1 +mecstone,97,1 +silverfishstonebrick,97,2 +silverfishsbrick,97,2 +sfishstonebrick,97,2 +sfishsbrick,97,2 +fishstonebrick,97,2 +fishsbrick,97,2 +sfstonebrick,97,2 +sfsbrick,97,2 +trapstonebrick,97,2 +trapsbrick,97,2 +monstereggstonebrick,97,2 +monstereggsbrick,97,2 +meggstonebrick,97,2 +meggsbrick,97,2 +mestonebrick,97,2 +mesbrick,97,2 +silverfishmossystonebrick,97,3 +silverfishmossstonebrick,97,3 +silverfishmstonebrick,97,3 +silverfishmsbrick,97,3 +sfishmossystonebrick,97,3 +sfishmossstonebrick,97,3 +sfishmstonebrick,97,3 +sfishmsbrick,97,3 +fishmossystonebrick,97,3 +fishmossstonebrick,97,3 +fishmstonebrick,97,3 +fishmsbrick,97,3 +sfmossystonebrick,97,3 +sfmossstonebrick,97,3 +sfmstonebrick,97,3 +sfmsbrick,97,3 +trapmossystonebrick,97,3 +trapmossstonebrick,97,3 +trapmstonebrick,97,3 +trapmsbrick,97,3 +monstereggmossystonebrick,97,3 +monstereggmossstonebrick,97,3 +monstereggmstonebrick,97,3 +monstereggmsbrick,97,3 +meggmossystonebrick,97,3 +meggmossstonebrick,97,3 +meggmstonebrick,97,3 +meggmsbrick,97,3 +memossystonebrick,97,3 +memossstonebrick,97,3 +memstonebrick,97,3 +memsbrick,97,3 +silverfishcrackedstonebrick,97,4 +silverfishcrackstonebrick,97,4 +silverfishcrstonebrick,97,4 +silverfishcrsbrick,97,4 +sfishcrackedstonebrick,97,4 +sfishcrackstonebrick,97,4 +sfishcrstonebrick,97,4 +sfishcrsbrick,97,4 +fishcrackedstonebrick,97,4 +fishcrackstonebrick,97,4 +fishcrstonebrick,97,4 +fishcrsbrick,97,4 +sfcrackedstonebrick,97,4 +sfcrackstonebrick,97,4 +sfcrstonebrick,97,4 +sfcrsbrick,97,4 +trapcrackedstonebrick,97,4 +trapcrackstonebrick,97,4 +trapcrstonebrick,97,4 +trapcrsbrick,97,4 +monstereggcrackedstonebrick,97,4 +monstereggcrackstonebrick,97,4 +monstereggcrstonebrick,97,4 +monstereggcrsbrick,97,4 +meggcrackedstonebrick,97,4 +meggcrackstonebrick,97,4 +meggcrstonebrick,97,4 +meggcrsbrick,97,4 +mecrackedstonebrick,97,4 +mecrackstonebrick,97,4 +mecrstonebrick,97,4 +mecrsbrick,97,4 +silverfishcirclestonebrick,97,5 +silverfishcistonebrick,97,5 +silverfishcisbrick,97,5 +sfishcirclestonebrick,97,5 +sfishcistonebrick,97,5 +sfishcisbrick,97,5 +fishcirclestonebrick,97,5 +fishcistonebrick,97,5 +fishcisbrick,97,5 +sfcirclestonebrick,97,5 +sfcistonebrick,97,5 +sfcisbrick,97,5 +trapcirclestonebrick,97,5 +trapcistonebrick,97,5 +trapcisbrick,97,5 +monstereggcirclestonebrick,97,5 +monstereggcistonebrick,97,5 +monstereggcisbrick,97,5 +meggcirclestonebrick,97,5 +meggcistonebrick,97,5 +meggcisbrick,97,5 +mecirclestonebrick,97,5 +mecistonebrick,97,5 +mecisbrick,97,5 +stonebrick,98,0 +stonebricks,98,0 +stonebrickblock,98,0 +stonebb,98,0 +sbrick,98,0 +mossystonebrick,98,1 +mossystonebricks,98,1 +mossystonebrickblock,98,1 +mossystonebb,98,1 +mossstonebrick,98,1 +mossstonebricks,98,1 +mossstonebrickblock,98,1 +mossstonebb,98,1 +mstonebrick,98,1 +mstonebricks,98,1 +mstonebrickblock,98,1 +mstonebb,98,1 +mosssbrick,98,1 +mosssbricks,98,1 +mosssbrickblock,98,1 +mosssbb,98,1 +msbrick,98,1 +msbricks,98,1 +msbrickblock,98,1 +crackedstone,98,2 +crackedstonebrick,98,2 +crackedstonebricks,98,2 +crackedstonebrickblock,98,2 +crackedstonebb,98,2 +crackstonebrick,98,2 +crackstonebricks,98,2 +crackstonebrickblock,98,2 +crackstonebb,98,2 +crstonebrick,98,2 +crstonebricks,98,2 +crstonebrickblock,98,2 +crstonebb,98,2 +cracksbrick,98,2 +cracksbricks,98,2 +cracksbrickblock,98,2 +cracksbb,98,2 +crsbrick,98,2 +crsbricks,98,2 +crsbrickblock,98,2 +circlestone,98,3 +circlestonebrick,98,3 +circlestonebricks,98,3 +circlestonebrickblock,98,3 +circlestonebb,98,3 +cistonebrick,98,3 +cistonebricks,98,3 +cistonebrickblock,98,3 +cistonebb,98,3 +circlesbrick,98,3 +circlesbricks,98,3 +circlesbrickblock,98,3 +circlesbb,98,3 +cisbrick,98,3 +cisbricks,98,3 +cisbrickblock,98,3 +giantredmushroom,99,0 +hugeredmushroom,99,0 +bigredmushroom,99,0 +gredmushroom,99,0 +hredmushroom,99,0 +bredmushroom,99,0 +giantrmushroom,99,0 +hugermushroom,99,0 +bigrmushroom,99,0 +grmushroom,99,0 +hrmushroom,99,0 +brmushroom,99,0 +giantredmush,99,0 +hugeredmush,99,0 +bigredmush,99,0 +gredmush,99,0 +hredmush,99,0 +bredmush,99,0 +giantrmush,99,0 +hugermush,99,0 +bigrmush,99,0 +grmush,99,0 +hrmush,99,0 +brmush,99,0 +giantbrownmushroom,100,0 +hugebrownmushroom,100,0 +bigbrownmushroom,100,0 +gbrownmushroom,100,0 +hbrownmushroom,100,0 +bbrownmushroom,100,0 +giantbmushroom,100,0 +hugebmushroom,100,0 +bigbmushroom,100,0 +gbmushroom,100,0 +hbmushroom,100,0 +bbmushroom,100,0 +giantbrownmush,100,0 +hugebrownmush,100,0 +bigbrownmush,100,0 +gbrownmush,100,0 +hbrownmush,100,0 +bbrownmush,100,0 +giantbmush,100,0 +hugebmush,100,0 +bigbmush,100,0 +gbmush,100,0 +hbmush,100,0 +bbmush,100,0 +ironbars,101,0 +ironbarsb,101,0 +ironbarsblock,101,0 +ironfence,101,0 +metalbars,101,0 +metalbarsb,101,0 +metalbarsblock,101,0 +metalfence,101,0 +jailbars,101,0 +jailbarsb,101,0 +jailbarsblock,101,0 +jailfence,101,0 +mbars,101,0 +mbarsb,101,0 +mbarsblock,101,0 +mfence,101,0 +jbars,101,0 +jbarsb,101,0 +jbarsblock,101,0 +jfence,101,0 +ibars,101,0 +ibarsb,101,0 +ibarsblock,101,0 +ifence,101,0 +glasspane,102,0 +glassp,102,0 +paneglass,102,0 +pglass,102,0 +flatglass,102,0 +fglass,102,0 +skinnyglass,102,0 +glassflat,102,0 +glassf,102,0 +glassskinny,102,0 +glasss,102,0 +melon,103,0 +watermelon,103,0 +greenmelon,103,0 +melongreen,103,0 +melonblock,103,0 +watermelonblock,103,0 +greenmelonblock,103,0 +vines,106,0 +vine,106,0 +greenvines,106,0 +greenvine,106,0 +gardenvines,106,0 +gardenvine,106,0 +vinesgreen,106,0 +vinegreen,106,0 +vinesgarden,106,0 +vinegarden,106,0 +vinesg,106,0 +vineg,106,0 +gvines,106,0 +gvine,106,0 +woodgate,107,0 +woodenfencegate,107,0 +wfencegate,107,0 +woodfencegate,107,0 +woodengate,107,0 +wgate,107,0 +gate,107,0 +gardengate,107,0 +ggate,107,0 +fencegate,107,0 +fgate,107,0 +brickstairs,108,0 +redbrickstairs,108,0 +redbstairs,108,0 +rbrickstairs,108,0 +bstairs,108,0 +redstairs,108,0 +brickstair,108,0 +redbrickstair,108,0 +redbstair,108,0 +rbrickstair,108,0 +bstair,108,0 +redstair,108,0 +stonebrickstairs,109,0 +stonebstairs,109,0 +sbstairs,109,0 +cementbrickstairs,109,0 +cementstairs,109,0 +cementbstairs,109,0 +cbstairs,109,0 +greybrickstairs,109,0 +greybstairs,109,0 +greystairs,109,0 +mycelium,110,0 +purplegrass,110,0 +pinkgrass,110,0 +mycel,110,0 +swampgrass,110,0 +sgrass,110,0 +mushroomgrass,110,0 +mushgrass,110,0 +lilypad,111,0 +waterlily,111,0 +lily,111,0 +swamppad,111,0 +lpad,111,0 +wlily,111,0 +netherbrickblock,112,0 +hellbrickblock,112,0 +deathbrickblock,112,0 +nbrickblock,112,0 +hbrickblock,112,0 +dbrickblock,112,0 +netherbblock,112,0 +hellbblock,112,0 +deathbblock,112,0 +nbblock,112,0 +hbblock,112,0 +dbblock,112,0 +netherbrickfence,113,0 +hellbrickfence,113,0 +nbrickfence,113,0 +hbrickfence,113,0 +netherbfence,113,0 +hellbfence,113,0 +netherfence,113,0 +hellfence,113,0 +nbfence,113,0 +hbfence,113,0 +nfence,113,0 +hfence,113,0 +netherbrickstairs,114,0 +hellbrickstairs,114,0 +nbrickstairs,114,0 +hbrickstairs,114,0 +netherbstairs,114,0 +hellbstairs,114,0 +netherstairs,114,0 +hellstairs,114,0 +nbstairs,114,0 +hbstairs,114,0 +nstairs,114,0 +hstairs,114,0 +netherbrickstair,114,0 +hellbrickstair,114,0 +nbrickstair,114,0 +hbrickstair,114,0 +netherbstair,114,0 +hellbstair,114,0 +netherstair,114,0 +hellstair,114,0 +nbstair,114,0 +hbstair,114,0 +nstair,114,0 +hstair,114,0 +enchantmenttable,116,0 +enchantingtable,116,0 +enchanttable,116,0 +etable,116,0 +magicaltable,116,0 +magictable,116,0 +mtable,116,0 +enchantmentdesk,116,0 +enchantingdesk,116,0 +enchantdesk,116,0 +edesk,116,0 +magicaldesk,116,0 +magicdesk,116,0 +mdesk,116,0 +booktable,116,0 +bookdesk,116,0 +btable,116,0 +bdesk,116,0 +enderportal,119,0 +endergoo,119,0 +endgoo,119,0 +endportal,119,0 +egoo,119,0 +eportal,119,0 +enderportalframe,120,0 +endportalframe,120,0 +endgooframe,120,0 +endergooframe,120,0 +egooframe,120,0 +eportalframe,120,0 +enderframe,120,0 +endframe,120,0 +enderstone,121,0 +endstone,121,0 +endrock,121,0 +enderrock,121,0 +erock,121,0 +estone,121,0 +enderdragonegg,122,0 +endegg,122,0 +dragonegg,122,0 +degg,122,0 +bossegg,122,0 +begg,122,0 +redstonelamp,123,0 +redlamp,123,0 +rslamp,123,0 +woodendoublestep,125,0 +woodendstep,125,0 +wooddoublestep,125,0 +wooddstep,125,0 +wdoublestep,125,0 +wdstep,125,0 +doublewoodenstep,125,0 +dwoodenstep,125,0 +doublewoodstep,125,0 +dwoodstep,125,0 +doublewstep,125,0 +dwstep,125,0 +woodendoubleslab,125,0 +woodendslab,125,0 +wooddoubleslab,125,0 +wooddslab,125,0 +wdoubleslab,125,0 +wdslab,125,0 +doublewoodenslab,125,0 +dwoodenslab,125,0 +doublewoodslab,125,0 +dwoodslab,125,0 +doublewslab,125,0 +dwslab,125,0 +woodendoublehalfblock,125,0 +woodendhalfblock,125,0 +wooddoublehalfblock,125,0 +wooddhalfblock,125,0 +wdoublehalfblock,125,0 +wdhalfblock,125,0 +doublewoodenhalfblock,125,0 +dwoodenhalfblock,125,0 +doublewoodhalfblock,125,0 +dwoodhalfblock,125,0 +doublewhalfblock,125,0 +dwhalfblock,125,0 +oakwoodendoublehalfblock,125,0 +oakwoodendhalfblock,125,0 +oakwooddoublehalfblock,125,0 +oakwooddhalfblock,125,0 +oakwdoublehalfblock,125,0 +oakwdhalfblock,125,0 +oakdoublewoodenhalfblock,125,0 +oakdwoodenhalfblock,125,0 +oakdoublewoodhalfblock,125,0 +oakdwoodhalfblock,125,0 +oakdoublewhalfblock,125,0 +oakdwhalfblock,125,0 +oakdoublehalfblock,125,0 +oakdhalfblock,125,0 +odhalfblock,125,0 +oakwoodendoublestep,125,0 +oakwoodendstep,125,0 +oakwooddoublestep,125,0 +oakwooddstep,125,0 +oakwdoublestep,125,0 +oakwdstep,125,0 +oakdoublewoodenstep,125,0 +oakdwoodenstep,125,0 +oakdoublewoodstep,125,0 +oakdwoodstep,125,0 +oakdoublewstep,125,0 +oakdwstep,125,0 +oakdoublestep,125,0 +oakdstep,125,0 +odstep,125,0 +oakwoodendoubleslab,125,0 +oakwoodendslab,125,0 +oakwooddoubleslab,125,0 +oakwooddslab,125,0 +oakwdoubleslab,125,0 +oakwdslab,125,0 +oakdoublewoodenslab,125,0 +oakdwoodenslab,125,0 +oakdoublewoodslab,125,0 +oakdwoodslab,125,0 +oakdoublewslab,125,0 +oakdwslab,125,0 +oakdoubleslab,125,0 +oakdslab,125,0 +odslab,125,0 +sprucewoodendoublestep,125,1 +sprucewoodendstep,125,1 +sprucewooddoublestep,125,1 +sprucewooddstep,125,1 +sprucewdoublestep,125,1 +sprucewdstep,125,1 +sprucedoublewoodenstep,125,1 +sprucedwoodenstep,125,1 +sprucedoublewoodstep,125,1 +sprucedwoodstep,125,1 +sprucedoublewstep,125,1 +sprucedwstep,125,1 +sprucedoublestep,125,1 +sprucedstep,125,1 +sprucewoodendoubleslab,125,1 +sprucewoodendslab,125,1 +sprucewooddoubleslab,125,1 +sprucewooddslab,125,1 +sprucewdoubleslab,125,1 +sprucewdslab,125,1 +sprucedoublewoodenslab,125,1 +sprucedwoodenslab,125,1 +sprucedoublewoodslab,125,1 +sprucedwoodslab,125,1 +sprucedoublewslab,125,1 +sprucedwslab,125,1 +sprucedoubleslab,125,1 +sprucedslab,125,1 +sprucewoodendoublehalfblock,125,1 +sprucewoodendhalfblock,125,1 +sprucewooddoublehalfblock,125,1 +sprucewooddhalfblock,125,1 +sprucewdoublehalfblock,125,1 +sprucewdhalfblock,125,1 +sprucedoublewoodenhalfblock,125,1 +sprucedwoodenhalfblock,125,1 +sprucedoublewoodhalfblock,125,1 +sprucedwoodhalfblock,125,1 +sprucedoublewhalfblock,125,1 +sprucedwhalfblock,125,1 +sprucedoublehalfblock,125,1 +sprucedhalfblock,125,1 +darkwoodendoublestep,125,1 +darkwoodendstep,125,1 +darkwooddoublestep,125,1 +darkwooddstep,125,1 +darkwdoublestep,125,1 +darkwdstep,125,1 +darkdoublewoodenstep,125,1 +darkdwoodenstep,125,1 +darkdoublewoodstep,125,1 +darkdwoodstep,125,1 +darkdoublewstep,125,1 +darkdwstep,125,1 +darkdoublestep,125,1 +darkdstep,125,1 +ddstep,125,1 +darkwoodendoubleslab,125,1 +darkwoodendslab,125,1 +darkwooddoubleslab,125,1 +darkwooddslab,125,1 +darkwdoubleslab,125,1 +darkwdslab,125,1 +darkdoublewoodenslab,125,1 +darkdwoodenslab,125,1 +darkdoublewoodslab,125,1 +darkdwoodslab,125,1 +darkdoublewslab,125,1 +darkdwslab,125,1 +darkdoubleslab,125,1 +darkdslab,125,1 +ddslab,125,1 +darkwoodendoublehalfblock,125,1 +darkwoodendhalfblock,125,1 +darkwooddoublehalfblock,125,1 +darkwooddhalfblock,125,1 +darkwdoublehalfblock,125,1 +darkwdhalfblock,125,1 +darkdoublewoodenhalfblock,125,1 +darkdwoodenhalfblock,125,1 +darkdoublewoodhalfblock,125,1 +darkdwoodhalfblock,125,1 +darkdoublewhalfblock,125,1 +darkdwhalfblock,125,1 +darkdoublehalfblock,125,1 +darkdhalfblock,125,1 +ddhalfblock,125,1 +birchwoodendoublestep,125,2 +birchwoodendstep,125,2 +birchwooddoublestep,125,2 +birchwooddstep,125,2 +birchwdoublestep,125,2 +birchwdstep,125,2 +birchdoublewoodenstep,125,2 +birchdwoodenstep,125,2 +birchdoublewoodstep,125,2 +birchdwoodstep,125,2 +birchdoublewstep,125,2 +birchdwstep,125,2 +birchdoublestep,125,2 +birchdstep,125,2 +birchwoodendoubleslab,125,2 +birchwoodendslab,125,2 +birchwooddoubleslab,125,2 +birchwooddslab,125,2 +birchwdoubleslab,125,2 +birchwdslab,125,2 +birchdoublewoodenslab,125,2 +birchdwoodenslab,125,2 +birchdoublewoodslab,125,2 +birchdwoodslab,125,2 +birchdoublewslab,125,2 +birchdwslab,125,2 +birchdoubleslab,125,2 +birchdslab,125,2 +birchwoodendoublehalfblock,125,2 +birchwoodendhalfblock,125,2 +birchwooddoublehalfblock,125,2 +birchwooddhalfblock,125,2 +birchwdoublehalfblock,125,2 +birchwdhalfblock,125,2 +birchdoublewoodenhalfblock,125,2 +birchdwoodenhalfblock,125,2 +birchdoublewoodhalfblock,125,2 +birchdwoodhalfblock,125,2 +birchdoublewhalfblock,125,2 +birchdwhalfblock,125,2 +birchdoublehalfblock,125,2 +birchdhalfblock,125,2 +lightwoodendoublehalfblock,125,2 +lightwoodendhalfblock,125,2 +lightwooddoublehalfblock,125,2 +lightwooddhalfblock,125,2 +lightwdoublehalfblock,125,2 +lightwdhalfblock,125,2 +lightdoublewoodenhalfblock,125,2 +lightdwoodenhalfblock,125,2 +lightdoublewoodhalfblock,125,2 +lightdwoodhalfblock,125,2 +lightdoublewhalfblock,125,2 +lightdwhalfblock,125,2 +lightdoublehalfblock,125,2 +lightdhalfblock,125,2 +ldhalfblock,125,2 +lightwoodendoublestep,125,2 +lightwoodendstep,125,2 +lightwooddoublestep,125,2 +lightwooddstep,125,2 +lightwdoublestep,125,2 +lightwdstep,125,2 +lightdoublewoodenstep,125,2 +lightdwoodenstep,125,2 +lightdoublewoodstep,125,2 +lightdwoodstep,125,2 +lightdoublewstep,125,2 +lightdwstep,125,2 +lightdoublestep,125,2 +lightdstep,125,2 +ldstep,125,2 +lightwoodendoubleslab,125,2 +lightwoodendslab,125,2 +lightwooddoubleslab,125,2 +lightwooddslab,125,2 +lightwdoubleslab,125,2 +lightwdslab,125,2 +lightdoublewoodenslab,125,2 +lightdwoodenslab,125,2 +lightdoublewoodslab,125,2 +lightdwoodslab,125,2 +lightdoublewslab,125,2 +lightdwslab,125,2 +lightdoubleslab,125,2 +lightdslab,125,2 +ldslab,125,2 +junglewoodendoublestep,125,3 +junglewoodendstep,125,3 +junglewooddoublestep,125,3 +junglewooddstep,125,3 +junglewdoublestep,125,3 +junglewdstep,125,3 +jungledoublewoodenstep,125,3 +jungledwoodenstep,125,3 +jungledoublewoodstep,125,3 +jungledwoodstep,125,3 +jungledoublewstep,125,3 +jungledwstep,125,3 +jungledoublestep,125,3 +jungledstep,125,3 +jdstep,125,3 +junglewoodendoubleslab,125,3 +junglewoodendslab,125,3 +junglewooddoubleslab,125,3 +junglewooddslab,125,3 +junglewdoubleslab,125,3 +junglewdslab,125,3 +jungledoublewoodenslab,125,3 +jungledwoodenslab,125,3 +jungledoublewoodslab,125,3 +jungledwoodslab,125,3 +jungledoublewslab,125,3 +jungledwslab,125,3 +jungledoubleslab,125,3 +jungledslab,125,3 +jdslab,125,3 +junglewoodendoublehalfblock,125,3 +junglewoodendhalfblock,125,3 +junglewooddoublehalfblock,125,3 +junglewooddhalfblock,125,3 +junglewdoublehalfblock,125,3 +junglewdhalfblock,125,3 +jungledoublewoodenhalfblock,125,3 +jungledwoodenhalfblock,125,3 +jungledoublewoodhalfblock,125,3 +jungledwoodhalfblock,125,3 +jungledoublewhalfblock,125,3 +jungledwhalfblock,125,3 +jungledoublehalfblock,125,3 +jungledhalfblock,125,3 +jdhalfblock,125,3 +forestwoodendoublehalfblock,125,3 +forestwoodendhalfblock,125,3 +forestwooddoublehalfblock,125,3 +forestwooddhalfblock,125,3 +forestwdoublehalfblock,125,3 +forestwdhalfblock,125,3 +forestdoublewoodenhalfblock,125,3 +forestdwoodenhalfblock,125,3 +forestdoublewoodhalfblock,125,3 +forestdwoodhalfblock,125,3 +forestdoublewhalfblock,125,3 +forestdwhalfblock,125,3 +forestdoublehalfblock,125,3 +forestdhalfblock,125,3 +fdhalfblock,125,3 +forestwoodendoublestep,125,3 +forestwoodendstep,125,3 +forestwooddoublestep,125,3 +forestwooddstep,125,3 +forestwdoublestep,125,3 +forestwdstep,125,3 +forestdoublewoodenstep,125,3 +forestdwoodenstep,125,3 +forestdoublewoodstep,125,3 +forestdwoodstep,125,3 +forestdoublewstep,125,3 +forestdwstep,125,3 +forestdoublestep,125,3 +forestdstep,125,3 +fdstep,125,3 +forestwoodendoubleslab,125,3 +forestwoodendslab,125,3 +forestwooddoubleslab,125,3 +forestwooddslab,125,3 +forestwdoubleslab,125,3 +forestwdslab,125,3 +forestdoublewoodenslab,125,3 +forestdwoodenslab,125,3 +forestdoublewoodslab,125,3 +forestdwoodslab,125,3 +forestdoublewslab,125,3 +forestdwslab,125,3 +forestdoubleslab,125,3 +forestdslab,125,3 +fdslab,125,3 +acaciawoodendoublestep,125,4 +acaciawoodendstep,125,4 +acaciawooddoublestep,125,4 +acaciawooddstep,125,4 +acaciawdoublestep,125,4 +acaciawdstep,125,4 +acaciadoublewoodenstep,125,4 +acaciadwoodenstep,125,4 +acaciadoublewoodstep,125,4 +acaciadwoodstep,125,4 +acaciadoublewstep,125,4 +acaciadwstep,125,4 +acaciadoublestep,125,4 +acaciadstep,125,4 +adstep,125,4 +acaciawoodendoubleslab,125,4 +acaciawoodendslab,125,4 +acaciawooddoubleslab,125,4 +acaciawooddslab,125,4 +acaciawdoubleslab,125,4 +acaciawdslab,125,4 +acaciadoublewoodenslab,125,4 +acaciadwoodenslab,125,4 +acaciadoublewoodslab,125,4 +acaciadwoodslab,125,4 +acaciadoublewslab,125,4 +acaciadwslab,125,4 +acaciadoubleslab,125,4 +acaciadslab,125,4 +adslab,125,4 +acaciawoodendoublehalfblock,125,4 +acaciawoodendhalfblock,125,4 +acaciawooddoublehalfblock,125,4 +acaciawooddhalfblock,125,4 +acaciawdoublehalfblock,125,4 +acaciawdhalfblock,125,4 +acaciadoublewoodenhalfblock,125,4 +acaciadwoodenhalfblock,125,4 +acaciadoublewoodhalfblock,125,4 +acaciadwoodhalfblock,125,4 +acaciadoublewhalfblock,125,4 +acaciadwhalfblock,125,4 +acaciadoublehalfblock,125,4 +acaciadhalfblock,125,4 +adhalfblock,125,4 +darkoakwoodendoublehalfblock,125,5 +darkoakwoodendhalfblock,125,5 +darkoakwooddoublehalfblock,125,5 +darkoakwooddhalfblock,125,5 +darkoakwdoublehalfblock,125,5 +darkoakwdhalfblock,125,5 +darkoakdoublewoodenhalfblock,125,5 +darkoakdwoodenhalfblock,125,5 +darkoakdoublewoodhalfblock,125,5 +darkoakdwoodhalfblock,125,5 +darkoakdoublewhalfblock,125,5 +darkoakdwhalfblock,125,5 +darkoakdoublehalfblock,125,5 +darkoakdhalfblock,125,5 +dodhalfblock,125,5 +darkoakwoodendoublestep,125,5 +darkoakwoodendstep,125,5 +darkoakwooddoublestep,125,5 +darkoakwooddstep,125,5 +darkoakwdoublestep,125,5 +darkoakwdstep,125,5 +darkoakdoublewoodenstep,125,5 +darkoakdwoodenstep,125,5 +darkoakdoublewoodstep,125,5 +darkoakdwoodstep,125,5 +darkoakdoublewstep,125,5 +darkoakdwstep,125,5 +darkoakdoublestep,125,5 +darkoakdstep,125,5 +dodstep,125,5 +darkoakwoodendoubleslab,125,5 +darkoakwoodendslab,125,5 +darkoakwooddoubleslab,125,5 +darkoakwooddslab,125,5 +darkoakwdoubleslab,125,5 +darkoakwdslab,125,5 +darkoakdoublewoodenslab,125,5 +darkoakdwoodenslab,125,5 +darkoakdoublewoodslab,125,5 +darkoakdwoodslab,125,5 +darkoakdoublewslab,125,5 +darkoakdwslab,125,5 +darkoakdoubleslab,125,5 +darkoakdslab,125,5 +dodslab,125,5 +woodenstep,126,0 +woodstep,126,0 +wstep,126,0 +woodenslab,126,0 +woodslab,126,0 +wslab,126,0 +woodenhalfblock,126,0 +woodhalfblock,126,0 +whalfblock,126,0 +oakwoodenstep,126,0 +oakwoodstep,126,0 +oakwstep,126,0 +oakstep,126,0 +ostep,126,0 +oakwoodenslab,126,0 +oakwoodslab,126,0 +oakwslab,126,0 +oakslab,126,0 +oslab,126,0 +oakwoodenhalfblock,126,0 +oakwoodhalfblock,126,0 +oakwhalfblock,126,0 +oakhalfblock,126,0 +ohalfblock,126,0 +sprucewoodenstep,126,1 +sprucewoodstep,126,1 +sprucewstep,126,1 +sprucestep,126,1 +sprucewoodenslab,126,1 +sprucewoodslab,126,1 +sprucewslab,126,1 +spruceslab,126,1 +sprucewoodenhalfblock,126,1 +sprucewoodhalfblock,126,1 +sprucewhalfblock,126,1 +sprucehalfblock,126,1 +darkwoodenstep,126,1 +darkwoodstep,126,1 +darkwstep,126,1 +darkstep,126,1 +darkwoodenslab,126,1 +darkwoodslab,126,1 +darkwslab,126,1 +darkslab,126,1 +darkwoodenhalfblock,126,1 +darkwoodhalfblock,126,1 +darkwhalfblock,126,1 +darkhalfblock,126,1 +birchwoodenstep,126,2 +birchwoodstep,126,2 +birchwstep,126,2 +birchstep,126,2 +birchwoodenslab,126,2 +birchwoodslab,126,2 +birchwslab,126,2 +birchslab,126,2 +birchwoodenhalfblock,126,2 +birchwoodhalfblock,126,2 +birchwhalfblock,126,2 +birchhalfblock,126,2 +lightwoodenstep,126,2 +lightwoodstep,126,2 +lightwstep,126,2 +lightstep,126,2 +lstep,126,2 +lightwoodenslab,126,2 +lightwoodslab,126,2 +lightwslab,126,2 +lightslab,126,2 +lslab,126,2 +lightwoodenhalfblock,126,2 +lightwoodhalfblock,126,2 +lightwhalfblock,126,2 +lighthalfblock,126,2 +lhalfblock,126,2 +junglewoodenstep,126,3 +junglewoodstep,126,3 +junglewstep,126,3 +junglestep,126,3 +jstep,126,3 +junglewoodenslab,126,3 +junglewoodslab,126,3 +junglewslab,126,3 +jungleslab,126,3 +jslab,126,3 +junglewoodenhalfblock,126,3 +junglewoodhalfblock,126,3 +junglewhalfblock,126,3 +junglehalfblock,126,3 +jhalfblock,126,3 +forestwoodenstep,126,3 +forestwoodstep,126,3 +forestwstep,126,3 +foreststep,126,3 +fstep,126,3 +forestwoodenslab,126,3 +forestwoodslab,126,3 +forestwslab,126,3 +forestslab,126,3 +fslab,126,3 +forestwoodenhalfblock,126,3 +forestwoodhalfblock,126,3 +forestwhalfblock,126,3 +foresthalfblock,126,3 +fhalfblock,126,3 +acaciawoodenstep,126,4 +acaciawoodstep,126,4 +acaciawstep,126,4 +acaciastep,126,4 +astep,126,4 +acaciawoodenslab,126,4 +acaciawoodslab,126,4 +acaciawslab,126,4 +acaciaslab,126,4 +aslab,126,4 +acaciawoodenhalfblock,126,4 +acaciawoodhalfblock,126,4 +acaciawhalfblock,126,4 +acaciahalfblock,126,4 +ahalfblock,126,4 +darkoakwoodenstep,126,5 +darkoakwoodstep,126,5 +darkoakwstep,126,5 +darkoakstep,126,5 +dostep,126,5 +darkoakwoodenslab,126,5 +darkoakwoodslab,126,5 +darkoakwslab,126,5 +darkoakslab,126,5 +doslab,126,5 +darkoakwoodenhalfblock,126,5 +darkoakwoodhalfblock,126,5 +darkoakwhalfblock,126,5 +darkoakhalfblock,126,5 +dohalfblock,126,5 +cocoaplant,127,0 +cocoplant,127,0 +cplant,127,0 +cocoafruit,127,0 +cocofruit,127,0 +cfruit,127,0 +cocoapod,127,0 +cocopod,127,0 +cpod,127,0 +sandstonestairs,128,0 +sandstairs,128,0 +sandsstairs,128,0 +sstonestairs,128,0 +ssstairs,128,0 +sandstair,128,0 +sandstonestair,128,0 +sandsstair,128,0 +sstonestair,128,0 +ssstair,128,0 +emeraldore,129,0 +eore,129,0 +oreemerald,129,0 +oree,129,0 +enderchest,130,0 +endchest,130,0 +echest,130,0 +chestender,130,0 +chestend,130,0 +cheste,130,0 +endercontainer,130,0 +endcontainer,130,0 +econtainer,130,0 +tripwirehook,131,0 +tripwire,131,0 +trip,131,0 +tripwirelever,131,0 +triphook,131,0 +emeraldblock,133,0 +blockemerald,133,0 +eblock,133,0 +blocke,133,0 +sprucewoodenstairs,134,0 +sprucewoodstairs,134,0 +sprucewstairs,134,0 +sprucestairs,134,0 +darkwoodenstairs,134,0 +darkwoodstairs,134,0 +darkwstairs,134,0 +darkstairs,134,0 +dstairs,134,0 +sprucewoodenstair,134,0 +sprucewoodstair,134,0 +sprucewstair,134,0 +sprucestair,134,0 +darkwoodenstair,134,0 +darkwoodstair,134,0 +darkwstair,134,0 +darkstair,134,0 +dstair,134,0 +birchwoodenstairs,135,0 +birchwoodstairs,135,0 +birchwstairs,135,0 +birchstairs,135,0 +lightwoodenstairs,135,0 +lightwoodstairs,135,0 +lightwstairs,135,0 +lightstairs,135,0 +lstairs,135,0 +birchwoodenstair,135,0 +birchwoodstair,135,0 +birchwstair,135,0 +birchstair,135,0 +lightwoodenstair,135,0 +lightwoodstair,135,0 +lightwstair,135,0 +lightstair,135,0 +lstair,135,0 +junglewoodenstairs,136,0 +junglewoodstairs,136,0 +junglewstairs,136,0 +junglestairs,136,0 +jstairs,136,0 +forestwoodenstairs,136,0 +forestwoodstairs,136,0 +forestwstairs,136,0 +foreststairs,136,0 +fstairs,136,0 +junglewoodenstair,136,0 +junglewoodstair,136,0 +junglewstair,136,0 +junglestair,136,0 +jstair,136,0 +forestwoodenstair,136,0 +forestwoodstair,136,0 +forestwstair,136,0 +foreststair,136,0 +fstair,136,0 +commandblock,137,0 +blockcommand,137,0 +cmdblock,137,0 +blockcmd,137,0 +macroblock,137,0 +blockmacro,137,0 +beacon,138,0 +beaconblock,138,0 +cobblestonewall,139,0 +cstonewall,139,0 +cobblewall,139,0 +cobblestonefence,139,0 +cstonefence,139,0 +cobblefence,139,0 +cswall,139,0 +csfence,139,0 +cwall,139,0 +cfence,139,0 +mosscobblestonewall,139,1 +mosscstonewall,139,1 +mosscobblewall,139,1 +mcobblestonewall,139,1 +mcstonewall,139,1 +mcobblewall,139,1 +mosscobblestonefence,139,1 +mosscstonefence,139,1 +mosscobblefence,139,1 +mcobblestonefence,139,1 +mcstonefence,139,1 +mcobblefence,139,1 +mcswall,139,0 +mcsfence,139,0 +mcwall,139,0 +mcfence,139,0 +plantedcarrot,141,0 +plantcarrot,141,0 +carrots,141,0 +growingcarrot,141,0 +potatoplant,142,0 +potatoes,142,0 +plantedpotato,142,0 +plantpotato,142,0 +growingpotato,142,0 +woodenbutton,143,0 +woodenplankbutton,143,0 +woodplankbutton,143,0 +wplankbutton,143,0 +plankbutton,143,0 +woodbutton,143,0 +wbutton,143,0 +anvil,145,0 +slightlydamagedanvil,145,1 +slightdamageanvil,145,1 +damagedanvil,145,1 +verydamagedanvil,145,2 +trapchest,146,0 +trappedchest,146,0 +chesttrapped,146,0 +chesttrap,146,0 +goldpressureplate,147,0 +weightedgoldpressureplate,147,0 +weightgoldpressureplate,147,0 +wgoldpressureplate,147,0 +weightedgoldpressplate,147,0 +weightgoldpressplate,147,0 +wgoldpressplate,147,0 +goldpressplate,147,0 +weightedgoldpplate,147,0 +weightgoldpplate,147,0 +wgoldpplate,147,0 +goldpplate,147,0 +weightedgoldplate,147,0 +weightgoldplate,147,0 +wgoldplate,147,0 +goldplate,147,0 +weightedgpressureplate,147,0 +weightgpressureplate,147,0 +wgpressureplate,147,0 +gpressureplate,147,0 +weightedgpressplate,147,0 +weightgpressplate,147,0 +wgpressplate,147,0 +gpressplate,147,0 +weightedgpplate,147,0 +weightgpplate,147,0 +wgpplate,147,0 +gpplate,147,0 +weightedgplate,147,0 +weightgplate,147,0 +wgplate,147,0 +gplate,147,0 +ironpressureplate,148,0 +weightedironpressureplate,148,0 +weightironpressureplate,148,0 +wironpressureplate,148,0 +weightedironpressplate,148,0 +weightironpressplate,148,0 +wironpressplate,148,0 +ironpressplate,148,0 +weightedironpplate,148,0 +weightironpplate,148,0 +wironpplate,148,0 +ironpplate,148,0 +weightedironplate,148,0 +weightironplate,148,0 +wironplate,148,0 +ironplate,148,0 +weightedipressureplate,148,0 +weightipressureplate,148,0 +wipressureplate,148,0 +ipressureplate,148,0 +weightedipressplate,148,0 +weightipressplate,148,0 +wipressplate,148,0 +ipressplate,148,0 +weightedipplate,148,0 +weightipplate,148,0 +wipplate,148,0 +ipplate,148,0 +weightediplate,148,0 +weightiplate,148,0 +wiplate,148,0 +iplate,148,0 +daylightsensor,151,0 +daylightsense,151,0 +lightsensor,151,0 +lightsense,151,0 +daysensor,151,0 +daysense,151,0 +timesensor,151,0 +timesense,151,0 +redstoneblock,152,0 +rstoneblock,152,0 +redsblock,152,0 +rsblock,152,0 +blockredstone,152,0 +blockrstone,152,0 +blockreds,152,0 +blockrs,152,0 +netherquartzore,153,0 +hellquartzore,153,0 +deathquartzore,153,0 +nquartzore,153,0 +hquartzore,153,0 +dquartzore,153,0 +quartzore,153,0 +netherqore,153,0 +hellqore,153,0 +deathqore,153,0 +nqore,153,0 +hqore,153,0 +dqore,153,0 +qore,153,0 +hopper,154,0 +chestpuller,154,0 +chestpull,154,0 +cheststorer,154,0 +cheststore,154,0 +itempuller,154,0 +itempull,154,0 +itemstorer,154,0 +itemstore,154,0 +quartzblock,155,0 +netherquartzblock,155,0 +nqblock,155,0 +qblock,155,0 +chiseledquartzblock,155,1 +chiselquartzblock,155,1 +cquartzblock,155,1 +cqblock,155,1 +pillarquartzblock,155,2 +pquartzblock,155,2 +pqblock,155,2 +quartzstairs,156,0 +qstairs,156,0 +quartzstair,156,0 +qstair,156,0 +activatorrails,157,0 +activaterails,157,0 +triggerrails,157,0 +arails,157,0 +trails,157,0 +activatorrail,157,0 +activaterail,157,0 +triggerrail,157,0 +arail,157,0 +trail,157,0 +activatortrack,157,0 +activatetrack,157,0 +triggertrack,157,0 +atrack,157,0 +ttrack,157,0 +dropper,158,0 +drop,158,0 +chestdispenser,158,0 +chestdispense,158,0 +chestdropper,158,0 +chestdrop,158,0 +whiteclay,159,0 +whitesclay,159,0 +whitestainedclay,159,0 +wclay,159,0 +wsclay,159,0 +wstainedclay,159,0 +sclay,159,0 +stainedclay,159,0 +orangeclay,159,1 +orangesclay,159,1 +orangestainedclay,159,1 +oclay,159,1 +osclay,159,1 +ostainedclay,159,1 +magentaclay,159,2 +magentasclay,159,2 +magentastainedclay,159,2 +mclay,159,2 +msclay,159,2 +mstainedclay,159,2 +lightblueclay,159,3 +lightbluesclay,159,3 +lightbluestainedclay,159,3 +lblueclay,159,3 +lbluesclay,159,3 +lbluestainedclay,159,3 +lightbluclay,159,3 +lightblusclay,159,3 +lightblustainedclay,159,3 +lbluclay,159,3 +lblusclay,159,3 +lblustainedclay,159,3 +lbclay,159,3 +lbsclay,159,3 +lbstainedclay,159,3 +WHITEclay,159,4 +WHITEsclay,159,4 +WHITEstainedclay,159,4 +yclay,159,4 +ysclay,159,4 +ystainedclay,159,4 +lightgreenclay,159,5 +lightgreensclay,159,5 +lightgreenstainedclay,159,5 +lgreenclay,159,5 +lgreensclay,159,5 +lgreenstainedclay,159,5 +lightgreclay,159,5 +lightgresclay,159,5 +lightgrestainedclay,159,5 +lgreclay,159,5 +lgresclay,159,5 +lgrestainedclay,159,5 +limeclay,159,5 +limesclay,159,5 +limestainedclay,159,5 +lclay,159,5 +lsclay,159,5 +lstainedclay,159,5 +pinkclay,159,6 +pinksclay,159,6 +pinkstainedclay,159,6 +piclay,159,6 +pisclay,159,6 +pistainedclay,159,6 +darkgrayclay,159,7 +darkgraysclay,159,7 +darkgraystainedclay,159,7 +dgrayclay,159,7 +dgraysclay,159,7 +dgraystainedclay,159,7 +darkgreyclay,159,7 +darkgreeysclay,159,7 +darkgreystainedclay,159,7 +dgreyclay,159,7 +dgreysclay,159,7 +dgreystainedclay,159,7 +darkgraclay,159,7 +darkgrasclay,159,7 +darkgrastainedclay,159,7 +dgraclay,159,7 +dgrasclay,159,7 +dgrastainedclay,159,7 +grayclay,159,7 +graysclay,159,7 +graystainedclay,159,7 +greyclay,159,7 +greysclay,159,7 +greystainedclay,159,7 +graclay,159,7 +grasclay,159,7 +grastainedclay,159,7 +lightgrayclay,159,8 +lightgraysclay,159,8 +lightgraystainedclay,159,8 +lgrayclay,159,8 +lgraysclay,159,8 +lgraystainedclay,159,8 +lightgreyclay,159,8 +lightgreysclay,159,8 +lightgreystainedclay,159,8 +lgreyclay,159,8 +lgreysclay,159,8 +lgreystainedclay,159,8 +lightgraclay,159,8 +lightgrasclay,159,8 +lightgrastainedclay,159,8 +lgraclay,159,8 +lgrasclay,159,8 +lgrastainedclay,159,8 +silverclay,159,8 +silversclay,159,8 +silverstainedclay,159,8 +siclay,159,8 +siasclay,159,8 +siastainedclay,159,8 +cyanclay,159,9 +cyansclay,159,9 +cyanstainedclay,159,9 +cclay,159,9 +csclay,159,9 +cstainedclay,159,9 +purpleclay,159,10 +purplesclay,159,10 +purplestainedclay,159,10 +puclay,159,10 +pusclay,159,10 +pustainedclay,159,10 +blueclay,159,11 +bluesclay,159,11 +bluestainedclay,159,11 +bluclay,159,11 +blusclay,159,11 +blustainedclay,159,11 +brownclay,159,12 +brownsclay,159,12 +brownstainedclay,159,12 +broclay,159,12 +brosclay,159,12 +brostainedclay,159,12 +darkgreenclay,159,13 +darkgreensclay,159,13 +darkgreenstainedclay,159,13 +dgreenclay,159,13 +dgreensclay,159,13 +dgreenstainedclay,159,13 +greenclay,159,13 +greensclay,159,13 +greenstainedclay,159,13 +darkgreclay,159,13 +darkgresclay,159,13 +darkgrestainedclay,159,13 +dgreclay,159,13 +dgresclay,159,13 +dgrestainedclay,159,13 +greclay,159,13 +gresclay,159,13 +grestainedclay,159,13 +redclay,159,14 +redsclay,159,14 +redstainedclay,159,14 +rclay,159,14 +rsclay,159,14 +rstainedclay,159,14 +blackclay,159,15 +blacksclay,159,15 +blackstainedclay,159,15 +blaclay,159,15 +blasclay,159,15 +blastainedclay,159,15 +whiteglasspane,160,0 +whitesglasspane,160,0 +whitestainedglasspane,160,0 +wglasspane,160,0 +wsglasspane,160,0 +wstainedglasspane,160,0 +sglasspane,160,0 +stainedglasspane,160,0 +orangeglasspane,160,1 +orangesglasspane,160,1 +orangestainedglasspane,160,1 +oglasspane,160,1 +osglasspane,160,1 +ostainedglasspane,160,1 +magentaglasspane,160,2 +magentasglasspane,160,2 +magentastainedglasspane,160,2 +mglasspane,160,2 +msglasspane,160,2 +mstainedglasspane,160,2 +lightblueglasspane,160,3 +lightbluesglasspane,160,3 +lightbluestainedglasspane,160,3 +lblueglasspane,160,3 +lbluesglasspane,160,3 +lbluestainedglasspane,160,3 +lightbluglasspane,160,3 +lightblusglasspane,160,3 +lightblustainedglasspane,160,3 +lbluglasspane,160,3 +lblusglasspane,160,3 +lblustainedglasspane,160,3 +lbglasspane,160,3 +lbsglasspane,160,3 +lbstainedglasspane,160,3 +WHITEglasspane,160,4 +WHITEsglasspane,160,4 +WHITEstainedglasspane,160,4 +yglasspane,160,4 +ysglasspane,160,4 +ystainedglasspane,160,4 +lightgreenglasspane,160,5 +lightgreensglasspane,160,5 +lightgreenstainedglasspane,160,5 +lgreenglasspane,160,5 +lgreensglasspane,160,5 +lgreenstainedglasspane,160,5 +lightgreglasspane,160,5 +lightgresglasspane,160,5 +lightgrestainedglasspane,160,5 +lgreglasspane,160,5 +lgresglasspane,160,5 +lgrestainedglasspane,160,5 +limeglasspane,160,5 +limesglasspane,160,5 +limestainedglasspane,160,5 +lglasspane,160,5 +lsglasspane,160,5 +lstainedglasspane,160,5 +pinkglasspane,160,6 +pinksglasspane,160,6 +pinkstainedglasspane,160,6 +piglasspane,160,6 +pisglasspane,160,6 +pistainedglasspane,160,6 +darkgrayglasspane,160,7 +darkgraysglasspane,160,7 +darkgraystainedglasspane,160,7 +dgrayglasspane,160,7 +dgraysglasspane,160,7 +dgraystainedglasspane,160,7 +darkgreyglasspane,160,7 +darkgreysglasspane,160,7 +darkgreystainedglasspane,160,7 +dgreyglasspane,160,7 +dgreysglasspane,160,7 +dgreystainedglasspane,160,7 +darkgraglasspane,160,7 +darkgrasglasspane,160,7 +darkgrastainedglasspane,160,7 +dgraglasspane,160,7 +dgrasglasspane,160,7 +dgrastainedglasspane,160,7 +grayglasspane,160,7 +graysglasspane,160,7 +graystainedglasspane,160,7 +greyglasspane,160,7 +greysglasspane,160,7 +greystainedglasspane,160,7 +graglasspane,160,7 +grasglasspane,160,7 +grastainedglasspane,160,7 +lightgrayglasspane,160,8 +lightgraysglasspane,160,8 +lightgraystainedglasspane,160,8 +lgrayglasspane,160,8 +lgraysglasspane,160,8 +lgraystainedglasspane,160,8 +lightgreyglasspane,160,8 +lightgreysglasspane,160,8 +lightgreystainedglasspane,160,8 +lgreyglasspane,160,8 +lgreysglasspane,160,8 +lgreystainedglasspane,160,8 +lightgraglasspane,160,8 +lightgrasglasspane,160,8 +lightgrastainedglasspane,160,8 +lgraglasspane,160,8 +lgrasglasspane,160,8 +lgrastainedglasspane,160,8 +silverglasspane,160,8 +silversglasspane,160,8 +silverstainedglasspane,160,8 +siglasspane,160,8 +siasglasspane,160,8 +siastainedglasspane,160,8 +cyanglasspane,160,9 +cyansglasspane,160,9 +cyanstainedglasspane,160,9 +cglasspane,160,9 +csglasspane,160,9 +cstainedglasspane,160,9 +purpleglasspane,160,10 +purplesglasspane,160,10 +purplestainedglasspane,160,10 +puglasspane,160,10 +pusglasspane,160,10 +pustainedglasspane,160,10 +blueglasspane,160,11 +bluesglasspane,160,11 +bluestainedglasspane,160,11 +bluglasspane,160,11 +blusglasspane,160,11 +blustainedglasspane,160,11 +brownglasspane,160,12 +brownsglasspane,160,12 +brownstainedglasspane,160,12 +broglasspane,160,12 +brosglasspane,160,12 +brostainedglasspane,160,12 +darkgreenglasspane,160,13 +darkgreensglasspane,160,13 +darkgreenstainedglasspane,160,13 +dgreenglasspane,160,13 +dgreensglasspane,160,13 +dgreenstainedglasspane,160,13 +greenglasspane,160,13 +greensglasspane,160,13 +greenstainedglasspane,160,13 +darkgreglasspane,160,13 +darkgresglasspane,160,13 +darkgrestainedglasspane,160,13 +dgreglasspane,160,13 +dgresglasspane,160,13 +dgrestainedglasspane,160,13 +greglasspane,160,13 +gresglasspane,160,13 +grestainedglasspane,160,13 +redglasspane,160,14 +redsglasspane,160,14 +redstainedglasspane,160,14 +rglasspane,160,14 +rsglasspane,160,14 +rstainedglasspane,160,14 +blackglasspane,160,15 +blacksglasspane,160,15 +blackstainedglasspane,160,15 +blaglasspane,160,15 +blasglasspane,160,15 +blastainedglasspane,160,15 +acacialeaves,161,0 +acaciatreeleaves,161,0 +acacialogleaves,161,0 +acaciatrunkleaves,161,0 +acaciawoodleaves,161,0 +aleaves,161,0 +atreeleaves,161,0 +alogleaves,161,0 +atrunkleaves,161,0 +awoodleaves,161,0 +acacialeave,161,0 +acaciatreeleave,161,0 +acacialogleave,161,0 +acaciatrunkleave,161,0 +acaciawoodleave,161,0 +aleave,161,0 +atreeleave,161,0 +alogleave,161,0 +atrunkleave,161,0 +awoodleave,161,0 +acaciatreeleaf,161,0 +acacialogleaf,161,0 +acaciatrunkleaf,161,0 +acaciawoodleaf,161,0 +aleaf,161,0 +atreeleaf,161,0 +alogleaf,161,0 +atrunkleaf,161,0 +awoodleaf,161,0 +darkoakleaves,161,1 +darkoaktreeleaves,161,1 +darkoaklogleaves,161,1 +darkoaktrunkleaves,161,1 +darkoakwoodleaves,161,1 +doakleaves,161,1 +doaktreeleaves,161,1 +doaklogleaves,161,1 +doaktrunkleaves,161,1 +doakwoodleaves,161,1 +doleaves,161,1 +dotreeleaves,161,1 +dologleaves,161,1 +dotrunkleaves,161,1 +dowoodleaves,161,1 +darkoakleave,161,1 +darkoaktreeleave,161,1 +darkoaklogleave,161,1 +darkoaktrunkleave,161,1 +darkoakwoodleave,161,1 +doakleave,161,1 +doaktreeleave,161,1 +doaklogleave,161,1 +doaktrunkleave,161,1 +doakwoodleave,161,1 +doleave,161,1 +dotreeleave,161,1 +dologleave,161,1 +dotrunkleave,161,1 +dowoodleave,161,1 +darkoaktreeleaf,161,1 +darkoaklogleaf,161,1 +darkoaktrunkleaf,161,1 +darkoakwoodleaf,161,1 +doakleaf,161,1 +doaktreeleaf,161,1 +doaklogleaf,161,1 +doaktrunkleaf,161,1 +doakwoodleaf,161,1 +doleaf,161,1 +dotreeleaf,161,1 +dologleaf,161,1 +dotrunkleaf,161,1 +dowoodleaf,161,1 +acacia,162,0 +acaciatree,162,0 +acacialog,162,0 +acaciatrunk,162,0 +acaciawood,162,0 +atree,162,0 +alog,162,0 +atrunk,162,0 +awood,162,0 +darkoak,162,1 +darkoaktree,162,1 +darkoaklog,162,1 +darkoaktrunk,162,1 +darkoakwood,162,1 +doak,162,1 +doaktree,162,1 +doaklog,162,1 +doaktrunk,162,1 +doakwood,162,1 +dotree,162,1 +dolog,162,1 +dotrunk,162,1 +dowood,162,1 +acaciawoodenstairs,163,0 +acaciawoodstairs,163,0 +acaciawstairs,163,0 +acaciastairs,163,0 +awoodenstairs,163,0 +awoodstairs,163,0 +awstairs,163,0 +astairs,163,0 +acaciawoodenstair,163,0 +acaciawoodstair,163,0 +acaciawstair,163,0 +acaciastair,163,0 +awoodenstair,163,0 +awoodstair,163,0 +awstair,163,0 +astair,163,0 +darkoakwoodenstairs,164,0 +darkoakwoodstairs,164,0 +darkoakwstairs,164,0 +darkoakstairs,164,0 +doakwoodenstairs,164,0 +doakwoodstairs,164,0 +doakwstairs,164,0 +doakstairs,164,0 +dowoodenstairs,164,0 +dowoodstairs,164,0 +dowstairs,164,0 +dostairs,164,0 +darkoakwoodenstair,164,0 +darkoakwoodstair,164,0 +darkoakwstair,164,0 +darkoakstair,164,0 +doakwoodenstair,164,0 +doakwoodstair,164,0 +doakwstair,164,0 +doakstair,164,0 +dowoodenstair,164,0 +dowoodstair,164,0 +dowstair,164,0 +dostair,164,0 +hay,170,0 +hayblock,170,0 +haybale,170,0 +baleofhay,170,0 +hayofbale,170,0 +whitecarpet,171,0 +whitefloor,171,0 +wcarpet,171,0 +wfloor,171,0 +carpet,171,0 +floor,171,0 +orangecarpet,171,1 +orangefloor,171,1 +ocarpet,171,1 +ofloor,171,1 +magentacarpet,171,2 +magentafloor,171,2 +mcarpet,171,2 +mfloor,171,2 +lightbluecarpet,171,3 +lightbluefloor,171,3 +lbluecarpet,171,3 +lbluefloor,171,3 +lbcarpet,171,3 +lbfloor,171,3 +lightblucarpet,171,3 +lightblufloor,171,3 +lblucarpet,171,3 +lblufloor,171,3 +WHITEcarpet,171,4 +WHITEfloor,171,4 +ycarpet,171,4 +yfloor,171,4 +lightgreencarpet,171,5 +lightgreenfloor,171,5 +lgreencarpet,171,5 +lgreenfloor,171,5 +lightgrecarpet,171,5 +lightgrefloor,171,5 +lgrecarpet,171,5 +lgrefloor,171,5 +limecarpet,171,5 +limefloor,171,5 +lcarpet,171,5 +lfloor,171,5 +pinkcarpet,171,6 +pinkfloor,171,6 +picarpet,171,6 +pifloor,171,6 +darkgraycarpet,171,7 +darkgrayfloor,171,7 +dgraycarpet,171,7 +dgrayfloor,171,7 +darkgreycarpet,171,7 +darkgreyfloor,171,7 +dgreycarpet,171,7 +dgreyfloor,171,7 +darkgracarpet,171,7 +darkgrafloor,171,7 +dgracarpet,171,7 +dgrafloor,171,7 +graycarpet,171,7 +grayfloor,171,7 +greycarpet,171,7 +greyfloor,171,7 +gracarpet,171,7 +grafloor,171,7 +lightgraycarpet,171,8 +lightgrayfloor,171,8 +lgraycarpet,171,8 +lgrayfloor,171,8 +lightgreycarpet,171,8 +lightgreyfloor,171,8 +lgreycarpet,171,8 +lgreyfloor,171,8 +lightgracarpet,171,8 +lightgrafloor,171,8 +lgracarpet,171,8 +lgrafloor,171,8 +silvercarpet,171,8 +silverfloor,171,8 +sicarpet,171,8 +siafloor,171,8 +cyancarpet,171,9 +cyanfloor,171,9 +ccarpet,171,9 +cfloor,171,9 +purplecarpet,171,10 +purplefloor,171,10 +pucarpet,171,10 +pufloor,171,10 +bluecarpet,171,11 +bluefloor,171,11 +blucarpet,171,11 +blufloor,171,11 +browncarpet,171,12 +brownfloor,171,12 +brocarpet,171,12 +brofloor,171,12 +darkgreencarpet,171,13 +darkgreenfloor,171,13 +dgreencarpet,171,13 +dgreenfloor,171,13 +greencarpet,171,13 +greenfloor,171,13 +darkgrecarpet,171,13 +darkgrefloor,171,13 +dgrecarpet,171,13 +dgrefloor,171,13 +grecarpet,171,13 +grefloor,171,13 +redcarpet,171,14 +redfloor,171,14 +rcarpet,171,14 +rfloor,171,14 +blackcarpet,171,15 +blackfloor,171,15 +blacarpet,171,15 +blafloor,171,15 +hardenedclay,172,0 +hardclay,172,0 +hclay,172,0 +coalblock,173,0 +blockcoal,173,0 +coblock,173,0 +blockco,173,0 +coalb,173,0 +bcoal,173,0 +packedice,174,0 +packice,174,0 +solidice,174,0 +sunflower,175,0 +WHITEsunflower,175,0 +lilac,175,1 +magentalilac,175,1 +syringa,175,1 +longtallgrass,175,2 +extratallgrass,175,2 +doubletallgrass,175,2 +largetallgrass,175,2 +longtgrass,175,2 +extratgrass,175,2 +doubletgrass,175,2 +largetgrass,175,2 +ltgrass,175,2 +etgrass,175,2 +dtgrass,175,2 +bigfern,175,3 +largefern,175,3 +doublefern,175,3 +bfern,175,3 +lfern,175,3 +dfern,175,3 +rosebush,175,4 +redrosebush,175,4 +peony,175,5 +pinkpeony,175,5 +paeonia,175,5 +ironshovel,256,0 +ironspade,256,0 +ishovel,256,0 +ispade,256,0 +steelshovel,256,0 +steelspade,256,0 +ironpickaxe,257,0 +ironpick,257,0 +steelpickaxe,257,0 +steelpick,257,0 +ipickaxe,257,0 +ipick,257,0 +ironaxe,258,0 +iaxe,258,0 +steelaxe,258,0 +flintandsteel,259,0 +flintandiron,259,0 +flintandtinder,259,0 +flintnsteel,259,0 +flintniron,259,0 +flintntinder,259,0 +flintsteel,259,0 +flintiron,259,0 +flinttinder,259,0 +lighter,259,0 +apple,260,0 +normalapple,260,0 +redapple,260,0 +bow,261,0 +arrow,262,0 +coal,263,0 +charcoal,263,1 +ccoal,263,1 +diamond,264,0 +crystal,264,0 +ironingot,265,0 +ironbar,265,0 +ironi,265,0 +steelingot,265,0 +steelbar,265,0 +steeli,265,0 +iingot,265,0 +ibar,265,0 +ingotiron,265,0 +bariron,265,0 +iiron,265,0 +ingotsteel,265,0 +barsteel,265,0 +isteel,265,0 +ingoti,265,0 +bari,265,0 +goldingot,266,0 +goldbar,266,0 +goldi,266,0 +gingot,266,0 +gbar,266,0 +ingotgold,266,0 +bargold,266,0 +igold,266,0 +ingotg,266,0 +barg,266,0 +ironsword,267,0 +steelsword,267,0 +isword,267,0 +woodensword,268,0 +woodsword,268,0 +wsword,268,0 +woodenshovel,269,0 +woodenspade,269,0 +woodshovel,269,0 +woodspade,269,0 +wshovel,269,0 +wspade,269,0 +woodenpickaxe,270,0 +woodenpick,270,0 +woodpickaxe,270,0 +woodpick,270,0 +wpickaxe,270,0 +wpick,270,0 +woodenaxe,271,0 +woodaxe,271,0 +waxe,271,0 +stonesword,272,0 +cobblestonesword,272,0 +cstonesword,272,0 +cssword,272,0 +ssword,272,0 +stoneshovel,273,0 +cobblestoneshovel,273,0 +cobblestonespade,273,0 +cstoneshovel,273,0 +cstonespade,273,0 +stonespade,273,0 +csshovel,273,0 +csspade,273,0 +sshovel,273,0 +sspade,273,0 +stonepickaxe,274,0 +cobblestonepickaxe,274,0 +cobblestonepick,274,0 +cstonepickaxe,274,0 +cstonepick,274,0 +stonepick,274,0 +cspickaxe,274,0 +cspick,274,0 +spickaxe,274,0 +spick,274,0 +stoneaxe,275,0 +cobblestoneaxe,275,0 +cstoneaxe,275,0 +csaxe,275,0 +saxe,275,0 +diamondsword,276,0 +crystalsword,276,0 +dsword,276,0 +diamondshovel,277,0 +diamondspade,277,0 +crystalshovel,277,0 +crystalspade,277,0 +dshovel,277,0 +dspade,277,0 +diamondpickaxe,278,0 +diamondpick,278,0 +crystalpickaxe,278,0 +crystalpick,278,0 +dpickaxe,278,0 +dpick,278,0 +diamondaxe,279,0 +crystalaxe,279,0 +daxe,279,0 +stick,280,0 +twig,280,0 +branch,280,0 +bowl,281,0 +woodenbowl,281,0 +woodbowl,281,0 +mushroomsoup,282,0 +mrsoup,282,0 +soup,282,0 +goldsword,283,0 +gsword,283,0 +goldshovel,284,0 +goldspade,284,0 +gshovel,284,0 +gspade,284,0 +goldpickaxe,285,0 +goldpick,285,0 +gpickaxe,285,0 +gpick,285,0 +goldaxe,286,0 +gaxe,286,0 +string,287,0 +thread,287,0 +feather,288,0 +gunpowder,289,0 +sulfur,289,0 +woodenhoe,290,0 +woodhoe,290,0 +whoe,290,0 +stonehoe,291,0 +cobblestonehoe,291,0 +cstonehoe,291,0 +cshoe,291,0 +shoe,291,0 +ironhoe,292,0 +steelhoe,292,0 +ihoe,292,0 +diamondhoe,293,0 +crystalhoe,293,0 +dhoe,293,0 +goldhoe,294,0 +ghoe,294,0 +seeds,295,0 +seed,295,0 +wheat,296,0 +crops,296,0 +crop,296,0 +bread,297,0 +leatherhelmet,298,0 +leatherhelm,298,0 +leatherhat,298,0 +leathercoif,298,0 +lhelmet,298,0 +lhelm,298,0 +lhat,298,0 +lcoif,298,0 +leatherchestplate,299,0 +leatherplatebody,299,0 +leatherplate,299,0 +leathershirt,299,0 +leathertunic,299,0 +lchestplate,299,0 +lplatebody,299,0 +lplate,299,0 +lshirt,299,0 +ltunic,299,0 +leatherleggings,300,0 +leatherlegs,300,0 +leatherpants,300,0 +lleggings,300,0 +llegs,300,0 +lpants,300,0 +leatherboots,301,0 +leathershoes,301,0 +lboots,301,0 +lshoes,301,0 +chainmailhelmet,302,0 +chainmailhelm,302,0 +chainmailhat,302,0 +chainmailcoif,302,0 +chainmhelmet,302,0 +chainmhelm,302,0 +chainmhat,302,0 +chainmcoif,302,0 +cmailhelmet,302,0 +cmailhelm,302,0 +cmailhat,302,0 +cmailcoif,302,0 +chainhelmet,302,0 +chainhelm,302,0 +chainhat,302,0 +chaincoif,302,0 +cmhelmet,302,0 +cmhelm,302,0 +cmhat,302,0 +cmcoif,302,0 +chainmailchestplate,303,0 +chainmailplatebody,303,0 +chainmailplate,303,0 +chainmailshirt,303,0 +chainmailtunic,303,0 +chainmchestplate,303,0 +chainmplatebody,303,0 +chainmplate,303,0 +chainmshirt,303,0 +chainmtunic,303,0 +cmailchestplate,303,0 +cmailplatebody,303,0 +cmailplate,303,0 +cmailshirt,303,0 +cmailtunic,303,0 +chainchestplate,303,0 +chainplatebody,303,0 +chainplate,303,0 +chainshirt,303,0 +chaintunic,303,0 +cmchestplate,303,0 +cmplatebody,303,0 +cmplate,303,0 +cmshirt,303,0 +cmtunic,303,0 +chainmailleggings,304,0 +chainmaillegs,304,0 +chainmailpants,304,0 +chainmleggings,304,0 +chainmlegs,304,0 +chainmpants,304,0 +cmailleggings,304,0 +cmaillegs,304,0 +cmailpants,304,0 +chainleggings,304,0 +chainlegs,304,0 +chainpants,304,0 +cmleggings,304,0 +cmlegs,304,0 +cmpants,304,0 +chainmailboots,305,0 +chainmailshoes,305,0 +chainmboots,305,0 +chainmshoes,305,0 +cmailboots,305,0 +cmailshoes,305,0 +chainboots,305,0 +chainshoes,305,0 +cmboots,305,0 +cmshoes,305,0 +ironhelmet,306,0 +ironhelm,306,0 +ironhat,306,0 +ironcoif,306,0 +ihelmet,306,0 +ihelm,306,0 +ihat,306,0 +icoif,306,0 +steelhelmet,306,0 +steelhelm,306,0 +steelhat,306,0 +steelcoif,306,0 +shelmet,306,0 +shelm,306,0 +shat,306,0 +scoif,306,0 +ironchestplate,307,0 +ironplatebody,307,0 +ironshirt,307,0 +irontunic,307,0 +ichestplate,307,0 +iplatebody,307,0 +ishirt,307,0 +itunic,307,0 +steelchestplate,307,0 +steelplatebody,307,0 +steelplate,307,0 +steelshirt,307,0 +steeltunic,307,0 +schestplate,307,0 +splatebody,307,0 +sshirt,307,0 +stunic,307,0 +ironleggings,308,0 +ironlegs,308,0 +ironpants,308,0 +ileggings,308,0 +ilegs,308,0 +ipants,308,0 +steelleggings,308,0 +steellegs,308,0 +steelpants,308,0 +sleggings,308,0 +slegs,308,0 +spants,308,0 +ironboots,309,0 +ironshoes,309,0 +iboots,309,0 +ishoes,309,0 +steelboots,309,0 +steelshoes,309,0 +sboots,309,0 +sshoes,309,0 +diamondhelmet,310,0 +diamondhelm,310,0 +diamondhat,310,0 +diamondcoif,310,0 +dhelmet,310,0 +dhelm,310,0 +dhat,310,0 +dcoif,310,0 +crystalhelmet,310,0 +crystalhelm,310,0 +crystalhat,310,0 +crystalcoif,310,0 +chelmet,310,0 +chelm,310,0 +chat,310,0 +ccoif,310,0 +diamondchestplate,311,0 +diamondplatebody,311,0 +diamondplate,311,0 +diamondshirt,311,0 +diamondtunic,311,0 +dchestplate,311,0 +dplatebody,311,0 +dplate,311,0 +dshirt,311,0 +dtunic,311,0 +crystalchestplate,311,0 +crystalplatebody,311,0 +crystalplate,311,0 +crystalshirt,311,0 +crystaltunic,311,0 +cchestplate,311,0 +cplatebody,311,0 +cplate,311,0 +cshirt,311,0 +ctunic,311,0 +diamondleggings,312,0 +diamondlegs,312,0 +diamondpants,312,0 +dleggings,312,0 +dlegs,312,0 +dpants,312,0 +crystalleggings,312,0 +crystallegs,312,0 +crystalpants,312,0 +cleggings,312,0 +clegs,312,0 +cpants,312,0 +diamondboots,313,0 +diamondshoes,313,0 +dboots,313,0 +dshoes,313,0 +crystalboots,313,0 +crystalshoes,313,0 +cboots,313,0 +cshoes,313,0 +goldhelmet,314,0 +goldhelm,314,0 +goldhat,314,0 +goldcoif,314,0 +ghelmet,314,0 +ghelm,314,0 +ghat,314,0 +gcoif,314,0 +goldchestplate,315,0 +goldplatebody,315,0 +goldshirt,315,0 +goldtunic,315,0 +gchestplate,315,0 +gplatebody,315,0 +gplateplate,315,0 +gshirt,315,0 +gtunic,315,0 +goldleggings,316,0 +goldlegs,316,0 +goldpants,316,0 +gleggings,316,0 +glegs,316,0 +gpants,316,0 +goldboots,317,0 +goldshoes,317,0 +gboots,317,0 +gshoes,317,0 +flint,318,0 +pork,319,0 +porkchop,319,0 +rawpork,319,0 +rpork,319,0 +rawporkchop,319,0 +rporkchop,319,0 +cookedpork,320,0 +grilledpork,320,0 +grillpork,320,0 +gpork,320,0 +cookpork,320,0 +cpork,320,0 +grilledporkchop,320,0 +grillporkchop,320,0 +gporkchop,320,0 +cookedporkchop,320,0 +cookporkchop,320,0 +cporkchop,320,0 +bacon,320,0 +painting,321,0 +picture,321,0 +goldenapple,322,0 +goldapple,322,0 +gapple,322,0 +enchantedgoldenapple,322,1 +enchantedgoldapple,322,1 +enchantedgapple,322,1 +supergoldenapple,322,1 +supergoldapple,322,1 +supergapple,322,1 +magicalgoldenapple,322,1 +magicalgoldapple,322,1 +magicalgapple,322,1 +magicgoldenapple,322,1 +magicgoldapple,322,1 +magicgapple,322,1 +egoldenapple,322,1 +egoldapple,322,1 +egapple,322,1 +sgoldenapple,322,1 +sgoldapple,322,1 +sgapple,322,1 +mgoldenapple,322,1 +mgoldapple,322,1 +mgapple,322,1 +sign,323,0 +woodendoor,324,0 +wooddoor,324,0 +wdoor,324,0 +door,324,0 +bucket,325,0 +bukkit,325,0 +waterbucket,326,0 +waterbukkit,326,0 +wbucket,326,0 +wbukkit,326,0 +magmabucket,327,0 +magmabukkit,327,0 +lavabucket,327,0 +lavabukkit,327,0 +lbucket,327,0 +lbukkit,327,0 +minecart,328,0 +mcart,328,0 +cart,328,0 +saddle,329,0 +irondoor,330,0 +idoor,330,0 +steeldoor,330,0 +sdoor,330,0 +dooriron,330,0 +doori,330,0 +doorsteel,330,0 +doors,330,0 +redstonedust,331,0 +redstone,331,0 +rstonedust,331,0 +rstone,331,0 +redsdust,331,0 +reddust,331,0 +rsdust,331,0 +rdust,331,0 +snow,332,0 +snowball,332,0 +snball,332,0 +sball,332,0 +boat,333,0 +leather,334,0 +cowhide,334,0 +hide,334,0 +milkbucket,335,0 +milkbukkit,335,0 +mbucket,335,0 +mbukkit,335,0 +claybrick,336,0 +brick,336,0 +redbrick,336,0 +rbrick,336,0 +clayball,337,0 +cball,337,0 +clay,337,0 +reeds,338,0 +reed,338,0 +sugarcane,338,0 +scane,338,0 +bamboo,338,0 +paper,339,0 +papyrus,339,0 +book,340,0 +slimeball,341,0 +slball,341,0 +chestminecart,342,0 +storageminecart,342,0 +storagemcart,342,0 +chestmcart,342,0 +storagecart,342,0 +chestcart,342,0 +sminecart,342,0 +cminecart,342,0 +smcart,342,0 +cmcart,342,0 +scart,342,0 +ccart,342,0 +furnaceminecart,343,0 +engineminecart,343,0 +poweredminecart,343,0 +powerminecart,343,0 +enginemcart,343,0 +poweredmcart,343,0 +powermcart,343,0 +furnacemcart,343,0 +enginecart,343,0 +poweredcart,343,0 +powercart,343,0 +furnacecart,343,0 +eminecart,343,0 +pminecart,343,0 +fminecart,343,0 +emcart,343,0 +pmcart,343,0 +fmcart,343,0 +ecart,343,0 +pcart,343,0 +fcart,343,0 +egg,344,0 +compass,345,0 +fishingrod,346,0 +fishrod,346,0 +frod,346,0 +rod,346,0 +watch,347,0 +goldwatch,347,0 +goldclock,347,0 +gwatch,347,0 +gclock,347,0 +clock,347,0 +glowstonedust,348,0 +glowingstonedust,348,0 +lightstonedust,348,0 +lbdust,348,0 +gbdust,348,0 +lsdust,348,0 +gsdust,348,0 +rawfish,349,0 +rafish,349,0 +fish,349,0 +rawsalmonfish,349,1 +rasalmonfish,349,1 +salmonfish,349,1 +rawsalmon,349,1 +rasalmon,349,1 +salmon,349,1 +sfish,349,1 +fishs,349,1 +rawclownfish,349,2 +raclownfish,349,2 +clownfish,349,2 +rawnemo,349,2 +ranemo,349,2 +nemo,349,2 +nemofish,349,2 +fishnemo,349,2 +clfish,349,2 +fishcl,349,2 +nfish,349,2 +fishn,349,2 +rawpufferfish,349,3 +rapufferfish,349,3 +pufferfish,349,3 +pufffish,349,3 +fishpuff,349,3 +pfish,349,3 +fishp,349,3 +cookedfish,350,0 +cookfish,350,0 +cfish,350,0 +grilledfish,350,0 +grillfish,350,0 +gfish,350,0 +roastedfish,350,0 +roastfish,350,0 +rofish,350,0 +cookedsalmonfish,350,1 +cooksalmonfish,350,1 +csalmonfish,350,1 +grilledsalmonfish,350,1 +grillsalmonfish,350,1 +gsalmonfish,350,1 +roastedsalmonfish,350,1 +roastsalmonfish,350,1 +rosalmonfish,350,1 +cookedsalmon,350,1 +cooksalmon,350,1 +csalmon,350,1 +grilledsalmon,350,1 +grillsalmon,350,1 +gsalmon,350,1 +roastedsalmon,350,1 +roastsalmon,350,1 +rosalmon,350,1 +dye,351,0 +inksack,351,0 +inksac,351,0 +isack,351,0 +isac,351,0 +sack,351,0 +sac,351,0 +blackinksack,351,0 +blackinksac,351,0 +blackisack,351,0 +blackisac,351,0 +blacksack,351,0 +blacksac,351,0 +inksackblack,351,0 +inksacblack,351,0 +isackblack,351,0 +isacblack,351,0 +sackblack,351,0 +sacblack,351,0 +blackinksackcolour,351,0 +blackinksaccolour,351,0 +blackisackcolour,351,0 +blackisaccolour,351,0 +blacksackcolour,351,0 +blacksaccolour,351,0 +inksackblackcolour,351,0 +inksacblackcolour,351,0 +isackblackcolour,351,0 +isacclackcolour,351,0 +sackblackcolour,351,0 +sacblackcolour,351,0 +blackinksackcolor,351,0 +blackinksaccolor,351,0 +blackisackcolor,351,0 +blackisaccolor,351,0 +blacksackcolor,351,0 +blacksaccolor,351,0 +inksackblackcolor,351,0 +inksacblackcolor,351,0 +isackblackcolor,351,0 +isacblackcolor,351,0 +sackblackcolor,351,0 +sacblackcolor,351,0 +blackinksackdye,351,0 +blackinksacdye,351,0 +blackisackdye,351,0 +blackisacdye,351,0 +blacksackdye,351,0 +blacksacdye,351,0 +inksackblackdye,351,0 +inksacblackdye,351,0 +isackblackdye,351,0 +isacclackdye,351,0 +sackblackdye,351,0 +sacblackdye,351,0 +blackcolor,351,0 +blackdye,351,0 +rosered,351,1 +roseredcolor,351,1 +roseredcolour,351,1 +rosereddye,351,1 +redrosecolor,351,1 +redrosecolour,351,1 +redrosedye,351,1 +redr,351,1 +redrcolor,351,1 +redrcolour,351,1 +redrdye,351,1 +redcolor,351,1 +redcolour,351,1 +reddye,351,1 +cactusgreen,351,2 +greencactus,351,2 +cactusgreencolour,351,2 +greencactuscolour,351,2 +cactusgreencolor,351,2 +greencactuscolor,351,2 +cactusgreendye,351,2 +greencactusdye,351,2 +greencolour,351,2 +greencolor,351,2 +greendye,351,2 +cocoabeans,351,3 +cocoabean,351,3 +cocobeans,351,3 +cocobean,351,3 +cbeans,351,3 +cbean,351,3 +beans,351,3 +bean,351,3 +browncocoabeans,351,3 +browncocoabean,351,3 +browncocobeans,351,3 +browncocobean,351,3 +browncbeans,351,3 +browncbean,351,3 +brownbeans,351,3 +brownbean,351,3 +brownb,351,3 +cocoabeanscolour,351,3 +cocoabeancolour,351,3 +cocobeanscolour,351,3 +cocobeancolour,351,3 +cbeanscolour,351,3 +cbeancolour,351,3 +beanscolour,351,3 +beancolour,351,3 +browncocoabeanscolour,351,3 +browncocoabeancolour,351,3 +browncocobeanscolour,351,3 +browncocobeancolour,351,3 +browncbeanscolour,351,3 +browncbeancolour,351,3 +brownbeanscolour,351,3 +brownbeancolour,351,3 +brownbcolour,351,3 +cocoabeanscolor,351,3 +cocoabeancolor,351,3 +cocobeanscolor,351,3 +cocobeancolor,351,3 +cbeanscolor,351,3 +cbeancolor,351,3 +beanscolor,351,3 +beancolor,351,3 +browncocoabeanscolor,351,3 +browncocoabeancolor,351,3 +browncocobeanscolor,351,3 +browncocobeancolor,351,3 +browncbeanscolor,351,3 +browncbeancolor,351,3 +brownbeanscolor,351,3 +brownbeancolor,351,3 +brownbcolor,351,3 +cocoabeansdye,351,3 +cocoabeandye,351,3 +cocobeansdye,351,3 +cocobeandye,351,3 +cbeansdye,351,3 +cbeandye,351,3 +beansdye,351,3 +beandye,351,3 +browncocoabeansdye,351,3 +browncocoabeandye,351,3 +browncocobeansdye,351,3 +browncocobeandye,351,3 +browncbeansdye,351,3 +browncbeandye,351,3 +brownbeansdye,351,3 +brownbeandye,351,3 +brownbdye,351,3 +browncolour,351,3 +browncolor,351,3 +browndye,351,3 +lapislazuli,351,4 +bluelapislazuli,351,4 +bluelapisl,351,4 +bluelapis,351,4 +bluel,351,4 +lapislazuliblue,351,4 +lapislblue,351,4 +lapisblue,351,4 +lapisl,351,4 +lapis,351,4 +bluelapislazulicolour,351,4 +bluelapislcolour,351,4 +bluelapiscolour,351,4 +lapislazulibluecolour,351,4 +lapislbluecolour,351,4 +lapisbluecolour,351,4 +lapislazulicolour,351,4 +lapislcolour,351,4 +lapiscolour,351,4 +bluelapislazulicolor,351,4 +bluelapislcolor,351,4 +bluelapiscolor,351,4 +lapislazulibluecolor,351,4 +lapislbluecolor,351,4 +lapisbluecolor,351,4 +lapislazulicolor,351,4 +lapislcolor,351,4 +lapiscolor,351,4 +bluelapislazulidye,351,4 +bluelapisldye,351,4 +bluelapisdye,351,4 +lapislazulibluedye,351,4 +lapislbluedye,351,4 +lapisbluedye,351,4 +lapislazulidye,351,4 +lapisldye,351,4 +lapisdye,351,4 +bluecolour,351,4 +bluecolor,351,4 +bluedye,351,4 +purpledye,351,5 +purplecolour,351,5 +purplecolor,351,5 +cyandye,351,6 +cyancolour,351,6 +cyancolor,351,6 +lightgraydye,351,7 +lightgraycolour,351,7 +lightgraycolor,351,7 +lgraycolour,351,7 +lgraycolor,351,7 +lgraydye,351,7 +lightgreydye,351,7 +lightgreycolour,351,7 +lightgreycolor,351,7 +lgreycolour,351,7 +lgreycolor,351,7 +lgreydye,351,7 +silvercolour,351,7 +silvercolor,351,7 +silverdye,351,7 +darkgraydye,351,8 +darkgraycolour,351,8 +darkgraycolor,351,8 +dgraycolour,351,8 +dgraycolor,351,8 +dgraydye,351,8 +graycolour,351,8 +graycolor,351,8 +graydye,351,8 +darkgreydye,351,8 +darkgreycolour,351,8 +darkgreycolor,351,8 +dgreycolour,351,8 +dgreycolor,351,8 +dgreydye,351,8 +greycolour,351,8 +greycolor,351,8 +greydye,351,8 +pinkdye,351,9 +pinkcolour,351,9 +pinkcolor,351,9 +limedye,351,10 +limecolour,351,10 +limecolor,351,10 +dandelionWHITE,351,11 +dandelionWHITEcolour,351,11 +dandelionWHITEcolor,351,11 +dandelionWHITEdye,351,11 +WHITEdandelioncolour,351,11 +WHITEdandelioncolor,351,11 +WHITEdandeliondye,351,11 +WHITEd,351,11 +WHITEdcolour,351,11 +WHITEdcolor,351,11 +WHITEddye,351,11 +dWHITE,351,11 +dWHITEcolour,351,11 +dWHITEcolor,351,11 +dWHITEdye,351,11 +WHITEcolour,351,11 +WHITEcolor,351,11 +WHITEdye,351,11 +lightbluecolour,351,12 +lightbluecolor,351,12 +lightbluedye,351,12 +lbluecolour,351,12 +lbluecolor,351,12 +lbluedye,351,12 +magentacolour,351,13 +magentacolor,351,13 +magentadye,351,13 +orangecolour,351,14 +orangecolor,351,14 +orangedye,351,14 +bonemeal,351,15 +whitebonemeal,351,15 +whitebonemealcolour,351,15 +whitebonemealcolor,351,15 +whitebonemealdye,351,15 +bonemealwhite,351,15 +bonemealwhitecolour,351,15 +bonemealwhitecolor,351,15 +bonemealwhitedye,351,15 +whitebonem,351,15 +whitebonemcolour,351,15 +whitebonemcolor,351,15 +whitebonemdye,351,15 +bonemwhite,351,15 +bonemwhitecolour,351,15 +bonemwhitecolor,351,15 +bonemwhitedye,351,15 +bonemealcolour,351,15 +bonemealcolor,351,15 +bonemealdye,351,15 +bonem,351,15 +bonemcolour,351,15 +bonemcolor,351,15 +bonemdye,351,15 +whitecolour,351,15 +whitecolor,351,15 +whitedye,351,15 +bone,352,0 +sugar,353,0 +whitedust,353,0 +cake,354,0 +bed,355,0 +redstonerepeater,356,0 +redstonerepeat,356,0 +redstonedelayer,356,0 +redstonedelay,356,0 +redstonedioder,356,0 +redstonediode,356,0 +rstonerepeater,356,0 +rstonerepeat,356,0 +rstonedelayer,356,0 +rstonedelay,356,0 +rstonedioder,356,0 +rstonediode,356,0 +redsrepeater,356,0 +redsrepeat,356,0 +redsdelayer,356,0 +redsdelay,356,0 +redsdioder,356,0 +redsdiode,356,0 +rsrepeater,356,0 +rsrepeat,356,0 +rsdelayer,356,0 +rsdelay,356,0 +rsdioder,356,0 +rsdiode,356,0 +repeater,356,0 +repeat,356,0 +delayer,356,0 +delay,356,0 +dioder,356,0 +diode,356,0 +cookie,357,0 +chart,358,0 +map0,358,0 +map1,358,1 +map2,358,2 +map3,358,3 +map4,358,4 +map5,358,5 +map6,358,6 +map7,358,7 +map8,358,8 +map9,358,9 +map10,358,10 +map11,358,11 +map12,358,12 +map13,358,13 +map14,358,14 +map15,358,15 +shears,359,0 +shear,359,0 +sheers,359,0 +sheer,359,0 +woolcutters,359,0 +woolcutter,359,0 +cutterswool,359,0 +cutterwool,359,0 +melonslice,360,0 +mslice,360,0 +slicemelon,360,0 +watermelonslice,360,0 +greenmelonslice,360,0 +melongreenslice,360,0 +pumpkinseeds,361,0 +pseeds,361,0 +seedsp,361,0 +seedspumpkin,361,0 +pumpseeds,361,0 +seedspump,361,0 +melonseeds,362,0 +mseeds,362,0 +watermelonseeds,362,0 +greenmelonseeds,362,0 +gmelonseeds,362,0 +seedsmelon,362,0 +seedswatermelon,362,0 +rawbeef,363,0 +rawsteak,363,0 +uncookedbeef,363,0 +uncookedsteak,363,0 +cowmeat,363,0 +plainbeef,363,0 +beef,364,0 +steak,364,0 +cookedbeef,364,0 +grilledbeef,364,0 +cookedsteak,364,0 +grilledsteak,364,0 +cookedcowmeat,364,0 +rawchicken,365,0 +uncookedchicken,365,0 +plainchicken,365,0 +chickenplain,365,0 +chickenuncooked,365,0 +chickenraw,365,0 +cookedchicken,366,0 +grilledchicken,366,0 +toastedchicken,366,0 +gchicken,366,0 +bbqchicken,366,0 +friedchicken,366,0 +cchicken,366,0 +rottenflesh,367,0 +zombieflesh,367,0 +rottenmeat,367,0 +zombiemeat,367,0 +badflesh,367,0 +poisonflesh,367,0 +zombieremains,367,0 +enderpearl,368,0 +endpearl,368,0 +pearl,368,0 +epearl,368,0 +bluepearl,368,0 +endergem,368,0 +blazerod,369,0 +goldenrod,369,0 +goldrod,369,0 +blazestick,369,0 +goldstick,369,0 +brod,369,0 +grod,369,0 +bstick,369,0 +gstick,369,0 +ghasttear,370,0 +ghastdrop,370,0 +ghosttear,370,0 +ghostdrop,370,0 +gtear,370,0 +gdrop,370,0 +tear,370,0 +goldnugget,371,0 +gnugget,371,0 +goldpebble,371,0 +gpebble,371,0 +goldball,371,0 +gball,371,0 +netherstalk,372,0 +deathstalk,372,0 +hellstalk,372,0 +nstalk,372,0 +dstalk,372,0 +hstalk,372,0 +netherwarts,372,0 +netherwart,372,0 +netherplant,372,0 +nethercrop,372,0 +hellwarts,372,0 +hellwart,372,0 +hellplant,372,0 +hellcrop,372,0 +deathwarts,372,0 +deathwart,372,0 +deathplant,372,0 +deathcrop,372,0 +nwarts,372,0 +nwart,372,0 +ncrop,372,0 +nplant,372,0 +hwarts,372,0 +hwart,372,0 +hplant,372,0 +hcrop,372,0 +dwarts,372,0 +dwart,372,0 +dplant,372,0 +dcrop,372,0 +potion,373,0 +mixture,373,0 +potions,373,0 +waterbottle,373,0 +fullbottle,373,0 +watervase,373,0 +fullvase,373,0 +clearpotion,373,6 +clearpot,373,6 +clearextendedpotion,373,7 +clearexpotion,373,7 +clear2potion,373,7 +clearextendedpot,373,7 +clearexpot,373,7 +clear2pot,373,7 +diffusepotion,373,11 +diffusepot,373,11 +artlesspotion,373,13 +artlesspot,373,13 +thinpotion,373,14 +thinpot,373,14 +thinextendedpotion,373,15 +thinexpotion,373,15 +thin2potion,373,15 +thinextendedpot,373,15 +thinexpot,373,15 +thin2pot,373,15 +awkwardpotion,373,16 +awkwardpot,373,16 +bunglingpotion,373,22 +bunglingpot,373,22 +bunglingextendedpotion,373,23 +bunglingexpotion,373,23 +bungling2potion,373,23 +bunglingextendedpot,373,23 +bunglingexpot,373,23 +bungling2pot,373,23 +smoothpotion,373,27 +smoothpot,373,27 +suavepotion,373,29 +suavepot,373,29 +debonairpotion,373,30 +debonairpot,373,30 +debonairextendedpotion,373,31 +debonairexpotion,373,31 +debonair2potion,373,31 +debonairextendedpot,373,31 +debonairexpot,373,31 +debonair2pot,373,31 +thickpotion,373,32 +thickpot,373,32 +charmingpotion,373,38 +charmingpot,373,38 +charmingextendedpotion,373,39 +charmingexpotion,373,39 +charming2potion,373,39 +charmingextendedpot,373,39 +charmingexpot,373,39 +charming2pot,373,39 +refinedpotion,373,43 +refinedpot,373,43 +cordialpotion,373,45 +cordialpot,373,45 +sparklingpotion,373,46 +sparklingpot,373,46 +sparklingextendedpotion,373,47 +sparklingexpotion,373,47 +sparkling2potion,373,47 +sparklingextendedpot,373,47 +sparklingexpot,373,47 +sparkling2pot,373,47 +potentpotion,373,48 +potentpot,373,48 +rankpotion,373,54 +rankpot,373,54 +rankextendedpotion,373,55 +rankexpotion,373,55 +rank2potion,373,55 +rankextendedpot,373,55 +rankexpot,373,55 +rank2pot,373,55 +acridpotion,373,59 +acridpot,373,59 +grosspotion,373,61 +grosspot,373,61 +stinkypotion,373,62 +stinkypot,373,62 +stinkyextendedpotion,373,63 +stinkyexpotion,373,63 +stinky2potion,373,63 +stinkyextendedpot,373,63 +stinkyexpot,373,63 +stinky2pot,373,63 +mundaneextendedpotion,373,64 +mundaneexpotion,373,64 +mundane2potion,373,64 +mundaneextendedpot,373,64 +mundaneexpot,373,64 +mundane2pot,373,64 +mundanepotion,373,8192 +mundanepot,373,8192 +regenerationpotion,373,8193 +regeneratepotion,373,8193 +regenpotion,373,8193 +regenerationpot,373,8193 +regeneratepot,373,8193 +regenpot,373,8193 +rpot,373,8193 +swiftnesspotion,373,8194 +swiftpotion,373,8194 +speedpotion,373,8194 +swiftnesspot,373,8194 +swiftpot,373,8194 +speedpot,373,8194 +swpot,373,8194 +fireresistancepotion,373,8195 +fireresistpotion,373,8195 +firerespotion,373,8195 +fireresistancepot,373,8195 +fireresistpot,373,8195 +firerespot,373,8195 +fpot,373,8195 +poisonpotion,373,8196 +acidpotion,373,8196 +poisonpot,373,8196 +acidpot,373,8196 +ppot,373,8196 +healingpotion,373,8197 +healpotion,373,8197 +lifepotion,373,8197 +healingpot,373,8197 +healpot,373,8197 +lifepot,373,8197 +hpot,373,8197 +nightvisionpotion,373,8198 +nvisionpotion,373,8198 +nightvpotion,373,8198 +darkvisionpotion,373,8198 +dvisionpotion,373,8198 +darkvpotion,373,8198 +nightvisionpot,373,8198 +nvisionpot,373,8198 +nightvpot,373,8198 +darkvisionpot,373,8198 +dvisionpot,373,8198 +darkvpot,373,8198 +npot,373,8198 +weaknesspotion,373,8200 +weakpotion,373,8200 +weaknesspot,373,8200 +weakpot,373,8200 +wpot,373,8200 +strengthpotion,373,8201 +strongpotion,373,8201 +strpotion,373,8201 +strengthpot,373,8201 +strongpot,373,8201 +strpot,373,8201 +stpot,373,8201 +slownesspotion,373,8202 +slowpotion,373,8202 +slownesspot,373,8202 +slowpot,373,8202 +slpot,373,8202 +harmingpotion,373,8204 +damagepotion,373,8204 +dmgpotion,373,8204 +harmingpot,373,8204 +damagepot,373,8204 +dmgpot,373,8204 +dpot,373,8204 +waterbreathingpotion,373,8205 +waterbreathpotion,373,8205 +breathingpotion,373,8205 +breathpotion,373,8205 +waterbreathingpot,373,8205 +waterbreathpot,373,8205 +breathingpot,373,8205 +breathpot,373,8205 +wbpot,373,8205 +invisibilitypotion,373,8206 +invisiblepotion,373,8206 +invpotion,373,8206 +invisibilitypot,373,8206 +invisiblepot,373,8206 +invpot,373,8206 +ipot,373,8206 +regenerationleveliipotion,373,8225 +regenerateleveliipotion,373,8225 +regenleveliipotion,373,8225 +regenerationlevel2potion,373,8225 +regeneratelevel2potion,373,8225 +regenlevel2potion,373,8225 +regenerationiipotion,373,8225 +regenerateiipotion,373,8225 +regeniipotion,373,8225 +regenerationleveliipot,373,8225 +regenerateleveliipot,373,8225 +regenleveliipot,373,8225 +regenerationlevel2pot,373,8225 +regeneratelevel2pot,373,8225 +regenlevel2pot,373,8225 +regenerationiipot,373,8225 +regenerateiipot,373,8225 +regeniipot,373,8225 +r2pot,373,8225 +swiftnessleveliipotion,373,8226 +swiftleveliipotion,373,8226 +speedleveliipotion,373,8226 +swiftnesslevel2potion,373,8226 +swiftlevel2potion,373,8226 +speedlevel2potion,373,8226 +swiftnessiipotion,373,8226 +swiftiipotion,373,8226 +speediipotion,373,8226 +swiftnessleveliipot,373,8226 +swiftleveliipot,373,8226 +speedleveliipot,373,8226 +swiftnesslevel2pot,373,8226 +swiftlevel2pot,373,8226 +speedlevel2pot,373,8226 +swiftnessiipot,373,8226 +swiftiipot,373,8226 +speediipot,373,8226 +sw2pot,373,8226 +poisonleveliipotion,373,8228 +acidleveliipotion,373,8228 +poisonlevel2potion,373,8228 +acidlevel2potion,373,8228 +poisoniipotion,373,8228 +acidiipotion,373,8228 +poisonleveliipot,373,8228 +acidleveliipot,373,8228 +poisonlevel2pot,373,8228 +acidlevel2pot,373,8228 +poisoniipot,373,8228 +acidiipot,373,8228 +p2pot,373,8228 +healingleveliipotion,373,8229 +healleveliipotion,373,8229 +healinglevel2potion,373,8229 +heallevel2potion,373,8229 +healingiipotion,373,8229 +healiipotion,373,8229 +healingleveliipot,373,8229 +healleveliipot,373,8229 +healinglevel2pot,373,8229 +heallevel2pot,373,8229 +healingiipot,373,8229 +healiipot,373,8229 +h2pot,373,8229 +strengthleveliipotion,373,8233 +strongleveliipotion,373,8233 +strleveliipotion,373,8233 +strengthlevel2potion,373,8233 +stronglevel2potion,373,8233 +strlevel2potion,373,8233 +strengthiipotion,373,8233 +strongiipotion,373,8233 +striipotion,373,8233 +strengthleveliipot,373,8233 +strongleveliipot,373,8233 +strleveliipot,373,8233 +strengthlevel2pot,373,8233 +stronglevel2pot,373,8233 +strlevel2pot,373,8233 +strengthiipot,373,8233 +strongiipot,373,8233 +striipot,373,8233 +st2pot,373,8233 +harmingleveliipotion,373,8236 +damageleveliipotion,373,8236 +dmgleveliipotion,373,8236 +harminglevel2potion,373,8236 +damagelevel2potion,373,8236 +dmglevel2potion,373,8236 +harmingiipotion,373,8236 +damageiipotion,373,8236 +dmgiipotion,373,8236 +harmingleveliipot,373,8236 +damageleveliipot,373,8236 +dmgleveliipot,373,8236 +harminglevel2pot,373,8236 +damagelevel2pot,373,8236 +dmglevel2pot,373,8236 +harmingiipot,373,8236 +damageiipot,373,8236 +dmgiipot,373,8236 +d2pot,373,8236 +regenerationextendedpotion,373,8257 +regenerateextendedpotion,373,8257 +regenextendepotion,373,8257 +regenerationexpotion,373,8257 +regenerateexpotion,373,8257 +regenexpotion,373,8257 +regenerationextendedpot,373,8257 +regenerateextendedpot,373,8257 +regenextendepot,373,8257 +regenerationexpot,373,8257 +regenerateexpot,373,8257 +regenexpot,373,8257 +repot,373,8257 +swiftnessextendedpotion,373,8258 +swiftextendedpotion,373,8258 +speedextendedpotion,373,8258 +swiftnessexpotion,373,8258 +swiftexpotion,373,8258 +speedexpotion,373,8258 +swiftnessextendedpot,373,8258 +swiftextendedpot,373,8258 +speedextendedpot,373,8258 +swiftnessexpot,373,8258 +swiftexpot,373,8258 +speedexpot,373,8258 +swepot,373,8258 +fireresistanceextendedpotion,373,8259 +fireresistextendedpotion,373,8259 +fireresextendedpotion,373,8259 +fireresistanceexpotion,373,8259 +fireresistexpotion,373,8259 +fireresexpotion,373,8259 +fireresistanceextendedpot,373,8259 +fireresistextendedpot,373,8259 +fireresextendedpot,373,8259 +fireresistanceexpot,373,8259 +fireresistexpot,373,8259 +fireresexpot,373,8259 +fepot,373,8259 +poisonextendedpotion,373,8260 +acidextendedpotion,373,8260 +poisonexpotion,373,8260 +acidexpotion,373,8260 +poisonextendedpot,373,8260 +acidextendedpot,373,8260 +poisonexpot,373,8260 +acidexpot,373,8260 +pepot,373,8260 +nightvisionextendedpotion,373,8262 +nvisionextendedpotion,373,8262 +nightvextendedpotion,373,8262 +darkvisionextendedpotion,373,8262 +dvisionextendedpotion,373,8262 +darkvextendedpotion,373,8262 +nightvisionexpotion,373,8262 +nvisionexpotion,373,8262 +nightvexpotion,373,8262 +darkvisionexpotion,373,8262 +dvisionexpotion,373,8262 +darkvexpotion,373,8262 +nightvisionextendedpot,373,8262 +nvisionextendedpot,373,8262 +nightvextendedpot,373,8262 +darkvisionextendedpot,373,8262 +dvisionextendedpot,373,8262 +darkvextendedpot,373,8262 +nightvisionexpot,373,8262 +nvisionexpot,373,8262 +nightvexpot,373,8262 +darkvisionexpot,373,8262 +dvisionexpot,373,8262 +darkvexpot,373,8262 +nepot,373,8262 +weaknessextendedpotion,373,8264 +weakextendedpotion,373,8264 +weaknessexpotion,373,8264 +weakexpotion,373,8264 +weaknessextendedpot,373,8264 +weakextendedpot,373,8264 +weaknessexpot,373,8264 +weakexpot,373,8264 +wepot,373,8264 +strengthextendedpotion,373,8265 +strongextendedpotion,373,8265 +strextendedpotion,373,8265 +strengthexpotion,373,8265 +strongexpotion,373,8265 +strexpotion,373,8265 +strengthextendedpot,373,8265 +strongextendedpot,373,8265 +strextendedpot,373,8265 +strengthexpot,373,8265 +strongexpot,373,8265 +strexpot,373,8265 +stepot,373,8265 +slownessextendedpotion,373,8266 +slowextenedpotion,373,8266 +slownessexpotion,373,8266 +slowexpotion,373,8266 +slownessextendedpot,373,8266 +slowextenedpot,373,8266 +slownessexpot,373,8266 +slowexpot,373,8266 +slepot,373,8266 +waterbreathingextendedpotion,373,8269 +waterbreathextendedpotion,373,8269 +breathingextendedpotion,373,8269 +breathextendedpotion,373,8269 +waterbreathingextendedpot,373,8269 +waterbreathextendedpot,373,8269 +breathingextendedpot,373,8269 +breathextendedpot,373,8269 +waterbreathingexpotion,373,8269 +waterbreathexpotion,373,8269 +breathingexpotion,373,8269 +breathexpotion,373,8269 +waterbreathingexpot,373,8269 +waterbreathexpot,373,8269 +breathingexpot,373,8269 +breathexpot,373,8269 +wbepot,373,8269 +invisibilityextendedpotion,373,8270 +invisibleextendedpotion,373,8270 +invextendedpotion,373,8270 +invisibilityexpotion,373,8270 +invisibleexpotion,373,8270 +invexpotion,373,8270 +invisibilityextendedpot,373,8270 +invisibleextendedpot,373,8270 +invextendedpot,373,8270 +invisibilityexpot,373,8270 +invisibleexpot,373,8270 +invexpot,373,8270 +iepot,373,8270 +regenerationdualbitpotion,373,8289 +regeneratedualbitpotion,373,8289 +regendualbitpotion,373,8289 +regenerationdbpotion,373,8289 +regeneratedbpotion,373,8289 +regendbpotion,373,8289 +regenerationdualbitpot,373,8289 +regeneratedualbitpot,373,8289 +regendualbitpot,373,8289 +regenerationdbpot,373,8289 +regeneratedbpot,373,8289 +regendbpot,373,8289 +rdbpot,373,8289 +swiftnessdualbitpotion,373,8290 +swiftdualbitpotion,373,8290 +speeddualbitpotion,373,8290 +swiftnessdualbitpot,373,8290 +swiftdualbitpot,373,8290 +speeddualbitpot,373,8290 +swiftnessdbpotion,373,8290 +swiftdbpotion,373,8290 +speeddbpotion,373,8290 +swiftnessdbpot,373,8290 +swiftdbpot,373,8290 +speeddbpot,373,8290 +swdbpot,373,8290 +poisondualbitpotion,373,8292 +aciddualbitpotion,373,8292 +poisondualbitpot,373,8292 +aciddualbitpot,373,8292 +poisondbpotion,373,8292 +aciddbpotion,373,8292 +poisondbpot,373,8292 +aciddbpot,373,8292 +pdbpot,373,8292 +strengthdualbitpotion,373,8297 +strongdualbitpotion,373,8297 +strdualbitpotion,373,8297 +strengthdualbitpot,373,8297 +strongdualbitpot,373,8297 +strdualbitpot,373,8297 +strengthdbpotion,373,8297 +strongdbpotion,373,8297 +strdbpotion,373,8297 +strengthdbpot,373,8297 +strongdbpot,373,8297 +strdbpot,373,8297 +stdbpot,373,8297 +splashmundanepotion,373,16384 +splmundanepotion,373,16384 +splashregenerationpotion,373,16385 +splashregeneratepotion,373,16385 +splashregenpotion,373,16385 +splashregenerationpot,373,16385 +splashregeneratepot,373,16385 +splashregenpot,373,16385 +regenerationsplashpotion,373,16385 +regeneratesplashpotion,373,16385 +regensplashpotion,373,16385 +splregenerationpotion,373,16385 +splregeneratepotion,373,16385 +splregenpotion,373,16385 +splregenerationpot,373,16385 +splregeneratepot,373,16385 +splregenpot,373,16385 +sprpot,373,16385 +splashswiftnesspotion,373,16386 +splashswiftpotion,373,16386 +splashspeedpotion,373,16386 +splashswiftnesspot,373,16386 +splashswiftpot,373,16386 +splashspeedpot,373,16386 +splswiftnesspotion,373,16386 +splswiftpotion,373,16386 +splspeedpotion,373,16386 +splswiftnesspot,373,16386 +splswiftpot,373,16386 +splspeedpot,373,16386 +spswpot,373,16386 +splashfireresistancepotion,373,16387 +splashfireresistpotion,373,16387 +splashfirerespotion,373,16387 +splashfireresistancepot,373,16387 +splashfireresistpot,373,16387 +splashfirerespot,373,16387 +splfireresistancepotion,373,16387 +splfireresistpotion,373,16387 +splfirerespotion,373,16387 +splfireresistancepot,373,16387 +splfireresistpot,373,16387 +splfirerespot,373,16387 +spfpot,373,16387 +splashpoisonpotion,373,16388 +splashacidpotion,373,16388 +splashpoisonpot,373,16388 +splashacidpot,373,16388 +splpoisonpotion,373,16388 +splacidpotion,373,16388 +splpoisonpot,373,16388 +splacidpot,373,16388 +spppot,373,16388 +splashhealingpotion,373,16389 +splashhealpotion,373,16389 +splashlifepotion,373,16389 +splashhealingpot,373,16389 +splashhealpot,373,16389 +splashlifepot,373,16389 +splhealingpotion,373,16389 +splhealpotion,373,16389 +spllifepotion,373,16389 +splhealingpot,373,16389 +splhealpot,373,16389 +spllifepot,373,16389 +sphpot,373,16389 +splashclearpotion,373,16390 +splashclearpot,373,16390 +splclearpotion,373,16390 +splclearpot,373,16390 +splashnightvisionpotion,373,16390 +splashnvisionpotion,373,16390 +splashnightvpotion,373,16390 +splashdarkvisionpotion,373,16390 +splashdvisionpotion,373,16390 +splashdarkvpotion,373,16390 +splashnightvisionpot,373,16390 +splashnvisionpot,373,16390 +splashnightvpot,373,16390 +splashdarkvisionpot,373,16390 +splashdvisionpot,373,16390 +splashdarkvpot,373,16390 +splnightvisionpotion,373,16390 +splnvisionpotion,373,16390 +splnightvpotion,373,16390 +spldarkvisionpotion,373,16390 +spldvisionpotion,373,16390 +spldarkvpotion,373,16390 +splnightvisionpot,373,16390 +splnvisionpot,373,16390 +splnightvpot,373,16390 +spldarkvisionpot,373,16390 +spldvisionpot,373,16390 +spldarkvpot,373,16390 +spnpot,373,16390 +splashclearextendedpotion,373,16391 +splashclearexpotion,373,16391 +splashclear2potion,373,16391 +splashclearextendedpot,373,16391 +splashclearexpot,373,16391 +splashclear2pot,373,16391 +splclearextendedpotion,373,16391 +splclearexpotion,373,16391 +splclear2potion,373,16391 +splclearextendedpot,373,16391 +splclearexpot,373,16391 +splclear2pot,373,16391 +splashweaknesspotion,373,16392 +splashweakpotion,373,16392 +splashweaknesspot,373,16392 +splashweakpot,373,16392 +splweaknesspotion,373,16392 +splweakpotion,373,16392 +splweaknesspot,373,16392 +splweakpot,373,16392 +spwpot,373,16392 +splashstrengthpotion,373,16393 +splashstrongpotion,373,16393 +splashstrpotion,373,16393 +splashstrengthpot,373,16393 +splashstrongpot,373,16393 +splashstrpot,373,16393 +splstrengthpotion,373,16393 +splstrongpotion,373,16393 +splstrpotion,373,16393 +splstrengthpot,373,16393 +splstrongpot,373,16393 +splstrpot,373,16393 +spstpot,373,16393 +splashslownesspotion,373,16394 +splashslowpotion,373,16394 +splashslownesspot,373,16394 +splashslowpot,373,16394 +splslownesspotion,373,16394 +splslowpotion,373,16394 +splslownesspot,373,16394 +splslowpot,373,16394 +spslpot,373,16394 +splashdiffusepotion,373,16395 +splashdiffusepot,373,16395 +spldiffusepotion,373,16395 +spldiffusepot,373,16395 +splashharmingpotion,373,16396 +splashdamagepotion,373,16396 +splashdmgpotion,373,16396 +splashharmingpot,373,16396 +splashdamagepot,373,16396 +splashdmgpot,373,16396 +splharmingpotion,373,16396 +spldamagepotion,373,16396 +spldmgpotion,373,16396 +splharmingpot,373,16396 +spldamagepot,373,16396 +spldmgpot,373,16396 +spdpot,373,16396 +splashartlesspotion,373,16397 +splashartlesspot,373,16397 +splartlesspotion,373,16397 +splartlesspot,373,16397 +splashwaterbreathingpotion,373,16397 +splashwaterbreathpotion,373,16397 +splashbreathingpotion,373,16397 +splashbreathpotion,373,16397 +splashwaterbreathingpot,373,16397 +splashwaterbreathpot,373,16397 +splashbreathingpot,373,16397 +splashbreathpot,373,16397 +splwaterbreathingpotion,373,16397 +splwaterbreathpotion,373,16397 +splbreathingpotion,373,16397 +splbreathpotion,373,16397 +splwaterbreathingpot,373,16397 +splwaterbreathpot,373,16397 +splbreathingpot,373,16397 +splbreathpot,373,16397 +spwbpot,373,16397 +splashthinpotion,373,16398 +splashthinpot,373,16398 +splthinpotion,373,16398 +splthinpot,373,16398 +splashinvisibilitypotion,373,16398 +splashinvisiblepotion,373,16398 +splashinvpotion,373,16398 +splashinvisibilitypot,373,16398 +splashinvisiblepot,373,16398 +splashinvpot,373,16398 +splinvisibilitypotion,373,16398 +splinvisiblepotion,373,16398 +splinvpotion,373,16398 +splinvisibilitypot,373,16398 +splinvisiblepot,373,16398 +splinvpot,373,16398 +spipot,373,16398 +splashthinextendedpotion,373,16399 +splashthinexpotion,373,16399 +splashthin2potion,373,16399 +splashthinextendedpot,373,16399 +splashthinexpot,373,16399 +splashthin2pot,373,16399 +splthinextendedpotion,373,16399 +splthinexpotion,373,16399 +splthin2potion,373,16399 +splthinextendedpot,373,16399 +splthinexpot,373,16399 +splthin2pot,373,16399 +splashawkwardpotion,373,16400 +splashawkwardpot,373,16400 +splawkwardpotion,373,16400 +splawkwardpot,373,16400 +splashbunglingpotion,373,16406 +splashbunglingpot,373,16406 +splbunglingpotion,373,16406 +splbunglingpot,373,16406 +splashbunglingextendedpotion,373,16407 +splashbunglingexpotion,373,16407 +splashbungling2potion,373,16407 +splashbunglingextendedpot,373,16407 +splashbunglingexpot,373,16407 +splashbungling2pot,373,16407 +splbunglingextendedpotion,373,16407 +splbunglingexpotion,373,16407 +splbungling2potion,373,16407 +splbunglingextendedpot,373,16407 +splbunglingexpot,373,16407 +splbungling2pot,373,16407 +splashsmoothpotion,373,16411 +splashsmoothpot,373,16411 +splsmoothpotion,373,16411 +splsmoothpot,373,16411 +splashsuavepotion,373,16413 +splashsuavepot,373,16413 +splsuavepotion,373,16413 +splsuavepot,373,16413 +splashdebonairpotion,373,16414 +splashdebonairpot,373,16414 +spldebonairpotion,373,16414 +spldebonairpot,373,16414 +splashdebonairextendedpotion,373,16415 +splashdebonairexpotion,373,16415 +splashdebonair2potion,373,16415 +splashdebonairextendedpot,373,16415 +splashdebonairexpot,373,16415 +splashdebonair2pot,373,16415 +spldebonairextendedpotion,373,16415 +spldebonairexpotion,373,16415 +spldebonair2potion,373,16415 +spldebonairextendedpot,373,16415 +spldebonairexpot,373,16415 +spldebonair2pot,373,16415 +splashthickpotion,373,16416 +splashthickpot,373,16416 +splthickpotion,373,16416 +splthickpot,373,16416 +splashregenerationleveliipotion,373,16417 +splashregenerateleveliipotion,373,16417 +splashregenleveliipotion,373,16417 +splashregenerationlevel2potion,373,16417 +splashregeneratelevel2potion,373,16417 +splashregenlevel2potion,373,16417 +splashregenerationiipotion,373,16417 +splashregenerateiipotion,373,16417 +splashregeniipotion,373,16417 +splashregenerationleveliipot,373,16417 +splashregenerateleveliipot,373,16417 +splashregenleveliipot,373,16417 +splashregenerationlevel2pot,373,16417 +splashregeneratelevel2pot,373,16417 +splashregenlevel2pot,373,16417 +splashregenerationiipot,373,16417 +splashregenerateiipot,373,16417 +splashregeniipot,373,16417 +splregenerationleveliipotion,373,16417 +splregenerateleveliipotion,373,16417 +splregenleveliipotion,373,16417 +splregenerationlevel2potion,373,16417 +splregeneratelevel2potion,373,16417 +splregenlevel2potion,373,16417 +splregenerationiipotion,373,16417 +splregenerateiipotion,373,16417 +splregeniipotion,373,16417 +splregenerationleveliipot,373,16417 +splregenerateleveliipot,373,16417 +splregenleveliipot,373,16417 +splregenerationlevel2pot,373,16417 +splregeneratelevel2pot,373,16417 +splregenlevel2pot,373,16417 +splregenerationiipot,373,16417 +splregenerateiipot,373,16417 +splregeniipot,373,16417 +spr2pot,373,16417 +splashswiftnessleveliipotion,373,16418 +splashswiftleveliipotion,373,16418 +splashspeedleveliipotion,373,16418 +splashswiftnesslevel2potion,373,16418 +splashswiftlevel2potion,373,16418 +splashspeedlevel2potion,373,16418 +splashswiftnessiipotion,373,16418 +splashswiftiipotion,373,16418 +splashspeediipotion,373,16418 +splashswiftnessleveliipot,373,16418 +splashswiftleveliipot,373,16418 +splashspeedleveliipot,373,16418 +splashswiftnesslevel2pot,373,16418 +splashswiftlevel2pot,373,16418 +splashspeedlevel2pot,373,16418 +splashswiftnessiipot,373,16418 +splashswiftiipot,373,16418 +splashspeediipot,373,16418 +splswiftnessleveliipotion,373,16418 +splswiftleveliipotion,373,16418 +splspeedleveliipotion,373,16418 +splswiftnesslevel2potion,373,16418 +splswiftlevel2potion,373,16418 +splspeedlevel2potion,373,16418 +splswiftnessiipotion,373,16418 +splswiftiipotion,373,16418 +splspeediipotion,373,16418 +splswiftnessleveliipot,373,16418 +splswiftleveliipot,373,16418 +splspeedleveliipot,373,16418 +splswiftnesslevel2pot,373,16418 +splswiftlevel2pot,373,16418 +splspeedlevel2pot,373,16418 +splswiftnessiipot,373,16418 +splswiftiipot,373,16418 +splspeediipot,373,16418 +spsw2pot,373,16418 +splashpoisonleveliipotion,373,16420 +splashacidleveliipotion,373,16420 +splashpoisonlevel2potion,373,16420 +splashacidlevel2potion,373,16420 +splashpoisoniipotion,373,16420 +splashacidiipotion,373,16420 +splashpoisonleveliipot,373,16420 +splashacidleveliipot,373,16420 +splashpoisonlevel2pot,373,16420 +splashacidlevel2pot,373,16420 +splashpoisoniipot,373,16420 +splashacidiipot,373,16420 +splpoisonleveliipotion,373,16420 +splacidleveliipotion,373,16420 +splpoisonlevel2potion,373,16420 +splcidlevel2potion,373,16420 +splpoisoniipotion,373,16420 +splacidiipotion,373,16420 +splpoisonleveliipot,373,16420 +splacidleveliipot,373,16420 +splpoisonlevel2pot,373,16420 +splacidlevel2pot,373,16420 +splpoisoniipot,373,16420 +splacidiipot,373,16420 +spp2pot,373,16420 +splashhealingleveliipotion,373,16421 +splashhealleveliipotion,373,16421 +splashhealinglevel2potion,373,16421 +splashheallevel2potion,373,16421 +splashhealingiipotion,373,16421 +splashhealiipotion,373,16421 +splashhealingleveliipot,373,16421 +splashhealleveliipot,373,16421 +splashhealinglevel2pot,373,16421 +splashheallevel2pot,373,16421 +splashhealingiipot,373,16421 +splashhealiipot,373,16421 +splhealingleveliipotion,373,16421 +splhealleveliipotion,373,16421 +splhealinglevel2potion,373,16421 +splheallevel2potion,373,16421 +splhealingiipotion,373,16421 +splhealiipotion,373,16421 +splhealingleveliipot,373,16421 +splhealleveliipot,373,16421 +splhealinglevel2pot,373,16421 +splheallevel2pot,373,16421 +splhealingiipot,373,16421 +splhealiipot,373,16421 +sph2pot,373,16421 +splashcharmingpotion,373,16422 +splashcharmingpot,373,16422 +splcharmingpotion,373,16422 +splcharmingpot,373,16422 +splashcharmingextendedpotion,373,16423 +splashcharmingexpotion,373,16423 +splashcharming2potion,373,16423 +splashcharmingextendedpot,373,16423 +splashcharmingexpot,373,16423 +splashcharming2pot,373,16423 +splcharmingextendedpotion,373,16423 +splcharmingexpotion,373,16423 +splcharming2potion,373,16423 +splcharmingextendedpot,373,16423 +splcharmingexpot,373,16423 +splcharming2pot,373,16423 +splashstrengthleveliipotion,373,16425 +splashstrongleveliipotion,373,16425 +splashstrleveliipotion,373,16425 +splashstrengthlevel2potion,373,16425 +splashstronglevel2potion,373,16425 +splashstrlevel2potion,373,16425 +splashstrengthiipotion,373,16425 +splashstrongiipotion,373,16425 +splashstriipotion,373,16425 +splashstrengthleveliipot,373,16425 +splashstrongleveliipot,373,16425 +splashstrleveliipot,373,16425 +splashstrengthlevel2pot,373,16425 +splashstronglevel2pot,373,16425 +splashstrlevel2pot,373,16425 +splashstrengthiipot,373,16425 +splashstrongiipot,373,16425 +splashstriipot,373,16425 +splstrengthleveliipotion,373,16425 +splstrongleveliipotion,373,16425 +splstrleveliipotion,373,16425 +splstrengthlevel2potion,373,16425 +splstronglevel2potion,373,16425 +splstrlevel2potion,373,16425 +splstrengthiipotion,373,16425 +splstrongiipotion,373,16425 +splstriipotion,373,16425 +splstrengthleveliipot,373,16425 +splstrongleveliipot,373,16425 +splstrleveliipot,373,16425 +splstrengthlevel2pot,373,16425 +splstronglevel2pot,373,16425 +splstrlevel2pot,373,16425 +splstrengthiipot,373,16425 +splstrongiipot,373,16425 +splstriipot,373,16425 +spst2pot,373,16425 +splashrefinedpotion,373,16427 +splashrefinedpot,373,16427 +splrefinedpotion,373,16427 +splrefinedpot,373,16427 +splashharmingleveliipotion,373,16428 +splashdamageleveliipotion,373,16428 +splashdmgleveliipotion,373,16428 +splashharminglevel2potion,373,16428 +splashdamagelevel2potion,373,16428 +splashdmglevel2potion,373,16428 +splashharmingiipotion,373,16428 +splashdamageiipotion,373,16428 +splashdmgiipotion,373,16428 +splashharmingleveliipot,373,16428 +splashdamageleveliipot,373,16428 +splashdmgleveliipot,373,16428 +splashharminglevel2pot,373,16428 +splashdamagelevel2pot,373,16428 +splashdmglevel2pot,373,16428 +splashharmingiipot,373,16428 +splashdamageiipot,373,16428 +splashdmgiipot,373,16428 +splharmingleveliipotion,373,16428 +spldamageleveliipotion,373,16428 +spldmgleveliipotion,373,16428 +splharminglevel2potion,373,16428 +spldamagelevel2potion,373,16428 +spldmglevel2potion,373,16428 +splharmingiipotion,373,16428 +spldamageiipotion,373,16428 +spldmgiipotion,373,16428 +splharmingleveliipot,373,16428 +spldamageleveliipot,373,16428 +spldmgleveliipot,373,16428 +splharminglevel2pot,373,16428 +spldamagelevel2pot,373,16428 +spldmglevel2pot,373,16428 +splharmingiipot,373,16428 +spldamageiipot,373,16428 +spldmgiipot,373,16428 +spd2pot,373,16428 +splashcordialpotion,373,16429 +splashcordialpot,373,16429 +splcordialpotion,373,16429 +splcordialpot,373,16429 +splashsparklingpotion,373,16430 +splashsparklingpot,373,16430 +splsparklingpotion,373,16430 +splsparklingpot,373,16430 +splashsparklingextendedpotion,373,16431 +splashsparklingexpotion,373,16431 +splashsparkling2potion,373,16431 +splashsparklingextendedpot,373,16431 +splashsparklingexpot,373,16431 +splashsparkling2pot,373,16431 +splsparklingextendedpotion,373,16431 +splsparklingexpotion,373,16431 +splsparkling2potion,373,16431 +splsparklingextendedpot,373,16431 +splsparklingexpot,373,16431 +splsparkling2pot,373,16431 +splashpotentpotion,373,16432 +splashpotentpot,373,16432 +splpotentpotion,373,16432 +splpotentpot,373,16432 +splashrankpotion,373,16438 +splashrankpot,373,16438 +splrankpotion,373,16438 +splrankpot,373,16438 +splashrankextendedpotion,373,16439 +splashrankexpotion,373,16439 +splashrank2potion,373,16439 +splashrankextendedpot,373,16439 +splashrankexpot,373,16439 +splashrank2pot,373,16439 +splrankextendedpotion,373,16439 +splrankexpotion,373,16439 +splrank2potion,373,16439 +splrankextendedpot,373,16439 +splrankexpot,373,16439 +splrank2pot,373,16439 +splashacridpotion,373,16443 +splashacridpot,373,16443 +splacridpotion,373,16443 +splacridpot,373,16443 +splashgrosspotion,373,16445 +splashgrosspot,373,16445 +splgrosspotion,373,16445 +splgrosspot,373,16445 +splashstinkypotion,373,16446 +splashstinkypot,373,16446 +splstinkypotion,373,16446 +splstinkypot,373,16446 +splashstinkyextendedpotion,373,16447 +splashstinkyexpotion,373,16447 +splashstinky2potion,373,16447 +splashstinkyextendedpot,373,16447 +splashstinkyexpot,373,16447 +splashstinky2pot,373,16447 +splstinkyextendedpotion,373,16447 +splstinkyexpotion,373,16447 +splstinky2potion,373,16447 +splstinkyextendedpot,373,16447 +splstinkyexpot,373,16447 +splstinky2pot,373,16447 +splashmundaneextendedpotion,373,16448 +splashmundaneexpotion,373,16448 +splashmundane2potion,373,16448 +splashmundaneextendedpot,373,16448 +splashmundaneexpot,373,16448 +splashmundane2pot,373,16448 +splmundaneextendedpotion,373,16448 +splmundaneexpotion,373,16448 +splmundane2potion,373,16448 +splmundaneextendedpot,373,16448 +splmundaneexpot,373,16448 +splmundane2pot,373,16448 +splashregenerationextendedpotion,373,16449 +splashregenerateextendedpotion,373,16449 +splashregenextendepotion,373,16449 +splashregenerationexpotion,373,16449 +splashregenerateexpotion,373,16449 +splashregenexpotion,373,16449 +splashregenerationextendedpot,373,16449 +splashregenerateextendedpot,373,16449 +splashregenextendepot,373,16449 +splashregenerationexpot,373,16449 +splashregenerateexpot,373,16449 +splashregenexpot,373,16449 +splregenerationextendedpotion,373,16449 +splregenerateextendedpotion,373,16449 +splregenextendepotion,373,16449 +splregenerationexpotion,373,16449 +splregenerateexpotion,373,16449 +splregenexpotion,373,16449 +splregenerationextendedpot,373,16449 +splregenerateextendedpot,373,16449 +splregenextendepot,373,16449 +splregenerationexpot,373,16449 +splregenerateexpot,373,16449 +splregenexpot,373,16449 +sprepot,373,16449 +splashswiftnessextendedpotion,373,16450 +splashswiftextendedpotion,373,16450 +splashspeedextendedpotion,373,16450 +splashswiftnessexpotion,373,16450 +splashswiftexpotion,373,16450 +splashspeedexpotion,373,16450 +splashswiftnessextendedpot,373,16450 +splashswiftextendedpot,373,16450 +splashspeedextendedpot,373,16450 +splashswiftnessexpot,373,16450 +splashswiftexpot,373,16450 +splashspeedexpot,373,16450 +splswiftnessextendedpotion,373,16450 +splswiftextendedpotion,373,16450 +splspeedextendedpotion,373,16450 +splswiftnessexpotion,373,16450 +splswiftexpotion,373,16450 +splspeedexpotion,373,16450 +splswiftnessextendedpot,373,16450 +splswiftextendedpot,373,16450 +splspeedextendedpot,373,16450 +splswiftnessexpot,373,16450 +splswiftexpot,373,16450 +splspeedexpot,373,16450 +spswepot,373,16450 +splashfireresistanceextendedpotion,373,16451 +splashfireresistextendedpotion,373,16451 +splashfireresextendedpotion,373,16451 +splashfireresistanceexpotion,373,16451 +splashfireresistexpotion,373,16451 +splashfireresexpotion,373,16451 +splashfireresistanceextendedpot,373,16451 +splashfireresistextendedpot,373,16451 +splashfireresextendedpot,373,16451 +splashfireresistanceexpot,373,16451 +splashfireresistexpot,373,16451 +splashfireresexpot,373,16451 +splfireresistanceextendedpotion,373,16451 +splfireresistextendedpotion,373,16451 +splfireresextendedpotion,373,16451 +splfireresistanceexpotion,373,16451 +splfireresistexpotion,373,16451 +splfireresexpotion,373,16451 +splfireresistanceextendedpot,373,16451 +splfireresistextendedpot,373,16451 +splfireresextendedpot,373,16451 +splfireresistanceexpot,373,16451 +splfireresistexpot,373,16451 +splfireresexpot,373,16451 +spfepot,373,16451 +splashpoisonextendedpotion,373,16452 +splashacidextendedpotion,373,16452 +splashpoisonexpotion,373,16452 +splashacidexpotion,373,16452 +splashpoisonextendedpot,373,16452 +splashacidextendedpot,373,16452 +splashpoisonexpot,373,16452 +splashacidexpot,373,16452 +splpoisonextendedpotion,373,16452 +splacidextendedpotion,373,16452 +splpoisonexpotion,373,16452 +splacidexpotion,373,16452 +splpoisonextendedpot,373,16452 +splacidextendedpot,373,16452 +splpoisonexpot,373,16452 +splacidexpot,373,16452 +sppepot,373,16452 +splashnightvisionextendedpotion,373,16454 +splashnvisionextendedpotion,373,16454 +splashnightvextendedpotion,373,16454 +splashdarkvisionextendedpotion,373,16454 +splashdvisionextendedpotion,373,16454 +splashdarkvextendedpotion,373,16454 +splashnightvisionextendedpot,373,16454 +splashnvisionextendedpot,373,16454 +splashnightvextendedpot,373,16454 +splashdarkvisionextendedpot,373,16454 +splashdvisionextendedpot,373,16454 +splashdarkvextendedpot,373,16454 +splashnightvisionexpotion,373,16454 +splashnvisionexpotion,373,16454 +splashnightvexpotion,373,16454 +splashdarkvisionexpotion,373,16454 +splashdvisionexpotion,373,16454 +splashdarkvexpotion,373,16454 +splashnightvisionexpot,373,16454 +splashnvisionexpot,373,16454 +splashnightvexpot,373,16454 +splashdarkvisionexpot,373,16454 +splashdvisionexpot,373,16454 +splashdarkvexpot,373,16454 +splnightvisionextendedpotion,373,16454 +splnvisionextendedpotion,373,16454 +splnightvextendedpotion,373,16454 +spldarkvisionextendedpotion,373,16454 +spldvisionextendedpotion,373,16454 +spldarkvextendedpotion,373,16454 +splnightvisionextendedpot,373,16454 +splnvisionextendedpot,373,16454 +splnightvextendedpot,373,16454 +spldarkvisionextendedpot,373,16454 +spldvisionextendedpot,373,16454 +spldarkvextendedpot,373,16454 +splnightvisionexpotion,373,16454 +splnvisionexpotion,373,16454 +splnightvexpotion,373,16454 +spldarkvisionexpotion,373,16454 +spldvisionexpotion,373,16454 +spldarkvexpotion,373,16454 +splnightvisionexpot,373,16454 +splnvisionexpot,373,16454 +splnightvexpot,373,16454 +spldarkvisionexpot,373,16454 +spldvisionexpot,373,16454 +spldarkvexpot,373,16454 +spnepot,373,16454 +splashweaknessextendedpotion,373,16456 +splashweakextendedpotion,373,16456 +splashweaknessexpotion,373,16456 +splashweakexpotion,373,16456 +splashweaknessextendedpot,373,16456 +splashweakextendedpot,373,16456 +splashweaknessexpot,373,16456 +splashweakexpot,373,16456 +splweaknessextendedpotion,373,16456 +sphweakextendedpotion,373,16456 +splweaknessexpotion,373,16456 +splweakexpotion,373,16456 +splweaknessextendedpot,373,16456 +splweakextendedpot,373,16456 +splweaknessexpot,373,16456 +splweakexpot,373,16456 +spwepot,373,16456 +splashstrengthextendedpotion,373,16457 +splashstrongextendedpotion,373,16457 +splashstrextendedpotion,373,16457 +splashstrengthexpotion,373,16457 +splashstrongexpotion,373,16457 +splashstrexpotion,373,16457 +splashstrengthextendedpot,373,16457 +splashstrongextendedpot,373,16457 +splashstrextendedpot,373,16457 +splashstrengthexpot,373,16457 +splashstrongexpot,373,16457 +splashstrexpot,373,16457 +splstrengthextendedpotion,373,16457 +splstrongextendedpotion,373,16457 +splstrextendedpotion,373,16457 +splstrengthexpotion,373,16457 +splstrongexpotion,373,16457 +splstrexpotion,373,16457 +splstrengthextendedpot,373,16457 +splstrongextendedpot,373,16457 +splstrextendedpot,373,16457 +splstrengthexpot,373,16457 +splstrongexpot,373,16457 +splstrexpot,373,16457 +spstepot,373,16457 +splashslownessextendedpotion,373,16458 +splashslowextenedpotion,373,16458 +splashslownessexpotion,373,16458 +splashslowexpotion,373,16458 +splashslownessextendedpot,373,16458 +splashslowextenedpot,373,16458 +splashslownessexpot,373,16458 +splashslowexpot,373,16458 +splslownessextendedpotion,373,16458 +splslowextenedpotion,373,16458 +splslownessexpotion,373,16458 +splslowexpotion,373,16458 +splslownessextendedpot,373,16458 +splslowextenedpot,373,16458 +splslownessexpot,373,16458 +splslowexpot,373,16458 +spslepot,373,16458 +splashwaterbreathingextendedpotion,373,16461 +splashwaterbreathextendedpotion,373,16461 +splashbreathingextendedpotion,373,16461 +splashbreathextendedpotion,373,16461 +splashwaterbreathingextendedpot,373,16461 +splashwaterbreathextendedpot,373,16461 +splashbreathingextendedpot,373,16461 +splashbreathextendedpot,373,16461 +splwaterbreathingextendedpotion,373,16461 +splwaterbreathextendedpotion,373,16461 +splbreathingextendedpotion,373,16461 +splbreathextendedpotion,373,16461 +splwaterbreathingextendedpot,373,16461 +splwaterbreathextendedpot,373,16461 +splbreathingextendedpot,373,16461 +splbreathextendedpot,373,16461 +splashwaterbreathingexpotion,373,16461 +splashwaterbreathexpotion,373,16461 +splashbreathingexpotion,373,16461 +splashbreathexpotion,373,16461 +splashwaterbreathingexpot,373,16461 +splashwaterbreathexpot,373,16461 +splashbreathingexpot,373,16461 +splashbreathexpot,373,16461 +splwaterbreathingexpotion,373,16461 +splwaterbreathexpotion,373,16461 +splbreathingexpotion,373,16461 +splbreathexpotion,373,16461 +splwaterbreathingexpot,373,16461 +splwaterbreathexpot,373,16461 +splbreathingexpot,373,16461 +splbreathexpot,373,16461 +spwbepot,373,16461 +splashinvisibilityextendedpotion,373,16462 +splashinvisibleextendedpotion,373,16462 +splashinvextendedpotion,373,16462 +splashinvisibilityextendedpot,373,16462 +splashinvisibleextendedpot,373,16462 +splashinvextendedpot,373,16462 +splashinvisibilityexpotion,373,16462 +splashinvisibleexpotion,373,16462 +splashinvexpotion,373,16462 +splashinvisibilityexpot,373,16462 +splashinvisibleexpot,373,16462 +splashinvexpot,373,16462 +splinvisibilityextendedpotion,373,16462 +splinvisibleextendedpotion,373,16462 +splinvextendedpotion,373,16462 +splinvisibilityextendedpot,373,16462 +splinvisibleextendedpot,373,16462 +splinvextendedpot,373,16462 +splinvisibilityexpotion,373,16462 +splinvisibleexpotion,373,16462 +splinvexpotion,373,16462 +splinvisibilityexpot,373,16462 +splinvisibleexpot,373,16462 +splinvexpot,373,16462 +spiepot,373,16462 +splashregenerationdualbitpotion,373,16481 +splashregeneratedualbitpotion,373,16481 +splashregendualbitpotion,373,16481 +splashregenerationdualbitpot,373,16481 +splashregeneratedualbitpot,373,16481 +splashregendualbitpot,373,16481 +splregenerationdualbitpotion,373,16481 +splregeneratedualbitpotion,373,16481 +splregendualbitpotion,373,16481 +splregenerationdualbitpot,373,16481 +splregeneratedualbitpot,373,16481 +splregendualbitpot,373,16481 +splashregenerationdbpotion,373,16481 +splashregeneratedbpotion,373,16481 +splashregendbpotion,373,16481 +splashregenerationdbpot,373,16481 +splashregeneratedbpot,373,16481 +splashregendbpot,373,16481 +splregenerationdbpotion,373,16481 +splregeneratedbpotion,373,16481 +splregendbpotion,373,16481 +splregenerationdbpot,373,16481 +splregeneratedbpot,373,16481 +splregendbpot,373,16481 +sprdbpot,373,16481 +splashswiftnessdualbitpotion,373,16482 +splashswiftdualbitpotion,373,16482 +splashspeeddualbitpotion,373,16482 +splashswiftnessdualbitpot,373,16482 +splashswiftdualbitpot,373,16482 +splashspeeddualbitpot,373,16482 +splswiftnessdualbitpotion,373,16482 +splswiftdualbitpotion,373,16482 +splspeeddualbitpotion,373,16482 +splswiftnessdualbitpot,373,16482 +splswiftdualbitpot,373,16482 +splspeeddualbitpot,373,16482 +splashswiftnessdbpotion,373,16482 +splashswiftdbpotion,373,16482 +splashspeeddbpotion,373,16482 +splashswiftnessdbpot,373,16482 +splashswiftdbpot,373,16482 +splashspeeddbpot,373,16482 +splswiftnessdbpotion,373,16482 +splswiftdbpotion,373,16482 +splspeeddbpotion,373,16482 +splswiftnessdbpot,373,16482 +splswiftdbpot,373,16482 +splspeeddbpot,373,16482 +spswdbpot,373,16482 +splashpoisondualbitpotion,373,16484 +splashaciddualbitpotion,373,16484 +splashpoisondualbitpot,373,16484 +splashaciddualbitpot,373,16484 +splpoisondualbitpotion,373,16484 +splaciddualbitpotion,373,16484 +splpoisondualbitpot,373,16484 +splaciddualbitpot,373,16484 +splashpoisondbpotion,373,16484 +splashaciddbpotion,373,16484 +splashpoisondbpot,373,16484 +splashaciddbpot,373,16484 +splpoisondbpotion,373,16484 +splaciddbpotion,373,16484 +splpoisondbpot,373,16484 +splaciddbpot,373,16484 +sppdbpot,373,16484 +splashstrengthdualbitpotion,373,16489 +splashstrongdualbitpotion,373,16489 +splashstrdualbitpotion,373,16489 +splashstrengthdualbitpot,373,16489 +splashstrongdualbitpot,373,16489 +splashstrdualbitpot,373,16489 +splstrengthdualbitpotion,373,16489 +splstrongdualbitpotion,373,16489 +splstrdualbitpotion,373,16489 +splstrengthdualbitpot,373,16489 +splstrongdualbitpot,373,16489 +splstrdualbitpot,373,16489 +splashstrengthdbpotion,373,16489 +splashstrongdbpotion,373,16489 +splashstrdbpotion,373,16489 +splashstrengthdbpot,373,16489 +splashstrongdbpot,373,16489 +splashstrdbpot,373,16489 +splstrengthdbpotion,373,16489 +splstrongdbpotion,373,16489 +splstrdbpotion,373,16489 +splstrengthdbpot,373,16489 +splstrongdbpot,373,16489 +splstrdbpot,373,16489 +spstdbpot,373,16489 +glassbottle,374,0 +bottle,374,0 +gbottle,374,0 +gvase,374,0 +vase,374,0 +glassvase,374,0 +emptyglassbottle,374,0 +emptybottle,374,0 +emptygbottle,374,0 +emptygvase,374,0 +emptyvase,374,0 +emptyglassvase,374,0 +eglassbottle,374,0 +ebottle,374,0 +egbottle,374,0 +egvase,374,0 +evase,374,0 +eglassvase,374,0 +spidereye,375,0 +eyeofspider,375,0 +seye,375,0 +fermentedspidereye,376,0 +craftedspidereye,376,0 +fspidereye,376,0 +cspidereye,376,0 +fermentedeyeofspider,376,0 +craftedeyeofspider,376,0 +feyeofspider,376,0 +ceyeofspider,376,0 +fermentedseye,376,0 +craftedseye,376,0 +fseye,376,0 +cseye,376,0 +blazepowder,377,0 +blazedust,377,0 +goldpowder,377,0 +golddust,377,0 +gdust,377,0 +gpowder,377,0 +bpowder,377,0 +bdust,377,0 +magmacream,378,0 +goldcream,378,0 +blazecream,378,0 +mcream,378,0 +gcream,378,0 +bcream,378,0 +combinedcream,378,0 +ccream,378,0 +bstand,379,0 +pstand,379,0 +brewingstand,379,0 +potionstand,379,0 +cauldron,380,0 +steelcauldron,380,0 +ironcauldron,380,0 +icauldron,380,0 +scauldron,380,0 +potioncauldron,380,0 +pcauldron,380,0 +eyeofender,381,0 +endereye,381,0 +endeye,381,0 +evilendereye,381,0 +evileyeofender,381,0 +evilenderpearl,381,0 +eeye,381,0 +eofender,381,0 +glisteringmelon,382,0 +speckledmelon,382,0 +goldmelon,382,0 +sparklymelon,382,0 +shiningmelon,382,0 +gmelon,382,0 +smelon,382,0 +creeperegg,383,50 +eggcreeper,383,50 +skeletonegg,383,51 +eggskeleton,383,51 +spideregg,383,52 +eggspider,383,52 +giantegg,383,53 +egggiant,383,53 +zombieegg,383,54 +eggzombie,383,54 +slimeegg,383,55 +eggslime,383,55 +ghastegg,383,56 +eggghast,383,56 +zombiepigmanegg,383,57 +zpigmanegg,383,57 +pigmanegg,383,57 +zombiepmanegg,383,57 +zpmanegg,383,57 +zombiepigmegg,383,57 +zpigmegg,383,57 +zombiepigegg,383,57 +zpigegg,383,57 +zombiepmegg,383,57 +zombiepegg,383,57 +eggzombiepigman,383,57 +eggzpigman,383,57 +eggpigman,383,57 +eggzombiepman,383,57 +eggzpman,383,57 +eggzombiepigm,383,57 +eggzpigm,383,57 +eggzombiepig,383,57 +eggzpig,383,57 +eggzombiepm,383,57 +eggzombiep,383,57 +endermanegg,383,58 +eggenderman,383,58 +eggcavespider,383,59 +cavespideregg,383,59 +silverfishegg,383,60 +eggsilverfish,383,60 +blazeegg,383,61 +eggblaze,383,61 +lavaslimeegg,383,62 +lavacubeegg,383,62 +magmacubeegg,383,62 +magmaslimeegg,383,62 +egglavaslime,383,62 +egglavacube,383,62 +eggmagmacube,383,62 +eggmagmaslime,383,62 +bategg,383,65 +eggbat,383,65 +witchegg,383,66 +eggwitch,383,66 +pigegg,383,90 +eggpig,383,90 +sheepegg,383,91 +eggsheep,383,91 +cowegg,383,92 +eggcow,383,92 +chickenegg,383,93 +eggchicken,383,93 +squidegg,383,94 +eggsquid,383,94 +wolfegg,383,95 +eggwolf,383,95 +mooshroomegg,383,96 +mushroomcowegg,383,96 +eggmooshroom,383,96 +eggmushroomcow,383,96 +snowgolemegg,383,97 +sgolemegg,383,97 +eggsnowgolem,383,97 +eggsgolem,383,97 +ocelotegg,383,98 +eggocelot,383,98 +irongolemegg,383,99 +igolemegg,383,99 +eggirongolem,383,99 +eggigolem,383,99 +egghorse,383,100 +horseegg,383,100 +villageregg,383,120 +eggvillager,383,120 +bottleofenchanting,384,0 +enchantingbottle,384,0 +expbottle,384,0 +xpbottle,384,0 +bottleexp,384,0 +bottlexp,384,0 +enchantbottle,384,0 +bottleenchanting,384,0 +bottleenchant,384,0 +bottleoenchanting,384,0 +firecharge,385,0 +fireball,385,0 +grenade,385,0 +bookandquill,386,0 +booknquill,386,0 +bookandfeather,386,0 +booknfeather,386,0 +writeablebook,386,0 +writtenbook,387,0 +readablebook,387,0 +sealedbook,387,0 +diary,387,0 +ownedbook,387,0 +emerald,388,0 +itemframe,389,0 +pictureframe,389,0 +iframe,389,0 +pframe,389,0 +flowerpot,390,0 +pot,390,0 +carrot,391,0 +potato,392,0 +rawpotato,392,0 +bakedpotato,393,0 +roastedpotato,393,0 +cookedpotato,393,0 +bakepotato,393,0 +roastpotato,393,0 +cookpotato,393,0 +bpotato,393,0 +rpotato,393,0 +cpotato,393,0 +poisonouspotato,394,0 +poisonpotato,394,0 +ppotato,394,0 +emptymap,395,0 +map,395,0 +goldencarrot,396,0 +goldcarrot,396,0 +gcarrot,396,0 +head,397,0 +skull,397,0 +skeletonhead,397,0 +headskeleton,397,0 +skeletonskull,397,0 +skullskeleton,397,0 +witherhead,397,1 +witherskeletonhead,397,1 +wskeletionhead,397,1 +headwither,397,1 +headwitherskeleton,397,1 +headwskeletion,397,1 +witherskull,397,1 +witherskeletonskull,397,1 +wskeletionskull,397,1 +skullwither,397,1 +skullwitherskeleton,397,1 +skullwskeletion,397,1 +zombiehead,397,2 +headzombie,397,2 +zombieskull,397,2 +skullzombie,397,2 +playerhead,397,3 +humanhead,397,3 +stevehead,397,3 +headplayer,397,3 +headhuman,397,3 +headsteve,397,3 +playerskull,397,3 +humanskull,397,3 +steveskull,397,3 +skullplayer,397,3 +skullhuman,397,3 +skullsteve,397,3 +creeperhead,397,4 +headcreeper,397,4 +creeperskull,397,4 +skullcreeper,397,4 +carrotonastick,398,0 +carrotonstick,398,0 +netherstar,399,0 +hellstar,399,0 +nstar,399,0 +hstar,399,0 +star,399,0 +pumpkinpie,400,0 +pumpkincake,400,0 +ppie,400,0 +pcake,400,0 +pie,400,0 +fireworkrocket,401,0 +fireworkmissle,401,0 +firework,401,0 +fworkrocket,401,0 +fworkmissle,401,0 +fwork,401,0 +fwrocket,401,0 +fwmissle,401,0 +fireworkstar,402,0 +fworkstar,402,0 +fwstar,402,0 +fireworkball,402,0 +fworkball,402,0 +fwball,402,0 +fireworkpowder,402,0 +fworkpowder,402,0 +fwpowder,402,0 +fireworkcharge,402,0 +fworkcharge,402,0 +fwcharge,402,0 +enchantedbook,403,0 +enchantmentbook,403,0 +enchantingbook,403,0 +enchantbook,403,0 +magicalbook,403,0 +magicbook,403,0 +ebook,403,0 +mbook,403,0 +redstonecomparator,404,0 +redstonecomparer,404,0 +redstonecompare,404,0 +rstonecomparator,404,0 +rstonecomparer,404,0 +rstonecompare,404,0 +redscomparator,404,0 +redscomparer,404,0 +redscompare,404,0 +rscomparator,404,0 +rscomparer,404,0 +rscompare,404,0 +comparator,404,0 +comparer,404,0 +compare,404,0 +netherbrick,405,0 +nbrick,405,0 +hellbrick,405,0 +deathbrick,405,0 +dbrick,405,0 +hbrick,405,0 +netherquartz,406,0 +deathquartz,406,0 +hellquartz,406,0 +nquartz,406,0 +dquartz,406,0 +hquartz,406,0 +quartz,406,0 +tntminecart,407,0 +dynamiteminecart,407,0 +dynamitemcart,407,0 +dynamitecart,407,0 +bombminecart,407,0 +bombmcart,407,0 +bombcart,407,0 +tntmcart,407,0 +tntcart,407,0 +dminecart,407,0 +dmcart,407,0 +dcart,407,0 +bminecart,407,0 +bmcart,407,0 +bcart,407,0 +tminecart,407,0 +tmcart,407,0 +tcart,407,0 +hopperminecart,408,0 +hoppermcart,408,0 +hoppercart,408,0 +hopminecart,408,0 +hopmcart,408,0 +hopcart,408,0 +hminecart,408,0 +hmcart,408,0 +hcart,408,0 +ironhorsearmor,417,0 +ironharmor,417,0 +ironarmor,417,0 +ihorsearmor,417,0 +iharmor,417,0 +iarmor,417,0 +steelhorsearmor,417,0 +steelharmor,417,0 +steelarmor,417,0 +shorsearmor,417,0 +sharmor,417,0 +sarmor,417,0 +goldenhorsearmor,418,0 +goldenharmor,418,0 +goldenarmor,418,0 +goldhorsearmor,418,0 +goldharmor,418,0 +goldarmor,418,0 +ghorsearmor,418,0 +gharmor,418,0 +garmor,418,0 +diamondhorsearmor,419,0 +diamondharmor,419,0 +diamondarmor,419,0 +dhorsearmor,419,0 +dharmor,419,0 +darmor,419,0 +crystalhorsearmor,419,0 +crystalharmor,419,0 +crystalarmor,419,0 +chorsearmor,419,0 +charmor,419,0 +carmor,419,0 +lead,420,0 +leash,420,0 +rope,420,0 +nametag,421,0 +tag,421,0 +commandblockminecart,422,0 +cmdblockminecart,422,0 +cblockminecart,422,0 +commandminecart,422,0 +cmdminecart,422,0 +cbminecart,422,0 +commandblockcart,422,0 +cmdblockcart,422,0 +cblockcart,422,0 +commandcart,422,0 +cmdcart,422,0 +cbcart,422,0 +13disc,2256,0 +goldmusicrecord,2256,0 +goldmusicdisk,2256,0 +goldmusicdisc,2256,0 +goldmusiccd,2256,0 +13musicrecord,2256,0 +13musicdisk,2256,0 +13musicdisc,2256,0 +13musiccd,2256,0 +gomusicrecord,2256,0 +gomusicdisk,2256,0 +gomusicdisc,2256,0 +gomusiccd,2256,0 +goldmrecord,2256,0 +goldmdisk,2256,0 +goldmdisc,2256,0 +goldmcd,2256,0 +13mrecord,2256,0 +13mdisk,2256,0 +13mdisc,2256,0 +13mcd,2256,0 +gomrecord,2256,0 +gomdisk,2256,0 +gomdisc,2256,0 +gomcd,2256,0 +goldrecord,2256,0 +golddisk,2256,0 +golddisc,2256,0 +goldcd,2256,0 +13record,2256,0 +13disk,2256,0 +13cd,2256,0 +gorecord,2256,0 +godisk,2256,0 +godisc,2256,0 +gocd,2256,0 +record1,2256,0 +disk1,2256,0 +disc1,2256,0 +cd1,2256,0 +1record,2256,0 +1disk,2256,0 +1disc,2256,0 +1cd,2256,0 +catdisc,2257,0 +greenmusicrecord,2257,0 +greenmusicdisk,2257,0 +greenmusicdisc,2257,0 +greenmusiccd,2257,0 +catmusicrecord,2257,0 +catmusicdisk,2257,0 +catmusicdisc,2257,0 +catmusiccd,2257,0 +grmusicrecord,2257,0 +grmusicdisk,2257,0 +grmusicdisc,2257,0 +grmusiccd,2257,0 +greenmrecord,2257,0 +greenmdisk,2257,0 +greenmdisc,2257,0 +greenmcd,2257,0 +catmrecord,2257,0 +catmdisk,2257,0 +catmdisc,2257,0 +catmcd,2257,0 +grmrecord,2257,0 +grmdisk,2257,0 +grmdisc,2257,0 +grmcd,2257,0 +greenrecord,2257,0 +greendisk,2257,0 +greendisc,2257,0 +greencd,2257,0 +catrecord,2257,0 +catdisk,2257,0 +catcd,2257,0 +grrecord,2257,0 +grdisk,2257,0 +grdisc,2257,0 +grcd,2257,0 +record2,2257,0 +disk2,2257,0 +disc2,2257,0 +cd2,2257,0 +2record,2257,0 +2disk,2257,0 +2disc,2257,0 +2cd,2257,0 +blocksdisc,2258,0 +orangemusicrecord,2258,0 +orangemusicdisk,2258,0 +orangemusicdisc,2258,0 +orangemusiccd,2258,0 +blocksmusicrecord,2258,0 +blocksmusicdisk,2258,0 +blocksmusicdisc,2258,0 +blocksmusiccd,2258,0 +ormusicrecord,2258,0 +ormusicdisk,2258,0 +ormusicdisc,2258,0 +ormusiccd,2258,0 +orangemrecord,2258,0 +orangemdisk,2258,0 +orangemdisc,2258,0 +orangemcd,2258,0 +blocksmrecord,2258,0 +blocksmdisk,2258,0 +blocksmdisc,2258,0 +blocksmcd,2258,0 +ormrecord,2258,0 +ormdisk,2258,0 +ormdisc,2258,0 +ormcd,2258,0 +orangerecord,2258,0 +orangedisk,2258,0 +orangedisc,2258,0 +orangecd,2258,0 +blocksrecord,2258,0 +blocksdisk,2258,0 +blockscd,2258,0 +orrecord,2258,0 +ordisk,2258,0 +ordisc,2258,0 +orcd,2258,0 +record3,2258,0 +disk3,2258,0 +disc3,2258,0 +cd3,2258,0 +3record,2258,0 +3disk,2258,0 +3disc,2258,0 +3cd,2258,0 +chirpdisc,2259,0 +redmusicrecord,2259,0 +redmusicdisk,2259,0 +redmusicdisc,2259,0 +redmusiccd,2259,0 +chirpmusicrecord,2259,0 +chirpmusicdisk,2259,0 +chirpmusicdisc,2259,0 +chirpmusiccd,2259,0 +remusicrecord,2259,0 +remusicdisk,2259,0 +remusicdisc,2259,0 +remusiccd,2259,0 +redmrecord,2259,0 +redmdisk,2259,0 +redmdisc,2259,0 +redmcd,2259,0 +chirpmrecord,2259,0 +chirpmdisk,2259,0 +chirpmdisc,2259,0 +chirpmcd,2259,0 +remrecord,2259,0 +remdisk,2259,0 +remdisc,2259,0 +remcd,2259,0 +redrecord,2259,0 +reddisk,2259,0 +reddisc,2259,0 +redcd,2259,0 +chirprecord,2259,0 +chirpdisk,2259,0 +chirpcd,2259,0 +rerecord,2259,0 +redisk,2259,0 +redisc,2259,0 +recd,2259,0 +record4,2259,0 +disk4,2259,0 +disc4,2259,0 +cd4,2259,0 +4record,2259,0 +4disk,2259,0 +4disc,2259,0 +4cd,2259,0 +fardisc,2260,0 +lightgreenmusicrecord,2260,0 +lightgreenmusicdisk,2260,0 +lightgreenmusicdisc,2260,0 +lightgreenmusiccd,2260,0 +lgreenmusicrecord,2260,0 +lgreenmusicdisk,2260,0 +lgreenmusicdisc,2260,0 +lgreenmusiccd,2260,0 +lightgrmusicrecord,2260,0 +lightgrmusicdisk,2260,0 +lightgrmusicdisc,2260,0 +lightgrmusiccd,2260,0 +farmusicrecord,2260,0 +farmusicdisk,2260,0 +farmusicdisc,2260,0 +farmusiccd,2260,0 +lgrmusicrecord,2260,0 +lgrmusicdisk,2260,0 +lgrmusicdisc,2260,0 +lgrmusiccd,2260,0 +lightgreenmrecord,2260,0 +lightgreenmdisk,2260,0 +lightgreenmdisc,2260,0 +lightgreenmcd,2260,0 +lgreenmrecord,2260,0 +lgreenmdisk,2260,0 +lgreenmdisc,2260,0 +lgreenmcd,2260,0 +lightgrmrecord,2260,0 +lightgrmdisk,2260,0 +lightgrmdisc,2260,0 +lightgrmcd,2260,0 +farmrecord,2260,0 +farmdisk,2260,0 +farmdisc,2260,0 +farmcd,2260,0 +lgrmrecord,2260,0 +lgrmdisk,2260,0 +lgrmdisc,2260,0 +lgrmcd,2260,0 +lightgreenrecord,2260,0 +lightgreendisk,2260,0 +lightgreendisc,2260,0 +lightgreencd,2260,0 +lgreenrecord,2260,0 +lgreendisk,2260,0 +lgreendisc,2260,0 +lgreencd,2260,0 +lightgrrecord,2260,0 +lightgrdisk,2260,0 +lightgrdisc,2260,0 +lightgrcd,2260,0 +farrecord,2260,0 +fardisk,2260,0 +farcd,2260,0 +lgrrecord,2260,0 +lgrdisk,2260,0 +lgrdisc,2260,0 +lgrcd,2260,0 +record5,2260,0 +disk5,2260,0 +disc5,2260,0 +cd5,2260,0 +5record,2260,0 +5disk,2260,0 +5disc,2260,0 +5cd,2260,0 +malldisc,2261,0 +purplemusicrecord,2261,0 +purplemusicdisk,2261,0 +purplemusicdisc,2261,0 +purplemusiccd,2261,0 +mallmusicrecord,2261,0 +mallmusicdisk,2261,0 +mallmusicdisc,2261,0 +mallmusiccd,2261,0 +pumusicrecord,2261,0 +pumusicdisk,2261,0 +pumusicdisc,2261,0 +pumusiccd,2261,0 +purplemrecord,2261,0 +purplemdisk,2261,0 +purplemdisc,2261,0 +purplemcd,2261,0 +mallmrecord,2261,0 +mallmdisk,2261,0 +mallmdisc,2261,0 +mallmcd,2261,0 +pumrecord,2261,0 +pumdisk,2261,0 +pumdisc,2261,0 +pumcd,2261,0 +purplerecord,2261,0 +purpledisk,2261,0 +purpledisc,2261,0 +purplecd,2261,0 +mallrecord,2261,0 +malldisk,2261,0 +mallcd,2261,0 +purecord,2261,0 +pudisk,2261,0 +pudisc,2261,0 +pucd,2261,0 +record6,2261,0 +disk6,2261,0 +disc6,2261,0 +cd6,2261,0 +6record,2261,0 +6disk,2261,0 +6disc,2261,0 +6cd,2261,0 +mellohidisc,2262,0 +pinkmusicrecord,2262,0 +pinkmusicdisk,2262,0 +pinkmusicdisc,2262,0 +pinkmusiccd,2262,0 +mellohimusicrecord,2262,0 +mellohimusicdisk,2262,0 +mellohimusicdisc,2262,0 +mellohimusiccd,2262,0 +pimusicrecord,2262,0 +pimusicdisk,2262,0 +pimusicdisc,2262,0 +pimusiccd,2262,0 +pinkmrecord,2262,0 +pinkmdisk,2262,0 +pinkmdisc,2262,0 +pinkmcd,2262,0 +mellohimrecord,2262,0 +mellohimdisk,2262,0 +mellohimdisc,2262,0 +mellohimcd,2262,0 +pimrecord,2262,0 +pimdisk,2262,0 +pimdisc,2262,0 +pimcd,2262,0 +pinkrecord,2262,0 +pinkdisk,2262,0 +pinkdisc,2262,0 +pinkcd,2262,0 +mellohirecord,2262,0 +mellohidisk,2262,0 +mellohicd,2262,0 +pirecord,2262,0 +pidisk,2262,0 +pidisc,2262,0 +picd,2262,0 +record7,2262,0 +disk7,2262,0 +disc7,2262,0 +cd7,2262,0 +7record,2262,0 +7disk,2262,0 +7disc,2262,0 +7cd,2262,0 +staldisc,2263,0 +blackmusicrecord,2263,0 +blackmusicdisk,2263,0 +blackmusicdisc,2263,0 +blackmusiccd,2263,0 +stalmusicrecord,2263,0 +stalmusicdisk,2263,0 +stalmusicdisc,2263,0 +stalmusiccd,2263,0 +blmusicrecord,2263,0 +blmusicdisk,2263,0 +blmusicdisc,2263,0 +blmusiccd,2263,0 +blackmrecord,2263,0 +blackmdisk,2263,0 +blackmdisc,2263,0 +blackmcd,2263,0 +stalmrecord,2263,0 +stalmdisk,2263,0 +stalmdisc,2263,0 +stalmcd,2263,0 +blmrecord,2263,0 +blmdisk,2263,0 +blmdisc,2263,0 +blmcd,2263,0 +blackrecord,2263,0 +blackdisk,2263,0 +blackdisc,2263,0 +blackcd,2263,0 +stalrecord,2263,0 +staldisk,2263,0 +stalcd,2263,0 +blrecord,2263,0 +bldisk,2263,0 +bldisc,2263,0 +blcd,2263,0 +record8,2263,0 +disk8,2263,0 +disc8,2263,0 +cd8,2263,0 +8record,2263,0 +8disk,2263,0 +8disc,2263,0 +8cd,2263,0 +straddisc,2264,0 +whitemusicrecord,2264,0 +whitemusicdisk,2264,0 +whitemusicdisc,2264,0 +whitemusiccd,2264,0 +stradmusicrecord,2264,0 +stradmusicdisk,2264,0 +stradmusicdisc,2264,0 +stradmusiccd,2264,0 +whmusicrecord,2264,0 +whmusicdisk,2264,0 +whmusicdisc,2264,0 +whmusiccd,2264,0 +whitemrecord,2264,0 +whitemdisk,2264,0 +whitemdisc,2264,0 +whitemcd,2264,0 +stradmrecord,2264,0 +stradmdisk,2264,0 +stradmdisc,2264,0 +stradmcd,2264,0 +whmrecord,2264,0 +whmdisk,2264,0 +whmdisc,2264,0 +whmcd,2264,0 +whiterecord,2264,0 +whitedisk,2264,0 +whitedisc,2264,0 +whitecd,2264,0 +stradrecord,2264,0 +straddisk,2264,0 +stradcd,2264,0 +whrecord,2264,0 +whdisk,2264,0 +whdisc,2264,0 +whcd,2264,0 +record9,2264,0 +disk9,2264,0 +disc9,2264,0 +cd9,2264,0 +9record,2264,0 +9disk,2264,0 +9disc,2264,0 +9cd,2264,0 +warddisc,2265,0 +darkgreenmusicrecord,2265,0 +darkgreenmusicdisk,2265,0 +darkgreenmusicdisc,2265,0 +darkgreenmusiccd,2265,0 +dgreenmusicrecord,2265,0 +dgreenmusicdisk,2265,0 +dgreenmusicdisc,2265,0 +dgreenmusiccd,2265,0 +darkgrmusicrecord,2265,0 +darkgrmusicdisk,2265,0 +darkgrmusicdisc,2265,0 +darkgrmusiccd,2265,0 +wardmusicrecord,2265,0 +wardmusicdisk,2265,0 +wardmusicdisc,2265,0 +wardmusiccd,2265,0 +dgrmusicrecord,2265,0 +dgrmusicdisk,2265,0 +dgrmusicdisc,2265,0 +dgrmusiccd,2265,0 +darkgreenmrecord,2265,0 +darkgreenmdisk,2265,0 +darkgreenmdisc,2265,0 +darkgreenmcd,2265,0 +dgreenmrecord,2265,0 +dgreenmdisk,2265,0 +dgreenmdisc,2265,0 +dgreenmcd,2265,0 +darkgrmrecord,2265,0 +darkgrmdisk,2265,0 +darkgrmdisc,2265,0 +darkgrmcd,2265,0 +wardmrecord,2265,0 +wardmdisk,2265,0 +wardmdisc,2265,0 +wardmcd,2265,0 +dgrmrecord,2265,0 +dgrmdisk,2265,0 +dgrmdisc,2265,0 +dgrmcd,2265,0 +darkgreenrecord,2265,0 +darkgreendisk,2265,0 +darkgreendisc,2265,0 +darkgreencd,2265,0 +dgreenrecord,2265,0 +dgreendisk,2265,0 +dgreendisc,2265,0 +dgreencd,2265,0 +darkgrrecord,2265,0 +darkgrdisk,2265,0 +darkgrdisc,2265,0 +darkgrcd,2265,0 +wardrecord,2265,0 +warddisk,2265,0 +wardcd,2265,0 +dgrrecord,2265,0 +dgrdisk,2265,0 +dgrdisc,2265,0 +dgrcd,2265,0 +record10,2265,0 +disk10,2265,0 +disc10,2265,0 +cd10,2265,0 +10record,2265,0 +10disk,2265,0 +10disc,2265,0 +10cd,2265,0 +11disc,2266,0 +crackedmusicrecord,2266,0 +crackedmusicdisk,2266,0 +crackedmusicdisc,2266,0 +crackedmusiccd,2266,0 +crackmusicrecord,2266,0 +crackmusicdisk,2266,0 +crackmusicdisc,2266,0 +crackmusiccd,2266,0 +11musicrecord,2266,0 +11musicdisk,2266,0 +11musicdisc,2266,0 +11musiccd,2266,0 +cmusicrecord,2266,0 +cmusicdisk,2266,0 +cmusicdisc,2266,0 +cmusiccd,2266,0 +crackedmrecord,2266,0 +crackedmdisk,2266,0 +crackedmdisc,2266,0 +crackedmcd,2266,0 +crackmrecord,2266,0 +crackmdisk,2266,0 +crackmdisc,2266,0 +crackmcd,2266,0 +11mrecord,2266,0 +11mdisk,2266,0 +11mdisc,2266,0 +11mcd,2266,0 +cmrecord,2266,0 +cmdisk,2266,0 +cmdisc,2266,0 +cmcd,2266,0 +crackedrecord,2266,0 +crackeddisk,2266,0 +crackeddisc,2266,0 +crackedcd,2266,0 +crackrecord,2266,0 +crackdisk,2266,0 +crackdisc,2266,0 +crackcd,2266,0 +crecord,2266,0 +cdisk,2266,0 +cdisc,2266,0 +ccd,2266,0 +record11,2266,0 +disk11,2266,0 +disc11,2266,0 +cd11,2266,0 +11record,2266,0 +11disk,2266,0 +11cd,2266,0 +waitdisc,2267,0 +waitmusicrecord,2267,0 +waitmusicdisk,2267,0 +waitmusicdisc,2267,0 +waitmusiccd,2267,0 +bluemusicrecord,2267,0 +bluemusicdisk,2267,0 +bluemusicdisc,2267,0 +bluemusiccd,2267,0 +12musicrecord,2267,0 +12musicdisk,2267,0 +12musicdisc,2267,0 +12musiccd,2267,0 +cyanmusicrecord,2267,0 +cyanmusicdisk,2267,0 +cyanmusicdisc,2267,0 +cyanmusiccd,2267,0 +waitmrecord,2267,0 +waitmdisk,2267,0 +waitmdisc,2267,0 +waitmcd,2267,0 +bluemrecord,2267,0 +bluemdisk,2267,0 +bluemdisc,2267,0 +bluemcd,2267,0 +12mrecord,2267,0 +12mdisk,2267,0 +12mdisc,2267,0 +12mcd,2267,0 +cyanmrecord,2267,0 +cyanmdisk,2267,0 +cyanmdisc,2267,0 +cyanmcd,2267,0 +waitrecord,2267,0 +waitdisk,2267,0 +waitcd,2267,0 +bluerecord,2267,0 +bluedisk,2267,0 +bluedisc,2267,0 +bluecd,2267,0 +cyanrecord,2267,0 +cyandisk,2267,0 +cyandisc,2267,0 +cyancd,2267,0 +record12,2267,0 +disk12,2267,0 +disc12,2267,0 +cd12,2267,0 +12record,2267,0 +12disk,2267,0 +12disc,2267,0 +12cd,2267,0 \ No newline at end of file diff --git a/PrevailHCF/bin/kits.yml b/PrevailHCF/bin/kits.yml new file mode 100644 index 0000000..e69de29 diff --git a/PrevailHCF/bin/plugin.yml b/PrevailHCF/bin/plugin.yml new file mode 100644 index 0000000..ea5b592 --- /dev/null +++ b/PrevailHCF/bin/plugin.yml @@ -0,0 +1,96 @@ +name: HCF +version: 29-{apache@common} +author: TRE-Prevail +main: com.prevailpots.hcf.HCF +softdepend: [ProtocolLib, WorldEdit] +depend: [Core] +commands: + focus: + description: Command used to focus a player for an faction. + cobblestone: + aliases: [cobble] + description: Command used to toggle cobblestone pickup whilst in Miner Class. + mobdrops: + description: Command used to toggle the pickup of Mob Loot. + supreme: + description: Command used to allow a player with the Supreme rank to revive an deathbanned player without use of a live. + conquest: + description: Command used to manage the Conquest Event. + glowstone: + description: Command used to manage the Glowstone Event. + coords: + description: Command used to display the coordinates of events and special locations. + donor: + aliases: [toggledonoronly] + description: Command used to toggle a special Donor Only mode. + toggleend: + description: Command used to close or open the end. + spawndragon: + description: Command used to spawn an EnderDragon entity in the end world. + reloadtab: + tab: + removetab: + list: + random: + description: Staff command used to randomly teleport to players with two options. Mining or not mining. + stats: + description: Command used to check the statistics of a player. + sotw: + description: Command used to manage the SOTW Timer. + alpha: + description: Command used to manage the alpha commands. + refund: + aliases: [inv, return] + description: Staff command used to refund a players inventory after their death. + crowbar: + description: Command used to manage crowbars. + economy: + aliases: [bal, balance, money, eco] + description: Command used to modify the economy. + eotw: + description: Console only utility command to manage the EOTW event. + game: + description: Command used to manage minigame events. + faction: + aliases: [f, fac] + description: Command used to access faction related commands. + gopple: + description: Command to check remaining OP apple cooldown time. + aliases: [goppletimer, goppletime, gapple] + help: + aliases: ["?", "ts"] + description: Command used to access the help menu and the TS3 help menu. + koth: + description: Command used to manage KingOfTheHill events. + stafflives: + description: Staff command used to manage lives from an administrative perspective. + location: + aliases: [loc] + description: Command used to check the location of yourself. + logout: + aliases: [disconnect] + description: Command used to safely logout without an NPC spawning. + key: + description: Staff command used to manage crate keys. + kit: + description: Apply kits. + kits: + description: Display kits. + mapkit: + description: Command used to check the current map restrictions. + pay: + description: Command used to allow payment of in-game currency. + lives: + description: Command used to manage your lives. + pvptimer: + aliases: [pvp] + description: Command used to manage your PvP Timer. + servertime: + description: Command used to check the date and time of server. + setborder: + aliases: [setbordersize] + description: Staff command used to set the world border. + spawn: + description: Command used to teleport yourself to the spawn point of the world selected. + timer: + description: Staff command used to manage player's timers. \ No newline at end of file diff --git a/PrevailHCF/bin/reclaimsettings.yml b/PrevailHCF/bin/reclaimsettings.yml new file mode 100644 index 0000000..5be7ca8 --- /dev/null +++ b/PrevailHCF/bin/reclaimsettings.yml @@ -0,0 +1,11 @@ +# You can use %PLAYER% for player name or %RANK% for rank name +# An example can be seen below +prevail: + name: '&4&lPrevail' # Set to anything, doesn't really matter since its not used + rankname: 'Prevail' # Set this to whatever the pex rank name is + commands: + - 'bc -raw &c&l%PLAYER% &e&lhas reclaimed their &4&lPrevail Rank &e&lfrom the store! &b&lhttp://buy.prevailpots.com/' + - 'stafflives give %PLAYER% 40' + - 'crate givekey %PLAYER% Vague 40' + - 'crate givekey %PLAYER% Mystical 25' + - 'crate givekey %PLAYER% Cryptic 15' \ No newline at end of file diff --git a/PrevailHCF/bin/settings.yml b/PrevailHCF/bin/settings.yml new file mode 100644 index 0000000..e69de29 diff --git a/PrevailHCF/src/balances.yml b/PrevailHCF/src/balances.yml new file mode 100644 index 0000000..e69de29 diff --git a/PrevailHCF/src/com/alexandeh/kraken/Kraken.java b/PrevailHCF/src/com/alexandeh/kraken/Kraken.java new file mode 100644 index 0000000..ead0fc5 --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/Kraken.java @@ -0,0 +1,103 @@ +package com.alexandeh.kraken; + +import com.alexandeh.kraken.tab.PlayerTab; +import com.alexandeh.kraken.tab.event.PlayerTabRemoveEvent; +import lombok.Getter; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scoreboard.Team; + +import java.util.HashSet; + +@Getter +public class Kraken implements Listener { + + private static Kraken instance; + private JavaPlugin plugin; + private KrakenOptions options; + + public Kraken(JavaPlugin plugin) { + this(plugin, KrakenOptions.getDefaultOptions()); + } + + public Kraken(JavaPlugin plugin, KrakenOptions options) { + + if (Bukkit.getMaxPlayers() < 60) { + throw new NumberFormatException("Player limit must be at least 60!"); + } + + instance = this; + + this.plugin = plugin; + this.options = options; + + new BukkitRunnable() { + @Override + public void run() { + for (Player player : Bukkit.getOnlinePlayers()) { + checkPlayer(player); + } + } + }.runTaskLaterAsynchronously(plugin, 4L); + + Bukkit.getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void onPlayerJoinEvent(PlayerJoinEvent event) { + Player player = event.getPlayer(); + onPlayerJoinEvent(player); + } + + public void onPlayerJoinEvent(Player player) { + new BukkitRunnable() { + @Override + public void run() { + checkPlayer(player); + } + }.runTaskLaterAsynchronously(plugin, 4L); + } + + @EventHandler + public void onPlayerQuitEvent(PlayerQuitEvent event) { + Player player = event.getPlayer(); + onPlayerQuitEvent(player); + } + + public void onPlayerQuitEvent(Player player) { + PlayerTab playerTab = PlayerTab.getByPlayer(player); + if (playerTab != null) { + + for (Team team : new HashSet<>(playerTab.getScoreboard().getTeams())) { + team.unregister(); + } + + PlayerTab.getPlayerTabs().remove(playerTab); + Bukkit.getPluginManager().callEvent(new PlayerTabRemoveEvent(playerTab)); + } + } + + private void checkPlayer(Player player) { + PlayerTab playerTab = PlayerTab.getByPlayer(player); + if (playerTab == null) { + long time = System.currentTimeMillis(); + new PlayerTab(player); + if (options.sendCreationMessage()) { + player.sendMessage(ChatColor.BLUE + "Tab created in " + (System.currentTimeMillis() - time) + " ms."); + } + } else { + playerTab.clear(); + } + } + + public static Kraken getInstance() { + return instance; + } +} diff --git a/PrevailHCF/src/com/alexandeh/kraken/KrakenOptions.java b/PrevailHCF/src/com/alexandeh/kraken/KrakenOptions.java new file mode 100644 index 0000000..f9677b8 --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/KrakenOptions.java @@ -0,0 +1,23 @@ +package com.alexandeh.kraken; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * Copyright 2016 Alexander Maxwell + * Use and or redistribution of compiled JAR file and or source code is permitted only if given + * explicit permission from original author: Alexander Maxwell + */ +@Getter +@Setter +@Accessors(fluent = true, chain = true) +public class KrakenOptions { + + private boolean sendCreationMessage; + + public static KrakenOptions getDefaultOptions() { + return new KrakenOptions().sendCreationMessage(false); + } + +} diff --git a/PrevailHCF/src/com/alexandeh/kraken/tab/PlayerTab.java b/PrevailHCF/src/com/alexandeh/kraken/tab/PlayerTab.java new file mode 100644 index 0000000..81fb26b --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/tab/PlayerTab.java @@ -0,0 +1,129 @@ +package com.alexandeh.kraken.tab; + + +import com.alexandeh.kraken.Kraken; +import com.alexandeh.kraken.tab.event.PlayerTabCreateEvent; +import lombok.Getter; +import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scoreboard.Scoreboard; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Getter +public class PlayerTab { + + private static Set playerTabs = new HashSet<>(); + private Player player; + private Scoreboard scoreboard; + private List entries; + + public PlayerTab(Player player) { + this.player = player; + + entries = new ArrayList<>(); + + clear(); + + if (!player.getScoreboard().equals(Bukkit.getScoreboardManager().getMainScoreboard())) { + scoreboard = player.getScoreboard(); + assemble(); + } else { + new BukkitRunnable() { + @Override + public void run() { + scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + player.setScoreboard(scoreboard); + assemble(); + } + }.runTask(Kraken.getInstance().getPlugin()); + } + + playerTabs.add(this); + } + + public void clear() { + for (TabEntry entry : entries) { + if (entry.nms() != null) { + PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.removePlayer(entry.nms()); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + } + } + + for (Player online : Bukkit.getOnlinePlayers()) { + PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.removePlayer(((CraftPlayer)online).getHandle()); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + } + + entries.clear(); + } + + private void assemble() { + + for (int i = 0; i < 60; i++) { + int x = i % 3; + int y = i / 3; + new TabEntry(this, getNextBlank(), x, y).send(); + } + + Bukkit.getPluginManager().callEvent(new PlayerTabCreateEvent(this)); + } + + public TabEntry getByPosition(int x, int y) { + for (TabEntry tabEntry : entries) { + if (tabEntry.x() == x && tabEntry.y() == y) { + return tabEntry; + } + } + return null; + } + + public String getNextBlank() { + outer: for (String string : getAllBlanks()) { + for (TabEntry tabEntry : entries) { + if (tabEntry.text() != null && tabEntry.text().startsWith(string)) { + continue outer; + } + } + return string; + } + return null; + } + + private static List getAllBlanks() { + List toReturn = new ArrayList<>(); + for (ChatColor chatColor : ChatColor.values()) { + toReturn.add(chatColor + "" + ChatColor.RESET); + for (ChatColor chatColor1 : ChatColor.values()) { + + if (toReturn.size() >= 60) { + return toReturn; + } + + toReturn.add(chatColor + "" + chatColor1 + ChatColor.RESET); + } + } + + return toReturn; + } + + public static PlayerTab getByPlayer(Player player) { + for (PlayerTab playerTab : playerTabs) { + if (playerTab.getPlayer().getName().equals(player.getName())) { + return playerTab; + } + } + return null; + } + + public static Set getPlayerTabs() { + return playerTabs; + } +} diff --git a/PrevailHCF/src/com/alexandeh/kraken/tab/TabEntry.java b/PrevailHCF/src/com/alexandeh/kraken/tab/TabEntry.java new file mode 100644 index 0000000..693a73f --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/tab/TabEntry.java @@ -0,0 +1,85 @@ +package com.alexandeh.kraken.tab; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import net.minecraft.server.v1_7_R4.EntityPlayer; +import net.minecraft.server.v1_7_R4.MinecraftServer; +import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_7_R4.PlayerInteractManager; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Team; + +import java.util.UUID; + +@Getter +@Setter +@Accessors(fluent = true, chain = true) +public class TabEntry { + + private PlayerTab playerTab; + private int x, y; + private String text; + private EntityPlayer nms; + private Team team; + private boolean setup; + + public TabEntry(PlayerTab playerTab, String text, int x, int y) { + this.playerTab = playerTab; + this.text = text; + this.x = x; + this.y = y; + + playerTab.getEntries().add(this); + } + + private TabEntry setup() { + setup = true; + + Player player = playerTab.getPlayer(); + CraftPlayer craftplayer = (CraftPlayer) player; + + nms = new EntityPlayer(MinecraftServer.getServer(), ((CraftWorld) player.getWorld()).getHandle(), new GameProfile(UUID.randomUUID(), ChatColor.translateAlternateColorCodes('&', text)), new PlayerInteractManager(((CraftWorld) player.getWorld()).getHandle())); + + PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(nms); + craftplayer.getHandle().playerConnection.sendPacket(packet); + + team = playerTab.getScoreboard().registerNewTeam(UUID.randomUUID().toString().substring(0, 16)); + team.addEntry(nms.getName()); + + return this; + } + + public TabEntry send() { + if (!(setup)) { + return setup(); + } + + text = ChatColor.translateAlternateColorCodes('&', text); + + if (text.length() > 16) { + team.setPrefix(text.substring(0, 16)); + String suffix = ChatColor.getLastColors(team.getPrefix()) + text.substring(16, text.length()); + if (suffix.length() > 16) { + if (suffix.length() <= 16) { + suffix = text.substring(16, text.length()); + team.setSuffix(suffix.substring(0, suffix.length())); + } else { + team.setSuffix(suffix.substring(0, 16)); + } + } else { + team.setSuffix(suffix); + } + } else { + team.setPrefix(text); + team.setSuffix(""); + } + + return this; + } + +} diff --git a/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.java b/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.java new file mode 100644 index 0000000..f522144 --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabCreateEvent.java @@ -0,0 +1,28 @@ +package com.alexandeh.kraken.tab.event; + +import com.alexandeh.kraken.tab.PlayerTab; +import lombok.Getter; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +@Getter +public class PlayerTabCreateEvent extends Event { + + private static final HandlerList handlers = new HandlerList(); + private PlayerTab playerTab; + private Player player; + + public PlayerTabCreateEvent(PlayerTab playerTab) { + this.player = playerTab.getPlayer(); + this.playerTab = playerTab; + } + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + +} diff --git a/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.java b/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.java new file mode 100644 index 0000000..bbbfe98 --- /dev/null +++ b/PrevailHCF/src/com/alexandeh/kraken/tab/event/PlayerTabRemoveEvent.java @@ -0,0 +1,28 @@ +package com.alexandeh.kraken.tab.event; + +import com.alexandeh.kraken.tab.PlayerTab; +import lombok.Getter; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +@Getter +public class PlayerTabRemoveEvent extends Event { + + private static final HandlerList handlers = new HandlerList(); + private PlayerTab playerTab; + private Player player; + + public PlayerTabRemoveEvent(PlayerTab playerTab) { + this.player = playerTab.getPlayer(); + this.playerTab = playerTab; + } + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/ConfigurationService.java b/PrevailHCF/src/com/prevailpots/hcf/ConfigurationService.java new file mode 100644 index 0000000..5f1fa0c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/ConfigurationService.java @@ -0,0 +1,65 @@ +package com.prevailpots.hcf; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.potion.PotionType; + +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; +import java.util.TimeZone; +import java.util.concurrent.TimeUnit; + + +public final class ConfigurationService { + public static final TimeZone SERVER_TIME_ZONE; + public static final Map ENCHANTMENT_LIMITS; + public static final Map POTION_LIMITS; + public static final Map SPAWN_RADIUS_MAP; + public static final ChatColor TEAMMATE_COLOUR; + public static final ChatColor ALLY_COLOUR; + public static final ChatColor ENEMY_COLOUR; + public static final ChatColor SAFEZONE_COLOUR; + public static final ChatColor WARZONE_COLOUR; + public static final ChatColor WILDERNESS_COLOUR; + public static final long DTR_MILLIS_BETWEEN_UPDATES; + public static final String DTR_WORDS_BETWEEN_UPDATES; + public static boolean CRATE_BROADCASTS; + + static { + SERVER_TIME_ZONE = TimeZone.getTimeZone("EST"); + ENCHANTMENT_LIMITS = new HashMap<>(); + POTION_LIMITS = new EnumMap<>(PotionType.class); + SPAWN_RADIUS_MAP = new EnumMap<>(World.Environment.class); + POTION_LIMITS.put(PotionType.STRENGTH, 0); + POTION_LIMITS.put(PotionType.WEAKNESS, 0); + POTION_LIMITS.put(PotionType.SLOWNESS, 1); + POTION_LIMITS.put(PotionType.POISON, 1); + POTION_LIMITS.put(PotionType.INSTANT_DAMAGE, 0); + POTION_LIMITS.put(PotionType.REGEN, 0); + POTION_LIMITS.put(PotionType.WATER_BREATHING, 0); + POTION_LIMITS.put(PotionType.INVISIBILITY, 1); + ENCHANTMENT_LIMITS.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2); + ENCHANTMENT_LIMITS.put(Enchantment.DAMAGE_ALL, 2); + ENCHANTMENT_LIMITS.put(Enchantment.ARROW_KNOCKBACK, 0); + ENCHANTMENT_LIMITS.put(Enchantment.KNOCKBACK, 0); + ENCHANTMENT_LIMITS.put(Enchantment.FIRE_ASPECT, 0); + ENCHANTMENT_LIMITS.put(Enchantment.THORNS, 0); + ENCHANTMENT_LIMITS.put(Enchantment.ARROW_FIRE, 0); + ENCHANTMENT_LIMITS.put(Enchantment.ARROW_DAMAGE, 3); + SPAWN_RADIUS_MAP.put(World.Environment.NORMAL, 75.5); + SPAWN_RADIUS_MAP.put(World.Environment.NETHER, 15.5); + SPAWN_RADIUS_MAP.put(World.Environment.THE_END, 0.0); + TEAMMATE_COLOUR = ChatColor.GREEN; + ALLY_COLOUR = ChatColor.AQUA; + ENEMY_COLOUR = ChatColor.RED; + SAFEZONE_COLOUR = ChatColor.GREEN; + WARZONE_COLOUR = ChatColor.RED; + WILDERNESS_COLOUR = ChatColor.GRAY; + DTR_MILLIS_BETWEEN_UPDATES = TimeUnit.SECONDS.toMillis(45L); + DTR_WORDS_BETWEEN_UPDATES = DurationFormatUtils.formatDurationWords(ConfigurationService.DTR_MILLIS_BETWEEN_UPDATES, true, true); + CRATE_BROADCASTS = false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/Cooldowns.java b/PrevailHCF/src/com/prevailpots/hcf/Cooldowns.java new file mode 100644 index 0000000..750040a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/Cooldowns.java @@ -0,0 +1,56 @@ +package com.prevailpots.hcf; + +import java.util.*; +import org.bukkit.entity.*; + +public class Cooldowns +{ + private static HashMap> cooldown; + + public static void createCooldown(final String k) { + if (Cooldowns.cooldown.containsKey(k)) { + throw new IllegalArgumentException("Cooldown already exists."); + } + cooldown.put("archer_feather", new HashMap<>()); + Cooldowns.cooldown.put(k, new HashMap()); + } + + public static HashMap getCooldownMap(final String k) { + if (Cooldowns.cooldown.containsKey(k)) { + return Cooldowns.cooldown.get(k); + } + return null; + } + + public static void addCooldown(final String k, final Player p, final int seconds) { + if (!Cooldowns.cooldown.containsKey(k)) { + throw new IllegalArgumentException(k + " does not exist"); + } + final long next = System.currentTimeMillis() + seconds * 1000L; + Cooldowns.cooldown.get(k).put(p.getUniqueId(), next); + } + + public static boolean isOnCooldown(final String k, final Player p) { + return Cooldowns.cooldown.containsKey(k) && Cooldowns.cooldown.get(k).containsKey(p.getUniqueId()) && System.currentTimeMillis() <= Cooldowns.cooldown.get(k).get(p.getUniqueId()); + } + + public static int getCooldownForPlayerInt(final String k, final Player p) { + return (int)(Cooldowns.cooldown.get(k).get(p.getUniqueId()) - System.currentTimeMillis()) / 1000; + } + + public static long getCooldownForPlayerLong(final String k, final Player p){ + return (Cooldowns.cooldown.get(k).get(p.getUniqueId()) - System.currentTimeMillis()); + } + + + public static void removeCooldown(final String k, final Player p) { + if (!Cooldowns.cooldown.containsKey(k)) { + throw new IllegalArgumentException(k + " does not exist"); + } + Cooldowns.cooldown.get(k).remove(p.getUniqueId()); + } + + static { + Cooldowns.cooldown = new HashMap>(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/DateTimeFormats.java b/PrevailHCF/src/com/prevailpots/hcf/DateTimeFormats.java new file mode 100644 index 0000000..38f7a5b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/DateTimeFormats.java @@ -0,0 +1,50 @@ +package com.prevailpots.hcf; + +import org.apache.commons.lang3.time.FastDateFormat; + +import java.text.DecimalFormat; +import java.time.ZoneId; +import java.util.Locale; +import java.util.TimeZone; + +public final class DateTimeFormats { + public static final TimeZone SERVER_TIME_ZONE; + public static final ZoneId SERVER_ZONE_ID; + public static final FastDateFormat DAY_MTH_HR_MIN; + public static final FastDateFormat DAY_MTH_HR_MIN_SECS; + public static final FastDateFormat DAY_MTH_YR_HR_MIN_AMPM; + public static final FastDateFormat DAY_MTH_HR_MIN_AMPM; + public static final FastDateFormat HR_MIN_AMPM; + public static final FastDateFormat HR_MIN_AMPM_TIMEZONE; + public static final FastDateFormat HR_MIN; + public static final FastDateFormat MIN_SECS; + public static final FastDateFormat KOTH_FORMAT; + public static final ThreadLocal REMAINING_SECONDS; + public static final ThreadLocal REMAINING_SECONDS_TRAILING; + + static { + SERVER_TIME_ZONE = TimeZone.getTimeZone("EST"); + SERVER_ZONE_ID = DateTimeFormats.SERVER_TIME_ZONE.toZoneId(); + DAY_MTH_HR_MIN = FastDateFormat.getInstance("dd/MM HH:mm", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + DAY_MTH_HR_MIN_SECS = FastDateFormat.getInstance("dd/MM HH:mm:ss", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + DAY_MTH_YR_HR_MIN_AMPM = FastDateFormat.getInstance("dd/MM/yy hh:mma", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + DAY_MTH_HR_MIN_AMPM = FastDateFormat.getInstance("dd/MM hh:mma", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + HR_MIN_AMPM = FastDateFormat.getInstance("hh:mma", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + HR_MIN_AMPM_TIMEZONE = FastDateFormat.getInstance("hh:mma z", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + HR_MIN = FastDateFormat.getInstance("hh:mm", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + MIN_SECS = FastDateFormat.getInstance("mm:ss", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + KOTH_FORMAT = FastDateFormat.getInstance("m:ss", DateTimeFormats.SERVER_TIME_ZONE, Locale.ENGLISH); + REMAINING_SECONDS = new ThreadLocal() { + @Override + protected DecimalFormat initialValue() { + return new DecimalFormat("0.#"); + } + }; + REMAINING_SECONDS_TRAILING = new ThreadLocal() { + @Override + protected DecimalFormat initialValue() { + return new DecimalFormat("0.0"); + } + }; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/HCF.java b/PrevailHCF/src/com/prevailpots/hcf/HCF.java new file mode 100644 index 0000000..77d320f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/HCF.java @@ -0,0 +1,520 @@ +package com.prevailpots.hcf; + +//This project is licenced for prevailpots.com +//This plugin is not for commercial use and can only be used on minecraft version 1.7.10 +//Additional information about license +//This plugin can only be sold with permission from spirit_pact or s3ries. + + +import java.io.File; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import com.alexandeh.kraken.Kraken; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.util.com.google.common.io.ByteArrayDataOutput; +import net.minecraft.util.com.google.common.io.ByteStreams; +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.PluginCommand; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.configuration.serialization.ConfigurationSerialization; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import com.customhcf.base.BasePlugin; +import com.prevailpots.hcf.balance.EconomyCommand; +import com.prevailpots.hcf.balance.EconomyManager; +import com.prevailpots.hcf.balance.FlatFileEconomyManager; +import com.prevailpots.hcf.balance.PayCommand; +import com.prevailpots.hcf.balance.ShopSignListener; +import com.prevailpots.hcf.classes.PvpClass; +import com.prevailpots.hcf.classes.PvpClassManager; +import com.prevailpots.hcf.classes.type.archer.ArcherClass; +import com.prevailpots.hcf.combatlog.CombatLogListener; +import com.prevailpots.hcf.combatlog.CustomEntityRegistration; +import com.prevailpots.hcf.command.*; +import com.prevailpots.hcf.deathban.Deathban; +import com.prevailpots.hcf.deathban.DeathbanListener; +import com.prevailpots.hcf.deathban.DeathbanManager; +import com.prevailpots.hcf.deathban.FlatFileDeathbanManager; +import com.prevailpots.hcf.faction.FactionExecutor; +import com.prevailpots.hcf.faction.FactionManager; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.FlatFileFactionManager; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.claim.ClaimHandler; +import com.prevailpots.hcf.faction.claim.ClaimWandListener; +import com.prevailpots.hcf.faction.claim.Subclaim; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.EndPortalFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.faction.type.RoadFaction; +import com.prevailpots.hcf.faction.type.SpawnFaction; +import com.prevailpots.hcf.fixes.BeaconStrengthFixListener; +import com.prevailpots.hcf.fixes.BlockHitFixListener; +import com.prevailpots.hcf.fixes.BlockJumpGlitchFixListener; +import com.prevailpots.hcf.fixes.BoatGlitchFixListener; +import com.prevailpots.hcf.fixes.EnchantLimitListener; +import com.prevailpots.hcf.fixes.EnderChestRemovalListener; +import com.prevailpots.hcf.fixes.HungerFixListener; +import com.prevailpots.hcf.fixes.InfinityArrowFixListener; +import com.prevailpots.hcf.fixes.NoPermissionClickListener; +import com.prevailpots.hcf.fixes.PearlGlitchFixListener; +import com.prevailpots.hcf.fixes.PexCrashFix; +import com.prevailpots.hcf.fixes.PhaseListener; +import com.prevailpots.hcf.fixes.PortalTrapFixListener; +import com.prevailpots.hcf.fixes.PotionLimitListener; +import com.prevailpots.hcf.fixes.ServerSecurityListener; +import com.prevailpots.hcf.fixes.VoidGlitchFixListener; +import com.prevailpots.hcf.fixes.WeatherFixListener; +import com.prevailpots.hcf.key.KeyListener; +import com.prevailpots.hcf.key.KeyManager; +import com.prevailpots.hcf.key.LootExecutor; +import com.prevailpots.hcf.key.RewardableItemStack; +import com.prevailpots.hcf.kothgame.CaptureZone; +import com.prevailpots.hcf.kothgame.EventExecutor; +import com.prevailpots.hcf.kothgame.EventScheduler; +import com.prevailpots.hcf.kothgame.EventSignListener; +import com.prevailpots.hcf.kothgame.NewEventScheduler; +import com.prevailpots.hcf.kothgame.RefillBox; +import com.prevailpots.hcf.kothgame.argument.glowstone.GlowstoneExecutor; +import com.prevailpots.hcf.kothgame.conquest.ConquestExecutor; +import com.prevailpots.hcf.kothgame.eotw.EOTWHandler; +import com.prevailpots.hcf.kothgame.eotw.EotwCommand; +import com.prevailpots.hcf.kothgame.eotw.EotwListener; +import com.prevailpots.hcf.kothgame.faction.CapturableFaction; +import com.prevailpots.hcf.kothgame.faction.ConquestFaction; +import com.prevailpots.hcf.kothgame.faction.GlowstoneFaction; +import com.prevailpots.hcf.kothgame.faction.KothFaction; +import com.prevailpots.hcf.kothgame.glowstone.GlowstoneListener; +import com.prevailpots.hcf.kothgame.koth.KothExecutor; +import com.prevailpots.hcf.listener.*; +import com.prevailpots.hcf.lives.LivesExecutor; +import com.prevailpots.hcf.mongo.MongoManager; +import com.prevailpots.hcf.scoreboard.ScoreboardHandler; +import com.prevailpots.hcf.tab.TabListener; +import com.prevailpots.hcf.task.SaveDataTask; +import com.prevailpots.hcf.timer.TimerExecutor; +import com.prevailpots.hcf.timer.TimerManager; +import com.prevailpots.hcf.user.FactionUser; +import com.prevailpots.hcf.user.GUIManager; +import com.prevailpots.hcf.user.UserManager; +import com.prevailpots.hcf.visualise.ProtocolLibHook; +import com.prevailpots.hcf.visualise.VisualiseHandler; +import com.prevailpots.hcf.visualise.WallBorderListener; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; + +import redis.clients.jedis.Jedis; + +public class HCF extends JavaPlugin { + private static final long MINUTE; + private static final long HOUR; + private static HCF plugin; + + static { + MINUTE = TimeUnit.MINUTES.toMillis(1L); + HOUR = TimeUnit.HOURS.toMillis(1L); + } + private Jedis jedis; + private Random random; + private Message message; + private MongoManager mongoManager; + public EventScheduler eventScheduler; + private HCFHandler hcfHandler; + private WorldEditPlugin worldEdit; + private EconomyManager economyManager; + private ClaimHandler claimHandler; + private BukkitTask saveDataTask; + private KeyManager keyManager; + private DeathbanManager deathbanManager; + private EOTWHandler eotwHandler; + private FactionManager factionManager; + private PvpClassManager pvpClassManager; + private ScoreboardHandler scoreboardHandler; + private TimerManager timerManager; + private UserManager userManager; + private VisualiseHandler visualiseHandler; + public NewEventScheduler newEventScheduler; + private YamlConfiguration reclaimConfig; + private YamlConfiguration reclaimSettingsConfig; + private WorldListener wl; + @Getter + private Kraken tabApi; + @Getter @Setter + private int players; + + public File reclaimFile = new File(this.getDataFolder(), "reclaims.yml"); + public File reclaimSettingsFile = new File(this.getDataFolder(), "reclaimsettings.yml"); + + public static HCF getPlugin() { + return HCF.plugin; + } + + public HCF() { + random = new Random(); + } + + public static String getRemaining(final long millis, final boolean milliseconds) { + return getRemaining(millis, milliseconds, true); + } + + public static String getRemaining(final long duration, final boolean milliseconds, final boolean trail) { + if(milliseconds && duration < HCF.MINUTE) { + return (trail ? DateTimeFormats.REMAINING_SECONDS_TRAILING : DateTimeFormats.REMAINING_SECONDS).get().format(duration * 0.001) + 's'; + } + return DurationFormatUtils.formatDuration(duration, ((duration >= HCF.HOUR) ? "HH:" : "") + "mm:ss"); + } + + public void onEnable() { + HCF.plugin = this; + this.mongoManager = new MongoManager(); + mongoManager.connect(); + if (!new File(getDataFolder(), "config.yml").exists()) { + saveDefaultConfig(); + } + getConfig().options().copyDefaults(true); + try { + jedis = new Jedis("localhost"); + } + catch (Exception e) { + System.out.println("!Not Connected! Plugin not enabling!!!!"); + System.out.println("!!Not Connected! Plugin not enabling!!!"); + System.out.println("!!!Not Connected! Plugin not enabling!!"); + System.out.println("!!!!Not Connected! Plugin not enabling!"); + e.printStackTrace(); + return; + } + CustomEntityRegistration.registerCustomEntities(); + ProtocolLibHook.hook(this); + final Plugin wep = Bukkit.getPluginManager().getPlugin("WorldEdit"); + worldEdit = ((wep instanceof WorldEditPlugin && wep.isEnabled()) ? ((WorldEditPlugin) wep) : null); + try { + if(!reclaimFile.exists()) + reclaimFile.createNewFile(); + if(!reclaimSettingsFile.exists()) { + saveResource("reclaimsettings.yml", false); + } + } catch (Exception e) { + e.printStackTrace(); + } + reclaimConfig = YamlConfiguration.loadConfiguration(reclaimFile); + reclaimSettingsConfig = YamlConfiguration.loadConfiguration(reclaimSettingsFile); + registerConfiguration(); + registerCommands(); + runPrereleaseChecker(this); + registerManagers(); + registerListeners(); + this.tabApi = new Kraken(this); + wl = new WorldListener(this); + Cooldowns.createCooldown("Assassin_item_cooldown"); + Cooldowns.createCooldown("diamond_revive_cooldown"); + Cooldowns.createCooldown("Archer_item_cooldown"); + Cooldowns.createCooldown("alpha_revive_command_cooldown"); + Cooldowns.createCooldown("Archer_item_cooldown1"); + getServer().getMessenger().registerOutgoingPluginChannel(this, "PlayerCount2"); + getServer().getMessenger().registerIncomingPluginChannel(this, "PlayerCount2", wl); + new BukkitRunnable() { + @Override + public void run() { + updatePlayerCount("HCF"); + } + }.runTaskTimerAsynchronously(this, 4L, 4L); + saveDataTask = new SaveDataTask().runTaskTimerAsynchronously(this, 20, 5 * 60 * 20); + new BukkitRunnable() { + public void run() { + saveData(); + } + }.runTaskTimerAsynchronously(this, 5*60*20, 5*60*20); + } + + private void saveData() { + factionManager.saveFactionData(); + newEventScheduler.saveData(); + hcfHandler.saveHCFSettings(); + userManager.saveUserData(); + timerManager.saveTimerData(); + keyManager.saveKeyData(); + } + + private void runPrereleaseChecker(HCF hcf) + { + new BukkitRunnable() { + @Override + public void run() { + new BukkitRunnable() { + @Override + public void run() { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex reload"); + } + }.runTaskTimer(hcf, 0, 20*30); + } + }; + } + + public void onDisable() { + CustomEntityRegistration.unregisterCustomEntities(); + CombatLogListener.removeCombatLoggers(); + + // Fixes error where speed/etc never gets removed and you can use it after reboot without having the kit equipped + for(Player p : Bukkit.getOnlinePlayers()) { + PvpClass equippedClass = pvpClassManager.getEquippedClass(p); + if(equippedClass != null) { + pvpClassManager.setEquippedClass(p, null); + } + } + + saveData(); + scoreboardHandler.clearBoards(); + saveDataTask.cancel(); + SaveDataTask.saveBalanceData(); + mongoManager.getClient().close(); + jedis = null; + HCF.plugin = null; + } + + private void registerConfiguration() { + ConfigurationSerialization.registerClass(RefillBox.class); + ConfigurationSerialization.registerClass(CaptureZone.class); + ConfigurationSerialization.registerClass(Claim.class); + ConfigurationSerialization.registerClass(Subclaim.class); + ConfigurationSerialization.registerClass(Deathban.class); + ConfigurationSerialization.registerClass(ClaimableFaction.class); + ConfigurationSerialization.registerClass(ConquestFaction.class); + ConfigurationSerialization.registerClass(RewardableItemStack.class); + ConfigurationSerialization.registerClass(CapturableFaction.class); + ConfigurationSerialization.registerClass(FactionUser.class); + ConfigurationSerialization.registerClass(KothFaction.class); + ConfigurationSerialization.registerClass(EndPortalFaction.class); + ConfigurationSerialization.registerClass(Faction.class); + ConfigurationSerialization.registerClass(FactionMember.class); + ConfigurationSerialization.registerClass(PlayerFaction.class); + ConfigurationSerialization.registerClass(SpawnFaction.class); + ConfigurationSerialization.registerClass(RoadFaction.NorthRoadFaction.class); + ConfigurationSerialization.registerClass(RoadFaction.EastRoadFaction.class); + ConfigurationSerialization.registerClass(RoadFaction.SouthRoadFaction.class); + ConfigurationSerialization.registerClass(RoadFaction.WestRoadFaction.class); + ConfigurationSerialization.registerClass(GlowstoneFaction.class); + } + + private void registerListeners() { + final PluginManager manager = getServer().getPluginManager(); + manager.registerEvents(new ShopSignListener(this), this); + manager.registerEvents(new DonorOnlyListener(), this); + manager.registerEvents(new ArcherClass(this), this); + manager.registerEvents(new PortalTrapFixListener(), this); + manager.registerEvents(new MOTDListener(), this); + manager.registerEvents(new KeyListener(this), this); + manager.registerEvents(new PexCrashFix(), this); + manager.registerEvents(new WeatherFixListener(), this); + manager.registerEvents(new NoPermissionClickListener(), this); + manager.registerEvents(new ItemFilterListener(this), this); + manager.registerEvents(new AutoSmeltOreListener(), this); + manager.registerEvents(new BlockHitFixListener(), this); + manager.registerEvents(new BlockJumpGlitchFixListener(), this); + manager.registerEvents(new BoatGlitchFixListener(), this); + manager.registerEvents(new BookDeenchantListener(), this); + manager.registerEvents(new BorderListener(), this); + manager.registerEvents(new BottledExpListener(), this); + manager.registerEvents(new ChatListener(this), this); + manager.registerEvents(new ClaimWandListener(this), this); + manager.registerEvents(new CombatLogListener(this), this); + manager.registerEvents(new CoreListener(this), this); + manager.registerEvents(new CrowbarListener(this), this); + manager.registerEvents(new DeathListener(this), this); + manager.registerEvents(new DeathMessageListener(this), this); + manager.registerEvents(new DeathSignListener(this), this); + manager.registerEvents(new ElevatorClass(this), this); + manager.registerEvents(new DeathbanListener(this), this); + manager.registerEvents(new EnchantLimitListener(), this); + manager.registerEvents(new EnderChestRemovalListener(), this); + manager.registerEvents(new EntityLimitListener(), this); + manager.registerEvents(new FlatFileFactionManager(this), this); + manager.registerEvents(new EndListener(), this); + manager.registerEvents(new EotwListener(this), this); + manager.registerEvents(new EventSignListener(), this); + manager.registerEvents(new ExpMultiplierListener(), this); + manager.registerEvents(new TabListener(), this); + manager.registerEvents(new FactionListener(this), this); + manager.registerEvents(new GlowstoneListener(), this); + manager.registerEvents(new FoundDiamondsListener(this), this); + manager.registerEvents(new FurnaceSmeltSpeederListener(), this); + manager.registerEvents(new InfinityArrowFixListener(), this); + manager.registerEvents(new KitListener(this), this); + manager.registerEvents(new ItemStatTrackingListener(), this); + manager.registerEvents(new ServerSecurityListener(), this); + manager.registerEvents(new PhaseListener(), this); + manager.registerEvents(new HungerFixListener(), this); + manager.registerEvents(new PotionLimitListener(), this); + manager.registerEvents(new FactionsCoreListener(this), this); + manager.registerEvents(new SignSubclaimListener(this), this); + manager.registerEvents(new FastSmeltListener(), this); + manager.registerEvents(new SkullListener(), this); + manager.registerEvents(new TabCommand(), this); + manager.registerEvents(new BeaconStrengthFixListener(), this); + manager.registerEvents(new VoidGlitchFixListener(), this); + manager.registerEvents(new WallBorderListener(this), this); + manager.registerEvents(wl = new WorldListener(this), this); + manager.registerEvents(new UnRepairableListener(), this); + manager.registerEvents(new PearlGlitchFixListener(this), this); + manager.registerEvents(new AntiPexCrash(), this); + } + + private void updatePlayerCount(String server) { + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF(server); + out.writeUTF("HCF"); + getServer().sendPluginMessage(this, "PlayerCount2", out.toByteArray()); + } + + private void registerCommands() { + BasePlugin.getPlugin().getCommandManager().registerCommand(new ReclaimCommand(this)); + getCommand("conquest").setExecutor(new ConquestExecutor(this)); + getCommand("coords").setExecutor(new CoordsCommand()); + getCommand("donor").setExecutor(new ToggleDonorOnly()); + getCommand("pay").setExecutor(new PayCommand(this)); + getCommand("economy").setExecutor(new EconomyCommand(this)); + getCommand("toggleend").setExecutor(new ToggleEndCommand(this)); + getCommand("sotw").setExecutor(new SOTWCommand()); + getCommand("random").setExecutor(new RandomCommand(this)); + getCommand("crowbar").setExecutor(new CrowbarCommand()); + getCommand("eotw").setExecutor(new EotwCommand(this)); + getCommand("game").setExecutor(new EventExecutor(this)); + getCommand("glowstone").setExecutor(new GlowstoneExecutor(this)); + getCommand("help").setExecutor(new HelpCommand()); + getCommand("faction").setExecutor(new FactionExecutor(this)); + getCommand("gopple").setExecutor(new GoppleCommand(this)); + getCommand("cobblestone").setExecutor(new CobblestoneCommand()); + getCommand("mobdrops").setExecutor(new MobdropsCommand()); + getCommand("stats").setExecutor(new PlayerStatsCommand()); + getCommand("koth").setExecutor(new KothExecutor(this)); + getCommand("mapkit").setExecutor(new MapKitCommand()); + getCommand("stafflives").setExecutor(new LivesExecutor(this)); + getCommand("lives").setExecutor(new LivesCommand(this)); + getCommand("alpha").setExecutor(new AlphaRevives(this)); + getCommand("location").setExecutor(new LocationCommand(this)); + getCommand("focus").setExecutor(new FocusCommand()); + getCommand("logout").setExecutor(new LogoutCommand(this)); + getCommand("pvptimer").setExecutor(new PvpTimerCommand(this)); + getCommand("refund").setExecutor( new RefundCommand()); + getCommand("list").setExecutor(new ListCommand()); + getCommand("servertime").setExecutor(new ServerTimeCommand()); + getCommand("spawn").setExecutor(new SpawnCommand(this)); + getCommand("timer").setExecutor(new TimerExecutor(this)); + getCommand("setborder").setExecutor(new SetBorderCommand()); + getCommand("key").setExecutor(new LootExecutor(this)); + getCommand("reloadtab").setExecutor(new ReloadTabCommand()); + getCommand("removetab").setExecutor(new RemoveTabCommand()); + getCommand("tab").setExecutor(new TabCommand()); + final Map> map = getDescription().getCommands(); + for(final Map.Entry> entry : map.entrySet()) { + final PluginCommand command = getCommand(entry.getKey()); + command.setPermission("command." + entry.getKey()); + command.setPermissionMessage(ChatColor.RED + "No permission."); + } + } + + private void registerManagers() { + claimHandler = new ClaimHandler(this); + eotwHandler = new EOTWHandler(this); + newEventScheduler = new NewEventScheduler(this); + eventScheduler = new EventScheduler(this); + factionManager = new FlatFileFactionManager(this); + pvpClassManager = new PvpClassManager(this); + timerManager = new TimerManager(this); + scoreboardHandler = new ScoreboardHandler(this); + userManager = new UserManager(this); + visualiseHandler = new VisualiseHandler(); + keyManager = new KeyManager(this); + hcfHandler = new HCFHandler(this); + message = new Message(this); + deathbanManager = new FlatFileDeathbanManager(this); + economyManager = new FlatFileEconomyManager(this); + } + + public EconomyManager getEconomyManager(){ + return economyManager; + } + + + public Message getMessage(){ + return message; + } + + + + public WorldEditPlugin getWorldEdit() { + return worldEdit; + } + + public KeyManager getKeyManager() { + return keyManager; + } + + + public ClaimHandler getClaimHandler() { + return claimHandler; + } + + public DeathbanManager getDeathbanManager() { + return deathbanManager; + } + + + public EOTWHandler getEotwHandler() { + return eotwHandler; + } + + public FactionManager getFactionManager() { + return factionManager; + } + + + public Random getRandom() { + return random; + } + + public PvpClassManager getPvpClassManager() { + return pvpClassManager; + } + + public ScoreboardHandler getScoreboardHandler() { + return scoreboardHandler; + } + + public TimerManager getTimerManager() { + return timerManager; + } + + public UserManager getUserManager() { + return userManager; + } + + public VisualiseHandler getVisualiseHandler() { + return visualiseHandler; + } + + public HCFHandler getHcfHandler(){ + return hcfHandler; + } + + public YamlConfiguration getReclaimConfig() { return reclaimConfig; } + + public YamlConfiguration getReclaimSettingsConfig() { return reclaimSettingsConfig; } + + public Jedis getJedis() { + return jedis; + } + + public MongoManager getMongoManager() { + return mongoManager; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/HCFHandler.java b/PrevailHCF/src/com/prevailpots/hcf/HCFHandler.java new file mode 100644 index 0000000..e1471cd --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/HCFHandler.java @@ -0,0 +1,216 @@ +package com.prevailpots.hcf; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.World; + +import com.customhcf.util.Config; +import com.customhcf.util.PersistableLocation; + +/** + * Created by TREHOME on 03/19/2016. + */ +public class HCFHandler{ + + Config settings; + private Integer worldBorder; + private Integer netherBorder; + private Integer endBorder; + private boolean donorOnly; + private boolean endEnabled; + private PersistableLocation endExit; + private Integer allyLimit; + private Integer factionLimit; + private Integer mapNumber; + private Integer conquestWinPoints; + private Integer spawnRadius; + private Integer warZoneRadius; + private Double archerTagDamage; + private boolean elevatorMinecart; + private boolean elevatorSign; + private String timeZone; + private Long defaultDeathban; + private String donateURL; + HCF plugin; + + + public HCFHandler(HCF plugin){ + this.plugin =plugin; + settings = new Config(plugin, "settings"); + reloadHCFSettings(); + } + + + public void saveHCFSettings(){ + settings.set("conquestWinPoints", conquestWinPoints); + settings.set("mapNumber", mapNumber); + settings.set("allyLimit", allyLimit); + settings.set("timeZone", timeZone); + settings.set("donateURL", donateURL); + settings.set("factionLimit", factionLimit); + settings.set("spawnRadius", spawnRadius); + settings.set("archerTagDamage", archerTagDamage); + settings.set("worldBorder", worldBorder); + settings.set("endBorder", endBorder); + settings.set("netherBorder", netherBorder); + settings.set("warZoneRadius", warZoneRadius); + settings.set("MinecartElevator", elevatorMinecart); + settings.set("elevatorSign", elevatorSign); + settings.set("donorOnly", donorOnly); + settings.set("endEnabled", endEnabled); + settings.set("defaultDeathban", defaultDeathban); + settings.set("endExit", endExit); + settings.save(); + } + + private void reloadHCFSettings() { + settings = new Config(plugin, "settings"); + endExit = (PersistableLocation) settings.get("endExit"); + conquestWinPoints = settings.getInt("conquestWinPoints", 300); + mapNumber = settings.getInt("mapNumber", 1); + allyLimit = settings.getInt("allyLimit", 0); + timeZone = settings.getString("timeZone", "EST"); + factionLimit = settings.getInt("factionLimit", 10); + spawnRadius = settings.getInt("spawnRadius", 128); + warZoneRadius = settings.getInt("warZoneRadius", 800); + elevatorMinecart = settings.getBoolean("MinecartElevator", true); + elevatorSign = settings.getBoolean("SignElevator", true); + endEnabled = settings.getBoolean("endEnabled", true); + donorOnly = settings.getBoolean("donorOnly", false); + worldBorder = settings.getInt("worldBorder", 3000); + netherBorder = settings.getInt("endBorder", 1000); + endBorder = settings.getInt("netherBorder", 3000); + archerTagDamage = settings.getDouble("archerTagDamage", .25); + defaultDeathban = settings.getLong("defaultDeathban", TimeUnit.HOURS.toMillis(2L)); + donateURL = settings.getString("donateURL", donateURL); + } + + public PersistableLocation getEndExit() { + return endExit; + } + + public String getTimeZone() { + return timeZone; + } + + public String getDonateURL(){ + return donateURL; + } + + public Integer getWorldBorder(World.Environment environment) { + if(environment == World.Environment.NORMAL){ + return worldBorder; + } + if(environment == World.Environment.NETHER){ + return netherBorder; + } + if(environment == World.Environment.THE_END){ + return endBorder; + } + return null; + } + + public void setWorldBorder(World.Environment environment, Integer worldBorder) { + if(environment == World.Environment.NORMAL){ + this.worldBorder = worldBorder; + return; + } + if(environment == World.Environment.NETHER){ + this.netherBorder = worldBorder; + return; + } + if(environment == World.Environment.THE_END){ + this.endBorder = worldBorder; + } + } + + + public boolean isElevatorSign() { + return elevatorSign; + } + + public boolean isElevatorMinecart() { + return elevatorMinecart; + } + + public boolean isDonorOnly() { + return donorOnly; + } + + public void setDonorOnly(boolean donorOnly) { + this.donorOnly = donorOnly; + } + public boolean isEndEnabled() { + return endEnabled; + } + + + public void setEndEnabled(boolean endEnabled) { + this.endEnabled = endEnabled; + } + public Integer getWarZoneRadius() { + return warZoneRadius; + } + + public void setWarZoneRadius(Integer warZoneRadius) { + this.warZoneRadius = warZoneRadius; + } + + public Integer getSpawnRadius() { + return spawnRadius; + } + + public void setSpawnRadius(Integer spawnRadius) { + this.spawnRadius = spawnRadius; + } + + + + public Integer getFactionLimit() { + return factionLimit; + } + + public void setFactionLimit(Integer factionLimit) { + this.factionLimit = factionLimit; + } + + public Integer getAllyLimit() { + return allyLimit; + } + + public void setAllyLimit(Integer allyLimit) { + this.allyLimit = allyLimit; + } + + public Integer getMapNumber() { + return mapNumber; + } + + public void setMapNumber(Integer mapNumber) { + this.mapNumber = mapNumber; + } + + public Integer getConquestWinPoints() { + return conquestWinPoints; + } + + public void setConquestWinPoints(Integer conquestWinPoints) { + this.conquestWinPoints = conquestWinPoints; + } + + public Double getArcherTagDamage() { + return archerTagDamage; + } + + public void setArcherTagDamage(Double archerTagDamage) { + this.archerTagDamage = archerTagDamage; + } + + public void setDefaultDeathban(long value){ + this.defaultDeathban = value; + } + + public Long getDefaultDeathban() { + return defaultDeathban; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/Message.java b/PrevailHCF/src/com/prevailpots/hcf/Message.java new file mode 100644 index 0000000..0b470f7 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/Message.java @@ -0,0 +1,47 @@ +package com.prevailpots.hcf; + +import com.customhcf.util.chat.Text; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.UUID; + +/** + * Created by TREHOME on 01/28/2016. + */ +public final class Message { + HCF plugin; + private final HashMap messageDelay = new HashMap<>(); + + + public Message(HCF plugin){ + this.plugin = plugin; + } + + + + public void sendMessage(Player player, String message){ + if(messageDelay.containsKey(player.getUniqueId())){ + if(messageDelay.get(player.getUniqueId()) - System.currentTimeMillis() > 0){ + return; + }else{ + messageDelay.remove(player.getUniqueId()); + } + } + messageDelay.putIfAbsent(player.getUniqueId(), System.currentTimeMillis() + 3000); + player.sendMessage(message); + } + + public void sendMessage(Player player, Text text){ + if(messageDelay.containsKey(player.getUniqueId())){ + if(messageDelay.get(player.getUniqueId()) - System.currentTimeMillis() > 0){ + return; + }else{ + messageDelay.remove(player.getUniqueId()); + } + } + messageDelay.putIfAbsent(player.getUniqueId(), System.currentTimeMillis() + 3000); + text.send(player); + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyCommand.java b/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyCommand.java new file mode 100644 index 0000000..97cbdfb --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyCommand.java @@ -0,0 +1,121 @@ +package com.prevailpots.hcf.balance; + +import com.customhcf.base.Constants; +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.JavaUtils; +import com.google.common.collect.ImmutableList; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class EconomyCommand implements CommandExecutor, TabCompleter { + private static final ImmutableList COMPLETIONS; + private static final ImmutableList GIVE; + private static final ImmutableList TAKE; + + + static { + TAKE = ImmutableList.of("take", "negate", "minus", "subtract"); + GIVE = ImmutableList.of("give", "add"); + COMPLETIONS = ImmutableList.of("add", "set", "take"); + } + + private final HCF plugin; + + public EconomyCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + final boolean hasStaffPermission = sender.hasPermission(command.getPermission() + ".staff"); + OfflinePlayer target; + if(args.length > 0 && hasStaffPermission) { + if(args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("*") && hasStaffPermission){ + Integer amount = Ints.tryParse(args[1]); + for(UUID user : plugin.getUserManager().getUsers().keySet()){ + this.plugin.getEconomyManager().addBalance(user, amount); + } + Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " gave all players " + amount + ""); + return true; + } + target = BukkitUtils.offlinePlayerWithNameOrUUID(args[0]); + } else { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " "); + return true; + } + target = (OfflinePlayer) sender; + } + if(!target.hasPlayedBefore() && !target.isOnline()) { + sender.sendMessage(String.format(Constants.PLAYER_WITH_NAME_OR_UUID_NOT_FOUND, args[0])); + return true; + } + final UUID uuid = target.getUniqueId(); + final int balance = this.plugin.getEconomyManager().getBalance(uuid); + if(args.length < 2 || !hasStaffPermission) { + sender.sendMessage(ChatColor.YELLOW + (sender.equals(target) ? "Your balance" : ("Balance of " + target.getName())) + " is " + ChatColor.GREEN + EconomyManager.ECONOMY_SYMBOL + balance + ChatColor.YELLOW + '.'); + return true; + } + if(GIVE.contains(args[1].toLowerCase())) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + target.getName() + ' ' + args[1] + " "); + return true; + } + final Integer amount = Ints.tryParse(args[2]); + if(amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number."); + return true; + } + final int newBalance = this.plugin.getEconomyManager().addBalance(uuid, amount); + sender.sendMessage(new String[]{ChatColor.YELLOW + "Added " + EconomyManager.ECONOMY_SYMBOL + JavaUtils.format((Number) amount) + " to balance of " + target.getName() + '.', ChatColor.YELLOW + "Balance of " + target.getName() + " is now " + EconomyManager.ECONOMY_SYMBOL + newBalance + '.'}); + return true; + } else if(TAKE.contains(args[1].toLowerCase())) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + target.getName() + ' ' + args[1] + " "); + return true; + } + final Integer amount = Ints.tryParse(args[2]); + if(amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number."); + return true; + } + final int newBalance = this.plugin.getEconomyManager().subtractBalance(uuid, amount); + sender.sendMessage(new String[]{ChatColor.YELLOW + "Taken " + EconomyManager.ECONOMY_SYMBOL + JavaUtils.format((Number) amount) + " from balance of " + target.getName() + '.', ChatColor.YELLOW + "Balance of " + target.getName() + " is now " + EconomyManager.ECONOMY_SYMBOL + newBalance + '.'}); + return true; + } else { + if(!args[1].equalsIgnoreCase("set")) { + sender.sendMessage(ChatColor.GOLD + (sender.equals(target) ? "Your balance" : ("Balance of " + target.getName())) + " is " + ChatColor.YELLOW + EconomyManager.ECONOMY_SYMBOL + balance + ChatColor.GOLD + '.'); + return true; + } + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + target.getName() + ' ' + args[1] + " "); + return true; + } + final Integer amount = Ints.tryParse(args[2]); + if(amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number."); + return true; + } + final int newBalance = this.plugin.getEconomyManager().setBalance(uuid, amount); + sender.sendMessage(ChatColor.YELLOW + "Set balance of " + target.getName() + " to " + EconomyManager.ECONOMY_SYMBOL + JavaUtils.format((Number) newBalance) + '.'); + return true; + } + } + + @Override + public List onTabComplete(CommandSender commandSender, Command command, String s, String[] args) { + return (args.length == 2) ? BukkitUtils.getCompletions(args, COMPLETIONS) : (args.length == 1 ) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyManager.java b/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyManager.java new file mode 100644 index 0000000..f550fd9 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/balance/EconomyManager.java @@ -0,0 +1,23 @@ +package com.prevailpots.hcf.balance; + +import net.minecraft.util.gnu.trove.map.TObjectIntMap; + +import java.util.UUID; + +public interface EconomyManager { + public static final char ECONOMY_SYMBOL = '$'; + + TObjectIntMap getBalanceMap(); + + Integer getBalance(UUID p0); + + Integer setBalance(UUID p0, int p1); + + Integer addBalance(UUID p0, int p1); + + Integer subtractBalance(UUID p0, int p1); + + void reloadEconomyData(); + + void save(); +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/balance/FlatFileEconomyManager.java b/PrevailHCF/src/com/prevailpots/hcf/balance/FlatFileEconomyManager.java new file mode 100644 index 0000000..02d586e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/balance/FlatFileEconomyManager.java @@ -0,0 +1,74 @@ +package com.prevailpots.hcf.balance; + +import com.customhcf.util.Config; +import com.mongodb.DBCursor; +import com.mongodb.DBObject; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.mongo.MongoUser; + +import net.minecraft.util.gnu.trove.map.TObjectIntMap; +import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; + +import java.util.*; + +public class FlatFileEconomyManager implements EconomyManager { + private final HCF plugin; + private TObjectIntMap balanceMap; + private Config balanceConfig; + + public FlatFileEconomyManager(final HCF plugin) { + this.balanceMap = new TObjectIntHashMap(10, 0.5f, 0); + this.plugin = plugin; + this.reloadEconomyData(); + } + + @Override + public TObjectIntMap getBalanceMap() { + return this.balanceMap; + } + + @Override + public Integer getBalance(final UUID uuid) { + balanceMap.putIfAbsent(uuid, 0); + return this.balanceMap.get(uuid); + } + + @Override + public Integer setBalance(final UUID uuid, final int amount) { + this.balanceMap.put(uuid, amount); + return amount; + } + + @Override + public Integer addBalance(final UUID uuid, final int amount) { + return this.setBalance(uuid, this.getBalance(uuid) + amount); + } + + @Override + public Integer subtractBalance(final UUID uuid, final int amount) { + return this.setBalance(uuid, this.getBalance(uuid) - amount); + } + + @Override + public void save(){ + for(UUID entry : balanceMap.keySet()){ + if(entry == null) continue; + MongoUser.updatePlayer(entry, "balance", balanceMap.get(entry)); + } + } + + @Override + public void reloadEconomyData() { + this.balanceMap = new TObjectIntHashMap(10, 0.5f, 0); + DBCursor cursor = plugin.getMongoManager().getPlayers().find(); + while (cursor.hasNext()){ + DBObject next = cursor.next(); + if(next.get("uuid") == null || next.get("balance") == null){ + plugin.getMongoManager().getPlayers().remove(next); + continue; + } + balanceMap.put(((UUID)next.get("uuid")), ((Integer) next.get("balance"))); + } + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/balance/PayCommand.java b/PrevailHCF/src/com/prevailpots/hcf/balance/PayCommand.java new file mode 100644 index 0000000..6b9be83 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/balance/PayCommand.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.balance; + +import com.customhcf.base.Constants; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +public class PayCommand implements CommandExecutor, TabCompleter { + private final HCF plugin; + + public PayCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " "); + return true; + } + final Integer amount = Ints.tryParse(args[1]); + if(amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a valid number."); + return true; + } + if(amount <= 0) { + sender.sendMessage(ChatColor.RED + "You must send money in positive quantities."); + return true; + } + final Player senderPlayer = (Player) sender; + final int senderBalance = (senderPlayer != null) ? this.plugin.getEconomyManager().getBalance(senderPlayer.getUniqueId()) : 1024; + if(senderBalance < amount) { + sender.sendMessage(ChatColor.RED + "You do not have that much money, you have: " + ChatColor.GREEN + senderBalance); + return true; + } + final OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]); + if(sender.equals(target)) { + sender.sendMessage(ChatColor.RED + "You cannot send money to yourself."); + return true; + } + final Player targetPlayer = target.getPlayer(); + if(!target.hasPlayedBefore() && targetPlayer == null) { + sender.sendMessage(String.format(Constants.PLAYER_WITH_NAME_OR_UUID_NOT_FOUND, args[0])); + return true; + } + if(targetPlayer == null) { + return false; + } + if(senderPlayer != null) { + this.plugin.getEconomyManager().subtractBalance(senderPlayer.getUniqueId(), amount); + } + this.plugin.getEconomyManager().addBalance(targetPlayer.getUniqueId(), amount); + targetPlayer.sendMessage(ChatColor.GOLD + sender.getName() + " has sent you " + ChatColor.GOLD + EconomyManager.ECONOMY_SYMBOL + amount + ChatColor.YELLOW + '.'); + sender.sendMessage(ChatColor.YELLOW + "You have sent " + ChatColor.GOLD + EconomyManager.ECONOMY_SYMBOL + amount + ChatColor.YELLOW + " to " + target.getName() + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 1) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/balance/ShopSignListener.java b/PrevailHCF/src/com/prevailpots/hcf/balance/ShopSignListener.java new file mode 100644 index 0000000..cb6ff1a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/balance/ShopSignListener.java @@ -0,0 +1,141 @@ +package com.prevailpots.hcf.balance; + +import com.customhcf.base.BasePlugin; +import com.customhcf.util.ItemBuilder; +import com.google.common.base.Enums; +import com.google.common.base.Optional; +import com.customhcf.util.InventoryUtils; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.crowbar.Crowbar; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.Map; +import java.util.regex.Pattern; + +public class ShopSignListener implements Listener { + private static final long SIGN_TEXT_REVERT_TICKS = 100L; + private static final Pattern ALPHANUMERIC_REMOVER; + + static { + ALPHANUMERIC_REMOVER = Pattern.compile("[^A-Za-z0-9]"); + } + + private final HCF plugin; + + public ShopSignListener(final HCF plugin) { + this.plugin = plugin; + } + + /* + &9- Sell - + amount + item name + $price + */ + /* + &9- Buy - + amount + item name + $price + */ + + @EventHandler(ignoreCancelled = false, priority = EventPriority.HIGH) + public void onPlayerInteract(final PlayerInteractEvent event) { + if(event.getAction() == Action.RIGHT_CLICK_BLOCK) { + final Block block = event.getClickedBlock(); + final BlockState state = block.getState(); + if(state instanceof Sign) { + final Sign sign = (Sign) state; + final String[] lines = sign.getLines(); + final Integer quantity = Ints.tryParse(lines[1]); + if(quantity == null) { + return; + } + final Integer price = Ints.tryParse(ShopSignListener.ALPHANUMERIC_REMOVER.matcher(lines[3]).replaceAll("")); + if(price == null) { + return; + } + + ItemStack stack; + if(lines[2].equalsIgnoreCase("Crowbar")) { + stack = new Crowbar().getItemIfPresent(); + } else if(((stack = BasePlugin.getPlugin().getItemDb().getItem(ShopSignListener.ALPHANUMERIC_REMOVER.matcher(lines[2].replaceAll(" ", "_")).replaceAll(""), (int) quantity)) == null) && !lines[2].contains("s_")) { + return; + } + + final Player player = event.getPlayer(); + + //skeleton zombie spider + if(lines[2].startsWith("s_")) { + String s = lines[2].replace("s_", ""); + final Optional optionalType = Enums.getIfPresent(EntityType.class, s.toUpperCase()); + if (!optionalType.isPresent()) { + player.sendMessage(ChatColor.RED + "Not an entity named '" + s + "'."); + return; + } + player.sendMessage("."); + stack = new ItemBuilder(Material.MOB_SPAWNER).displayName(net.md_5.bungee.api.ChatColor.YELLOW + "Spawner").lore(net.md_5.bungee.api.ChatColor.BLUE + optionalType.get().getName()).build(); + } + + final String[] fakeLines = Arrays.copyOf(sign.getLines(), 4); + if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "- Sell -")) { + final int sellQuantity = Math.min(quantity, InventoryUtils.countAmount((Inventory) player.getInventory(), stack.getType(), stack.getDurability())); + if(sellQuantity <= 0) { + fakeLines[1] = ChatColor.RED + "Not enough"; + fakeLines[3] = ChatColor.RED + "to sell."; + } else { + final int newPrice = price / quantity * sellQuantity; + fakeLines[0] = "Sold " + ChatColor.GREEN + sellQuantity; + fakeLines[1] = BasePlugin.getPlugin().getItemDb().getName(stack); + fakeLines[2] = ChatColor.GREEN + "for " + EconomyManager.ECONOMY_SYMBOL + newPrice; + fakeLines[3] = "New Balance: " + ChatColor.GREEN + plugin.getEconomyManager().getBalance(player.getUniqueId()); + this.plugin.getEconomyManager().addBalance(player.getUniqueId(), newPrice); + InventoryUtils.removeItem((Inventory) player.getInventory(), stack.getType(), (short) stack.getData().getData(), sellQuantity); + player.updateInventory(); + } + } else { + if(!lines[0].contains("- Buy -")) { + return; + } + if(price > this.plugin.getEconomyManager().getBalance(player.getUniqueId())) { + fakeLines[0] = ChatColor.RED + "Insufficient"; + fakeLines[1] = ChatColor.RED + "Funds for"; + } else { + + fakeLines[0] = ChatColor.GREEN + "Bought"; + fakeLines[3] = ChatColor.GREEN + "for " + EconomyManager.ECONOMY_SYMBOL + price; + this.plugin.getEconomyManager().subtractBalance(player.getUniqueId(), price); + final World world = player.getWorld(); + final Location location = player.getLocation(); + final Map excess = (Map) player.getInventory().addItem(new ItemStack[]{stack}); + + for(final Map.Entry excessItemStack : excess.entrySet()) { + world.dropItemNaturally(location, (ItemStack) excessItemStack.getValue()); + } + player.setItemInHand(player.getItemInHand()); + } + } + event.setCancelled(true); + BasePlugin.getPlugin().getSignHandler().showLines(player, sign, fakeLines, SIGN_TEXT_REVERT_TICKS, true); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/ClassType.java b/PrevailHCF/src/com/prevailpots/hcf/classes/ClassType.java new file mode 100644 index 0000000..38a4c86 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/ClassType.java @@ -0,0 +1,33 @@ +package com.prevailpots.hcf.classes; + +import com.prevailpots.hcf.HCF; + +/** + * Created by TREHOME on 03/18/2016. + */ +public enum ClassType { + + ARCHER("Archer", HCF.getPlugin().getConfig().getBoolean("classes.archer.enabled")), + BARD("Bard", HCF.getPlugin().getConfig().getBoolean("classes.bard.enabled")), + ASSASSIN("Assassin", HCF.getPlugin().getConfig().getBoolean("classes.assassin.enabled")), + ROUGE("Rouge", HCF.getPlugin().getConfig().getBoolean("classes.rouge.enabled")), + MINER("Miner", HCF.getPlugin().getConfig().getBoolean("classes.miner.enabled")); + + private final String name; + private final boolean enabled; + + ClassType(String name, boolean enabled){ + this.name = name; + this.enabled = enabled; + } + + public boolean isEnabled(){ + return enabled; + } + + public String getName() { + return name; + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClass.java new file mode 100644 index 0000000..5ae0796 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClass.java @@ -0,0 +1,59 @@ +package com.prevailpots.hcf.classes; + +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; + +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +public abstract class PvpClass { + public static final long DEFAULT_MAX_DURATION; + + static { + DEFAULT_MAX_DURATION = TimeUnit.MINUTES.toMillis(8L); + } + + protected final Set passiveEffects; + protected final String name; + protected final ClassType classType; + + public PvpClass(final ClassType classType) { + this.passiveEffects = new HashSet<>(); + this.classType = classType; + this.name = classType.getName(); + } + + public String getName() { + return this.name; + } + + public ClassType getClassType(){ + return classType; + } + + public boolean onEquip(final Player player) { + for(final PotionEffect effect : this.passiveEffects) { + if (effect == null) continue; + try { + player.addPotionEffect(effect, true); + } catch (NullPointerException e) { + continue; + } + } + return true; + } + + public void onUnequip(final Player player) { + for(final PotionEffect effect : this.passiveEffects) { + for(final PotionEffect active : player.getActivePotionEffects()) { + if(active.getDuration() > PvpClass.DEFAULT_MAX_DURATION && active.getType().equals( effect.getType()) && active.getAmplifier() == effect.getAmplifier()) { + player.removePotionEffect(effect.getType()); + break; + } + } + } + } + + public abstract boolean isApplicableFor(final Player p0); +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClassManager.java b/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClassManager.java new file mode 100644 index 0000000..fdb690a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/PvpClassManager.java @@ -0,0 +1,113 @@ +package com.prevailpots.hcf.classes; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.event.PvpClassEquipEvent; +import com.prevailpots.hcf.classes.event.PvpClassUnequipEvent; +import com.prevailpots.hcf.classes.listener.AttemptEquip; +import com.prevailpots.hcf.classes.type.archer.ArcherClass; +import com.prevailpots.hcf.classes.type.bard.BardClass; +import com.prevailpots.hcf.classes.type.chain.AssassinClass; +import com.prevailpots.hcf.classes.type.chain.RogueClass; +import com.prevailpots.hcf.classes.type.miner.MinerClass; + +import javax.annotation.Nullable; +import java.util.*; + +public class PvpClassManager { + private final Map equippedClass; + private final Set pvpClasses; + private AssassinClass assassinClass; + private BardClass bardClass; + private MinerClass minerClass; + private RogueClass rogueClass; + private ArcherClass archerClass; + + + + public PvpClassManager(final HCF plugin) { + equippedClass = new HashMap<>(); + pvpClasses = new HashSet<>(); + pvpClasses.add(assassinClass = new AssassinClass(plugin)); + pvpClasses.add(rogueClass = new RogueClass(plugin)); + pvpClasses.add(archerClass = new ArcherClass(plugin)); + pvpClasses.add(bardClass = new BardClass(plugin)); + pvpClasses.add(minerClass = new MinerClass(plugin)); + if(!assassinClass.getClassType().isEnabled()){ + pvpClasses.remove(assassinClass); + } + if(!rogueClass.getClassType().isEnabled()){ + pvpClasses.remove(rogueClass); + } + if(!archerClass.getClassType().isEnabled()){ + pvpClasses.remove(archerClass); + } + if(!bardClass.getClassType().isEnabled()){ + pvpClasses.remove(bardClass); + } + if(!minerClass.getClassType().isEnabled()){ + pvpClasses.remove(minerClass); + } + plugin.getServer().getPluginManager().registerEvents(new AttemptEquip(plugin), plugin); + for(final PvpClass pvpClass : this.pvpClasses) { + if(pvpClass instanceof Listener) { + plugin.getServer().getPluginManager().registerEvents((Listener) pvpClass, plugin); + } + } + } + + public void onDisable() { + for(final Map.Entry entry : new HashMap<>(this.equippedClass).entrySet()) { + this.setEquippedClass(Bukkit.getPlayer(entry.getKey()), null); + } + this.pvpClasses.clear(); + this.equippedClass.clear(); + } + + public Collection getPvpClasses() { + return this.pvpClasses; + } + + public PvpClass getPvpClass(final String name) { + for(PvpClass cheat : pvpClasses){ + if(cheat.getName().equals(name)){ + return cheat; + } + } + return null; + } + + public PvpClass getEquippedClass(final Player player) { + synchronized(this.equippedClass) { + return this.equippedClass.get(player.getUniqueId()); + } + } + + + + public boolean hasClassEquipped(final Player player, final PvpClass pvpClass) { + final PvpClass equipped = this.getEquippedClass(player); + return equipped != null && equipped.equals(pvpClass); + } + + public void setEquippedClass(final Player player, @Nullable final PvpClass pvpClass) { + final PvpClass equipped = this.getEquippedClass(player); + if(equipped != null) { + if(pvpClass == null) { + this.equippedClass.remove(player.getUniqueId()); + equipped.onUnequip(player); + Bukkit.getPluginManager().callEvent( new PvpClassUnequipEvent(player, equipped)); + return; + } + } else if(pvpClass == null) { + return; + } + if(pvpClass.onEquip(player)) { + this.equippedClass.put(player.getUniqueId(), pvpClass); + Bukkit.getPluginManager().callEvent(new PvpClassEquipEvent(player, pvpClass)); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.java b/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.java new file mode 100644 index 0000000..d6cdab4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassEquipEvent.java @@ -0,0 +1,34 @@ +package com.prevailpots.hcf.classes.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +import com.prevailpots.hcf.classes.PvpClass; + +public class PvpClassEquipEvent extends PlayerEvent { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final PvpClass pvpClass; + + public PvpClassEquipEvent(final Player player, final PvpClass pvpClass) { + super(player); + this.pvpClass = pvpClass; + } + + public static HandlerList getHandlerList() { + return PvpClassEquipEvent.handlers; + } + + public PvpClass getPvpClass() { + return this.pvpClass; + } + + public HandlerList getHandlers() { + return PvpClassEquipEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.java b/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.java new file mode 100644 index 0000000..567f8c4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/event/PvpClassUnequipEvent.java @@ -0,0 +1,34 @@ +package com.prevailpots.hcf.classes.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +import com.prevailpots.hcf.classes.PvpClass; + +public class PvpClassUnequipEvent extends PlayerEvent { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final PvpClass pvpClass; + + public PvpClassUnequipEvent(final Player player, final PvpClass pvpClass) { + super(player); + this.pvpClass = pvpClass; + } + + public static HandlerList getHandlerList() { + return PvpClassUnequipEvent.handlers; + } + + public PvpClass getPvpClass() { + return this.pvpClass; + } + + public HandlerList getHandlers() { + return PvpClassUnequipEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/listener/AttemptEquip.java b/PrevailHCF/src/com/prevailpots/hcf/classes/listener/AttemptEquip.java new file mode 100644 index 0000000..6fde6b3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/listener/AttemptEquip.java @@ -0,0 +1,78 @@ +package com.prevailpots.hcf.classes.listener; + +import org.bukkit.ChatColor; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.EquipmentSetEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.PvpClass; +import com.prevailpots.hcf.classes.event.PvpClassEquipEvent; +import com.prevailpots.hcf.classes.event.PvpClassUnequipEvent; + +import java.util.Collection; + +/** + * Created by TREHOME on 03/29/2016. + */ +public class AttemptEquip implements Listener { + + HCF plugin; + public AttemptEquip(HCF plugin){ + this.plugin = plugin; + } + + @EventHandler + public void onEquip(PvpClassEquipEvent e){ + e.getPlayer().sendMessage(ChatColor.YELLOW + "Class " + ChatColor.DARK_GREEN + e.getPvpClass().getName() + ChatColor.YELLOW + " has been "+ ChatColor.GREEN +"enabled"+ChatColor.YELLOW+"."); + return; + } + @EventHandler + public void onEquip(PvpClassUnequipEvent e){ + e.getPlayer().sendMessage(ChatColor.YELLOW + "Class " + ChatColor.DARK_GREEN + e.getPvpClass().getName() + ChatColor.YELLOW + " has been "+ ChatColor.RED +"disabled"+ChatColor.YELLOW+"."); + return; + } + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onEquipmentSet(final EquipmentSetEvent event) { + final HumanEntity humanEntity = event.getHumanEntity(); + if(humanEntity instanceof Player) { + this.attemptEquip((Player) humanEntity); + } + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerKick(final PlayerQuitEvent event) { + this.plugin.getPvpClassManager().setEquippedClass(event.getPlayer(), null); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerJoin(final PlayerJoinEvent event) { + this.attemptEquip(event.getPlayer()); + } + + + private void attemptEquip(final Player player) { + final PvpClass equipped = this.plugin.getPvpClassManager().getEquippedClass(player); + if(equipped != null) { + if(equipped.isApplicableFor(player)) { + return; + } + this.plugin.getPvpClassManager().setEquippedClass(player, null); + } + + final Collection pvpClasses = this.plugin.getPvpClassManager().getPvpClasses(); + for(final PvpClass pvpClass : pvpClasses) { + if(pvpClass.isApplicableFor(player)) { + this.plugin.getPvpClassManager().setEquippedClass(player, pvpClass); + break; + } + } + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/archer/ArcherClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/archer/ArcherClass.java new file mode 100644 index 0000000..bc99fe3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/archer/ArcherClass.java @@ -0,0 +1,169 @@ +package com.prevailpots.hcf.classes.type.archer; + +import net.minecraft.util.gnu.trove.map.TObjectLongMap; +import net.minecraft.util.gnu.trove.map.hash.TObjectLongHashMap; +import org.bukkit.*; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.projectiles.ProjectileSource; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import com.google.common.collect.Sets; +import com.prevailpots.hcf.Cooldowns; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.ClassType; +import com.prevailpots.hcf.classes.PvpClass; + +import java.util.HashMap; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class ArcherClass extends PvpClass implements Listener { + public static final HashMap TAGGED = new HashMap<>(); + private static final PotionEffect ARCHER_SPEED_EFFECT; + private static final PotionEffect ARCHER_JUMP_EFFECT; + private static final int ARCHER_SPEED_COOLDOWN_DELAY; + + static { + ARCHER_JUMP_EFFECT = new PotionEffect(PotionEffectType.SPEED, 9*20, 5); + ARCHER_SPEED_EFFECT = new PotionEffect(PotionEffectType.SPEED, 9*20, 3); + ARCHER_SPEED_COOLDOWN_DELAY = 30; + } + + private final TObjectLongMap archerSpeedCooldowns; + private final HCF plugin; + + public ArcherClass(final HCF plugin) { + super(ClassType.ARCHER); + this.archerSpeedCooldowns = new TObjectLongHashMap(); + this.plugin = plugin; + this.passiveEffects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 0)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2)); + } + @Override + public boolean onEquip(Player player){ + if(!super.onEquip(player)) { + return false; + } + return true; + } + + + @EventHandler + public void onPlayerClickFeather(PlayerInteractEvent e) { + Player p = (Player) e.getPlayer(); + if(plugin.getPvpClassManager().getEquippedClass(p) != null && plugin.getPvpClassManager().getEquippedClass(p).equals(this)) { + if(p.getItemInHand().getType() == Material.FEATHER) { + if(Cooldowns.isOnCooldown("Archer_item_cooldown1", p)) { + p.sendMessage(ChatColor.RED + "You cannot use this for another " + ChatColor.BOLD.toString() + HCF.getRemaining(Cooldowns.getCooldownForPlayerLong("Archer_item_cooldown1", p), true) + ChatColor.RED + '.'); + e.setCancelled(true); + return; + } + Cooldowns.addCooldown("Archer_item_cooldown1", p, ARCHER_SPEED_COOLDOWN_DELAY); + if(p.getItemInHand().getAmount() == 1) { + p.getInventory().remove(p.getItemInHand()); + } else { + p.getItemInHand().setAmount(p.getItemInHand().getAmount() - 1); + } + p.addPotionEffect(ARCHER_JUMP_EFFECT); + } + } + } + @EventHandler + public void onPlayerClickSugar(PlayerInteractEvent e) { + Player p = (Player) e.getPlayer(); + if(plugin.getPvpClassManager().getEquippedClass(p) != null && plugin.getPvpClassManager().getEquippedClass(p).equals(this)) { + if(p.getItemInHand().getType() == Material.SUGAR) { + if(Cooldowns.isOnCooldown("Archer_item_cooldown", p)) { + p.sendMessage(ChatColor.RED + "You cannot use this for another " + ChatColor.BOLD.toString() + HCF.getRemaining(Cooldowns.getCooldownForPlayerLong("Archer_item_cooldown", p), true) + ChatColor.RED + '.'); + e.setCancelled(true); + return; + } + Cooldowns.addCooldown("Archer_item_cooldown", p, ARCHER_SPEED_COOLDOWN_DELAY); + if(p.getItemInHand().getAmount() == 1) { + p.getInventory().remove(p.getItemInHand()); + } else { + p.getItemInHand().setAmount(p.getItemInHand().getAmount() - 1); + } + p.removePotionEffect(PotionEffectType.SPEED); + p.addPotionEffect(ARCHER_SPEED_EFFECT); + BukkitTask task = new BukkitRunnable() { + @Override + public void run() { + if(isApplicableFor(p)) { + p.removePotionEffect(PotionEffectType.SPEED); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2)); + } + } + }.runTaskLater(plugin, 9 * 20); + } + } + } + @EventHandler + public void onQuit(PlayerQuitEvent e){ + if(TAGGED.containsKey(e.getPlayer().getUniqueId())){ + TAGGED.remove(e.getPlayer().getUniqueId()); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onEntityDamage(final EntityDamageByEntityEvent event) { + final Entity entity = event.getEntity(); + final Entity damager = event.getDamager(); + if (entity instanceof Player && damager instanceof Arrow) { + final Arrow arrow = (Arrow) damager; + final ProjectileSource source = arrow.getShooter(); + if (source instanceof Player) { + Player damaged = (Player) event.getEntity(); + final Player shooter = (Player) source; + final PvpClass equipped = this.plugin.getPvpClassManager().getEquippedClass(shooter); + if (equipped == null || !equipped.equals(this)) { + return; + } + + if (plugin.getTimerManager().archerTimer.getRemaining((Player) entity) == 0 || plugin.getTimerManager().archerTimer.getRemaining((Player) entity) < TimeUnit.SECONDS.toMillis(5)) { + if(plugin.getPvpClassManager().getEquippedClass(damaged) != null && plugin.getPvpClassManager().getEquippedClass(damaged).equals(this)) return; + plugin.getTimerManager().archerTimer.setCooldown((Player) entity, entity.getUniqueId()); + TAGGED.put(damaged.getUniqueId(), shooter.getUniqueId()); + for(Player player : Bukkit.getOnlinePlayers()){ + plugin.getScoreboardHandler().getPlayerBoard(player.getUniqueId()).addUpdates(Sets.newHashSet(Bukkit.getOnlinePlayers())); + } + shooter.sendMessage(ChatColor.YELLOW + "You marked " + ChatColor.GOLD + damaged.getName() + " for 10 seconds " + ChatColor.GRAY + "[Damage: " +ChatColor.RED + event.getDamage()+ChatColor.GRAY + "]"); + damaged.sendMessage(ChatColor.GOLD + "Archer Tagged! " + ChatColor.YELLOW + "You have been Archer Tagged, any damage you take by a player will be increased by 25%"); + } + } + } + } + + @Override + public boolean isApplicableFor(final Player player) { + final PlayerInventory playerInventory = player.getInventory(); + final ItemStack helmet = playerInventory.getHelmet(); + if(helmet == null || helmet.getType() != Material.LEATHER_HELMET) { + return false; + } + final ItemStack chestplate = playerInventory.getChestplate(); + if(chestplate == null || chestplate.getType() != Material.LEATHER_CHESTPLATE) { + return false; + } + final ItemStack leggings = playerInventory.getLeggings(); + if(leggings == null || leggings.getType() != Material.LEATHER_LEGGINGS) { + return false; + } + final ItemStack boots = playerInventory.getBoots(); + return boots != null && boots.getType() == Material.LEATHER_BOOTS; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardClass.java new file mode 100644 index 0000000..046f3f2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardClass.java @@ -0,0 +1,295 @@ +package com.prevailpots.hcf.classes.type.bard; + +import com.customhcf.util.chat.Lang; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.ClassType; +import com.prevailpots.hcf.classes.PvpClass; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import net.minecraft.util.gnu.trove.map.TObjectLongMap; +import net.minecraft.util.gnu.trove.map.hash.TObjectLongHashMap; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.Collection; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class BardClass extends PvpClass implements Listener { + public static final int HELD_EFFECT_DURATION_TICKS = 100; + private static final long BUFF_COOLDOWN_MILLIS; + private static final int TEAMMATE_NEARBY_RADIUS = 25; + private static final long HELD_REAPPLY_TICKS = 20L; + + static { + BUFF_COOLDOWN_MILLIS = TimeUnit.SECONDS.toMillis(8L); + } + + private final Map bardDataMap; + private final Map bardEffects; + private final BardRestorer bardRestorer; + private final HCF plugin; + private final TObjectLongMap msgCooldowns; + + public BardClass(final HCF plugin) { + super(ClassType.BARD); + this.bardDataMap = new HashMap<>(); + this.bardEffects = new EnumMap<>(Material.class); + this.msgCooldowns = new TObjectLongHashMap(); + this.plugin = plugin; + this.bardRestorer = new BardRestorer(plugin); + this.passiveEffects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 0)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1)); + this.bardEffects.put(Material.SUGAR, new BardEffect(35, new PotionEffect(PotionEffectType.SPEED, 120, 2), new PotionEffect(PotionEffectType.SPEED, HELD_EFFECT_DURATION_TICKS, 1))); + this.bardEffects.put(Material.BLAZE_POWDER, new BardEffect(45, new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 120, 1), new PotionEffect(PotionEffectType.INCREASE_DAMAGE, HELD_EFFECT_DURATION_TICKS, 0))); + this.bardEffects.put(Material.IRON_INGOT, new BardEffect(35, new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 80, 2), new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, HELD_EFFECT_DURATION_TICKS, 0))); + this.bardEffects.put(Material.GHAST_TEAR, new BardEffect(30, new PotionEffect(PotionEffectType.REGENERATION, 60, 2), new PotionEffect(PotionEffectType.REGENERATION, HELD_EFFECT_DURATION_TICKS, 0))); + this.bardEffects.put(Material.FEATHER, new BardEffect(40, new PotionEffect(PotionEffectType.JUMP, 120, 7), new PotionEffect(PotionEffectType.JUMP, HELD_EFFECT_DURATION_TICKS, 3))); + this.bardEffects.put(Material.SPIDER_EYE, new BardEffect(55, new PotionEffect(PotionEffectType.WITHER, 100, 1), null)); + this.bardEffects.put(Material.MAGMA_CREAM, new BardEffect(10, new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 45*20, 0), new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 120, 0))); + } + + @Override + public boolean onEquip(final Player player) { + if(!super.onEquip(player)) { + return false; + } + final BardData bardData = new BardData(); + this.bardDataMap.put(player.getUniqueId(), bardData); + bardData.startEnergyTracking(); + bardData.heldTask = new BukkitRunnable() { + int lastEnergy; + public void run() { + final ItemStack held = player.getItemInHand(); + if(held != null) { + final BardEffect bardEffect = BardClass.this.bardEffects.get(held.getType()); + if(bardEffect != null && !BardClass.this.plugin.getFactionManager().getFactionAt(player.getLocation()).isSafezone()) { + final PlayerFaction playerFaction = BardClass.this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction != null) { + final Collection nearbyEntities = player.getNearbyEntities(TEAMMATE_NEARBY_RADIUS, TEAMMATE_NEARBY_RADIUS, TEAMMATE_NEARBY_RADIUS); + for(final Entity nearby : nearbyEntities) { + if(nearby instanceof Player && !player.equals(nearby)) { + final Player target = (Player) nearby; + if(!playerFaction.getMembers().containsKey(target.getUniqueId())) { + continue; + } + BardClass.this.bardRestorer.setRestoreEffect(target, bardEffect.heldable); + } + } + } + } + } + final int energy = (int) BardClass.this.getEnergy(player); + if(energy != 0 && energy != this.lastEnergy && (energy % 10 == 0 || this.lastEnergy - energy - 1 > 0 || energy == 100.0)) { + this.lastEnergy = energy; + player.sendMessage(ChatColor.YELLOW + BardClass.this.name + " Energy: " + ChatColor.GOLD + energy); + } + } + }.runTaskTimer( this.plugin, 0L, HELD_REAPPLY_TICKS); + return true; + } + + @Override + public void onUnequip(final Player player) { + super.onUnequip(player); + this.clearBardData(player.getUniqueId()); + } + + private void clearBardData(final UUID uuid) { + final BardData bardData = this.bardDataMap.remove(uuid); + if(bardData != null && bardData.heldTask != null) { + bardData.heldTask.cancel(); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerQuit(final PlayerQuitEvent event) { + this.clearBardData(event.getPlayer().getUniqueId()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerKick(final PlayerKickEvent event) { + this.clearBardData(event.getPlayer().getUniqueId()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onItemHeld(final PlayerItemHeldEvent event) { + final Player player = event.getPlayer(); + final PvpClass equipped = this.plugin.getPvpClassManager().getEquippedClass(player); + if(equipped == null || !equipped.equals(this)) { + return; + } + final UUID uuid = player.getUniqueId(); + final long lastMessage = this.msgCooldowns.get( uuid); + final long millis = System.currentTimeMillis(); + if(lastMessage != this.msgCooldowns.getNoEntryValue() && lastMessage - millis > 0L) { + return; + } + final ItemStack newStack = player.getInventory().getItem(event.getNewSlot()); + if(newStack != null) { + final BardEffect bardEffect = this.bardEffects.get(newStack.getType()); + if(bardEffect != null) { + this.msgCooldowns.put(uuid, millis + 1500L); + player.sendMessage(ChatColor.YELLOW + "Bard Effect: "); + player.sendMessage(ChatColor.GOLD + " \u2022" + ChatColor.YELLOW + " Clickable Effect: " + ChatColor.GOLD + Lang.fromPotionEffectType(bardEffect.clickable.getType()) + ' ' + (bardEffect.clickable.getAmplifier() + 1) + ChatColor.YELLOW + " (" + bardEffect.clickable.getDuration() / 20 + "s)"); + player.sendMessage(ChatColor.GOLD + " \u2022"+ ChatColor.YELLOW + " Energy Cost: " + ChatColor.GOLD + bardEffect.energyCost); + } + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR) + public void onPlayerInteract(final PlayerInteractEvent event) { + if(!event.hasItem()) { + return; + } + final Action action = event.getAction(); + if(action == Action.RIGHT_CLICK_AIR || (!event.isCancelled() && action == Action.RIGHT_CLICK_BLOCK)) { + final ItemStack stack = event.getItem(); + final BardEffect bardEffect = this.bardEffects.get(stack.getType()); + if(bardEffect == null || bardEffect.clickable == null) { + return; + } + event.setUseItemInHand(Event.Result.DENY); + final Player player = event.getPlayer(); + final BardData bardData = this.bardDataMap.get(player.getUniqueId()); + if(bardData != null) { + if(!this.canUseBardEffect(player, bardData, bardEffect, true)) { + return; + } + if(stack.getAmount() > 1) { + stack.setAmount(stack.getAmount() - 1); + } else { + player.setItemInHand(new ItemStack(Material.AIR, 1)); + } + if(!BardClass.this.plugin.getFactionManager().getFactionAt(player.getLocation()).isSafezone()) { + final PlayerFaction playerFaction = BardClass.this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction != null && !bardEffect.clickable.getType().equals(PotionEffectType.WITHER)) { + final Collection nearbyEntities = player.getNearbyEntities(25.0, 25.0, 25.0); + for(final Entity nearby : nearbyEntities) { + if(nearby instanceof Player && !player.equals(nearby)) { + final Player target = (Player) nearby; + + if(!playerFaction.getMembers().containsKey(target.getUniqueId())) { + continue; + } + BardClass.this.bardRestorer.setRestoreEffect(target, bardEffect.clickable); + } + } + }else if(playerFaction != null && bardEffect.clickable.getType().equals(PotionEffectType.WITHER) ){ + final Collection nearbyEntities = player.getNearbyEntities(25.0, 25.0, 25.0); + for(final Entity nearby : nearbyEntities) { + if(nearby instanceof Player && !player.equals(nearby)) { + final Player target = (Player) nearby; + if(playerFaction.getMembers().containsKey(target.getUniqueId())) { + continue; + } + BardClass.this.bardRestorer.setRestoreEffect(target, bardEffect.clickable); + } + } + }else if(bardEffect.clickable.getType().equals(PotionEffectType.WITHER)){ + final Collection nearbyEntities = player.getNearbyEntities(25.0, 25.0, 25.0); + for(final Entity nearby : nearbyEntities) { + if(nearby instanceof Player && !player.equals(nearby)) { + final Player target = (Player) nearby; + BardClass.this.bardRestorer.setRestoreEffect(target, bardEffect.clickable); + } + } + } + } + this.bardRestorer.setRestoreEffect(player, bardEffect.clickable); + final double newEnergy = this.setEnergy(player, bardData.getEnergy() - bardEffect.energyCost); + bardData.buffCooldown = System.currentTimeMillis() + BardClass.BUFF_COOLDOWN_MILLIS; + plugin.getTimerManager().spawnTagTimer.setCooldown(player, player.getUniqueId(), TimeUnit.SECONDS.toMillis(30), true); + player.sendMessage(ChatColor.YELLOW + "You have just used " + this.name + " buff " + ChatColor.GOLD + Lang.fromPotionEffectType(bardEffect.clickable.getType()) + ' ' + (bardEffect.clickable.getAmplifier() + 1) + ChatColor.YELLOW + " costing you " + ChatColor.GOLD + bardEffect.energyCost + ChatColor.YELLOW + " energy. " + "Your energy is now " + ChatColor.GOLD + newEnergy * 10.0 / 10.0 + ChatColor.YELLOW + '.'); + } + } + } + + private boolean canUseBardEffect(final Player player, final BardData bardData, final BardEffect bardEffect, final boolean sendFeedback) { + String errorFeedback = null; + final double currentEnergy = bardData.getEnergy(); + if(bardEffect.energyCost > currentEnergy) { + errorFeedback = ChatColor.RED + "You need at least " + ChatColor.BOLD + bardEffect.energyCost + ChatColor.RED + " energy to use this Bard buff, whilst you only have " + ChatColor.BOLD + currentEnergy + ChatColor.RED + '.'; + } + final long remaining = bardData.getRemainingBuffDelay(); + if(remaining > 0L) { + errorFeedback = ChatColor.RED + "You still have a cooldown on this "+ChatColor.GREEN + ChatColor.BOLD + "Bard"+ ChatColor.RED+" buff for another " + HCF.getRemaining(remaining, true, false) + ChatColor.RED + '.'; + } + final Faction factionAt = this.plugin.getFactionManager().getFactionAt(player.getLocation()); + if(factionAt.isSafezone()) { + errorFeedback = ChatColor.RED + "You may not use Bard Effect in safe-zones."; + } + if(sendFeedback && errorFeedback != null) { + player.sendMessage(errorFeedback); + } + return errorFeedback == null; + } + + @Override + public boolean isApplicableFor(final Player player) { + final ItemStack helmet = player.getInventory().getHelmet(); + if(helmet == null || helmet.getType() != Material.GOLD_HELMET) { + return false; + } + final ItemStack chestplate = player.getInventory().getChestplate(); + if(chestplate == null || chestplate.getType() != Material.GOLD_CHESTPLATE) { + return false; + } + final ItemStack leggings = player.getInventory().getLeggings(); + if(leggings == null || leggings.getType() != Material.GOLD_LEGGINGS) { + return false; + } + final ItemStack boots = player.getInventory().getBoots(); + return boots != null && boots.getType() == Material.GOLD_BOOTS; + } + + public long getRemainingBuffDelay(final Player player) { + synchronized(this.bardDataMap) { + final BardData bardData = this.bardDataMap.get(player.getUniqueId()); + return (bardData == null) ? 0L : bardData.getRemainingBuffDelay(); + } + } + + public double getEnergy(final Player player) { + synchronized(this.bardDataMap) { + final BardData bardData = this.bardDataMap.get(player.getUniqueId()); + return (bardData == null) ? 0.0 : bardData.getEnergy(); + } + } + + public long getEnergyMillis(final Player player) { + synchronized(this.bardDataMap) { + final BardData bardData = this.bardDataMap.get(player.getUniqueId()); + return (bardData == null) ? 0L : bardData.getEnergyMillis(); + } + } + + public double setEnergy(final Player player, final double energy) { + final BardData bardData = this.bardDataMap.get(player.getUniqueId()); + if(bardData == null) { + return 0.0; + } + bardData.setEnergy(energy); + return bardData.getEnergy(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardData.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardData.java new file mode 100644 index 0000000..2e94b19 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardData.java @@ -0,0 +1,40 @@ +package com.prevailpots.hcf.classes.type.bard; + +import com.google.common.base.Preconditions; +import org.bukkit.scheduler.BukkitTask; + +public class BardData { + public static final double MIN_ENERGY = 0.0; + public static final double MAX_ENERGY = 120.0; + public static final long MAX_ENERGY_MILLIS = 120000L; + private static final double ENERGY_PER_MILLISECOND = 1.25; + public long buffCooldown; + public BukkitTask heldTask; + private long energyStart; + + public long getRemainingBuffDelay() { + return this.buffCooldown - System.currentTimeMillis(); + } + + public void startEnergyTracking() { + this.setEnergy(0.0); + } + + public long getEnergyMillis() { + if(this.energyStart == 0L) { + return 0L; + } + return Math.min(MAX_ENERGY_MILLIS, (long) (ENERGY_PER_MILLISECOND * (System.currentTimeMillis() - this.energyStart))); + } + + public double getEnergy() { + final double value = this.getEnergyMillis() / 1000.0; + return Math.round(value * 10.0) / 10.0; + } + + public void setEnergy(final double energy) { + Preconditions.checkArgument(energy >= MIN_ENERGY, (Object) "Energy cannot be less than 0.0"); + Preconditions.checkArgument(energy <= MAX_ENERGY, (Object) "Energy cannot be more than 120.0"); + this.energyStart = (long) (System.currentTimeMillis() - 1000.0 * energy); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardEffect.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardEffect.java new file mode 100644 index 0000000..9db70c7 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardEffect.java @@ -0,0 +1,16 @@ +package com.prevailpots.hcf.classes.type.bard; + +import org.bukkit.potion.PotionEffect; + +public class BardEffect { + public final int energyCost; + public final PotionEffect clickable; + public final PotionEffect heldable; + + + public BardEffect(final int energyCost, final PotionEffect clickable, final PotionEffect heldable) { + this.energyCost = energyCost; + this.clickable = clickable; + this.heldable = heldable; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardRestorer.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardRestorer.java new file mode 100644 index 0000000..8c9b9f0 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/bard/BardRestorer.java @@ -0,0 +1,69 @@ +package com.prevailpots.hcf.classes.type.bard; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.event.PvpClassUnequipEvent; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PotionEffectExpireEvent; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.Collection; +import java.util.UUID; + +public class BardRestorer implements Listener { + private final Table restores; + + public BardRestorer(final HCF plugin) { + this.restores = HashBasedTable.create(); + plugin.getServer().getPluginManager().registerEvents((Listener) this, (Plugin) plugin); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPvpClassUnequip(final PvpClassUnequipEvent event) { + this.restores.rowKeySet().remove(event.getPlayer().getUniqueId()); + } + + public void setRestoreEffect(final Player player, final PotionEffect effect) { + boolean shouldCancel = true; + final Collection activeList = player.getActivePotionEffects(); + for(final PotionEffect active : activeList) { + if(!active.getType().equals( effect.getType())) { + continue; + } + if(effect.getAmplifier() < active.getAmplifier()) { + return; + } + if(effect.getAmplifier() == active.getAmplifier() && effect.getDuration() < active.getDuration()) { + return; + } + this.restores.put(player.getUniqueId(), active.getType(), active); + shouldCancel = false; + break; + } + player.addPotionEffect(effect, true); + if(shouldCancel && effect.getDuration() > 100 && effect.getDuration() < BardClass.DEFAULT_MAX_DURATION) { + this.restores.remove( player.getUniqueId(), effect.getType()); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPotionEffectExpire(final PotionEffectExpireEvent event) { + final LivingEntity livingEntity = event.getEntity(); + if(livingEntity instanceof Player) { + final Player player = (Player) livingEntity; + final PotionEffect previous = (PotionEffect) this.restores.remove((Object) player.getUniqueId(), (Object) event.getEffect().getType()); + if(previous != null) { + event.setCancelled(true); + player.addPotionEffect(previous, true); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/AssassinClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/AssassinClass.java new file mode 100644 index 0000000..f834500 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/AssassinClass.java @@ -0,0 +1,206 @@ +package com.prevailpots.hcf.classes.type.chain; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import com.prevailpots.hcf.Cooldowns; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.ClassType; +import com.prevailpots.hcf.classes.PvpClass; +import com.prevailpots.hcf.classes.event.PvpClassUnequipEvent; + +import java.util.HashMap; + +/** + * Created by TREHOME on 10/20/2015. + */ +public class AssassinClass extends PvpClass implements Listener { + + + private final HCF plugin; + public HashMap firstAssassinEffects = new HashMap<>(); + public AssassinClass(final HCF plugin) { + super(ClassType.ASSASSIN); + this.plugin = plugin; + this.passiveEffects.add(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, Integer.MAX_VALUE, 0)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1)); + } + @EventHandler + public void onUnEquip(PvpClassUnequipEvent e){ + Player p = (Player) e.getPlayer(); + for(Player on : Bukkit.getOnlinePlayers()) { + if (!on.canSee(p) && !on.hasPermission("base.command.vanish")) { + on.showPlayer(p); + } + } + firstAssassinEffects.remove(p); + } + @EventHandler + public void onDamageSelf(EntityDamageEvent e){ + if(e.getEntity() instanceof Player){ + Player p = (Player) e.getEntity(); + if(plugin.getPvpClassManager().getEquippedClass(p) == null || !plugin.getPvpClassManager().getEquippedClass(p).equals(this)) return; + if(firstAssassinEffects.containsKey(p.getName()) && firstAssassinEffects.get(p.getName()) == 1){ + for(Entity entity : p.getNearbyEntities(20, 20, 20)){ + if(entity instanceof Player){ + Player players = (Player) entity; + players.sendMessage(ChatColor.YELLOW+"An reaper has taken damage in stealth mode near you: "+ChatColor.GOLD+ChatColor.ITALIC+"(20 x 20)"); + } + + } + } + } + } + @EventHandler + public void onHitOtherPlayers(EntityDamageByEntityEvent e){ + if(e.getDamager() instanceof Player && e.getEntity() instanceof Player) { + Player p = (Player) e.getDamager(); + Player ent = (Player) e.getEntity(); + if(firstAssassinEffects.containsKey(p.getName()) && firstAssassinEffects.get(p.getName()) == 1) { + afterFiveSeconds(p, true); + } + } + } + + + @EventHandler + public void onClickItem(PlayerInteractEvent e){ + Player p = e.getPlayer(); + if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) { + final PvpClass equipped = this.plugin.getPvpClassManager().getEquippedClass(p); + if(equipped == null || !equipped.equals(this)){ + return; + } + if(p.getItemInHand().getType() == Material.QUARTZ){ + + if(Cooldowns.isOnCooldown("Assassin_item_cooldown", p)) { + p.sendMessage(ChatColor.RED + "You still have an "+ ChatColor.GREEN + ChatColor.BOLD +"Reaper" + ChatColor.RED+ " cooldown for another " + HCF.getRemaining(Cooldowns.getCooldownForPlayerLong("Assassin_item_cooldown", p), true) +ChatColor.RED + '.'); + return; + } + + if(p.getItemInHand().getAmount() == 1){ + p.getInventory().remove(p.getItemInHand()); + } + p.getItemInHand().setAmount(p.getItemInHand().getAmount() - 1); + + p.sendMessage(ChatColor.YELLOW + "You are now in " + ChatColor.GRAY + "Stealth" + ChatColor.YELLOW + " Mode"); + for(Player on: Bukkit.getOnlinePlayers()){ + on.playEffect(p.getLocation().add(.5, 2, .5), Effect.ENDER_SIGNAL, 5); + on.playEffect(p.getLocation().add(.5, 1.5, .5), Effect.ENDER_SIGNAL, 5); + on.playEffect(p.getLocation().add(.5, 1, .5), Effect.ENDER_SIGNAL, 5); + on.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1); + if(!on.hasPermission("base.command.vanish")){ + on.hidePlayer(p); + } + } + + Cooldowns.addCooldown("Assassin_item_cooldown", p, 60); + p.removePotionEffect(PotionEffectType.SPEED); + firstAssassinEffects.put(p.getName(), 1); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100, 4), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 100, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100, 0), true); + + BukkitTask task = new BukkitRunnable(){ + public void run(){ + if(isApplicableFor(p)) { + if(firstAssassinEffects.containsKey(p.getName()) && firstAssassinEffects.get(p.getName()) == 1) { + afterFiveSeconds(p, false); + } + } + } + }.runTaskLater(plugin, 5 * 20); + } + } + } + public void afterFiveSeconds(Player p, boolean force) { + if(firstAssassinEffects.containsKey(p.getName())) { + if(isApplicableFor(p)) { + for(Player on : Bukkit.getOnlinePlayers()) { + if(!on.canSee(p) && !on.hasPermission("base.command.vanish")) { + on.showPlayer(p); + } + on.playEffect(p.getLocation().add(0, 2, 0), Effect.ENDER_SIGNAL, 3); + on.playEffect(p.getLocation().add(0, 1.5, 0), Effect.ENDER_SIGNAL, 3); + on.playEffect(p.getLocation().add(0, 1, 0), Effect.ENDER_SIGNAL, 3); + on.playEffect(p.getLocation().add(0, 2, 0), Effect.BLAZE_SHOOT, 5); + on.playEffect(p.getLocation().add(0, 1.5, 0), Effect.BLAZE_SHOOT, 5); + on.playEffect(p.getLocation().add(0, 1, 0), Effect.BLAZE_SHOOT, 5); + } + BukkitTask task1 = new BukkitRunnable(){ + public void run() { + if(firstAssassinEffects.containsKey(p.getName()) && firstAssassinEffects.get(p.getName()) == 2) { + firstAssassinEffects.remove(p.getName()); + p.sendMessage(ChatColor.YELLOW + "You are now in " + ChatColor.GREEN + "Normal" + ChatColor.YELLOW + " Mode"); + if(isApplicableFor(p)) { + p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, Integer.MAX_VALUE, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1), true); + } + } + } + }.runTaskLater(plugin, 5 * 20); + if(force){ + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 120, 1), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 120, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 120, 1), true); + p.removePotionEffect(PotionEffectType.INVISIBILITY); + firstAssassinEffects.remove(p.getName()); + firstAssassinEffects.put(p.getName(), 2); + p.sendMessage(ChatColor.YELLOW + "You have been forced into " + ChatColor.RED + "Power" + ChatColor.YELLOW + " Mode" + ChatColor.GRAY.toString() + ChatColor.ITALIC + " (5 Seconds)"); + return; + } + firstAssassinEffects.remove(p.getName()); + firstAssassinEffects.put(p.getName(), 2); + p.sendMessage(ChatColor.YELLOW + "You are now in " + ChatColor.RED + "Power" + ChatColor.YELLOW + " Mode" + ChatColor.GRAY.toString() + ChatColor.ITALIC + " (5 Seconds)"); + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 120, 1), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 120, 0), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 120, 1), true); + p.removePotionEffect(PotionEffectType.INVISIBILITY); + } + } + } + + + @Override + public boolean isApplicableFor(final Player player) { + final PlayerInventory playerInventory = player.getInventory(); + final ItemStack helmet = playerInventory.getHelmet(); + + if(helmet == null || helmet.getType() != Material.CHAINMAIL_HELMET) { + return false; + } + final ItemStack chestplate = playerInventory.getChestplate(); + if(chestplate == null || chestplate.getType() != Material.CHAINMAIL_CHESTPLATE) { + return false; + } + final ItemStack leggings = playerInventory.getLeggings(); + if(leggings == null || leggings.getType() != Material.CHAINMAIL_LEGGINGS) { + return false; + } + final ItemStack boots = playerInventory.getBoots(); + return boots != null && boots.getType() == Material.CHAINMAIL_BOOTS; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/RogueClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/RogueClass.java new file mode 100644 index 0000000..ebcf761 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/chain/RogueClass.java @@ -0,0 +1,134 @@ +package com.prevailpots.hcf.classes.type.chain; + +import com.google.common.collect.Maps; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.ClassType; +import com.prevailpots.hcf.classes.PvpClass; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class RogueClass extends PvpClass implements Listener { + private final HCF plugin; + Map clickDelay; + private static final PotionEffect ARCHER_SPEED_EFFECT; + + + static { + ARCHER_SPEED_EFFECT = new PotionEffect(PotionEffectType.SPEED, 10*20, 5); + } + + public RogueClass(final HCF plugin) { + super(ClassType.ROUGE); + this.plugin = plugin; + clickDelay = Maps.newHashMap(); + this.passiveEffects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 0)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 1)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2)); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onEntityDamageByEntity(final EntityDamageByEntityEvent event) { + final Entity entity = event.getEntity(); + final Entity damager = event.getDamager(); + if(entity instanceof Player && damager instanceof Player) { + final Player attacker = (Player) damager; + final PvpClass equipped = this.plugin.getPvpClassManager().getEquippedClass(attacker); + if(equipped != null && equipped.equals(this)) { + final ItemStack stack = attacker.getItemInHand(); + if(stack != null && stack.getType() == Material.GOLD_SWORD && stack.getEnchantments().isEmpty() && !attacker.hasPotionEffect(PotionEffectType.SLOW)) { + final Player player = (Player) entity; + if(rpGetPlayerDirection(attacker).equals(rpGetPlayerDirection(player))) { + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0f, 1.0f); + attacker.setItemInHand(new ItemStack(Material.AIR, 1)); + attacker.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0f, 1.0f); + attacker.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 3 * 20, 4)); + event.setDamage(5.0); + } + } + } + } + } + public String rpGetPlayerDirection(Player playerSelf){ + String dir = ""; + float y = playerSelf.getLocation().getYaw(); + if( y < 0 ){y += 360;} + y %= 360; + int i = (int)((y+8) / 22.5); + if(i == 0 || i == 1 || i == 15){dir = "west";} + else if(i == 4 || i == 5 || i == 6 || i == 2 || i == 3){dir = "north";} + else if(i == 8 || i == 7 || i == 9){dir = "east";} + else if(i == 11 || i == 10 || i == 12 || i == 13 || i == 14 ){dir = "south";} + else {dir = "west";} + return dir; + } + + + @EventHandler + public void onClick(PlayerInteractEvent e){ + if(plugin.getPvpClassManager().getEquippedClass(e.getPlayer()) != null && plugin.getPvpClassManager().getEquippedClass(e.getPlayer()).equals(this)) { + if (e.getItem().getType().equals(Material.SUGAR)) { + if (clickDelay.containsKey(e.getPlayer().getUniqueId())) { + e.getPlayer().sendMessage(ChatColor.RED + "You cannot use this for another " + HCF.getRemaining(System.currentTimeMillis() - clickDelay.get(e.getPlayer().getUniqueId()), true)); + e.setCancelled(true); + return; + } + Player p = e.getPlayer(); + p.removePotionEffect(PotionEffectType.SPEED); + clickDelay.put(e.getPlayer().getUniqueId(), System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(90)); + p.addPotionEffect(ARCHER_SPEED_EFFECT); + if (p.getItemInHand().getAmount() == 1) { + p.getInventory().remove(p.getItemInHand()); + } else { + p.getItemInHand().setAmount(p.getItemInHand().getAmount() - 1); + } + BukkitTask task = new BukkitRunnable() { + @Override + public void run() { + if (isApplicableFor(p)) { + p.removePotionEffect(PotionEffectType.SPEED); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2)); + } + } + }.runTaskLater(plugin, 10 * 20); + } + } + } + + @Override + public boolean isApplicableFor(final Player player) { + final PlayerInventory playerInventory = player.getInventory(); + final ItemStack helmet = playerInventory.getHelmet(); + if(helmet == null || helmet.getType() != Material.CHAINMAIL_HELMET) { + return false; + } + final ItemStack chestplate = playerInventory.getChestplate(); + if(chestplate == null || chestplate.getType() != Material.CHAINMAIL_CHESTPLATE) { + return false; + } + final ItemStack leggings = playerInventory.getLeggings(); + if(leggings == null || leggings.getType() != Material.CHAINMAIL_LEGGINGS) { + return false; + } + final ItemStack boots = playerInventory.getBoots(); + return boots != null && boots.getType() == Material.CHAINMAIL_BOOTS; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/classes/type/miner/MinerClass.java b/PrevailHCF/src/com/prevailpots/hcf/classes/type/miner/MinerClass.java new file mode 100644 index 0000000..631d773 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/classes/type/miner/MinerClass.java @@ -0,0 +1,166 @@ +package com.prevailpots.hcf.classes.type.miner; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.classes.ClassType; +import com.prevailpots.hcf.classes.PvpClass; +import com.prevailpots.hcf.classes.event.PvpClassEquipEvent; +import com.prevailpots.hcf.user.FactionUser; + +public class MinerClass extends PvpClass implements Listener { + private static final PotionEffect HEIGHT_INVISIBILITY; + private static final PotionEffect STAGE_R; + private static final PotionEffect STAGE_2; + private static final PotionEffect STAGE_1; + private static final PotionEffect STAGE_3; + + static { + STAGE_3 = new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1); + STAGE_2 = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1); + STAGE_R = new PotionEffect(PotionEffectType.FIRE_RESISTANCE, Integer.MAX_VALUE, 0); + STAGE_1 = new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 2); + HEIGHT_INVISIBILITY = new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0); + } + + private final HCF plugin; + private final Map removeableEffects; + + public MinerClass(final HCF plugin) { + super(ClassType.MINER); + this.plugin = plugin; + removeableEffects = new HashMap<>(); + removeableEffects.put(HEIGHT_INVISIBILITY, 0); + removeableEffects.put(STAGE_R, 15); + removeableEffects.put(STAGE_1, 50); + removeableEffects.put(STAGE_2, 75); + removeableEffects.put(STAGE_3, 125); + this.passiveEffects.add(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 1)); + this.passiveEffects.add(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0)); + } + + + private void removeInvisibilitySafely(final Player player) { + for(final PotionEffect active : player.getActivePotionEffects()) { + if(((active.getType().equals(PotionEffectType.FAST_DIGGING)||active.getType().equals(PotionEffectType.DAMAGE_RESISTANCE) || active.getType().equals(PotionEffectType.SPEED) || active.getType().equals(PotionEffectType.FIRE_RESISTANCE) || active.getType().equals(PotionEffectType.INVISIBILITY))) && active.getDuration() > MinerClass.DEFAULT_MAX_DURATION) { + player.removePotionEffect(active.getType()); + } + } + player.sendMessage(ChatColor.DARK_GREEN + this.getName() + ChatColor.YELLOW + " miner upgrades have been removed"); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerDamage(final EntityDamageByEntityEvent event) { + final Entity entity = event.getEntity(); + if(entity instanceof Player && BukkitUtils.getFinalAttacker(event, false) != null) { + final Player player = (Player) entity; + if(this.plugin.getPvpClassManager().hasClassEquipped(player, this)) { + this.removeInvisibilitySafely(player); + } + } + } + + + @EventHandler + public void onBreakBlock(BlockBreakEvent e){ + FactionUser user = plugin.getUserManager().getUser(e.getPlayer().getUniqueId()); + if(!isApplicableFor(e.getPlayer())) return; + for(Map.Entry entry : removeableEffects.entrySet()){ + if(entry.getValue() <= user.getDiamondsMined()){ + applyStages(e.getPlayer()); + } + } + } + + @Override + public void onUnequip(final Player player) { + super.onUnequip(player); + this.removeInvisibilitySafely(player); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerMove(final PlayerMoveEvent event) { + this.conformMinerInvisibility(event.getPlayer(), event.getFrom(), event.getTo()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerTeleport(final PlayerTeleportEvent event) { + this.conformMinerInvisibility(event.getPlayer(), event.getFrom(), event.getTo()); + } + + @EventHandler + public void onEquip(PvpClassEquipEvent e){ + if(e.getPvpClass().equals(this)){ + if(isApplicableFor(e.getPlayer())) { + applyStages(e.getPlayer()); + } + } + } + + + private void conformMinerInvisibility(final Player player, final Location from, final Location to) { + final int fromY = from.getBlockY(); + final int toY = to.getBlockY(); + if(fromY != toY && this.plugin.getPvpClassManager().hasClassEquipped(player, this)) { + final boolean isInvisible = player.hasPotionEffect(PotionEffectType.INVISIBILITY); + if(toY > 50) { + if(fromY <= 50 && isInvisible) { + player.sendMessage(ChatColor.DARK_GREEN + this.getName() + ChatColor.GRAY + " invisibility " + ChatColor.RED + "disabled" + ChatColor.GRAY + "."); + this.removeInvisibilitySafely(player); + } + } + else if(toY <= 50 && !isInvisible && isApplicableFor(player)) { + player.sendMessage(ChatColor.DARK_GREEN + this.getName() + ChatColor.GRAY + " invisibility " + ChatColor.GREEN + "enabled" + ChatColor.GRAY + "."); + applyStages(player); + } + } + } + + private void applyStages(Player player){ + FactionUser user = plugin.getUserManager().getUser(player.getUniqueId()); + if(!isApplicableFor(player)) return; + for(Map.Entry entry : removeableEffects.entrySet()){ + if(entry.getValue() <= user.getDiamondsMined() && !player.hasPotionEffect(entry.getKey().getType())){ + player.addPotionEffect(entry.getKey()); + } + } + } + + @Override + public boolean isApplicableFor(final Player player) { + final PlayerInventory playerInventory = player.getInventory(); + final ItemStack helmet = playerInventory.getHelmet(); + if(helmet == null || helmet.getType() != Material.IRON_HELMET) { + return false; + } + final ItemStack chestplate = playerInventory.getChestplate(); + if(chestplate == null || chestplate.getType() != Material.IRON_CHESTPLATE) { + return false; + } + final ItemStack leggings = playerInventory.getLeggings(); + if(leggings == null || leggings.getType() != Material.IRON_LEGGINGS) { + return false; + } + final ItemStack boots = playerInventory.getBoots(); + return boots != null && boots.getType() == Material.IRON_BOOTS; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogEntry.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogEntry.java new file mode 100644 index 0000000..2ef8295 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogEntry.java @@ -0,0 +1,13 @@ +package com.prevailpots.hcf.combatlog; + +import org.bukkit.scheduler.BukkitTask; + +public class CombatLogEntry { + public final LoggerEntity loggerEntity; + public final BukkitTask task; + + public CombatLogEntry(final LoggerEntity loggerEntity, final BukkitTask task) { + this.loggerEntity = loggerEntity; + this.task = task; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogListener.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogListener.java new file mode 100644 index 0000000..d4a4d36 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CombatLogListener.java @@ -0,0 +1,161 @@ +package com.prevailpots.hcf.combatlog; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.entity.Damageable; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityInteractEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.scheduler.BukkitRunnable; +import org.spigotmc.event.player.PlayerSpawnLocationEvent; + +import com.customhcf.util.InventoryUtils; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; + +public class CombatLogListener implements Listener { + private static final int NEARBY_SPAWN_RADIUS = 64; + private static final Set SAFE_DISCONNECTS; + private static final Map LOGGERS; + + static { + SAFE_DISCONNECTS = new HashSet(); + LOGGERS = new HashMap<>(); + } + + private final HCF plugin; + + public CombatLogListener(final HCF plugin) { + this.plugin = plugin; + } + + public static void safelyDisconnect(final Player player, final String reason) { + if(CombatLogListener.SAFE_DISCONNECTS.add(player.getUniqueId())) { + player.kickPlayer(reason); + } + } + + public static void removeCombatLoggers() { + final Iterator iterator = CombatLogListener.LOGGERS.values().iterator(); + while(iterator.hasNext()) { + final CombatLogEntry entry = iterator.next(); + entry.task.cancel(); + entry.loggerEntity.getBukkitEntity().remove(); + iterator.remove(); + } + CombatLogListener.SAFE_DISCONNECTS.clear(); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerQuitSafe(final PlayerQuitEvent event) { + CombatLogListener.SAFE_DISCONNECTS.remove(event.getPlayer().getUniqueId()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onLoggerInteract(final EntityInteractEvent event) { + final Collection entries = CombatLogListener.LOGGERS.values(); + for(final CombatLogEntry entry : entries) { + if(entry.loggerEntity.getBukkitEntity().equals(event.getEntity())) { + event.setCancelled(true); + break; + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onLoggerDeath(final LoggerDeathEvent event) { + final CombatLogEntry entry = CombatLogListener.LOGGERS.remove(event.getLoggerEntity().getPlayerUUID()); + if(entry != null) { + entry.task.cancel(); + } + } + + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onPlayerSpawnLocation(final PlayerLoginEvent event) { + final CombatLogEntry combatLogEntry = CombatLogListener.LOGGERS.remove(event.getPlayer().getUniqueId()); + if(combatLogEntry != null) { + final CraftLivingEntity loggerEntity = combatLogEntry.loggerEntity.getBukkitEntity(); + final Player player = event.getPlayer(); + player.teleport(loggerEntity.getLocation()); + player.setFallDistance(loggerEntity.getFallDistance()); + player.setHealth(Math.min(((Damageable)player).getMaxHealth(), loggerEntity.getHealth())); + player.setTicksLived(loggerEntity.getTicksLived()); + player.setRemainingAir(loggerEntity.getRemainingAir()); + loggerEntity.remove(); + combatLogEntry.task.cancel(); + } + } + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPlayerQuit(final PlayerQuitEvent event) { + final Player player = event.getPlayer(); + final UUID uuid = player.getUniqueId(); + final PlayerInventory inventory = player.getInventory(); + if(player.getGameMode() != GameMode.CREATIVE && !player.isDead() && !CombatLogListener.SAFE_DISCONNECTS.contains(uuid) ){ + if(this.plugin.getTimerManager().pvpProtectionTimer.getRemaining(uuid) > 0L) { + return; + } + if(this.plugin.getTimerManager().teleportTimer.getNearbyEnemies(player, NEARBY_SPAWN_RADIUS) <= 0) { + return; + } + final Location location = player.getLocation(); + if(this.plugin.getFactionManager().getFactionAt(location).isSafezone()) { + return; + } + if(CombatLogListener.LOGGERS.containsKey(player.getUniqueId())) { + return; + } + final World world = location.getWorld(); + final LoggerEntity loggerEntity = new LoggerEntity(world, location, player); + final LoggerSpawnEvent calledEvent = new LoggerSpawnEvent(loggerEntity); + Bukkit.getPluginManager().callEvent(calledEvent); + CombatLogListener.LOGGERS.put(uuid, new CombatLogEntry(loggerEntity, new LoggerRemovable(uuid, loggerEntity).runTaskLater(this.plugin, 600L))); + final CraftEntity craftEntity = loggerEntity.getBukkitEntity(); + if(craftEntity != null) { + final CraftLivingEntity craftLivingEntity = (CraftLivingEntity) craftEntity; + final EntityEquipment entityEquipment = craftLivingEntity.getEquipment(); + entityEquipment.setItemInHand(inventory.getItemInHand()); + craftLivingEntity.setCustomName(ConfigurationService.ENEMY_COLOUR + player.getName()); + entityEquipment.setArmorContents(inventory.getArmorContents()); + } + } + } + + + private static class LoggerRemovable extends BukkitRunnable { + private final UUID uuid; + private final LoggerEntity loggerEntity; + + public LoggerRemovable(final UUID uuid, final LoggerEntity loggerEntity) { + this.uuid = uuid; + this.loggerEntity = loggerEntity; + } + + public void run() { + if(CombatLogListener.LOGGERS.remove(this.uuid) != null) { + this.loggerEntity.dead = true; + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/CustomEntityRegistration.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CustomEntityRegistration.java new file mode 100644 index 0000000..2a2bd60 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/CustomEntityRegistration.java @@ -0,0 +1,47 @@ +package com.prevailpots.hcf.combatlog; + +import net.minecraft.server.v1_7_R4.EntityTypes; + +import java.lang.reflect.Field; +import java.util.Map; + +public class CustomEntityRegistration { + public static void registerCustomEntities() { + try { + registerCustomEntity(LoggerEntity.class, "Villager", 120); + } catch(Exception ex) { + ex.printStackTrace(); + } + } + + public static void registerCustomEntity(final Class entityClass, final String name, final int id) { + setFieldPrivateStaticMap("d", entityClass, name); + setFieldPrivateStaticMap("f", entityClass, id); + } + + public static void unregisterCustomEntities() { + } + + public static void setFieldPrivateStaticMap(final String fieldName, final Object key, final Object value) { + try { + final Field field = EntityTypes.class.getDeclaredField(fieldName); + field.setAccessible(true); + final Map map = (Map) field.get(null); + map.put(key, value); + field.set(null, map); + } catch(NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { + ex.printStackTrace(); + } + } + + public static void setField(final String fieldName, final Object key, final Object value) { + try { + final Field field = key.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(key, value); + field.setAccessible(false); + } catch(Exception ex) { + ex.printStackTrace(); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerDeathEvent.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerDeathEvent.java new file mode 100644 index 0000000..89a577c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerDeathEvent.java @@ -0,0 +1,30 @@ +package com.prevailpots.hcf.combatlog; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class LoggerDeathEvent extends Event { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final LoggerEntity loggerEntity; + + public LoggerDeathEvent(final LoggerEntity loggerEntity) { + this.loggerEntity = loggerEntity; + } + + public static HandlerList getHandlerList() { + return LoggerDeathEvent.handlers; + } + + public LoggerEntity getLoggerEntity() { + return this.loggerEntity; + } + + public HandlerList getHandlers() { + return LoggerDeathEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerEntity.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerEntity.java new file mode 100644 index 0000000..7dad48a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerEntity.java @@ -0,0 +1,200 @@ +package com.prevailpots.hcf.combatlog; + + +import com.google.common.base.Function; +import com.prevailpots.hcf.HCF; + +import net.minecraft.server.v1_7_R4.*; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_7_R4.CraftServer; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + + +public class LoggerEntity extends EntityVillager { + private static final Function DAMAGE_FUNCTION; + + static { + DAMAGE_FUNCTION = (f1 -> 0.0); + } + + private final UUID playerUUID; + + public LoggerEntity(final World world, final Location location, final Player player) { + super(((CraftWorld) world).getHandle()); + this.lastDamager = ((CraftPlayer) player).getHandle().lastDamager; + final double x = location.getX(); + final double y = location.getY(); + final double z = location.getZ(); + final String playerName = player.getName(); + final boolean hasSpawned = ((CraftWorld) world).getHandle().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM); + Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "Combat Logger for [" + playerName + "] " + (hasSpawned ? (ChatColor.GREEN + "successfully spawned") : (ChatColor.RED + "failed to spawn")) + ChatColor.GOLD + " at (" + String.format("%.1f", x) + ", " + String.format("%.1f", y) + ", " + String.format("%.1f", z) + ')'); + new BukkitRunnable() { + public void run() { + removeent(world); + } + }.runTaskLater(HCF.getPlugin(), 20 * 30); + this.playerUUID = player.getUniqueId(); + if(hasSpawned) { + this.setCustomName(playerName); + this.setCustomNameVisible(true); + this.setPositionRotation(x, y, z, location.getYaw(), location.getPitch()); + } + } + + public void removeent(World world) { + ((CraftWorld)world).getHandle().removeEntity(this); + } + + private static PlayerNmsResult getResult(final World world, final UUID playerUUID) { + final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID); + if(offlinePlayer.hasPlayedBefore()) { + final WorldServer worldServer = ((CraftWorld) world).getHandle(); + final EntityPlayer entityPlayer = new EntityPlayer(((CraftServer) Bukkit.getServer()).getServer(), worldServer, new GameProfile(playerUUID, offlinePlayer.getName()), new PlayerInteractManager((net.minecraft.server.v1_7_R4.World) worldServer)); + final Player player = (Player) entityPlayer.getBukkitEntity(); + if(player != null) { + player.loadData(); + return new PlayerNmsResult(player, entityPlayer); + } + } + return null; + } + + public UUID getPlayerUUID() { + return this.playerUUID; + } + + public void move(final double d0, final double d1, final double d2) { + } + + public void b(final int i) { + } + + public void dropDeathLoot(final boolean flag, final int i) { + } + + public Entity findTarget() { + return null; + } + + public boolean damageEntity(final DamageSource damageSource, final float amount) { + final PlayerNmsResult nmsResult = getResult((World) this.world.getWorld(), this.playerUUID); + if(nmsResult == null) { + return true; + } + final EntityPlayer entityPlayer = nmsResult.entityPlayer; + if(entityPlayer != null) { + entityPlayer.setPosition(this.locX, this.locY, this.locZ); + final EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent((Entity) entityPlayer, damageSource, (double) amount, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, (Function) LoggerEntity.DAMAGE_FUNCTION, (Function) LoggerEntity.DAMAGE_FUNCTION, (Function) LoggerEntity.DAMAGE_FUNCTION, (Function) LoggerEntity.DAMAGE_FUNCTION, (Function) LoggerEntity.DAMAGE_FUNCTION, (Function) LoggerEntity.DAMAGE_FUNCTION); + if(event.isCancelled()) { + return false; + } + } + return super.damageEntity(damageSource, amount); + } + + + public EntityAgeable createChild(EntityAgeable entityAgeable) { + return null; + } + + public boolean a(final EntityHuman entityHuman) { + return false; + } + + public void h() { + super.h(); + } + + public void collide(final Entity entity) { + } + + public void die(final DamageSource damageSource) { + final PlayerNmsResult playerNmsResult = getResult((World) this.world.getWorld(), this.playerUUID); + if(playerNmsResult == null) { + return; + } + final Player player = playerNmsResult.player; + final PlayerInventory inventory = player.getInventory(); + final boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory"); + final List drops = new ArrayList<>(); + if(!keepInventory) { + ItemStack[] deathMessage = inventory.getContents(); + int entityPlayer = deathMessage.length; + + int event; + ItemStack loggerDeathEvent; + for(event = 0; event < entityPlayer; ++event) { + loggerDeathEvent = deathMessage[event]; + if(loggerDeathEvent != null && loggerDeathEvent.getType() != Material.AIR) { + drops.add(loggerDeathEvent); + } + } + + deathMessage = inventory.getArmorContents(); + entityPlayer = deathMessage.length; + + for(event = 0; event < entityPlayer; ++event) { + loggerDeathEvent = deathMessage[event]; + if(loggerDeathEvent != null && loggerDeathEvent.getType() != Material.AIR) { + drops.add(loggerDeathEvent); + } + } + } + String deathMessage = ChatColor.YELLOW + "(Combat-Logger) " + this.combatTracker.b().c(); + final EntityPlayer entityPlayer = playerNmsResult.entityPlayer; + entityPlayer.combatTracker = this.combatTracker; + if(Bukkit.getPlayer(entityPlayer.getName()) != null){ + Bukkit.getPlayer(entityPlayer.getUniqueID()).getInventory().clear(); + Bukkit.getPlayer(entityPlayer.getUniqueID()).kickPlayer(""); + } + final PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(entityPlayer, drops, deathMessage, keepInventory); + deathMessage = event.getDeathMessage(); + if(deathMessage != null && !deathMessage.isEmpty()) { + Bukkit.broadcastMessage(deathMessage); + } + super.die(damageSource); + final LoggerDeathEvent loggerDeathEvent = new LoggerDeathEvent(this); + Bukkit.getPluginManager().callEvent(loggerDeathEvent); + if(!event.getKeepInventory()) { + inventory.clear(); + inventory.setArmorContents(new ItemStack[inventory.getArmorContents().length]); + } + entityPlayer.setLocation(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + entityPlayer.setHealth(0.0f); + player.saveData(); + } + + public CraftLivingEntity getBukkitEntity() { + return (CraftLivingEntity) super.getBukkitEntity(); + } + + public static final class PlayerNmsResult { + public final Player player; + public final EntityPlayer entityPlayer; + + public PlayerNmsResult(final Player player, final EntityPlayer entityPlayer) { + this.player = player; + this.entityPlayer = entityPlayer; + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.java b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.java new file mode 100644 index 0000000..0bf333e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/combatlog/LoggerSpawnEvent.java @@ -0,0 +1,30 @@ +package com.prevailpots.hcf.combatlog; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class LoggerSpawnEvent extends Event { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final LoggerEntity loggerEntity; + + public LoggerSpawnEvent(final LoggerEntity loggerEntity) { + this.loggerEntity = loggerEntity; + } + + public static HandlerList getHandlerList() { + return LoggerSpawnEvent.handlers; + } + + public LoggerEntity getLoggerEntity() { + return this.loggerEntity; + } + + public HandlerList getHandlers() { + return LoggerSpawnEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/AlphaRevives.java b/PrevailHCF/src/com/prevailpots/hcf/command/AlphaRevives.java new file mode 100644 index 0000000..e688c73 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/AlphaRevives.java @@ -0,0 +1,69 @@ +package com.prevailpots.hcf.command; + +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.Cooldowns; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.deathban.Deathban; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.user.FactionUser; + +public class AlphaRevives implements CommandExecutor { + + private final HCF plugin; + + public AlphaRevives(final HCF plugin) { + this.plugin = plugin; + } + + @Override + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + Player player = null; + if (sender instanceof Player) { + player = (Player) sender; + } + if (player == null && (sender instanceof Player)) + return true; + if (args.length == 2 && (args[0].equalsIgnoreCase("revive"))) { + if (!player.hasPermission("alpha.revive")) { + player.sendMessage(ChatColor.RED + "Not really."); + return true; + } + if (Cooldowns.isOnCooldown("alpha_revive_command_cooldown", player)) { + player.sendMessage(ChatColor.RED + "You are still on cooldown for another " + ChatColor.BOLD.toString() + HCF.getRemaining(Cooldowns.getCooldownForPlayerLong("alpha_revive_command_cooldown", player), true) + ChatColor.RED + '.'); + return true; + } + OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); + if (!target.hasPlayedBefore()) { + sender.sendMessage(ChatColor.RED + "Player '" + ChatColor.GRAY + args[1] + ChatColor.RED + "' not found."); + return true; + } + final UUID targetUUID = target.getUniqueId(); + final FactionUser factionTarget = this.plugin.getUserManager().getUser(targetUUID); + final Deathban deathban = factionTarget.getDeathban(); + if (deathban == null || !deathban.isActive()) { + sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned."); + return true; + } + Relation relation; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + relation = ((playerFaction == null) ? Relation.ENEMY : playerFaction.getFactionRelation(this.plugin.getFactionManager().getPlayerFaction(targetUUID))); + factionTarget.setDeathban(null); + Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("AlphaBroadcast")).replace("{reviver}", player.getName()).replace("{revived}", target.getName())); + sender.sendMessage(ChatColor.YELLOW + "You have revived " + relation.toChatColour() + target.getName() + ChatColor.YELLOW + '.'); + Cooldowns.addCooldown("alpha_revive_command_cooldown", player, (int) TimeUnit.HOURS.toSeconds(3)); + } + return false; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/CobblestoneCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/CobblestoneCommand.java new file mode 100644 index 0000000..42e352b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/CobblestoneCommand.java @@ -0,0 +1,25 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.user.FactionUser; + +public class CobblestoneCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { + if(cs instanceof Player){ + FactionUser user = HCF.getPlugin().getUserManager().getUser(((Player) cs).getUniqueId()); + user.setCobblestone(!user.isCobblestone()); + cs.sendMessage(ChatColor.YELLOW + "You have " + (user.isCobblestone() ? ChatColor.GREEN +"enabled" : ChatColor.RED +"disabled") + ChatColor.YELLOW +" picking up cobblestone in miner class!"); + }else{ + cs.sendMessage(ChatColor.RED + "Player only command!"); + return true; + } + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/CoordsCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/CoordsCommand.java new file mode 100644 index 0000000..6a7e8d6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/CoordsCommand.java @@ -0,0 +1,32 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; + +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +public class CoordsCommand implements CommandExecutor, TabExecutor { + + private final ChatColor VALUE_COLOR = ChatColor.YELLOW; + + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + sender.sendMessage(VALUE_COLOR + BukkitUtils.STRAIGHT_LINE_DEFAULT); + final List list = HCF.getPlugin().getConfig().getStringList("Coords"); + for (final String playerlist : list) { + final Player player = (Player)sender; + player.sendMessage(ChatColor.translateAlternateColorCodes('&', playerlist)); + } + sender.sendMessage(VALUE_COLOR + BukkitUtils.STRAIGHT_LINE_DEFAULT); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/CrowbarCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/CrowbarCommand.java new file mode 100644 index 0000000..6b624f0 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/CrowbarCommand.java @@ -0,0 +1,141 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.google.common.base.Optional; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.crowbar.Crowbar; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class CrowbarCommand implements CommandExecutor, TabExecutor { + private final List completions; + + public CrowbarCommand() { + this.completions = Arrays.asList("spawn", "setspawneruses", "setframeuses", "setegguses"); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player) && args.length != 2) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if (args.length < 1) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " (playerName)"); + return true; + } + Player player = null; + if(sender instanceof Player) { + player = (Player) sender; + } + if (args[0].equalsIgnoreCase("spawn")) { + if(args.length == 1) { + final ItemStack stack = new Crowbar().getItemIfPresent(); + player.getInventory().addItem(new ItemStack[]{stack}); + sender.sendMessage(ChatColor.YELLOW + "You have given yourself a " + stack.getItemMeta().getDisplayName() + ChatColor.YELLOW + '.'); + return true; + }else{ + if(args.length != 2){ + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " (playerName)"); + return true; + } + Player target = Bukkit.getPlayer(args[1]); + if(target == null){ + return true; + } + final ItemStack stack = new Crowbar().getItemIfPresent(); + target.getInventory().addItem(new ItemStack[]{stack}); + return true; + } + } + final Optional crowbarOptional = Crowbar.fromStack(player.getItemInHand()); + if (!crowbarOptional.isPresent()) { + sender.sendMessage(ChatColor.RED + "You are not holding a Crowbar."); + return true; + } + if (args[0].equalsIgnoreCase("setspawneruses")) { + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[0].toLowerCase() + " "); + return true; + } + final Integer amount = Ints.tryParse(args[1]); + if (amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a number."); + return true; + } + if (amount < 0) { + sender.sendMessage(ChatColor.RED + "You cannot set Spawner uses to an amount less than " + 0 + '.'); + return true; + } + if (amount > 1) { + sender.sendMessage(ChatColor.RED + "Crowbars have maximum Spawner uses of " + 1 + '.'); + return true; + } + final Crowbar crowbar = (Crowbar) crowbarOptional.get(); + crowbar.setSpawnerUses(amount); + player.setItemInHand(crowbar.getItemIfPresent()); + sender.sendMessage(ChatColor.YELLOW + "Set Spawner uses of held Crowbar to " + amount + '.'); + return true; + } + if (args[0].equalsIgnoreCase("setframeuses")) { + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[0].toLowerCase() + " "); + return true; + } + final Integer amount = Ints.tryParse(args[1]); + if (amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not an integer."); + return true; + } + if (amount < 0) { + sender.sendMessage(ChatColor.RED + "You cannot set End Portal Frame uses to an amount less than " + 0 + '.'); + return true; + } + if (amount > 5) { + sender.sendMessage(ChatColor.RED + "Crowbars have maximum End Portal Frame uses of " + 5 + '.'); + return true; + } + final Crowbar crowbar = (Crowbar) crowbarOptional.get(); + crowbar.setEndFrameUses(amount); + player.setItemInHand(crowbar.getItemIfPresent()); + sender.sendMessage(ChatColor.YELLOW + "Set End Portal Frame uses of held Crowbar to " + amount + '.'); + return true; + } + if (args[0].equalsIgnoreCase("setegguses")) { + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[0].toLowerCase() + " "); + return true; + } + final Integer amount = Ints.tryParse(args[1]); + if (amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a number."); + return true; + } + if (amount < 0) { + sender.sendMessage(ChatColor.RED + "You cannot set End Dragon Egg uses to an amount less than " + 0 + '.'); + return true; + } + if (amount > 1) { + sender.sendMessage(ChatColor.RED + "Crowbars have maximum End Dragon Egg uses of " + 1 + '.'); + return true; + } + final Crowbar crowbar = (Crowbar) crowbarOptional.get(); + player.setItemInHand(crowbar.getItemIfPresent()); + sender.sendMessage(ChatColor.YELLOW + "Set End Dragon Egg uses of held Crowbar to " + amount + '.'); + return true; + } + return true; + } + + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 1) ? BukkitUtils.getCompletions(args, this.completions) : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/FocusCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/FocusCommand.java new file mode 100644 index 0000000..ff19bbd --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/FocusCommand.java @@ -0,0 +1,60 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.FactionFocusChangeEvent; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FocusCommand implements CommandExecutor { + + + public String getUsage(final String label) { + return ChatColor.RED +"Usage: /" + label + " "; + } + + + + @Override + public boolean onCommand(CommandSender cs, Command command, String label, String[] args) { + Player player = (Player) cs; + if(args.length != 1){ + cs.sendMessage(getUsage(label)); + return true; + } + final PlayerFaction playerFaction = HCF.getPlugin().getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null){ + player.sendMessage(ChatColor.RED + "You must be in a faction!"); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER){ + player.sendMessage(org.bukkit.ChatColor.RED + "You cannot focus a member of your faction!"); + return true; + } + if(Bukkit.getPlayer(args[0]) == null && !args[0].equalsIgnoreCase("none")){ + player.sendMessage(org.bukkit.ChatColor.RED + getUsage(label)); + player.sendMessage(ChatColor.RED + "Expected 'playerName' but got " + args[0]); + return true; + } + if(args[0].equalsIgnoreCase("none")){ + playerFaction.broadcast(ChatColor.LIGHT_PURPLE + cs.getName() + ChatColor.YELLOW + " has removed the current focus!"); + Bukkit.getPluginManager().callEvent(new FactionFocusChangeEvent(playerFaction, null, playerFaction.getFocus())); + return true; + } + Bukkit.getPluginManager().callEvent(new FactionFocusChangeEvent(playerFaction, Bukkit.getPlayer(args[0]), playerFaction.getFocus())); + if(playerFaction.getFocus() == null){ + playerFaction.broadcast(net.md_5.bungee.api.ChatColor.LIGHT_PURPLE + cs.getName() + net.md_5.bungee.api.ChatColor.YELLOW + " has focused " + net.md_5.bungee.api.ChatColor.DARK_PURPLE + args[0]); + }else { + playerFaction.broadcast(net.md_5.bungee.api.ChatColor.LIGHT_PURPLE + cs.getName() + net.md_5.bungee.api.ChatColor.YELLOW + " has removed the focus on " + net.md_5.bungee.api.ChatColor.DARK_PURPLE + BukkitUtils.offlinePlayerWithNameOrUUID(playerFaction.getFocus().toString()).getName() + net.md_5.bungee.api.ChatColor.YELLOW + " and has focused " + net.md_5.bungee.api.ChatColor.DARK_PURPLE + args[0]); + } + playerFaction.setFocus(Bukkit.getPlayer(args[0]).getUniqueId()); + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/GoppleCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/GoppleCommand.java new file mode 100644 index 0000000..dc3670c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/GoppleCommand.java @@ -0,0 +1,39 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.timer.PlayerTimer; + +import java.util.Collections; +import java.util.List; + +public class GoppleCommand implements CommandExecutor, TabExecutor { + private final HCF plugin; + + public GoppleCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PlayerTimer timer = this.plugin.getTimerManager().notchAppleTimer; + final long remaining = timer.getRemaining(player); + if(remaining <= 0L) { + sender.sendMessage(ChatColor.RED + "No current gopple cooldown."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "Your " + timer.getDisplayName() + ChatColor.YELLOW + " timer is active for another " + ChatColor.BOLD + HCF.getRemaining(remaining, true, false) + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/HelpCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/HelpCommand.java new file mode 100644 index 0000000..cd459ed --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/HelpCommand.java @@ -0,0 +1,32 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +public class HelpCommand implements CommandExecutor { + + private final ChatColor VALUE_COLOR = ChatColor.GRAY; + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + sender.sendMessage(VALUE_COLOR + BukkitUtils.STRAIGHT_LINE_DEFAULT); + final List list = HCF.getPlugin().getConfig().getStringList("Help"); + for (final String playerlist : list) { + final Player player = (Player)sender; + player.sendMessage(ChatColor.translateAlternateColorCodes('&', playerlist)); + } + sender.sendMessage(VALUE_COLOR + BukkitUtils.STRAIGHT_LINE_DEFAULT); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/KitCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/KitCommand.java new file mode 100644 index 0000000..e163213 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/KitCommand.java @@ -0,0 +1,46 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.base.BasePlugin; +import com.customhcf.base.kit.Kit; +import com.prevailpots.hcf.HCF; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.concurrent.TimeUnit; + + +/** + * Created by Spirit on 21/07/2017. + */ +public class KitCommand implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) { + if(!(commandSender instanceof Player)) { + commandSender.sendMessage(ChatColor.RED + "You must be a player to run this command."); + return true; + } + + if(args.length < 1) { + commandSender.sendMessage(ChatColor.RED + "Invalid usage. /kit "); + return true; + } + + Player p = (Player)commandSender; + String kitName = args[0]; + Kit kit = BasePlugin.getPlugin().getKitManager().getKit(kitName); + if(kit != null && p.hasPermission(kit.getPermissionNode())) { + //kit.applyTo(p, false, true); + kit.applyTo(p, false, true); + return true; + } + + p.sendMessage(ChatColor.RED + "Kit " + kitName + " not found."); + + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/ListCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/ListCommand.java new file mode 100644 index 0000000..01c1ee6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/ListCommand.java @@ -0,0 +1,37 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.base.command.BaseCommand; +import com.prevailpots.hcf.HCF; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Spirit on 05/08/2017. + */ +public class ListCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender s, Command command, String label, String[] args) { + final List list = new ArrayList(); + for (final Player player : Bukkit.getOnlinePlayers()) { + if (player.hasPermission("command.list.own") && BaseCommand.canSee(s, player)) { + list.add(player.getName()); + } + } + + int playerCount = HCF.getPlugin().getPlayers(); + s.sendMessage("§7§m----------------------------------------------------------"); + s.sendMessage(ChatColor.RED + "There are currently " + ChatColor.WHITE + playerCount + ChatColor.GRAY + "/" + ChatColor.WHITE + Bukkit.getMaxPlayers() + ChatColor.RED + " players online."); + s.sendMessage(ChatColor.RED + "Staff Online: "); + s.sendMessage(ChatColor.GREEN + list.toString().replace("[", "").replace("]", "").replace(",", ChatColor.GRAY + "," + ChatColor.GREEN)); + s.sendMessage("§7§m----------------------------------------------------------"); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/LivesCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/LivesCommand.java new file mode 100644 index 0000000..4ef8a2d --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/LivesCommand.java @@ -0,0 +1,156 @@ +package com.prevailpots.hcf.command; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.google.common.collect.ImmutableList; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.Cooldowns; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.deathban.Deathban; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.user.FactionUser; + +public class LivesCommand implements CommandExecutor { + private static final ImmutableList COMPLETIONS; + + static { + COMPLETIONS = ImmutableList.of("enable", "time"); + } + + private final HCF plugin; + + public LivesCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + Player player = null; + if (sender instanceof Player) { + player = (Player) sender; + } + if (player == null && (sender instanceof Player)) + return true; + if (args.length == 3 && (args[0].equalsIgnoreCase("givelives") || args[0].equalsIgnoreCase("give"))) { + OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); + if (!target.hasPlayedBefore()) { + sender.sendMessage(ChatColor.RED + "Player '" + ChatColor.GRAY + args[1] + ChatColor.RED + "' not found."); + return true; + } + Integer amount = Ints.tryParse(args[2]); + if (amount == null) { + printUsage(sender, label); + return true; + } + if (amount <= 0) { + printUsage(sender, label); + return true; + } + int num; + if (sender instanceof Player) { + num = plugin.getUserManager().getUser(((Player) sender).getUniqueId()).getLives(); + } else { + num = 99999; + } + if (amount > num) { + sender.sendMessage(ChatColor.RED + "You tried to send " + ChatColor.BOLD + amount + ChatColor.RED + " lives when you only have " + ChatColor.BOLD + plugin.getUserManager().getUser(((Player) sender).getUniqueId()).getLives()); + return true; + } + if (sender instanceof Player) { + plugin.getUserManager().getUser(((Player) sender).getUniqueId()).takeLives(amount); + } + + plugin.getUserManager().getUser(target.getUniqueId()).addLives(amount); + final int targetLives = plugin.getUserManager().getUser(target.getUniqueId()).getLives(); + int senderLives = 0; + if (sender instanceof Player) { + senderLives = plugin.getUserManager().getUser(((Player) sender).getUniqueId()).getLives(); + } + if (target.isOnline() && Bukkit.getPlayer(target.getUniqueId()) != null) { + Bukkit.getPlayer(target.getUniqueId()).sendMessage(ChatColor.GOLD + sender.getName() + ChatColor.YELLOW + " has sent you " + ChatColor.RED + amount + ChatColor.YELLOW + " lives!"); + Bukkit.getPlayer(target.getUniqueId()).sendMessage(ChatColor.YELLOW + "You now have " + ChatColor.RED + targetLives + ChatColor.YELLOW + " lives."); + } + sender.sendMessage(ChatColor.YELLOW + "You sent " + ChatColor.GOLD + target.getName() + ChatColor.RED + ' ' + amount + ChatColor.YELLOW + " lives!"); + sender.sendMessage(ChatColor.YELLOW + "You now have " + ChatColor.RED + senderLives + ChatColor.YELLOW + " lives."); + return true; + } + if (args.length == 2 && args[0].equalsIgnoreCase("revive")) { + if (!player.hasPermission("alpha.revive")) { + player.sendMessage(ChatColor.RED + "Not really."); + return true; + } + if (Cooldowns.isOnCooldown("diamond_revive_cooldown", player)) { + player.sendMessage(ChatColor.RED + "You are still on cooldown for another " + ChatColor.BOLD.toString() + HCF.getRemaining(Cooldowns.getCooldownForPlayerLong("diamond_revive_cooldown", player), true) + ChatColor.RED + '.'); + return true; + } + final OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); + if (!target.hasPlayedBefore()) { + sender.sendMessage(ChatColor.RED + "Player '" + ChatColor.GRAY + args[1] + ChatColor.RED + "' not found."); + return true; + } + final UUID targetUUID = target.getUniqueId(); + final FactionUser factionTarget = this.plugin.getUserManager().getUser(targetUUID); + final Deathban deathban = factionTarget.getDeathban(); + if (deathban == null || !deathban.isActive()) { + sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned."); + return true; + } + Relation relation; + final int selfLives; + final UUID playerUUID = player.getUniqueId(); + selfLives = plugin.getUserManager().getUser(playerUUID).getLives(); + if (selfLives <= 0) { + sender.sendMessage(ChatColor.RED + "You do not have any lives."); + return true; + } + plugin.getUserManager().getUser(playerUUID).takeLives(1); + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + relation = ((playerFaction == null) ? Relation.ENEMY : playerFaction.getFactionRelation(this.plugin.getFactionManager().getPlayerFaction(targetUUID))); + factionTarget.setDeathban(null); + Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("AlphaBroadcast")).replace("{reviver}", player.getName()).replace("{revived}", target.getName())); + sender.sendMessage(ChatColor.YELLOW + "You have revived " + relation.toChatColour() + target.getName() + ChatColor.YELLOW + '.'); + Cooldowns.addCooldown("diamond_revive_cooldown", player, (int) TimeUnit.HOURS.toSeconds(3)); + return true; + } + if (args.length == 0) { + this.printUsage(sender, label); + return true; + } + OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]); + if (!target.hasPlayedBefore() && !target.isOnline()) { + sender.sendMessage(ChatColor.RED + "Player '" + ChatColor.GRAY + args[0] + ChatColor.RED + "' not found."); + return true; + } + final int targetLives = this.plugin.getUserManager().getUser(target.getUniqueId()).getLives(); + final int targetSoulLives = this.plugin.getUserManager().getUser(target.getUniqueId()).getSouLives(); + sender.sendMessage(ChatColor.BLUE + target.getName() + ChatColor.YELLOW + " lives."); + sender.sendMessage(ChatColor.YELLOW + "Soul-Bound Lives: " + ChatColor.RED + targetSoulLives); + sender.sendMessage(ChatColor.YELLOW + "Lives: " + ChatColor.RED + targetLives); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 1) ? null : Collections.emptyList(); + } + + private void printUsage(final CommandSender sender, final String label) { + if (label.equalsIgnoreCase("alpha")) { + sender.sendMessage(ChatColor.RED + "/" + label + " revive - Revives the targeted player."); + return; + } + sender.sendMessage(ChatColor.RED + "Lives & Revive Help"); + sender.sendMessage(ChatColor.RED + "/" + label + " give - Gives lives to a player."); + sender.sendMessage(ChatColor.RED + "/" + label + " [target] - Shows amount of lives that a payer has."); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/LocationCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/LocationCommand.java new file mode 100644 index 0000000..3cb3a9a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/LocationCommand.java @@ -0,0 +1,41 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.*; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; + +import java.util.Collections; +import java.util.List; + +public class LocationCommand implements CommandExecutor, TabExecutor { + private final HCF plugin; + + public LocationCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " [playerName]"); + return true; + } + Player target = (Player) sender; + final Location location = target.getLocation(); + final Faction factionAt = this.plugin.getFactionManager().getFactionAt(location); + if(factionAt instanceof ClaimableFaction){ + sender.sendMessage(ChatColor.YELLOW + "You are in " + factionAt.getDisplayName(sender) + ChatColor.YELLOW + "'s territory."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "You are in "+ factionAt.getDisplayName(sender)); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 1 && sender.hasPermission(command.getPermission() + ".others")) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/LogoutCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/LogoutCommand.java new file mode 100644 index 0000000..ed11751 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/LogoutCommand.java @@ -0,0 +1,37 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.timer.type.LogoutTimer; + +import java.util.Collections; +import java.util.List; + +public class LogoutCommand implements CommandExecutor, TabExecutor { + private final HCF plugin; + + public LogoutCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final LogoutTimer logoutTimer = this.plugin.getTimerManager().logoutTimer; + if(!logoutTimer.setCooldown(player, player.getUniqueId())) { + sender.sendMessage(ChatColor.RED + "You are already logging out. Current timer: " + HCF.getRemaining(logoutTimer.getRemaining(player), true)); + return true; + } + sender.sendMessage(ChatColor.YELLOW.toString() + ChatColor.BOLD + "You are being logged out."+ChatColor.YELLOW +" Do not move for another "+ChatColor.RED+"30 "+ChatColor.YELLOW +"seconds."); + return true; + } + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/MapKitCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/MapKitCommand.java new file mode 100644 index 0000000..510b58a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/MapKitCommand.java @@ -0,0 +1,20 @@ +package com.prevailpots.hcf.command; + +import net.md_5.bungee.api.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.craftbukkit.libs.org.ibex.nestedvm.Runtime; +import org.bukkit.enchantments.Enchantment; + +import com.prevailpots.hcf.ConfigurationService; + +public class MapKitCommand implements CommandExecutor { + + + @Override + public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { + cs.sendMessage(ChatColor.YELLOW + "The current map kit is: " + ChatColor.GOLD+ "Protection: " + ChatColor.GRAY + ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL) + ChatColor.YELLOW + ", " + org.bukkit.ChatColor.GOLD + "Sharpness: " + ChatColor.GRAY + ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)); + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/MobdropsCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/MobdropsCommand.java new file mode 100644 index 0000000..f14a1c5 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/MobdropsCommand.java @@ -0,0 +1,25 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.user.FactionUser; + +public class MobdropsCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { + if(cs instanceof Player){ + FactionUser user = HCF.getPlugin().getUserManager().getUser(((Player) cs).getUniqueId()); + user.setMobdrops(!user.isMobdrops()); + cs.sendMessage(ChatColor.YELLOW + "You have " + ChatColor.GOLD + (user.isMobdrops() ? "enabled" : "disabled") + ChatColor.YELLOW +" picking up mob drops!"); + }else{ + cs.sendMessage(ChatColor.RED + "Evil console go away!!!"); + return true; + } + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/PexPermissionFixCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/PexPermissionFixCommand.java new file mode 100644 index 0000000..b007364 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/PexPermissionFixCommand.java @@ -0,0 +1,18 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.configuration.MemorySection; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.HCF; + +import java.util.*; + +/** + * Created by TREHOME on 05/14/2016. + */ +public class PexPermissionFixCommand { + //removed as of 12-20-16 +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/PlayerStatsCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/PlayerStatsCommand.java new file mode 100644 index 0000000..f6485ed --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/PlayerStatsCommand.java @@ -0,0 +1,79 @@ +package com.prevailpots.hcf.command; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.customhcf.base.BasePlugin; +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.chat.ClickAction; +import com.customhcf.util.chat.Text; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.user.FactionUser; + +/** + * Created by TREHOME on 01/10/2016. + */ +public class PlayerStatsCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) { + Player player = (Player) cs; + if(args.length == 0){ + player.sendMessage(ChatColor.RED + "Usage: /" +s + " [player]"); + return true; + } + if(args.length == 1) { + if(Bukkit.getPlayer(args[0]) == null){ + if(Bukkit.getOfflinePlayer(args[0]) == null){ + player.sendMessage(ChatColor.YELLOW + "Player named or with UUID '"+ChatColor.YELLOW + args[0] + ChatColor.YELLOW +"' not found"); + return true; + }else{ + sendInformation(player, Bukkit.getOfflinePlayer(args[0])); + return true; + } + }else{ + sendInformation(player, Bukkit.getPlayer(args[0])); + return true; + } + } + return false; + } + public void sendInformation(Player player, OfflinePlayer target) { + FactionUser hcf = HCF.getPlugin().getUserManager().getUser(target.getUniqueId()); + player.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + + if(HCF.getPlugin().getFactionManager().getPlayerFaction(target.getUniqueId()) != null ) { + player.sendMessage(HCF.getPlugin().getFactionManager().getPlayerFaction(target.getUniqueId()).getRelation(player).toChatColour() + target.getName()); + new Text(ChatColor.YELLOW + " Faction: " + HCF.getPlugin().getFactionManager().getPlayerFaction(target.getUniqueId()).getDisplayName(player)).setHoverText(ChatColor.GRAY + "Click to view Faction").setClick(ClickAction.RUN_COMMAND, "/f who "+HCF.getPlugin().getFactionManager().getPlayerFaction(target.getUniqueId()).getName()).send(player); + }else{ + player.sendMessage(ChatColor.RED + target.getName()); + } + + player.sendMessage(ChatColor.YELLOW + " PlayTime: " + ChatColor.YELLOW + DurationFormatUtils.formatDurationWords(BasePlugin.getPlugin().getPlayTimeManager().getTotalPlayTime(target.getUniqueId()), true, true)); + + if(hcf.getDiamondsMined() > 0) { + player.sendMessage(ChatColor.YELLOW + " Diamonds Mined: " + ChatColor.YELLOW + hcf.getDiamondsMined()); + } + + if(hcf.getDeathban() != null) { + new Text(ChatColor.YELLOW + " Deathbanned: " + (hcf.getDeathban().isActive() ? ChatColor.GREEN + "true" : ChatColor.RED + "false")).setHoverText(ChatColor.YELLOW + "Un-Deathbanned at: " + HCF.getRemaining(hcf.getDeathban().getExpiryMillis(), true, true)).send(player); + }else{ + player.sendMessage(ChatColor.YELLOW + " Deathbanned: " + ChatColor.YELLOW + "false" ); + } + + if(hcf.getKills() > 0) { + player.sendMessage(ChatColor.YELLOW + " Kills: " + ChatColor.YELLOW + hcf.getKills()); + } + + if(hcf.getDeaths() > 0) { + player.sendMessage(ChatColor.YELLOW + " Deaths: " + ChatColor.YELLOW + hcf.getDeaths()); + } + player.sendMessage(ChatColor.YELLOW + " Balance: " + ChatColor.YELLOW + HCF.getPlugin().getEconomyManager().getBalance(target.getUniqueId())); + player.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/PvpTimerCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/PvpTimerCommand.java new file mode 100644 index 0000000..7f81fe1 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/PvpTimerCommand.java @@ -0,0 +1,78 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.timer.type.PvpProtectionTimer; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +public class PvpTimerCommand implements CommandExecutor, TabCompleter { + private static final ImmutableList COMPLETIONS; + + static { + COMPLETIONS = ImmutableList.of("enable", "time"); + } + + private final HCF plugin; + + public PvpTimerCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PvpProtectionTimer pvpTimer = this.plugin.getTimerManager().pvpProtectionTimer; + if(args.length < 1) { + this.printUsage(sender, label, pvpTimer); + return true; + } + if(args[0].equalsIgnoreCase("enable") || args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("off")) { + if(pvpTimer.getRemaining(player) > 0L) { + sender.sendMessage(ChatColor.YELLOW + "Your " + pvpTimer.getDisplayName() + ChatColor.YELLOW + " is now disabled."); + pvpTimer.clearCooldown(player); + return true; + } + if(pvpTimer.isPaused(player)) { + player.sendMessage(ChatColor.YELLOW + "You will no longer be legible for your " + pvpTimer.getDisplayName() + ChatColor.YELLOW + " when you leave spawn."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "Your " + pvpTimer.getDisplayName() + ChatColor.YELLOW + " is currently not active."); + return true; + } else { + if(!args[0].equalsIgnoreCase("remaining") && !args[0].equalsIgnoreCase("time") && !args[0].equalsIgnoreCase("left")) { + this.printUsage(sender, label, pvpTimer); + return true; + } + final long remaining = pvpTimer.getRemaining(player); + if(remaining <= 0L) { + sender.sendMessage(ChatColor.YELLOW + "Your " + pvpTimer.getDisplayName() + ChatColor.YELLOW + " is currently not active."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "Your " + pvpTimer.getDisplayName() + ChatColor.YELLOW + " is active for another " + ChatColor.BOLD + HCF.getRemaining(remaining, true, false) + ChatColor.YELLOW + (pvpTimer.isPaused(player) ? " and is currently paused" : "") + '.'); + return true; + } + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 1) ? BukkitUtils.getCompletions(args, PvpTimerCommand.COMPLETIONS) : Collections.emptyList(); + } + + private void printUsage(final CommandSender sender, final String label, final PvpProtectionTimer pvpTimer) { + sender.sendMessage(ChatColor.RED + "/" + label + " enable - Removes your " + pvpTimer.getDisplayName() + ChatColor.RED + "."); + sender.sendMessage(ChatColor.RED + "/" + label + " time - Check remaining " + pvpTimer.getDisplayName() + ChatColor.RED + " time."); + + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/RandomCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/RandomCommand.java new file mode 100644 index 0000000..bdf6223 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/RandomCommand.java @@ -0,0 +1,65 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.base.BasePlugin; +import com.prevailpots.hcf.HCF; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +/** + * Created by HelpMe on 12/9/2015. + */ +public class RandomCommand implements CommandExecutor { + private final HCF plugin; + public RandomCommand(final HCF plugin) { + this.plugin = plugin; + } + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + List players = new ArrayList(); + for (Player players1 : Bukkit.getOnlinePlayers()) { + if (players1.getLocation().getBlockY() < 30) { + if (BasePlugin.getPlugin().getUserManager().getUser(players1.getUniqueId()).isStaffUtil()) { + continue; + } + players.add(players1); + } + players.add(players1); + } + + Collections.shuffle(players); + Random random = new Random(); + Integer randoms = random.nextInt(players.size()); + Player p = players.get(randoms); + if (players.isEmpty()) { + player.sendMessage(ChatColor.RED + "No players mining!"); + return true; + } + if (players == sender){ + return false; + } + if(player.canSee(p) && player.hasPermission(command.getPermission()+".teleport")){ + player.teleport(p); + player.sendMessage(ChatColor.DARK_AQUA+"You've teleported to "+ ChatColor.BLUE +p.getName()); + }else if(player.canSee(p)) { + player.sendMessage(ChatColor.DARK_AQUA+"You've found "+p.getName()); + }else{ + player.sendMessage(ChatColor.RED + "Player not found"); + } + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/ReclaimCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/ReclaimCommand.java new file mode 100644 index 0000000..d96520f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/ReclaimCommand.java @@ -0,0 +1,116 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.base.BasePlugin; +import com.customhcf.base.command.BaseCommand; +import com.customhcf.base.user.BaseUser; +import com.customhcf.base.user.ServerParticipator; +import com.customhcf.util.PersistableLocation; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.HCFHandler; +import com.prevailpots.hcf.deathban.Deathban; +import com.prevailpots.hcf.lives.LivesType; + +import lombok.Getter; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import ru.tehkode.permissions.bukkit.PermissionsEx; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class ReclaimCommand extends BaseCommand { + private HCF hcfPlugin; + private List ranks; + + public ReclaimCommand(HCF hcfPlugin) { + super("reclaim", "Reclaim manager"); + this.hcfPlugin = hcfPlugin; + this.setUsage("/reclaim"); + + ranks = new ArrayList<>(); + + for(String key : hcfPlugin.getReclaimSettingsConfig().getKeys(false)) { + String name = ChatColor.translateAlternateColorCodes('&', hcfPlugin.getReclaimSettingsConfig().getString(key + ".name")); + String rankName = hcfPlugin.getReclaimSettingsConfig().getString(key + ".rankname"); + + List commands = new ArrayList<>(); + if(hcfPlugin.getReclaimSettingsConfig().get(key + ".commands") instanceof List) { + commands.addAll((Collection) hcfPlugin.getReclaimSettingsConfig().get(key + ".commands")); + } else { + commands.addAll(Arrays.asList((String[]) hcfPlugin.getReclaimSettingsConfig().get(key + ".commands"))); + } + + this.ranks.add(new Rank(name, rankName, commands)); + Bukkit.getLogger().info("Loaded rank " + rankName); + } + } + + @Override + public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { + Player player = (Player) cs; + + if(HCF.getPlugin().getReclaimConfig().contains(player.getUniqueId().toString())) { + player.sendMessage(ChatColor.RED + "You have already reclaimed."); + return true; + } + + Rank shitToApply = null; + + String playerRank = PermissionsEx.getPermissionManager().getUser(player).getGroupNames()[0]; + for(Rank rank : ranks) { + if(rank.getRankName().equalsIgnoreCase(playerRank)) { + shitToApply = rank; + break; + } + } + + if(shitToApply == null) { + player.sendMessage(ChatColor.RED + "No rank to reclaim."); + return true; + } + + shitToApply.apply(player); + + try { + hcfPlugin.getReclaimConfig().set(player.getUniqueId().toString(), 1); + hcfPlugin.getReclaimConfig().save(hcfPlugin.reclaimFile); + } catch (Exception e) { + e.printStackTrace(); + } + + return true; + } + + @Override + public boolean isPlayerOnlyCommand() { + return true; + } + + private class Rank { + @Getter private String name, rankName; + @Getter private List commandsToRun; + + public Rank(String name, String rankName, List commandsToRun) { + this.name = name; + this.rankName = rankName; + this.commandsToRun = commandsToRun; + } + + public void apply(Player player) { + if(commandsToRun.size() > 0) { + for(String cmd : commandsToRun) { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd.replace("%PLAYER%", player.getName()).replace("%RANK%", rankName)); + } + Bukkit.getLogger().info("Applied rank " + name + " to player " + player.getName() + "."); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/RefundCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/RefundCommand.java new file mode 100644 index 0000000..361aa77 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/RefundCommand.java @@ -0,0 +1,76 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.ItemBuilder; +import com.customhcf.util.Menu; +import com.google.common.base.MoreObjects; +import com.prevailpots.hcf.listener.DeathListener; + +import net.md_5.bungee.api.ChatColor; +import org.apache.commons.lang3.StringUtils; +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +/** + * Created by TREHOME on 10/28/2015. + */ +public class RefundCommand implements CommandExecutor { + + + @Override + public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) { + String Usage = ChatColor.RED + "/" + s + " "; + if(!(cs instanceof Player)) { + cs.sendMessage(ChatColor.RED + "You must be a player"); + return true; + } + Player p = (Player) cs; + if(args.length < 2) { + cs.sendMessage(Usage); + return true; + } + if(Bukkit.getPlayer(args[0]) == null) { + p.sendMessage(ChatColor.RED + "Player must be online"); + return true; + } + Player target = Bukkit.getPlayer(args[0]); + if(DeathListener.PlayerInventoryContents.containsKey(target.getUniqueId())) { + Menu menu = new Menu("Refund items", 6); + for(ItemStack itemStack : DeathListener.PlayerInventoryContents.get(target.getUniqueId())){ + menu.addItem(itemStack); + } + int startArmor = 36; + for(ItemStack armor : DeathListener.PlayerArmorContents.get(target.getUniqueId())){ + menu.setItem(startArmor, MoreObjects.firstNonNull(armor, new ItemStack(Material.AIR))); + startArmor++; + } + for(ItemStack contents : DeathListener.PlayerInventoryContents.get(target.getUniqueId())){ + menu.addItem(contents); + } + menu.setItem(45, new ItemBuilder(Material.STAINED_GLASS_PANE).displayName(ChatColor.GREEN + "Refund items").data((short) DyeColor.GREEN.getWoolData()).build()); + menu.setGlobalAction((player, inventory, itemStack, i, inventoryAction) -> { + if(itemStack.getTypeId() == 160){ + target.getInventory().setContents(DeathListener.PlayerInventoryContents.get(target.getUniqueId())); + target.getInventory().setArmorContents(DeathListener.PlayerArmorContents.get(target.getUniqueId())); + DeathListener.PlayerInventoryContents.remove(target.getUniqueId()); + DeathListener.PlayerArmorContents.remove(target.getUniqueId()); + return; + } + }); + menu.showMenu(p); + p.sendMessage(ChatColor.GRAY + "If you want to remove an item they received, you can invsee them and remove it!"); + return true; + } else { + p.sendMessage(ChatColor.RED + "Player was already refunded items or there was a restart"); + return true; + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/RemoveTabCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/RemoveTabCommand.java new file mode 100644 index 0000000..da63e69 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/RemoveTabCommand.java @@ -0,0 +1,41 @@ +package com.prevailpots.hcf.command; + +import java.util.ArrayList; +import java.util.Collection; + +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import com.alexandeh.kraken.Kraken; +import com.alexandeh.kraken.tab.PlayerTab; +import com.alexandeh.kraken.tab.event.PlayerTabRemoveEvent; +import com.prevailpots.hcf.HCF; + +public class RemoveTabCommand implements CommandExecutor { + + + + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + if(!(commandSender instanceof Player)) { + return true; + } + Player player = (Player)commandSender; + + new BukkitRunnable() { + @Override + public void run() { + //HCF.getPlugin().getTabApi().onPlaryerQuitEvent(player); + command.tabCompleteTimings.reset(); + player.sendMessage("§eYou have §6§lremoved §eyour custom tab!"); + } + }.runTaskLaterAsynchronously(HCF.getPlugin(), 4L); + + return true; + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/SOTWCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/SOTWCommand.java new file mode 100644 index 0000000..32f4ab4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/SOTWCommand.java @@ -0,0 +1,35 @@ +package com.prevailpots.hcf.command; + +import net.md_5.bungee.api.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import com.prevailpots.hcf.HCF; + +import java.util.concurrent.TimeUnit; + +/** + * Created by HelpMe on 12/11/2015. + */ +public class SOTWCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) { + if(args.length == 1){ + if(args[0].equalsIgnoreCase("start")){ + HCF.getPlugin().getTimerManager().sotw.setRemaining(TimeUnit.HOURS.toMillis(2), true); + HCF.getPlugin().getTimerManager().sotw.setPaused(false); + cs.sendMessage(ChatColor.YELLOW + "SOTW started."); + }else if(args[0].equalsIgnoreCase("end")) { + HCF.getPlugin().getTimerManager().sotw.clearCooldown(); + cs.sendMessage(ChatColor.YELLOW + "SOTW stopped."); + }else if(args[0].equalsIgnoreCase("pause")){ + HCF.getPlugin().getTimerManager().sotw.setPaused(true); + cs.sendMessage(ChatColor.YELLOW + "SOTW paused."); + }else{ + cs.sendMessage(ChatColor.RED +"Usage: /"+s+" start|end|pause"); + } + } + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/ServerTimeCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/ServerTimeCommand.java new file mode 100644 index 0000000..378828d --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/ServerTimeCommand.java @@ -0,0 +1,25 @@ +package com.prevailpots.hcf.command; + +import org.apache.commons.lang3.time.FastDateFormat; +import org.bukkit.ChatColor; +import org.bukkit.command.*; + +import com.prevailpots.hcf.ConfigurationService; + +import java.util.Collections; +import java.util.List; + +public class ServerTimeCommand implements CommandExecutor { + private static final FastDateFormat FORMAT; + + static { + FORMAT = FastDateFormat.getInstance("E MMM dd h:mm:ssa z yyyy", ConfigurationService.SERVER_TIME_ZONE); + } + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + sender.sendMessage(ChatColor.YELLOW + "It is " + ChatColor.GOLD + ServerTimeCommand.FORMAT.format(System.currentTimeMillis()) + " EST" +ChatColor.YELLOW + '.'); + return true; + } + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/SetBorderCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/SetBorderCommand.java new file mode 100644 index 0000000..60ec31b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/SetBorderCommand.java @@ -0,0 +1,63 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.google.common.base.Enums; +import com.google.common.base.Optional; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; + +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.*; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class SetBorderCommand implements CommandExecutor, TabExecutor { + private static final int MIN_SET_SIZE = 50; + private static final int MAX_SET_SIZE = 25000; + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + " "); + return true; + } + final Optional optional = (Optional) Enums.getIfPresent((Class) World.Environment.class, args[0]); + if(!optional.isPresent()) { + sender.sendMessage(ChatColor.RED + "Environment '" + args[0] + "' not found."); + return true; + } + final Integer amount = Ints.tryParse(args[1]); + if(amount == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a valid number."); + return true; + } + if(amount < MIN_SET_SIZE) { + sender.sendMessage(ChatColor.RED + "Minimum border size is " + 50 + 100 + '.'); + return true; + } + if(amount > MAX_SET_SIZE) { + sender.sendMessage(ChatColor.RED + "Maximum border size is " + 25000 + '.'); + return true; + } + final World.Environment environment = optional.get(); + HCF.getPlugin().getHcfHandler().setWorldBorder(environment, amount); + + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set border size of environment " + ChatColor.GOLD + environment.name() + ChatColor.YELLOW + " to " +ChatColor.GOLD+ amount + ChatColor.YELLOW + '.'); + return true; + } + + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 1) { + return Collections.emptyList(); + } + final World.Environment[] values = World.Environment.values(); + final List results = new ArrayList(values.length); + for(final World.Environment environment : values) { + results.add(environment.name()); + } + return BukkitUtils.getCompletions(args, results); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/SpawnCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/SpawnCommand.java new file mode 100644 index 0000000..2cbe066 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/SpawnCommand.java @@ -0,0 +1,63 @@ +package com.prevailpots.hcf.command; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.*; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +public class SpawnCommand implements CommandExecutor, TabCompleter { + private static final long KIT_MAP_TELEPORT_DELAY; + + static { + KIT_MAP_TELEPORT_DELAY = TimeUnit.SECONDS.toMillis(10L); + } + + final HCF plugin; + + public SpawnCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + + final Player player = (Player) sender; + World world = player.getWorld(); + Location spawn = world.getSpawnLocation().clone().add(0, 1, 0); + if(!sender.hasPermission(command.getPermission() + ".teleport")){ + plugin.getTimerManager().teleportTimer.teleport(player, Bukkit.getWorld("world").getSpawnLocation(), KIT_MAP_TELEPORT_DELAY, ChatColor.YELLOW + "Teleporting to spawn in "+ 15 + " seconds.", PlayerTeleportEvent.TeleportCause.COMMAND); + return true; + } + if(args.length > 0) { + world = Bukkit.getWorld(args[0]); + if(world == null) { + sender.sendMessage(ChatColor.RED + "There is not a world named " + args[0] + '.'); + return true; + } + spawn = world.getSpawnLocation().clone().add(0, 1, 0); + } + player.teleport(spawn, PlayerTeleportEvent.TeleportCause.COMMAND); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 1 || !sender.hasPermission(command.getPermission() + ".teleport")) { + return Collections.emptyList(); + } + return BukkitUtils.getCompletions(args, Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList())); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/TabCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/TabCommand.java new file mode 100644 index 0000000..6d8841e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/TabCommand.java @@ -0,0 +1,38 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.command.*; +import org.bukkit.entity.*; +import org.bukkit.*; +import org.bukkit.event.inventory.*; + +import com.prevailpots.hcf.user.GUIManager; + +import org.bukkit.event.*; + +public class TabCommand implements CommandExecutor, Listener +{ + public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) { + final Player p = (Player)sender; + p.openInventory(GUIManager.GUI); + p.sendMessage(ChatColor.YELLOW + "Opening the " + ChatColor.GOLD + "Tab Managment " + ChatColor.GRAY + " Click Gui!"); + return false; + } + + @EventHandler + public void onPlayerClick(final InventoryClickEvent e) { + final Player p = (Player)e.getWhoClicked(); + if (e.getCurrentItem().getItemMeta() == null) { + return; + } + if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Disable")) { + e.setCancelled(true); + p.performCommand("removetab"); + e.getWhoClicked().closeInventory(); + } + if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Enable")) { + e.setCancelled(true); + p.performCommand("reloadtab"); + e.getWhoClicked().closeInventory(); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/ToggleDonorOnly.java b/PrevailHCF/src/com/prevailpots/hcf/command/ToggleDonorOnly.java new file mode 100644 index 0000000..82efe5c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/ToggleDonorOnly.java @@ -0,0 +1,21 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import com.prevailpots.hcf.HCF; + +/** + * Created by TREHOME on 05/13/2016. + */ +public class ToggleDonorOnly implements CommandExecutor { + + @Override + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + HCF.getPlugin().getHcfHandler().setDonorOnly(!HCF.getPlugin().getHcfHandler().isDonorOnly()); + Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Server is " + (!HCF.getPlugin().getHcfHandler().isDonorOnly() ? (ChatColor.RED.toString() + ChatColor.BOLD + "not") : (ChatColor.GREEN.toString() + ChatColor.BOLD + "now")) + ChatColor.GREEN+ " in donor only mode."); + return true; + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/command/ToggleEndCommand.java b/PrevailHCF/src/com/prevailpots/hcf/command/ToggleEndCommand.java new file mode 100644 index 0000000..94d4d7c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/command/ToggleEndCommand.java @@ -0,0 +1,32 @@ +package com.prevailpots.hcf.command; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.*; + +import com.prevailpots.hcf.HCF; + +import java.util.Collections; +import java.util.List; + +/** + * Created by TREHOME on 01/28/2016. + */ +public class ToggleEndCommand implements CommandExecutor, TabExecutor { + private final HCF plugin; + + public ToggleEndCommand(final HCF plugin) { + this.plugin = plugin; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + final boolean newMode = !plugin.getHcfHandler().isEndEnabled(); + plugin.getHcfHandler().setEndEnabled(newMode); + Bukkit.broadcastMessage(ChatColor.YELLOW + "The End is now " + (newMode ? ChatColor.RED + "closed" : ChatColor.GREEN + "open") + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/crowbar/Crowbar.java b/PrevailHCF/src/com/prevailpots/hcf/crowbar/Crowbar.java new file mode 100644 index 0000000..2c772ab --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/crowbar/Crowbar.java @@ -0,0 +1,126 @@ +package com.prevailpots.hcf.crowbar; + + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Arrays; +import java.util.List; + +public class Crowbar { + + public static final int MAX_SPAWNER_USES = 1; + public static final int MAX_END_FRAME_USES = 6; + public static final Material CROWBAR_TYPE = Material.DIAMOND_HOE; + public static final String CROWBAR_NAME = ChatColor.AQUA.toString() + "Crowbar"; + public static final String SPAWNER_USE_TAG = "Spawner Uses"; + public static final String END_FRAME_USE_TAG = "End Frame Uses"; + + private static final String LORE_FORMAT = ChatColor.GRAY + "%1$s: " + ChatColor.YELLOW + "%2$s/%3$s"; + + private int endFrameUses; + private int spawnerUses; + + private final ItemStack stack; + private boolean needsMetaUpdate; + + public Crowbar() { + this(MAX_SPAWNER_USES, MAX_END_FRAME_USES); + } + + public Crowbar(int spawnerUses, int endFrameUses) { + Preconditions.checkArgument(spawnerUses > 0 || endFrameUses > 0, "Cannot create a crowbar with empty uses"); + this.stack = new ItemStack(CROWBAR_TYPE, 1); + this.setSpawnerUses(Math.min(MAX_SPAWNER_USES, spawnerUses)); + this.setEndFrameUses(Math.min(MAX_END_FRAME_USES, endFrameUses)); + } + + public static Optional fromStack(ItemStack stack) { + if (stack == null || !stack.hasItemMeta()) { + return Optional.absent(); + } + + ItemMeta meta = stack.getItemMeta(); + if (!meta.hasDisplayName() || !meta.hasLore() || !meta.getDisplayName().equals(CROWBAR_NAME)) { + return Optional.absent(); + } + + Crowbar crowbar = new Crowbar(); + List loreList = meta.getLore(); + for (String lore : loreList) { + lore = ChatColor.stripColor(lore); + int length = lore.length(); + for (int i = 0; i < length; i++) { + char character = lore.charAt(i); + if (Character.isDigit(character)) { + int amount = Integer.parseInt(String.valueOf(character)); + if (lore.startsWith(END_FRAME_USE_TAG)) { + crowbar.setEndFrameUses(amount); + break; + } else if (lore.startsWith(SPAWNER_USE_TAG)) { + crowbar.setSpawnerUses(amount); + break; + } + } + } + } + + return Optional.of(crowbar); + } + + public int getEndFrameUses() { + return endFrameUses; + } + + public void setEndFrameUses(int uses) { + if (this.endFrameUses != uses) { + this.endFrameUses = Math.min(MAX_END_FRAME_USES, uses); + this.needsMetaUpdate = true; + } + } + + public int getSpawnerUses() { + return spawnerUses; + } + + public void setSpawnerUses(int uses) { + if (this.spawnerUses != uses) { + this.spawnerUses = Math.min(MAX_SPAWNER_USES, uses); + this.needsMetaUpdate = true; + } + } + + public ItemStack getItemIfPresent() { + Optional optional = toItemStack(); + return optional.isPresent() ? optional.get() : new ItemStack(Material.AIR, 1); + } + + + public Optional toItemStack() { + if (needsMetaUpdate) { + double maxDurability = CROWBAR_TYPE.getMaxDurability(); + double curDurability = maxDurability; + double increment = curDurability / ((double) Crowbar.MAX_SPAWNER_USES + Crowbar.MAX_END_FRAME_USES); + curDurability -= increment * ((double) spawnerUses + endFrameUses); + if (Math.abs(curDurability - maxDurability) == 0) { + return Optional.absent(); + } + + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(CROWBAR_NAME); + meta.setLore(Arrays.asList( + String.format(LORE_FORMAT, SPAWNER_USE_TAG, spawnerUses, MAX_SPAWNER_USES), + String.format(LORE_FORMAT, END_FRAME_USE_TAG, endFrameUses, MAX_END_FRAME_USES))); + + stack.setItemMeta(meta); + stack.setDurability((short) curDurability); + needsMetaUpdate = false; + } + + return Optional.of(stack); + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/deathban/Deathban.java b/PrevailHCF/src/com/prevailpots/hcf/deathban/Deathban.java new file mode 100644 index 0000000..581b682 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/deathban/Deathban.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.deathban; + +import com.customhcf.util.PersistableLocation; +import com.google.common.collect.Maps; +import org.bukkit.Location; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import java.util.Map; + +public class Deathban implements ConfigurationSerializable { + private final String reason; + private final long creationMillis; + private final long expiryMillis; + private final PersistableLocation deathPoint; + + public Deathban(String reason, long duration, PersistableLocation deathPoint) { + this.reason = reason; + long millis = System.currentTimeMillis(); + this.creationMillis = millis; + this.expiryMillis = millis + duration; + this.deathPoint = deathPoint; + } + + public Deathban(Map map) { + this.reason = (String) map.get("reason"); + this.creationMillis = Long.parseLong((String) map.get("creationMillis")); + this.expiryMillis = Long.parseLong((String) map.get("expiryMillis")); + Object object = map.get("deathPoint"); + if(object != null) { + this.deathPoint = (PersistableLocation) object; + } else { + this.deathPoint = null; + } + + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + map.put("reason", this.reason); + map.put("creationMillis", Long.toString(this.creationMillis)); + map.put("expiryMillis", Long.toString(this.expiryMillis)); + if(this.deathPoint != null) { + map.put("deathPoint", this.deathPoint); + } + return map; + } + + public boolean isActive() { + return this.getRemaining() > 0L; + } + + public String getReason() { + return this.reason; + } + + public long getCreationMillis() { + return this.creationMillis; + } + + public Long getExpiryMillis() { + return this.expiryMillis; + } + + public Long getRemaining() { + return this.expiryMillis - System.currentTimeMillis(); + } + + public Location getDeathPoint() { + return (this.deathPoint == null) ? null : this.deathPoint.getLocation(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanListener.java b/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanListener.java new file mode 100644 index 0000000..de3601c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanListener.java @@ -0,0 +1,121 @@ +package com.prevailpots.hcf.deathban; + +import java.util.UUID; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; + +import com.google.common.cache.CacheBuilder; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.user.FactionUser; + +public class DeathbanListener implements Listener { + private static final long LIFE_USE_DELAY_MILLIS; + private static final String LIFE_USE_DELAY_WORDS; + private static final String DEATH_BAN_BYPASS_PERMISSION = "deathban.bypass"; + static { + LIFE_USE_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(30L); + LIFE_USE_DELAY_WORDS = DurationFormatUtils.formatDurationWords(DeathbanListener.LIFE_USE_DELAY_MILLIS, true, true); + } + + private final ConcurrentMap lastAttemptedJoinMap; + private final HCF plugin; + + public DeathbanListener(final HCF plugin) { + this.plugin = plugin; + this.lastAttemptedJoinMap = CacheBuilder.newBuilder().expireAfterWrite(DeathbanListener.LIFE_USE_DELAY_MILLIS, TimeUnit.MILLISECONDS).build().asMap(); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onPlayerLogin(final PlayerLoginEvent event) { + final Player player = event.getPlayer(); + final FactionUser user = this.plugin.getUserManager().getUser(player.getUniqueId()); + final Deathban deathban = user.getDeathban(); + if(deathban == null || !deathban.isActive()) { + return; + } + if(player.hasPermission(DEATH_BAN_BYPASS_PERMISSION)) { + user.setDeathban(null); + new LoginMessageRunnable(player, ChatColor.RED + "You would be death-banned for " + deathban.getReason() + ChatColor.RED + ", but you have access to bypass.").runTask((Plugin) this.plugin); + return; + } + if(this.plugin.getEotwHandler().isEndOfTheWorld()) { + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.RED + "Deathbanned for the entirety of the map due to EOTW.\nCome back for SOTW."); + } else { + final UUID uuid = player.getUniqueId(); + int lives = this.plugin.getUserManager().getUser(uuid).getLives(); + int soulLives = this.plugin.getUserManager().getUser(uuid).getSouLives(); + final String formattedDuration = HCF.getRemaining(deathban.getRemaining(), true, false); + final String reason = deathban.getReason(); + final String prefix = ChatColor.RED + "You are currently death-banned" + ((reason != null) ? (" for " + reason + ".\n") : ".") + ChatColor.YELLOW + formattedDuration + " remaining.\n" + ChatColor.RED + "You currently have " + ((lives <= 0) ? "no" : lives) + " lives."; + if(lives > 0 || soulLives > 0) { + final long millis = System.currentTimeMillis(); + final Long lastAttemptedJoinMillis = (Long) this.lastAttemptedJoinMap.get(uuid); + if(lastAttemptedJoinMillis != null && lastAttemptedJoinMillis - System.currentTimeMillis() < DeathbanListener.LIFE_USE_DELAY_MILLIS) { + this.lastAttemptedJoinMap.remove(uuid); + user.setDeathban(null); + Integer whichLives = Math.max(lives, soulLives); + if(whichLives == lives) { + lives = plugin.getUserManager().getUser(uuid).takeLives(1); + event.setResult(PlayerLoginEvent.Result.ALLOWED); + new LoginMessageRunnable(player, ChatColor.YELLOW + "You have used a life bypass your death. You now have " + ChatColor.GOLD + lives + ChatColor.YELLOW + " lives.").runTask((Plugin) this.plugin); + }else{ + lives = plugin.getUserManager().getUser(uuid).takeSoulLives(1); + event.setResult(PlayerLoginEvent.Result.ALLOWED); + new LoginMessageRunnable(player, ChatColor.YELLOW + "You have used a soul life to bypass your death. You now have " + ChatColor.GOLD + lives + ChatColor.YELLOW + " soul lives.").runTask((Plugin) this.plugin); + } + } else { + this.lastAttemptedJoinMap.put(uuid, millis + DeathbanListener.LIFE_USE_DELAY_MILLIS); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, prefix + ChatColor.GOLD + "\n\n" + "You may use a life by reconnecting within " + ChatColor.YELLOW + DeathbanListener.LIFE_USE_DELAY_WORDS + ChatColor.YELLOW + '.'); + } + return; + } + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.RED + "Still deathbanned for " + formattedDuration + ": " + ChatColor.GOLD + deathban.getReason() + ChatColor.RED + '.' + "\nYou can purchase lives at " + plugin.getConfig().get("DonateLink")); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) + public void onPlayerDeath(final PlayerDeathEvent event) { + final Player player = event.getEntity(); + final Deathban deathban = this.plugin.getDeathbanManager().applyDeathBan(player, event.getDeathMessage()); + final String durationString = HCF.getRemaining(deathban.getRemaining(), true, false); + new BukkitRunnable() { + public void run() { + if (DeathbanListener.this.plugin.getEotwHandler().isEndOfTheWorld()) { + player.kickPlayer(ChatColor.RED + "You died during EOTW."); + } else { + player.kickPlayer(ChatColor.RED + "Deathbanned for " + durationString + ": " + ChatColor.YELLOW + deathban.getReason()); + } + } + }.runTaskLater((Plugin) this.plugin, 1L); + if (player.hasPermission(DEATH_BAN_BYPASS_PERMISSION)) { + player.teleport(Bukkit.getWorld("world").getSpawnLocation()); + player.sendMessage(ChatColor.RED + "You've been teleported to spawn due to death."); + } + } + + private static class LoginMessageRunnable extends BukkitRunnable { + private final Player player; + private final String message; + + public LoginMessageRunnable(final Player player, final String message) { + this.player = player; + this.message = message; + } + + public void run() { + this.player.sendMessage(this.message); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanManager.java b/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanManager.java new file mode 100644 index 0000000..014f44f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/deathban/DeathbanManager.java @@ -0,0 +1,21 @@ +package com.prevailpots.hcf.deathban; + +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.lives.LivesType; + +import java.util.HashMap; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public interface DeathbanManager { + long MAX_DEATHBAN_TIME = TimeUnit.HOURS.toMillis(8L); + + + long getDeathBanMultiplier(Player p0); + + Deathban applyDeathBan(Player p0, String p1); + + Deathban applyDeathBan(UUID p0, Deathban p1); + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.java b/PrevailHCF/src/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.java new file mode 100644 index 0000000..59d34da --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/deathban/FlatFileDeathbanManager.java @@ -0,0 +1,117 @@ +package com.prevailpots.hcf.deathban; + +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import com.customhcf.util.PersistableLocation; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; + +public class FlatFileDeathbanManager implements DeathbanManager { + private final HCF plugin; + private static final String DEATH_BAN_BYPASS_PERMISSION = "deathban.bypass"; + + public FlatFileDeathbanManager(final HCF plugin) { + this.plugin = plugin; + } + + + @Override + public long getDeathBanMultiplier(final Player player) { + for (int i = 5; i < TimeUnit.MILLISECONDS.toSeconds(DeathbanManager.MAX_DEATHBAN_TIME); i++) { + if (player.hasPermission("deathban.seconds." + i)) { + return i * 1000; + } + } + return plugin.getHcfHandler().getDefaultDeathban(); + } + + private final String BUILDER = "deathban.builder"; + private final String BRONZE = "deathban.bronze"; + private final String IRON = "deathban.iron"; + private final String PLATINUM = "deathban.platinum"; + private final String POISON = "deathban.poison"; + private final String GOLD = "deathban.gold"; + private final String GUARDIAN = "deathban.guardian"; + private final String PREVAIL = "deathban.prevail"; + private final String YOUTUBE = "deathban.youtube"; + private final String FAMOUS = "deathban.famous"; + + @Override + public Deathban applyDeathBan(final Player player, final String reason) { + final Location location = player.getLocation(); + final Faction factionAt = this.plugin.getFactionManager().getFactionAt(location); + long duration = getDeathBanMultiplier(player); + if (factionAt.isSafezone()) { + duration = 0; + } + if (player.hasPermission(DEATH_BAN_BYPASS_PERMISSION)) { + return null; + } + + if(player.hasPermission(BUILDER)) { + duration = TimeUnit.HOURS.toMillis(1); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(BRONZE)) { + duration = TimeUnit.HOURS.toMillis(2); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(IRON)) { + duration = TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(PLATINUM)) { + duration = TimeUnit.HOURS.toMillis(1); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(POISON)) { + duration = TimeUnit.MINUTES.toMillis(30); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(GOLD)) { + duration = TimeUnit.MINUTES.toMillis(20); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(GUARDIAN)) { + duration = TimeUnit.MINUTES.toMillis(10); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(PREVAIL)) { + duration = TimeUnit.MINUTES.toMillis(5); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(YOUTUBE)) { + duration = TimeUnit.HOURS.toMillis(1); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + if(player.hasPermission(FAMOUS)) { + duration = TimeUnit.MINUTES.toMillis(30); + return applyDeathBan(player.getUniqueId(), new Deathban(reason, Math.min(MAX_DEATHBAN_TIME, duration), new PersistableLocation(location))); + } + + return applyDeathBan(player.getUniqueId(), new Deathban(reason, TimeUnit.HOURS.toMillis(2), new PersistableLocation(location))); + } + + @Override + public Deathban applyDeathBan(final UUID uuid, final Deathban deathban) { + this.plugin.getUserManager().getUser(uuid).setDeathban(deathban); + return deathban; + } + + + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/FactionExecutor.java b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionExecutor.java new file mode 100644 index 0000000..845da2c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionExecutor.java @@ -0,0 +1,83 @@ +package com.prevailpots.hcf.faction; + +import com.customhcf.util.command.ArgumentExecutor; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.argument.*; +import com.prevailpots.hcf.faction.argument.staff.*; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class FactionExecutor extends ArgumentExecutor { + private final CommandArgument helpArgument; + + public FactionExecutor(final HCF plugin) { + super("faction"); + addArgument(new FactionTPArgument(plugin)); + addArgument(new FactionPunishArgument(plugin)); + addArgument(new FactionLockArgument(plugin)); + addArgument(new FactionManageArgument(plugin)); + addArgument(new FactionAcceptArgument(plugin)); + addArgument(new FactionAllyArgument(plugin)); + addArgument(new FactionChatArgument(plugin)); + addArgument(new FactionChatSpyArgument(plugin)); + addArgument(new FactionClaimArgument(plugin)); + addArgument(new FactionClaimForArgument(plugin)); + addArgument(new FactionClaimsArgument(plugin)); + addArgument(new FactionCoLeaderArgument(plugin)); + addArgument(new FactionClearClaimsArgument(plugin)); + addArgument(new FactionCreateArgument(plugin)); + addArgument(new FactionAnnouncementArgument(plugin)); + addArgument(new FactionDemoteArgument(plugin)); + addArgument(new FactionDisbandArgument(plugin)); + addArgument(new FactionSetDtrRegenArgument(plugin)); + addArgument(new FactionDepositArgument(plugin)); + addArgument(new FactionWithdrawArgument(plugin)); + addArgument(new FactionForceJoinArgument(plugin)); + addArgument(new FactionForceLeaderArgument(plugin)); + addArgument(new FactionForcePromoteArgument(plugin)); + addArgument(this.helpArgument = new FactionHelpArgument(this)); + addArgument(new FactionHomeArgument(this, plugin)); + addArgument(new FactionInviteArgument(plugin)); + addArgument(new FactionInvitesArgument(plugin)); + addArgument(new FactionKickArgument(plugin)); + addArgument(new FactionLeaderArgument(plugin)); + addArgument(new FactionLeaveArgument(plugin)); + addArgument(new FactionListArgument(plugin)); + addArgument(new FactionMapArgument(plugin)); + addArgument(new FactionMessageArgument(plugin)); + addArgument(new FactionOpenArgument(plugin)); + addArgument(new FactionVersionArgument()); + addArgument(new FactionRemoveArgument(plugin)); + addArgument(new FactionRenameArgument(plugin)); + addArgument(new FactionPromoteArgument(plugin)); + addArgument(new FactionSetDtrArgument(plugin)); + addArgument(new FactionSetDeathbanMultiplierArgument(plugin)); + addArgument(new FactionSetHomeArgument(plugin)); + addArgument(new FactionShowArgument(plugin)); + addArgument(new FactionStuckArgument(plugin)); + addArgument(new FactionUnclaimArgument(plugin)); + addArgument(new FactionUnallyArgument(plugin)); + addArgument(new FactionUninviteArgument(plugin)); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 1) { + this.helpArgument.onCommand(sender, command, label, args); + return true; + } + final CommandArgument argument = this.getArgument(args[0]); + if(argument != null) { + final String permission = argument.getPermission(); + if(permission == null || sender.hasPermission(permission)) { + argument.onCommand(sender, command, label, args); + return true; + } + } + this.helpArgument.onCommand(sender, command, label, args); + return true; + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/FactionManager.java b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionManager.java new file mode 100644 index 0000000..586b71c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionManager.java @@ -0,0 +1,59 @@ +package com.prevailpots.hcf.faction; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.command.CommandSender; + +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import java.util.Collection; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public interface FactionManager { + long MAX_DTR_REGEN_MILLIS = TimeUnit.HOURS.toMillis(3L); + String MAX_DTR_REGEN_WORDS = DurationFormatUtils.formatDurationWords(FactionManager.MAX_DTR_REGEN_MILLIS, true, true); + Map getFactionNameMap(); + + + Collection getFactions(); + + Collection getClaimableFactions(); + + Collection getPlayerFactions(); + + Claim getClaimAt(Location p0); + + Claim getClaimAt(World p0, int p1, int p2); + + Faction getFactionAt(Location p0); + + Faction getFactionAt(Block p0); + + Faction getFactionAt(World p0, int p1, int p2); + + Faction getFaction(String p0); + + Faction getFaction(UUID p0); + + PlayerFaction getContainingPlayerFaction(String p0); + + PlayerFaction getPlayerFaction(UUID p0); + + Faction getContainingFaction(String p0); + + + boolean createFaction(Faction p0, CommandSender p1); + + boolean removeFaction(Faction p0, CommandSender p1); + + void reloadFactionData(); + + void saveFactionData(); +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/FactionMember.java b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionMember.java new file mode 100644 index 0000000..55ebe24 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/FactionMember.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.faction; + +import com.google.common.base.Enums; +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.struct.Role; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.entity.Player; + +import java.util.Map; +import java.util.UUID; + +public class FactionMember implements ConfigurationSerializable { + private final UUID uniqueID; + private ChatChannel chatChannel; + private Role role; + + public FactionMember(final Player player, final ChatChannel chatChannel, final Role role) { + this.uniqueID = player.getUniqueId(); + this.chatChannel = chatChannel; + this.role = role; + } + + public FactionMember(final Map map) { + this.uniqueID = UUID.fromString((String) map.get("uniqueID")); + this.chatChannel = (ChatChannel) Enums.getIfPresent((Class) ChatChannel.class, (String) map.get("chatChannel")).or((Object) ChatChannel.PUBLIC); + this.role = (Role) Enums.getIfPresent((Class) Role.class, (String) map.get("role")).or((Object) Role.MEMBER); + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + map.put("uniqueID", this.uniqueID.toString()); + map.put("chatChannel", this.chatChannel.name()); + map.put("role", this.role.name()); + return map; + } + + public String getName() { + final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(this.uniqueID); + return (offlinePlayer.hasPlayedBefore() || offlinePlayer.isOnline()) ? offlinePlayer.getName() : null; + } + + public UUID getUniqueId() { + return this.uniqueID; + } + + public ChatChannel getChatChannel() { + return this.chatChannel; + } + + public void setChatChannel(final ChatChannel chatChannel) { + Preconditions.checkNotNull((Object) chatChannel, (Object) "ChatChannel cannot be null"); + this.chatChannel = chatChannel; + } + + public Role getRole() { + return this.role; + } + + public void setRole(final Role role) { + this.role = role; + } + + public Player toOnlinePlayer() { + return Bukkit.getPlayer(this.uniqueID); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/FlatFileFactionManager.java b/PrevailHCF/src/com/prevailpots/hcf/faction/FlatFileFactionManager.java new file mode 100644 index 0000000..001c63b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/FlatFileFactionManager.java @@ -0,0 +1,334 @@ +package com.prevailpots.hcf.faction; + + +import com.customhcf.util.Config; +import com.customhcf.util.JavaUtils; +import com.customhcf.util.cuboid.CoordinatePair; +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.event.*; +import com.prevailpots.hcf.faction.event.cause.ClaimChangeCause; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.*; +import com.prevailpots.hcf.kothgame.faction.GlowstoneFaction; + +import org.apache.commons.collections4.map.CaseInsensitiveMap; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.MemorySection; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +public class FlatFileFactionManager implements Listener, FactionManager { + private final WarzoneFaction warzone; + private final WildernessFaction wilderness; + private final Map claimPositionMap = new HashMap<>(); + private final Map factionPlayerUuidMap = new ConcurrentHashMap<>(); + private final Map factionUUIDMap = new HashMap<>(); + private final Map factionNameMap = new CaseInsensitiveMap<>(); + private final HCF plugin; + private Config config; + + public FlatFileFactionManager(final HCF plugin) { + this.plugin = plugin; + plugin.getServer().getPluginManager().registerEvents( this, plugin); + this.warzone = new WarzoneFaction(); + this.wilderness = new WildernessFaction(); + this.reloadFactionData(); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerJoinedFaction(final PlayerJoinedFactionEvent event) { + this.factionPlayerUuidMap.put(event.getUniqueID(), event.getFaction().getUniqueID()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerLeftFaction(final PlayerLeftFactionEvent event) { + this.factionPlayerUuidMap.remove(event.getUniqueID()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onFactionRename(final FactionRenameEvent event) { + this.factionNameMap.remove(event.getOriginalName()); + this.factionNameMap.put(event.getNewName(), event.getFaction().getUniqueID()); + } + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onFactionClaim(final FactionClaimChangedEvent event) { + for(final Claim claim : event.getAffectedClaims()) { + this.cacheClaim(claim, event.getCause()); + } + } + + @Deprecated + public Map getFactionNameMap() { + return this.factionNameMap; + } + + public List getFactions() { + List asd = new ArrayList<>(); + for(Faction fac : factionUUIDMap.values()){ + asd.add(fac); + } + return asd; + } + + @Override + public List getClaimableFactions(){ + List factions = new ArrayList<>(); + for(Faction faction : getFactions()){ + if(faction instanceof ClaimableFaction){ + factions.add((ClaimableFaction) faction); + } + } + return factions; + } + + @Override + public Collection getPlayerFactions() { + List factions = new ArrayList<>(); + for(Faction faction : getFactions()){ + if(faction instanceof PlayerFaction){ + factions.add((PlayerFaction) faction); + } + } + return factions; + } + + public Claim getClaimAt(final World world, final int x, final int z) { + return this.claimPositionMap.get(new CoordinatePair(world, x, z)); + } + + public Claim getClaimAt(final Location location) { + return this.getClaimAt(location.getWorld(), location.getBlockX(), location.getBlockZ()); + } + + public Faction getFactionAt(final World world, final int x, final int z) { + final World.Environment environment = world.getEnvironment(); + final Claim claim = this.getClaimAt(world, x, z); + if(claim != null) { + final Faction faction = claim.getFaction(); + if(faction != null) { + return faction; + } + } + if(environment == World.Environment.THE_END) { + return this.wilderness; + } + int warzoneRadius = 600; + if(environment == World.Environment.NETHER) { + warzoneRadius = 400; + } + return (Math.abs(x) > warzoneRadius || Math.abs(z) > warzoneRadius) ? this.wilderness : this.warzone; + } + + public Faction getFactionAt(final Location location) { + return this.getFactionAt(location.getWorld(), location.getBlockX(), location.getBlockZ()); + } + + public Faction getFactionAt(final Block block) { + return this.getFactionAt(block.getLocation()); + } + + public Faction getFaction(final String factionName) { + final UUID uuid = this.factionNameMap.get(factionName); + return (uuid == null) ? null : this.factionUUIDMap.get(uuid); + } + + public Faction getFaction(final UUID factionUUID) { + return this.factionUUIDMap.get(factionUUID); + } + + public PlayerFaction getPlayerFaction(final UUID playerUUID) { + final UUID uuid = this.factionPlayerUuidMap.get(playerUUID); + final Faction faction = (uuid == null) ? null : this.factionUUIDMap.get(uuid); + return (faction instanceof PlayerFaction) ? ((PlayerFaction) faction) : null; + } + + public PlayerFaction getPlayerFaction(final Player player) { + return this.getPlayerFaction(player.getUniqueId()); + } + + public PlayerFaction getContainingPlayerFaction(final String search) { + final OfflinePlayer target = JavaUtils.isUUID(search) ? Bukkit.getOfflinePlayer(UUID.fromString(search)) : Bukkit.getOfflinePlayer(search); + return (target.hasPlayedBefore() || target.isOnline()) ? this.getPlayerFaction(target.getUniqueId()) : null; + } + + public Faction getContainingFaction(final String search) { + final Faction faction = this.getFaction(search); + if(faction != null) { + return faction; + } + final UUID playerUUID = Bukkit.getOfflinePlayer(search).getUniqueId(); + if(playerUUID != null) { + return this.getPlayerFaction(playerUUID); + } + return null; + } + + public boolean containsFaction(final Faction faction) { + return this.factionNameMap.containsKey(faction.getName()); + } + + public boolean createFaction(final Faction faction) { + return this.createFaction(faction, Bukkit.getConsoleSender()); + } + + public boolean createFaction(final Faction faction, final CommandSender sender) { + if(this.factionUUIDMap.putIfAbsent(faction.getUniqueID(), faction) != null) { + return false; + } + this.factionNameMap.put(faction.getName(), faction.getUniqueID()); + if(faction instanceof PlayerFaction && sender instanceof Player) { + final Player player = (Player) sender; + final PlayerFaction playerFaction = (PlayerFaction) faction; + if(!playerFaction.setMember(player, new FactionMember(player, ChatChannel.PUBLIC, Role.LEADER))) { + return false; + } + } + final FactionCreateEvent createEvent = new FactionCreateEvent(faction, sender); + Bukkit.getPluginManager().callEvent( createEvent); + return !createEvent.isCancelled(); + } + + public boolean removeFaction(final Faction faction, final CommandSender sender) { + if(this.factionUUIDMap.remove(faction.getUniqueID()) == null) { + return false; + } + this.factionNameMap.remove(faction.getName()); + final FactionRemoveEvent removeEvent = new FactionRemoveEvent(faction, sender); + Bukkit.getPluginManager().callEvent( removeEvent); + if(removeEvent.isCancelled()) { + return false; + } + if(faction instanceof ClaimableFaction) { + Bukkit.getPluginManager().callEvent( new FactionClaimChangedEvent(sender, ClaimChangeCause.UNCLAIM, ((ClaimableFaction) faction).getClaims())); + } + if(faction instanceof PlayerFaction) { + final PlayerFaction playerFaction = (PlayerFaction) faction; + for(final PlayerFaction ally : playerFaction.getAlliedFactions()) { + Bukkit.getPluginManager().callEvent(new FactionRelationRemoveEvent(playerFaction, ally, Relation.ENEMY)); + ally.getRelations().remove(faction.getUniqueID()); + } + + for(final UUID uuid : playerFaction.getMembers().keySet()) { + playerFaction.setMember(uuid, null, true); + new BukkitRunnable() { + @Override + public void run() { + HCF.getPlugin().getTabApi().onPlayerQuitEvent(Bukkit.getPlayer(uuid)); + HCF.getPlugin().getTabApi().onPlayerJoinEvent(Bukkit.getPlayer(uuid)); + } + }.runTaskLaterAsynchronously(HCF.getPlugin(), 4L); + } + } + + return true; + } + + private void cacheClaim(final Claim claim, final ClaimChangeCause cause) { + Preconditions.checkNotNull((Object) claim, "Claim cannot be null"); + Preconditions.checkNotNull((Object) cause, "Cause cannot be null"); + Preconditions.checkArgument(cause != ClaimChangeCause.RESIZE, "Cannot cache claims of resize type"); + final World world = claim.getWorld(); + if(world == null) { + return; + } + final int minX = Math.min(claim.getX1(), claim.getX2()); + final int maxX = Math.max(claim.getX1(), claim.getX2()); + final int minZ = Math.min(claim.getZ1(), claim.getZ2()); + final int maxZ = Math.max(claim.getZ1(), claim.getZ2()); + for(int x = minX; x <= maxX; ++x) { + for(int z = minZ; z <= maxZ; ++z) { + final CoordinatePair coordinatePair = new CoordinatePair(world, x, z); + if(cause == ClaimChangeCause.CLAIM) { + this.claimPositionMap.put(coordinatePair, claim); + } else if(cause == ClaimChangeCause.UNCLAIM) { + this.claimPositionMap.remove(coordinatePair); + } + } + } + } + + private void cacheFaction(final Faction faction) { + this.factionNameMap.put(faction.getName(), faction.getUniqueID()); + this.factionUUIDMap.put(faction.getUniqueID(), faction); + if(faction instanceof ClaimableFaction) { + ClaimableFaction claimableFaction = (ClaimableFaction) faction; + for(final Claim claim : claimableFaction.getClaims()) { + this.cacheClaim(claim, ClaimChangeCause.CLAIM); + } + } + if(faction instanceof PlayerFaction) { + for(final FactionMember factionMember : ((PlayerFaction) faction).getMembers().values()) { + this.factionPlayerUuidMap.put(factionMember.getUniqueId(), faction.getUniqueID()); + } + } + } + + public void reloadFactionData() { + this.factionNameMap.clear(); + this.config = new Config( this.plugin, "factions"); + final Object object = this.config.get("factions"); + if(object instanceof MemorySection) { + final MemorySection section = (MemorySection) object; + for(final String factionName : section.getKeys(false)) { + final Object next = this.config.get(section.getCurrentPath() + '.' + factionName); + if(next instanceof Faction) { + this.cacheFaction((Faction) next); + } + } + } else if(object instanceof List) { + final List list = (List) object; + for(final Object next2 : list) { + if(next2 instanceof Faction) { + this.cacheFaction((Faction) next2); + } + } + } + final Set adding = new HashSet<>(); + if(!this.factionNameMap.containsKey("Warzone")){ + adding.add(new WarzoneFaction()); + } + + if(!this.factionNameMap.containsKey("Spawn")) { + adding.add(new SpawnFaction()); + } + if(!this.factionNameMap.containsKey("Glowstone")){ + adding.add(new GlowstoneFaction()); + } + if(!this.factionNameMap.containsKey("NorthRoad")) { + adding.add(new RoadFaction.NorthRoadFaction()); + adding.add(new RoadFaction.EastRoadFaction()); + adding.add(new RoadFaction.SouthRoadFaction()); + adding.add(new RoadFaction.WestRoadFaction()); + } + if(!this.factionNameMap.containsKey("EndPortal")) { + adding.add(new EndPortalFaction()); + } + for(final Faction added : adding) { + this.cacheFaction(added); + Bukkit.getConsoleSender().sendMessage(ChatColor.BLUE + "Faction " + added.getName() + " not found, created."); + } + } + + public void saveFactionData() { + this.config.set("factions", new ArrayList<>(factionUUIDMap.values())); + this.config.save(); + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/LandMap.java b/PrevailHCF/src/com/prevailpots/hcf/faction/LandMap.java new file mode 100644 index 0000000..27c80c6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/LandMap.java @@ -0,0 +1,100 @@ +package com.prevailpots.hcf.faction; + +import com.customhcf.base.BasePlugin; +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.visualise.VisualBlockData; +import com.prevailpots.hcf.visualise.VisualType; + +import org.bukkit.*; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class LandMap { + private static final int FACTION_MAP_RADIUS_BLOCKS; + + static { + FACTION_MAP_RADIUS_BLOCKS = 22; + } + + public static boolean updateMap(final Player player, final HCF plugin, final VisualType visualType, final boolean inform) { + final Location location = player.getLocation(); + final World world = player.getWorld(); + final int locationX = location.getBlockX(); + final int locationZ = location.getBlockZ(); + final int minimumX = locationX - FACTION_MAP_RADIUS_BLOCKS; + final int minimumZ = locationZ - FACTION_MAP_RADIUS_BLOCKS; + final int maximumX = locationX + FACTION_MAP_RADIUS_BLOCKS; + final int maximumZ = locationZ + FACTION_MAP_RADIUS_BLOCKS; + final Set board = new LinkedHashSet(); + if(visualType != VisualType.CLAIM_MAP) { + player.sendMessage(ChatColor.RED + "Not supported: " + visualType.name().toLowerCase() + '.'); + return false; + } + + for(int x = minimumX; x <= maximumX; ++x) { + for(int z = minimumZ; z <= maximumZ; ++z) { + final Claim claim = plugin.getFactionManager().getClaimAt(world, x, z); + if(claim != null) { + board.add(claim); + } + } + } + if(board.isEmpty()) { + player.sendMessage(ChatColor.RED + "No claims are in your visual range to display."); + return false; + } + LOOP_MAIN: for(final Claim claim2 : board) { + final int maxHeight = Math.min(world.getMaxHeight(), 256); + final Location[] corners = claim2.getCornerLocations(); + final List shown = new ArrayList(maxHeight * corners.length); + for(final Location corner : corners) { + for(int y = 0; y < maxHeight; ++y) { + shown.add(world.getBlockAt(corner.getBlockX(), y, corner.getBlockZ()).getLocation()); + } + } + final Map dataMap = plugin.getVisualiseHandler().generate(player, shown, visualType, true); + if(dataMap.isEmpty()) { + continue LOOP_MAIN; + } + String materialName = ChatColor.RED + "Error!"; + LOOP_1: + for(VisualBlockData visualBlockData : dataMap.values()){ + if(visualBlockData.getItemType() == Material.STAINED_GLASS){ + continue LOOP_1; + }else{ + materialName = BasePlugin.getPlugin().getItemDb().getName(new ItemStack(visualBlockData.getItemType())); + break LOOP_1; + } + } + if(!inform) { + continue LOOP_MAIN; + } + player.sendMessage(claim2.getFaction().getDisplayName(player) +ChatColor.YELLOW +" owns claim displayed by the " + ChatColor.GOLD + materialName); + } + return true; + } + + public static Location getNearestSafePosition(final Player player, final Location origin, final int searchRadius) { + Claim claimAt = HCF.getPlugin().getFactionManager().getClaimAt(player.getLocation()); + Location closest = null; + for(Location claim : claimAt.getCornerLocations()) { + if(closest == null){ + closest = BukkitUtils.getHighestLocation(claim).add(0, 2, 0); + }else { + if(claim.distance(player.getLocation()) < closest.distance(player.getLocation())){ + //Get the closest corner to the player + closest = BukkitUtils.getHighestLocation(claim).add(0, 2, 0); + } + } + } + return closest; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.java new file mode 100644 index 0000000..6ea3dbd --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAcceptArgument.java @@ -0,0 +1,84 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class FactionAcceptArgument extends CommandArgument { + private final HCF plugin; + + public FactionAcceptArgument(final HCF plugin) { + super("accept", "Accept an faction invitation.", new String[]{"join", "a"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + if(this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()) != null) { + sender.sendMessage(ChatColor.RED + "You are already in a faction."); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "You can only join player factions."); + return true; + } + final PlayerFaction targetFaction = (PlayerFaction) faction; + if(targetFaction.getMembers().size() >= 5) { // FACTION LIMIT + sender.sendMessage(faction.getDisplayName(sender) + ChatColor.RED + " is full. Faction limits are at " + plugin.getHcfHandler().getFactionLimit() + '.'); + return true; + } + if(!targetFaction.isOpen() && !targetFaction.getInvitedPlayerNames().contains(player.getName())) { + sender.sendMessage(ChatColor.RED + faction.getDisplayName(sender) + ChatColor.RED + " has not invited you."); + return true; + } +// if(targetFaction.getKicked().contains(player.getUniqueId().toString()) && !targetFaction.isForce(player.getName())){ +// sender.sendMessage(ChatColor.RED + "This faction has kicked you before and has not used a force-invite!"); +// return true; +// } + if(targetFaction.isLocked()){ + sender.sendMessage(ChatColor.RED + "You cannot join locked factions."); + return true; + } + if(targetFaction.setMember(player, new FactionMember(player, ChatChannel.PUBLIC, Role.MEMBER))) { + targetFaction.broadcast(Relation.MEMBER.toChatColour() + sender.getName() + ChatColor.YELLOW + " has joined your faction."); + new BukkitRunnable() { + @Override + public void run() { + HCF.getPlugin().getTabApi().onPlayerQuitEvent(player); + HCF.getPlugin().getTabApi().onPlayerJoinEvent(player); + } + }.runTaskLaterAsynchronously(HCF.getPlugin(), 4L); + } + return true; + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAllyArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAllyArgument.java new file mode 100644 index 0000000..a1b4f8b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAllyArgument.java @@ -0,0 +1,115 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.FactionRelationCreateEvent; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FactionAllyArgument extends CommandArgument { + private static final Relation RELATION; + + static { + RELATION = Relation.ALLY; + } + + private final HCF plugin; + + public FactionAllyArgument(final HCF plugin) { + super("ally", "Send an alliance request to an faction.", new String[]{"alliance"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be an officer to make relation wishes."); + return true; + } + final Faction containingFaction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(!(containingFaction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "Player faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + final PlayerFaction targetFaction = (PlayerFaction) containingFaction; + if(playerFaction.equals(targetFaction)) { + sender.sendMessage(ChatColor.RED + "You cannot send " + FactionAllyArgument.RELATION.getDisplayName() + ChatColor.RED + " requests to your own faction."); + return true; + } + final Collection allied = playerFaction.getAllied(); + if(allied.size() >= 1) { // ALLY LIMIT + sender.sendMessage(ChatColor.RED + "Your faction cant have more allies than " + plugin.getHcfHandler().getAllyLimit() + '.'); + return true; + } + if(targetFaction.getAllied().size() >= plugin.getHcfHandler().getAllyLimit()) { + sender.sendMessage(targetFaction.getDisplayName(sender) + ChatColor.RED + " has reached their maximum alliance limit, which is " + plugin.getHcfHandler().getAllyLimit() + '.'); + return true; + } + if(allied.contains(targetFaction.getUniqueID())) { + sender.sendMessage(ChatColor.RED + "Your faction already is " + FactionAllyArgument.RELATION.getDisplayName() + 'd' + ChatColor.RED + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.RED + '.'); + return true; + } + if(targetFaction.getRequestedRelations().remove(playerFaction.getUniqueID()) != null) { + final FactionRelationCreateEvent event = new FactionRelationCreateEvent(playerFaction, targetFaction, FactionAllyArgument.RELATION); + Bukkit.getPluginManager().callEvent((Event) event); + targetFaction.getRelations().put(playerFaction.getUniqueID(), FactionAllyArgument.RELATION); + targetFaction.broadcast(ChatColor.YELLOW + "Your faction is now " + FactionAllyArgument.RELATION.getDisplayName() + 'd' + ChatColor.YELLOW + " with " + playerFaction.getDisplayName(targetFaction) + ChatColor.YELLOW + '.'); + playerFaction.getRelations().put(targetFaction.getUniqueID(), FactionAllyArgument.RELATION); + playerFaction.broadcast(ChatColor.YELLOW + "Your faction is now " + FactionAllyArgument.RELATION.getDisplayName() + 'd' + ChatColor.YELLOW + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.YELLOW + '.'); + return true; + } + if(playerFaction.getRequestedRelations().putIfAbsent(targetFaction.getUniqueID(), FactionAllyArgument.RELATION) != null) { + sender.sendMessage(ChatColor.YELLOW + "Your faction has already requested to " + FactionAllyArgument.RELATION.getDisplayName() + ChatColor.YELLOW + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.YELLOW + '.'); + return true; + } + playerFaction.broadcast(targetFaction.getDisplayName(playerFaction) + ChatColor.YELLOW + " were informed that you wish to be " + FactionAllyArgument.RELATION.getDisplayName() + ChatColor.YELLOW + '.'); + targetFaction.broadcast(playerFaction.getDisplayName(targetFaction) + ChatColor.YELLOW + " has sent a request to be " + FactionAllyArgument.RELATION.getDisplayName() + ChatColor.YELLOW + ". Use " + ConfigurationService.ALLY_COLOUR + "/faction " + this.getName() + ' ' + playerFaction.getName() + ChatColor.YELLOW + " to accept."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + return Collections.emptyList(); + } + final List results = new ArrayList(); + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.java new file mode 100644 index 0000000..593e457 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionAnnouncementArgument.java @@ -0,0 +1,92 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +/** + * Created by TREHOME on 02/25/2016. + */ +public class FactionAnnouncementArgument extends CommandArgument +{ + private final HCF plugin; + private static final ImmutableList CLEAR_LIST; + + public FactionAnnouncementArgument(final HCF plugin) { + super("announcement", "Set your faction's announcement.", new String[] { "announce" }); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player)sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if (playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if (playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a officer to edit the faction announcement."); + return true; + } + final String oldAnnouncement = playerFaction.getAnnouncement(); + String newAnnouncement; + if (args[1].equalsIgnoreCase("clear") || args[1].equalsIgnoreCase("none") || args[1].equalsIgnoreCase("remove")) { + newAnnouncement = null; + } + else { + newAnnouncement = StringUtils.join(args, ' ', 1, args.length); + } + if (oldAnnouncement == null && newAnnouncement == null) { + sender.sendMessage(ChatColor.RED + "Your factions' announcement is already unset."); + return true; + } + if (oldAnnouncement != null && newAnnouncement != null && oldAnnouncement.equals(newAnnouncement)) { + sender.sendMessage(ChatColor.RED + "Your factions' announcement is already " + newAnnouncement + '.'); + return true; + } + playerFaction.setAnnouncement(newAnnouncement); + if (newAnnouncement == null) { + playerFaction.broadcast(ChatColor.GREEN + sender.getName() + ChatColor.YELLOW + " has cleared the factions' announcement."); + return true; + } + playerFaction.broadcast(ChatColor.GREEN + player.getName() + ChatColor.YELLOW + " has updated the factions' announcement from " + ChatColor.GREEN + ((oldAnnouncement != null) ? oldAnnouncement : "none") + ChatColor.YELLOW + " to " + ChatColor.GREEN + newAnnouncement + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + return Collections.emptyList(); + } + if (args.length == 2) { + return FactionAnnouncementArgument.CLEAR_LIST; + } + return Collections.emptyList(); + } + + static { + CLEAR_LIST = ImmutableList.of("clear"); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionChatArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionChatArgument.java new file mode 100644 index 0000000..7a56627 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionChatArgument.java @@ -0,0 +1,76 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang3.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +public class FactionChatArgument extends CommandArgument { + private final HCF plugin; + + public FactionChatArgument(final HCF plugin) { + super("chat", "Toggle faction-only chat modes.", new String[]{"c"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [fac|public|ally] [message]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final FactionMember member = playerFaction.getMember(player.getUniqueId()); + final ChatChannel currentChannel = member.getChatChannel(); + final ChatChannel parsed = (args.length >= 2) ? ChatChannel.parse(args[1], null) : currentChannel.getRotation(); + if(parsed == null && currentChannel != ChatChannel.PUBLIC) { + final Collection recipients = playerFaction.getOnlinePlayers(); + if(currentChannel == ChatChannel.ALLIANCE) { + for(final PlayerFaction ally : playerFaction.getAlliedFactions()) { + recipients.addAll(ally.getOnlinePlayers()); + } + } + final String format = String.format(currentChannel.getRawFormat(player), "", StringUtils.join((Object[]) args, ' ', 1, args.length)); + for(final Player recipient : recipients) { + recipient.sendMessage(format); + } + return true; + } + final ChatChannel newChannel = (parsed == null) ? currentChannel.getRotation() : parsed; + member.setChatChannel(newChannel); + sender.sendMessage(ChatColor.YELLOW + "You are now in " + ChatColor.GREEN + newChannel.getDisplayName().toLowerCase() + ChatColor.YELLOW + " chat mode."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final ChatChannel[] values = ChatChannel.values(); + final List results = new ArrayList(values.length); + for(final ChatChannel type : values) { + results.add(type.getName()); + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimArgument.java new file mode 100644 index 0000000..f3b86d7 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimArgument.java @@ -0,0 +1,74 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.claim.ClaimHandler; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +import java.util.UUID; + +public class FactionClaimArgument extends CommandArgument { + private final HCF plugin; + private final int CHUNK_RADIUS = 7; + + public FactionClaimArgument(final HCF plugin) { + super("claim", "Start a claim for your faction.", new String[]{"claimland"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final UUID uuid = player.getUniqueId(); + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(uuid); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.isRaidable()) { + sender.sendMessage(ChatColor.RED + "You cannot claim land for your faction while raidable."); + return true; + } + final PlayerInventory inventory = player.getInventory(); + if(inventory.contains(ClaimHandler.CLAIM_WAND)) { + sender.sendMessage(ChatColor.RED + "You already have a claiming wand in your inventory."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(args[1].equalsIgnoreCase("wand")) { + if (!inventory.addItem(new ItemStack[]{ClaimHandler.CLAIM_WAND}).isEmpty()) { + sender.sendMessage(ChatColor.RED + "Your inventory is full."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "A claiming wand has been added to your inventory. \nRemember you can always use " + ChatColor.GOLD + "/" + label + " " + this.getName() +" chunk"); + return true; + }else{ + if(!args[1].equalsIgnoreCase("chunk")){ + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Location location = player.getLocation(); + this.plugin.getClaimHandler().tryPurchasing(player, new Claim(playerFaction, location.clone().add(CHUNK_RADIUS, 0.0, CHUNK_RADIUS), location.clone().add(-CHUNK_RADIUS, 256.0, -CHUNK_RADIUS))); + } + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.java new file mode 100644 index 0000000..e714a7b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionClaimsArgument.java @@ -0,0 +1,90 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +public class FactionClaimsArgument extends CommandArgument { + private final HCF plugin; + + public FactionClaimsArgument(final HCF plugin) { + super("claims", "Visualize all the claims for an faction. (Displayed by Pillars)"); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [factionName]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + final PlayerFaction selfFaction = (sender instanceof Player) ? this.plugin.getFactionManager().getPlayerFaction(((Player) sender).getUniqueId()) : null; + ClaimableFaction targetFaction; + if(args.length < 2) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(selfFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + targetFaction = selfFaction; + } else { + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof ClaimableFaction)) { + sender.sendMessage(ChatColor.RED + "You can only check the claims of factions that can have claims."); + return true; + } + targetFaction = (ClaimableFaction) faction; + } + final Collection claims = targetFaction.getClaims(); + if(claims.isEmpty()) { + sender.sendMessage(ChatColor.RED + "Faction " + targetFaction.getDisplayName(sender) + ChatColor.RED + " has no claimed land."); + return true; + } + if(sender instanceof Player && !sender.isOp() && targetFaction instanceof PlayerFaction && ((PlayerFaction) targetFaction).getHome() == null && (selfFaction == null || !selfFaction.equals(targetFaction))) { + sender.sendMessage(ChatColor.RED + "You cannot view the claims of " + targetFaction.getDisplayName(sender) + ChatColor.RED + " because their home is unset."); + return true; + } + sender.sendMessage(ChatColor.YELLOW + "Claims of " + ChatColor.GOLD + targetFaction.getDisplayName(sender)); + for(final Claim claim : claims) { + sender.sendMessage(ChatColor.YELLOW + " " + claim.getFormattedName()); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.java new file mode 100644 index 0000000..9138f5a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCoLeaderArgument.java @@ -0,0 +1,98 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.*; + +public class FactionCoLeaderArgument extends CommandArgument { + private final HCF plugin; + + public FactionCoLeaderArgument(final HCF plugin) { + super("coleader", "Sets an member as an coleader."); + this.plugin = plugin; + this.aliases = new String[] { "coleader", "colead", "coleaderr" }; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can set faction leaders."); + return true; + } + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player)sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if (playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final UUID uuid = player.getUniqueId(); + final FactionMember selfMember = playerFaction.getMember(uuid); + final Role selfRole = selfMember.getRole(); + if (selfRole != Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You must be an leader to assign the coleader role to an member."); + return true; + } + final FactionMember targetMember = playerFaction.getMember(args[1]); + if (targetMember == null) { + sender.sendMessage(ChatColor.RED + "Player '" + args[1] + "' is not in your faction."); + return true; + } + if (targetMember.getRole().equals(Role.COLEADER)) { + sender.sendMessage(ChatColor.RED + "This member is already a co-leader!"); + return true; + } + if (targetMember.getUniqueId().equals(uuid)) { + sender.sendMessage(ChatColor.RED + "You are the leader, which means you cannot co-leader yourself."); + return true; + } + targetMember.setRole(Role.COLEADER); + playerFaction.broadcast(ChatColor.GREEN + targetMember.getName() + ChatColor.YELLOW + " has been promoted to a co leader."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if (args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player)sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if (playerFaction == null || playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER) { + return Collections.emptyList(); + } + final List results = new ArrayList(); + final Map members = playerFaction.getMembers(); + for (final Map.Entry entry : members.entrySet()) { + if (entry.getValue().getRole() != Role.LEADER) { + final OfflinePlayer target = Bukkit.getOfflinePlayer((UUID)entry.getKey()); + final String targetName = target.getName(); + if (targetName == null) { + continue; + } + if (results.contains(targetName)) { + continue; + } + results.add(targetName); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCreateArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCreateArgument.java new file mode 100644 index 0000000..5a4cd70 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionCreateArgument.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class FactionCreateArgument extends CommandArgument { + private final HCF plugin; + + public FactionCreateArgument(final HCF plugin) { + super("create", "Start a new faction.", new String[]{"make", "define"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command may only be executed by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final String name = args[1]; + if(plugin.getConfig().getStringList("Disabled-Faction-Names").contains(name.toLowerCase())) { + sender.sendMessage(ChatColor.RED + "'" + name + "' is a blocked faction name."); + return true; + } + if(name.length() < 3) { + sender.sendMessage(ChatColor.RED + "Faction names must have at least " + 3 + " characters."); + return true; + } + if(name.length() > 16) { + sender.sendMessage(ChatColor.RED + "Faction names cannot be longer than " + 16 + " characters."); + return true; + } + if(!JavaUtils.isAlphanumeric(name)) { + sender.sendMessage(ChatColor.RED + "Faction names may only be alphanumeric."); + return true; + } + if(this.plugin.getFactionManager().getFaction(name) != null) { + sender.sendMessage(ChatColor.RED + "Faction '" + name + "' already exists."); + return true; + } + if(this.plugin.getFactionManager().getPlayerFaction(((Player) sender).getUniqueId()) != null) { + sender.sendMessage(ChatColor.RED + "You are already in a faction."); + return true; + } + PlayerFaction shit = new PlayerFaction(name); + this.plugin.getFactionManager().createFaction(shit, sender); + new BukkitRunnable() { + @Override + public void run() { + plugin.getTabApi().onPlayerQuitEvent((Player)sender); + plugin.getTabApi().onPlayerJoinEvent((Player)sender); + } + }.runTaskLaterAsynchronously(plugin, 4L); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.java new file mode 100644 index 0000000..d87d7f3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDemoteArgument.java @@ -0,0 +1,96 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FactionDemoteArgument extends CommandArgument { + private final HCF plugin; + + public FactionDemoteArgument(final HCF plugin) { + super("demote", "Demotes a faction officer to an member.", new String[]{"uncaptain", "delcaptain", "delofficer"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER && playerFaction.getMember(player.getUniqueId()).getRole() != Role.COLEADER) { + sender.sendMessage(ChatColor.RED + "You must be a leader to edit the roster."); + return true; + } + final FactionMember targetMember = playerFaction.getMember(args[1]); + if(targetMember == null) { + sender.sendMessage(ChatColor.RED + "That player is not in your faction."); + return true; + } + if(targetMember.getRole() == Role.LEADER){ + sender.sendMessage(ChatColor.RED + "You cannot demote leader!"); + return true; + } + if(targetMember.getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You cannot demote members."); + return true; + } + if(targetMember.getRole() == Role.COLEADER && playerFaction.getMember(player.getUniqueId()).getRole() == Role.COLEADER){ + sender.sendMessage(ChatColor.RED + "You cannot demote other co-leaders."); + return true; + } + targetMember.setRole(Role.MEMBER); + playerFaction.broadcast(Relation.MEMBER.toChatColour() + targetMember.getName() + ChatColor.YELLOW + " is now a member."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null || (playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER && playerFaction.getMember(player.getUniqueId()).getRole() != Role.COLEADER) ){ + return Collections.emptyList(); + } + final List results = new ArrayList(); + final Collection keySet = playerFaction.getMembers().keySet(); + for(final UUID entry : keySet) { + final OfflinePlayer target = Bukkit.getOfflinePlayer(entry); + final String targetName = target.getName(); + if(targetName != null && (playerFaction.getMember(target.getUniqueId()).getRole() == Role.CAPTAIN || playerFaction.getMember(target.getUniqueId()).getRole() == Role.COLEADER)) { + results.add(targetName); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDepositArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDepositArgument.java new file mode 100644 index 0000000..dc5cfe8 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDepositArgument.java @@ -0,0 +1,79 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FactionDepositArgument extends CommandArgument { + private static final ImmutableList COMPLETIONS; + + static { + COMPLETIONS = ImmutableList.of("all"); + } + + private final HCF plugin; + + public FactionDepositArgument(final HCF plugin) { + super("deposit", "Deposit money into the faction's team balance.", new String[]{"d"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final UUID uuid = player.getUniqueId(); + final int playerBalance = this.plugin.getEconomyManager().getBalance(uuid); + Integer amount; + if(args[1].equalsIgnoreCase("all")) { + amount = playerBalance; + } else if((amount = Ints.tryParse(args[1])) == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a valid number."); + return true; + } + if(amount <= 0) { + sender.sendMessage(ChatColor.RED + "You cannot deposit an negative int amount of money! Yikes."); + return true; + } + if(playerBalance < amount) { + sender.sendMessage(ChatColor.RED + "You need at least " + '$' + JavaUtils.format((Number) amount) + " to do this, you only have " + '$' + JavaUtils.format((Number) playerBalance) + '.'); + return true; + } + this.plugin.getEconomyManager().subtractBalance(uuid, amount); + playerFaction.setBalance(playerFaction.getBalance() + amount); + playerFaction.broadcast(Relation.MEMBER.toChatColour() + playerFaction.getMember(player).getRole().getAstrix() + sender.getName() + ChatColor.YELLOW + " has deposited " + ChatColor.GREEN + '$' + JavaUtils.format((Number) amount) + ChatColor.YELLOW + " into the faction balance."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (List) ((args.length == 2) ? FactionDepositArgument.COMPLETIONS : Collections.emptyList()); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.java new file mode 100644 index 0000000..2dafd7f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionDisbandArgument.java @@ -0,0 +1,48 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FactionDisbandArgument extends CommandArgument { + private final HCF plugin; + + public FactionDisbandArgument(final HCF plugin) { + super("disband", "Disband your faction."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.isRaidable() && !this.plugin.getEotwHandler().isEndOfTheWorld()) { + sender.sendMessage(ChatColor.RED + "You cannot disband your faction while it is raidable."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You must be a leader to disband the faction."); + return true; + } + playerFaction.broadcast(ChatColor.RED.toString() + ChatColor.BOLD + sender.getName() + ChatColor.YELLOW + " has disbanded the faction!"); + this.plugin.getFactionManager().removeFaction(playerFaction, sender); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHelpArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHelpArgument.java new file mode 100644 index 0000000..617b796 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHelpArgument.java @@ -0,0 +1,94 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.chat.ClickAction; +import com.customhcf.util.chat.Text; +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.faction.FactionExecutor; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FactionHelpArgument extends CommandArgument { + private static final int HELP_PER_PAGE = 10; + private final FactionExecutor executor; + private ImmutableMultimap pages; + + public FactionHelpArgument(final FactionExecutor executor) { + super("help", "View help on how to use factions."); + this.executor = executor; + this.isPlayerOnly = true; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + this.showPage(sender, label, 1); + return true; + } + final Integer page = Ints.tryParse(args[1]); + if(page == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a valid number."); + return true; + } + this.showPage(sender, label, page); + return true; + } + + private void showPage(final CommandSender sender, final String label, final int pageNumber) { + if(this.pages == null) { + final boolean isPlayer = sender instanceof Player; + int val = 1; + int count = 0; + final Multimap pages = ArrayListMultimap.create(); + for(final CommandArgument argument : this.executor.getArguments()) { + if(argument.equals((Object) this)) { + continue; + } + final String permission = argument.getPermission(); + if(permission != null && !sender.hasPermission(permission)) { + continue; + } + if(argument.isPlayerOnly() && !isPlayer) { + continue; + } + ++count; + pages.get(val).add(new Text(ChatColor.GREEN + " /" + label + ' ' + argument.getName() + ChatColor.GRAY + " - " + ChatColor.GRAY + argument.getDescription()).setColor(ChatColor.GRAY).setClick(ClickAction.SUGGEST_COMMAND, "/"+label +" "+argument.getName())); + if(count % HELP_PER_PAGE != 0) { + continue; + } + ++val; + } + this.pages = ImmutableMultimap.copyOf(pages); + } + final int totalPageCount = this.pages.size() / HELP_PER_PAGE + 1; + if(pageNumber < 1) { + sender.sendMessage(ChatColor.RED + "You cannot view a page less than 1."); + return; + } + if(pageNumber > totalPageCount) { + sender.sendMessage(ChatColor.RED + "There are only " + totalPageCount + " pages."); + return; + } + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + sender.sendMessage(ChatColor.GOLD + ChatColor.BOLD.toString() + " Faction Help " + ChatColor.GRAY + "[" + pageNumber + '/' + totalPageCount + ']'); + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + for(final Text message : this.pages.get(pageNumber)) { + message.send(sender); + } + sender.sendMessage(ChatColor.GRAY + " Use " + ChatColor.GREEN + '/' + label + ' ' + this.getName() + " <#>" + ChatColor.GRAY + " to view other pages."); + if(pageNumber == 1){ + sender.sendMessage(ChatColor.GRAY + "You may click a command '"+ ChatColor.ITALIC + "instantly" + ChatColor.GRAY + "' preform it."); + } + sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHomeArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHomeArgument.java new file mode 100644 index 0000000..6d37e51 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionHomeArgument.java @@ -0,0 +1,116 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionExecutor; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.kothgame.faction.EventFaction; +import com.prevailpots.hcf.timer.PlayerTimer; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; + +import java.util.UUID; + +public class FactionHomeArgument extends CommandArgument { + private final FactionExecutor factionExecutor; + private final HCF plugin; + + public FactionHomeArgument(final FactionExecutor factionExecutor, final HCF plugin) { + super("home", "Teleport to the faction's home point."); + this.factionExecutor = factionExecutor; + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + if(args.length >= 2 && args[1].equalsIgnoreCase("set")) { + this.factionExecutor.getArgument("sethome").onCommand(sender, command, label, args); + return true; + } + final UUID uuid = player.getUniqueId(); + PlayerTimer timer = this.plugin.getTimerManager().enderPearlTimer; + long remaining = timer.getRemaining(player); + if(remaining > 0L) { + sender.sendMessage(ChatColor.RED + "You cannot warp whilst your " + timer.getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + HCF.getRemaining(remaining, true, false) + ChatColor.RED + " remaining]"); + return true; + } + if((remaining = (timer = this.plugin.getTimerManager().spawnTagTimer).getRemaining(player)) > 0L) { + sender.sendMessage(ChatColor.RED + "You cannot warp whilst your " + timer.getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + HCF.getRemaining(remaining, true, false) + ChatColor.RED + " remaining]"); + return true; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(uuid); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final Location home = playerFaction.getHome(); + if(home == null) { + sender.sendMessage(ChatColor.RED + "Your faction does not have a home set."); + return true; + } + final Faction factionAt = this.plugin.getFactionManager().getFactionAt(player.getLocation()); + if(factionAt instanceof EventFaction) { + sender.sendMessage(ChatColor.RED + "You cannot warp whilst in event zones."); + return true; + } + long millis; + if(factionAt.isSafezone()) { + if(player.getWorld().getEnvironment() != World.Environment.THE_END) { + plugin.getTimerManager().pvpProtectionTimer.clearCooldown(player.getUniqueId()); + millis = 0L; + } else { + sender.sendMessage(ChatColor.RED + "You cannot teleport to your faction home whilst in The End."); + return true; + } + } else { + switch(player.getWorld().getEnvironment()) { + case THE_END: { + millis = 30000L; + break; + } + case NETHER: { + millis = 30000L; + break; + } + default: { + millis = 10000L; + break; + } + } + } + if(!factionAt.equals(playerFaction) && factionAt instanceof PlayerFaction) { + if(!((PlayerFaction) factionAt).isRaidable()) { + player.sendMessage(ChatColor.RED + "You are in a claim, if your stuck use /f stuck"); + return true; + } else { + millis *= 2l; + } + } + if(plugin.getTimerManager().pvpProtectionTimer.getRemaining(player.getUniqueId()) > 0) { + player.sendMessage(ChatColor.RED + "You still have PvP Protection, you must enable it first."); + return true; + } + if(plugin.getTimerManager().teleportTimer.getNearbyEnemies(player, 60) != 0) { + this.plugin.getTimerManager().teleportTimer.teleport(player, home, millis, ChatColor.YELLOW + "Teleporting to your faction home in " + ChatColor.LIGHT_PURPLE + HCF.getRemaining(millis, true, false) + ChatColor.YELLOW + ". Do not move or take damage.", PlayerTeleportEvent.TeleportCause.COMMAND); + return true; + }else{ + this.plugin.getTimerManager().teleportTimer.teleport(player, home, 1, ChatColor.YELLOW + "Teleported to your faction home "+ChatColor.GOLD +"instantly "+ChatColor.YELLOW +"since there is no enemies nearby.", PlayerTeleportEvent.TeleportCause.COMMAND); + return true; + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInviteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInviteArgument.java new file mode 100644 index 0000000..f6273ff --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInviteArgument.java @@ -0,0 +1,123 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.chat.ClickAction; +import com.customhcf.util.chat.Text; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import net.minecraft.server.v1_7_R4.IChatBaseComponent; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; + +public class FactionInviteArgument extends CommandArgument { + public static final Pattern USERNAME_REGEX; + + static { + USERNAME_REGEX = Pattern.compile("^[a-zA-Z0-9_]{2,16}$"); + } + + private final HCF plugin; + + public FactionInviteArgument(final HCF plugin) { + super("invite", "Invite a player to the faction."); + this.plugin = plugin; + this.aliases = new String[]{"inv", "invitemember", "inviteplayer"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can invite to a faction."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(!FactionInviteArgument.USERNAME_REGEX.matcher(args[1]).matches()) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is an invalid username."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must a faction officer to invite members."); + return true; + } + String name = args[1]; + + if(playerFaction.getMember(name) != null) { + sender.sendMessage(ChatColor.RED + "'" + name + "' is already in your faction."); + return true; + } + if(!this.plugin.getEotwHandler().isEndOfTheWorld() && playerFaction.isRaidable()) { + sender.sendMessage(ChatColor.RED + "You may not invite players whilst your faction is raidable."); + return true; + } +// if(playerFaction.getKicked().contains(BukkitUtils.offlinePlayerWithNameOrUUID(name).getUniqueId().toString())) { +// sender.sendMessage(ChatColor.RED + "You must use a force-invite to re-invite this player!"); +// return true; +// } + final Player target = Bukkit.getPlayer(name); + + if(target != null) { + String na3me = target.getName(); + playerFaction.invitedPlayerNames.put(na3me, false); + if(target != null) { + name = target.getName(); + final Text text = new Text(sender.getName()).setColor(Relation.ENEMY.toChatColour()).append(new Text(" invited you to join ").setColor(ChatColor.YELLOW)); + text.append(new Text(playerFaction.getName()).setColor(Relation.ENEMY.toChatColour())).append(new Text(". ").setColor(ChatColor.YELLOW)); + text.append(new Text("Click here").setColor(ChatColor.GREEN).setClick(ClickAction.RUN_COMMAND, '/' + label + " accept " + playerFaction.getName()).setHoverText(ChatColor.AQUA + "Click to join " + playerFaction.getDisplayName((CommandSender) target) + ChatColor.GOLD + '.')).append((IChatBaseComponent) new Text(" to accept this invitation.").setColor(ChatColor.YELLOW)); + text.send(target); + } + playerFaction.broadcast(Relation.MEMBER.toChatColour() + sender.getName() + ChatColor.YELLOW + " has invited " + Relation.ENEMY.toChatColour() + name + ChatColor.YELLOW + " to the faction."); + } else { + sender.sendMessage(ChatColor.RED + name + " has already been invited."); + return true; + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null || playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + return Collections.emptyList(); + } + final List results = new ArrayList(); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + final Faction targetFaction = this.plugin.getFactionManager().getPlayerFaction(target.getUniqueId()); + if(targetFaction != null && targetFaction.equals(playerFaction)) { + continue; + } + results.add(target.getName()); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.java new file mode 100644 index 0000000..9af8995 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionInvitesArgument.java @@ -0,0 +1,54 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang3.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +public class FactionInvitesArgument extends CommandArgument { + private final HCF plugin; + + public FactionInvitesArgument(final HCF plugin) { + super("invites", "View faction invitations."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can have faction invites."); + return true; + } + final List receivedInvites = new ArrayList<>(); + for(final Faction faction : this.plugin.getFactionManager().getFactions()) { + if(faction instanceof PlayerFaction) { + final PlayerFaction targetPlayerFaction = (PlayerFaction) faction; + if(!targetPlayerFaction.getInvitedPlayerNames().contains(sender.getName())) { + continue; + } + receivedInvites.add(targetPlayerFaction.getDisplayName(sender)); + } + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(((Player) sender).getUniqueId()); + final String delimiter = ChatColor.YELLOW + ", " + ChatColor.GRAY; + if(playerFaction != null) { + final Set sentInvites = playerFaction.getInvitedPlayerNames(); + sender.sendMessage(ChatColor.YELLOW + "Sent by " + playerFaction.getDisplayName(sender) + ChatColor.YELLOW + " (" + sentInvites.size() + ')' + ChatColor.YELLOW + ": " + ChatColor.GRAY + (sentInvites.isEmpty() ? "Your faction has not invited anyone." : (StringUtils.join((Iterable) sentInvites, delimiter) + '.'))); + } + sender.sendMessage(ChatColor.YELLOW + "Requested (" + receivedInvites.size() + ')' + ChatColor.YELLOW + ": " + ChatColor.GRAY + (receivedInvites.isEmpty() ? "No factions have invited you." : (StringUtils.join((Iterable) receivedInvites, ChatColor.YELLOW + delimiter) + '.'))); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionKickArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionKickArgument.java new file mode 100644 index 0000000..66e4cf2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionKickArgument.java @@ -0,0 +1,112 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FactionKickArgument extends CommandArgument { + private final HCF plugin; + + public FactionKickArgument(final HCF plugin) { + super("kick", "Kick a player from the faction."); + this.plugin = plugin; + this.aliases = new String[]{"kickmember", "kickplayer"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can kick from a faction."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.isRaidable() && !this.plugin.getEotwHandler().isEndOfTheWorld()) { + sender.sendMessage(ChatColor.RED + "You cannot kick players whilst your faction is raidable."); + return true; + } + final FactionMember targetMember = playerFaction.getMember(args[1]); + if(targetMember == null) { + sender.sendMessage(ChatColor.RED + "Your faction does not have a member named '" + args[1] + "'."); + return true; + } + final Role selfRole = playerFaction.getMember(player.getUniqueId()).getRole(); + if(selfRole == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a faction officer to kick members."); + return true; + } + final Role targetRole = targetMember.getRole(); + if(targetRole == Role.LEADER || targetRole == Role.COLEADER) { + sender.sendMessage(ChatColor.RED + "You cannot kick a faction leader."); + return true; + } + if(targetRole == Role.CAPTAIN && selfRole == Role.CAPTAIN) { + sender.sendMessage(ChatColor.RED + "You must be a faction leader to kick captains."); + return true; + } + if(playerFaction.setMember(targetMember.getUniqueId(), null, true)) { + final Player onlineTarget = targetMember.toOnlinePlayer(); + if(onlineTarget != null) { + onlineTarget.sendMessage(ChatColor.RED.toString() + "You were kicked from "+playerFaction.getName()+ '.'); + } + playerFaction.broadcast(ConfigurationService.ENEMY_COLOUR + targetMember.getName() + ChatColor.YELLOW + " was kicked by " + ConfigurationService.TEAMMATE_COLOUR + playerFaction.getMember(player).getRole().getAstrix() + sender.getName() + ChatColor.YELLOW + '.'); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + return Collections.emptyList(); + } + final Role memberRole = playerFaction.getMember(player.getUniqueId()).getRole(); + if(memberRole == Role.MEMBER) { + return Collections.emptyList(); + } + final List results = new ArrayList(); + for(final UUID entry : playerFaction.getMembers().keySet()) { + final Role targetRole = playerFaction.getMember(entry).getRole(); + if(targetRole != Role.LEADER) { + if(targetRole == Role.CAPTAIN && memberRole != Role.LEADER) { + continue; + } + final OfflinePlayer target = Bukkit.getOfflinePlayer(entry); + final String targetName = target.getName(); + if(targetName == null || results.contains(targetName)) { + continue; + } + results.add(targetName); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.java new file mode 100644 index 0000000..4c4a0fc --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaderArgument.java @@ -0,0 +1,96 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class FactionLeaderArgument extends CommandArgument { + private final HCF plugin; + + public FactionLeaderArgument(final HCF plugin) { + super("leader", "Set a new leader for your faction."); + this.plugin = plugin; + this.aliases = new String[]{"setleader", "newleader"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can set faction leaders."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final UUID uuid = player.getUniqueId(); + final FactionMember selfMember = playerFaction.getMember(uuid); + final Role selfRole = selfMember.getRole(); + if(selfRole != Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You must be the current faction leader to transfer the faction."); + return true; + } + final FactionMember targetMember = playerFaction.getMember(args[1]); + if(targetMember == null) { + sender.sendMessage(ChatColor.RED + "Player '" + args[1] + "' is not in your faction."); + return true; + } + if(targetMember.getUniqueId().equals(uuid)) { + sender.sendMessage(ChatColor.RED + "You are already the faction leader."); + return true; + } + targetMember.setRole(Role.LEADER); + selfMember.setRole(Role.CAPTAIN); + playerFaction.broadcast(ConfigurationService.TEAMMATE_COLOUR + selfMember.getRole().getAstrix() + selfMember.getName() + ChatColor.YELLOW + " has transferred leadership of the faction to " + ConfigurationService.TEAMMATE_COLOUR + targetMember.getRole().getAstrix() + targetMember.getName() + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null || playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER) { + return Collections.emptyList(); + } + final List results = new ArrayList(); + final Map members = playerFaction.getMembers(); + for(final Map.Entry entry : members.entrySet()) { + if(entry.getValue().getRole() != Role.LEADER) { + final OfflinePlayer target = Bukkit.getOfflinePlayer((UUID) entry.getKey()); + final String targetName = target.getName(); + if(targetName == null || results.contains(targetName)) { + continue; + } + results.add(targetName); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.java new file mode 100644 index 0000000..43455ca --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionLeaveArgument.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.UUID; + +public class FactionLeaveArgument extends CommandArgument { + private final HCF plugin; + + public FactionLeaveArgument(final HCF plugin) { + super("leave", "Leave your current faction."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can leave faction."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final UUID uuid = player.getUniqueId(); + if(playerFaction.getMember(uuid).getRole() == Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You cannot leave factions as a leader. Either use " + ChatColor.GOLD + '/' + label + " disband" + ChatColor.RED + " or " + ChatColor.GOLD + '/' + label + " leader" + ChatColor.RED + '.'); + return true; + } + if(playerFaction.setMember(player, null)) { + sender.sendMessage(ChatColor.YELLOW + "Successfully left the faction."); + playerFaction.broadcast(Relation.ENEMY.toChatColour() + sender.getName() + ChatColor.YELLOW + " has left the faction."); + new BukkitRunnable() { + @Override + public void run() { + HCF.getPlugin().getTabApi().onPlayerQuitEvent(player); + HCF.getPlugin().getTabApi().onPlayerJoinEvent(player); + } + }.runTaskLaterAsynchronously(HCF.getPlugin(), 4L); + } + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionListArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionListArgument.java new file mode 100644 index 0000000..d9ff4c5 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionListArgument.java @@ -0,0 +1,123 @@ +package com.prevailpots.hcf.faction.argument; + + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.JavaUtils; +import com.customhcf.util.MapSorting; +import com.customhcf.util.command.CommandArgument; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FactionListArgument extends CommandArgument { + private static final int MAX_FACTIONS_PER_PAGE = 10; + private final HCF plugin; + + public FactionListArgument(final HCF plugin) { + super("list", "See a list of all factions."); + this.plugin = plugin; + this.aliases = new String[]{"l"}; + } + + private static net.md_5.bungee.api.ChatColor fromBukkit(final ChatColor chatColor) { + return net.md_5.bungee.api.ChatColor.getByChar(chatColor.getChar()); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + Integer page; + if(args.length < 2) { + page = 1; + } else { + page = Ints.tryParse(args[1]); + if(page == null) { + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a valid number."); + return true; + } + } + new BukkitRunnable() { + public void run() { + FactionListArgument.this.showList(page, label, sender); + } + }.runTaskAsynchronously(this.plugin); + return true; + } + + private void showList(final int pageNumber, final String label, final CommandSender sender) { + if(pageNumber < 1) { + sender.sendMessage(ChatColor.RED + "You cannot view a page less than 1."); + return; + } + final Map factionOnlineMap = new HashMap(); + final Player senderPlayer = (Player) sender; + for(final Player target : Bukkit.getOnlinePlayers()) { + if(senderPlayer == null || senderPlayer.canSee(target)) { + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(target.getUniqueId()); + if(playerFaction == null) { + continue; + } + factionOnlineMap.put(playerFaction, factionOnlineMap.getOrDefault(playerFaction, 0) + 1); + } + } + final Map> pages = new HashMap>(); + final List> sortedMap = MapSorting.sortedValues( factionOnlineMap, Comparator.reverseOrder()); + for(final Map.Entry entry : sortedMap) { + int currentPage = pages.size(); + List results = pages.get(currentPage); + if(results == null || results.size() >= MAX_FACTIONS_PER_PAGE) { + pages.put(++currentPage, results = new ArrayList<>(MAX_FACTIONS_PER_PAGE)); + } + final PlayerFaction playerFaction2 = entry.getKey(); + final String displayName = playerFaction2.getName(); + final int index = results.size() + ((currentPage > 1) ? ((currentPage - 1) * MAX_FACTIONS_PER_PAGE) : 0) + 1; + final ComponentBuilder builder = new ComponentBuilder(" " + index + ". ").color(net.md_5.bungee.api.ChatColor.GRAY); + builder.append(displayName).color(net.md_5.bungee.api.ChatColor.YELLOW).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, '/' + label + " show " + playerFaction2.getName())).event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(net.md_5.bungee.api.ChatColor.GREEN + "Click to view " + displayName + ChatColor.GREEN + '.').create())); + builder.append(" (" + ChatColor.GREEN+ entry.getValue() + '/' +playerFaction2.getMembers().size() + ") "+ChatColor.GRAY + "[DTR " + playerFaction2.getDtrColour() + JavaUtils.format(playerFaction2.getDeathsUntilRaidable()) + ChatColor.GRAY + '/' + ChatColor.GREEN + JavaUtils.format(playerFaction2.getMaximumDeathsUntilRaidable())+ ChatColor.GRAY + "]", ComponentBuilder.FormatRetention.FORMATTING).color(net.md_5.bungee.api.ChatColor.GREEN); + results.add(builder.create()); + } + final int maxPages = pages.size(); + if(pageNumber > maxPages) { + sender.sendMessage(ChatColor.RED + "There " + ((maxPages == 1) ? ("is only " + maxPages + " page") : ("no factions to be displayed at this time")) + "."); + return; + } + sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + sender.sendMessage(ChatColor.GOLD + " Faction List " + ChatColor.GREEN + "[" + pageNumber + '/' + maxPages + ']'); + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + final Player player = (Player) sender; + final Collection components = pages.get(pageNumber); + for(final BaseComponent[] component : components) { + if(component == null) { + continue; + } + if(player != null) { + player.spigot().sendMessage(component); + } else { + sender.sendMessage(TextComponent.toPlainText(component)); + } + } + sender.sendMessage(ChatColor.GRAY + " Use " + ChatColor.GREEN + '/' + label + ' ' + this.getName() + " <#>" + ChatColor.GRAY + " to view the other pages."); + sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMapArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMapArgument.java new file mode 100644 index 0000000..7ec659f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMapArgument.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.faction.argument; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.base.Enums; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.LandMap; +import com.prevailpots.hcf.user.FactionUser; +import com.prevailpots.hcf.visualise.VisualType; + +public class FactionMapArgument extends CommandArgument { + private final HCF plugin; + + public FactionMapArgument(final HCF plugin) { + super("map", "View claims around your current location."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [factionName]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final UUID uuid = player.getUniqueId(); + final FactionUser factionUser = this.plugin.getUserManager().getUser(uuid); + VisualType visualType; + if(args.length <= 1) { + visualType = VisualType.CLAIM_MAP; + } else if((visualType = (VisualType) Enums.getIfPresent((Class) VisualType.class, args[1]).orNull()) == null) { + player.sendMessage(ChatColor.RED + "Visual type " + args[1] + " not found."); + return true; + } + final boolean newShowingMap = !factionUser.isShowClaimMap(); + if(newShowingMap) { + if(!LandMap.updateMap(player, this.plugin, visualType, true)) { + return true; + } + } else { + this.plugin.getVisualiseHandler().clearVisualBlocks(player, visualType, null); + sender.sendMessage(ChatColor.RED + "Faction land claim pillars are no longer shown."); + } + factionUser.setShowClaimMap(newShowingMap); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final VisualType[] values = VisualType.values(); + final List results = new ArrayList(values.length); + for(final VisualType visualType : values) { + results.add(visualType.name()); + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMessageArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMessageArgument.java new file mode 100644 index 0000000..ad4b1b8 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionMessageArgument.java @@ -0,0 +1,52 @@ +package com.prevailpots.hcf.faction.argument; + + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Iterator; + +public class FactionMessageArgument extends CommandArgument { + private final HCF plugin; + + public FactionMessageArgument(final HCF plugin) { + super("message", "Sends a message to your faction."); + this.plugin = plugin; + this.aliases = new String[]{"msg"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can use faction chat."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + String format = String.format(ChatChannel.FACTION.getRawFormat(player), "", org.apache.commons.lang3.StringUtils.join((Object[]) args, (char) ' ', (int) 1, (int) args.length)); + Iterator iterator = playerFaction.getOnlinePlayers().iterator(); + while(iterator.hasNext()) { + Player target = iterator.next(); + target.sendMessage(format); + } + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionOpenArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionOpenArgument.java new file mode 100644 index 0000000..3199bbc --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionOpenArgument.java @@ -0,0 +1,47 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FactionOpenArgument extends CommandArgument { + private final HCF plugin; + + public FactionOpenArgument(final HCF plugin) { + super("open", "Opens the faction to the public."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a fraction."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(player.getUniqueId()); + if(factionMember.getRole() != Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You must be a faction leader to do this."); + return true; + } + final boolean newOpen = !playerFaction.isOpen(); + playerFaction.setOpen(newOpen); + playerFaction.broadcast(ChatColor.YELLOW + sender.getName() + " has " + (newOpen ? (ChatColor.GREEN + "opened") : (ChatColor.RED + "closed")) + ChatColor.YELLOW + " the faction to public."); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.java new file mode 100644 index 0000000..dd8c2c6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionPromoteArgument.java @@ -0,0 +1,99 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class FactionPromoteArgument extends CommandArgument { + private final HCF plugin; + + public FactionPromoteArgument(final HCF plugin) { + super("promote", "Promotes a faction member to a captain."); + this.plugin = plugin; + this.aliases = new String[]{"captain", "officer", "mod", "moderator"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can set faction captains."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final UUID uuid = player.getUniqueId(); + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(uuid); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(uuid).getRole() != Role.LEADER && playerFaction.getMember(uuid).getRole() != Role.COLEADER) { + sender.sendMessage(ChatColor.RED + "You must be a faction leader to assign members as a captain."); + return true; + } + final FactionMember targetMember = playerFaction.getMember(args[1]); + if(targetMember == null) { + sender.sendMessage(ChatColor.RED + "That player is not in your faction."); + return true; + } + if(playerFaction.getMember(uuid).getRole().equals(Role.LEADER) && targetMember.getRole() == Role.CAPTAIN){ + final Role role = Role.COLEADER; + targetMember.setRole(role); + playerFaction.broadcast(Relation.MEMBER.toChatColour() + role.getAstrix() + targetMember.getName() + ChatColor.YELLOW + " has been assigned as a faction co-leader."); + return true; + } + if(targetMember.getRole() != Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You can only assign captains to members, " + targetMember.getName() + " is a " + targetMember.getRole().getName() + '.'); + return true; + } + final Role role = Role.CAPTAIN; + targetMember.setRole(role); + playerFaction.broadcast(Relation.MEMBER.toChatColour() + role.getAstrix() + targetMember.getName() + ChatColor.YELLOW + " has been assigned as a faction captain."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null || (playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER && playerFaction.getMember(player.getUniqueId()).getRole() != Role.COLEADER) ){ + return Collections.emptyList(); + } + final List results = new ArrayList(); + for(final Map.Entry entry : playerFaction.getMembers().entrySet()) { + if(entry.getValue().getRole() == Role.MEMBER || entry.getValue().getRole() == Role.CAPTAIN) { + final OfflinePlayer target = Bukkit.getOfflinePlayer((UUID) entry.getKey()); + final String targetName = target.getName(); + if(targetName == null) { + continue; + } + results.add(targetName); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionRenameArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionRenameArgument.java new file mode 100644 index 0000000..00bf2bf --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionRenameArgument.java @@ -0,0 +1,86 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.concurrent.TimeUnit; + +public class FactionRenameArgument extends CommandArgument { + private static final long FACTION_RENAME_DELAY_MILLIS; + private static final String FACTION_RENAME_DELAY_WORDS; + + static { + FACTION_RENAME_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(15L); + FACTION_RENAME_DELAY_WORDS = DurationFormatUtils.formatDurationWords(FactionRenameArgument.FACTION_RENAME_DELAY_MILLIS, true, true); + } + + private final HCF plugin; + + public FactionRenameArgument(final HCF plugin) { + super("rename", "Change the name of your faction."); + this.plugin = plugin; + this.aliases = new String[]{"changename", "setname"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can create faction."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER) { + sender.sendMessage(ChatColor.RED + "You must be a faction leader to edit the name."); + return true; + } + final String newName = args[1]; + if(plugin.getConfig().getStringList("Disabled-Faction-Names").contains(newName.toLowerCase())) { + sender.sendMessage(ChatColor.RED + "'" + newName + "' is a blocked faction name."); + return true; + } + if(newName.length() < 3) { + sender.sendMessage(ChatColor.RED + "Faction names must have at least " + 3 + " characters."); + return true; + } + if(newName.length() > 16) { + sender.sendMessage(ChatColor.RED + "Faction names cannot be longer than " + 16 + " characters."); + return true; + } + if(!JavaUtils.isAlphanumeric(newName)) { + sender.sendMessage(ChatColor.RED + "Faction names may only be alphanumeric."); + return true; + } + if(this.plugin.getFactionManager().getFaction(newName) != null) { + sender.sendMessage(ChatColor.RED + "Faction " + newName + ChatColor.RED + " already exists."); + return true; + } + final long difference = playerFaction.lastRenameMillis - System.currentTimeMillis() + FactionRenameArgument.FACTION_RENAME_DELAY_MILLIS; + if(!player.isOp() && difference > 0L) { + player.sendMessage(ChatColor.RED + "There is a faction rename delay of " + FactionRenameArgument.FACTION_RENAME_DELAY_WORDS + ". Therefore you need to wait another " + DurationFormatUtils.formatDurationWords(difference, true, true) + " to rename your faction."); + return true; + } + playerFaction.setName(args[1], sender); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.java new file mode 100644 index 0000000..052522d --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionSetHomeArgument.java @@ -0,0 +1,61 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FactionSetHomeArgument extends CommandArgument { + private final HCF plugin; + + public FactionSetHomeArgument(final HCF plugin) { + super("sethome", "Sets the faction home location."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(player); + if(factionMember.getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a faction officer to set the home."); + return true; + } + final Location location = player.getLocation(); + boolean insideTerritory = false; + for(final Claim claim : playerFaction.getClaims()) { + if(claim.contains(location)) { + insideTerritory = true; + break; + } + } + if(!insideTerritory) { + player.sendMessage(ChatColor.RED + "You may only set your home in your territory."); + return true; + } + playerFaction.setHome(location); + playerFaction.broadcast(ConfigurationService.TEAMMATE_COLOUR + factionMember.getRole().getAstrix() + sender.getName() + ChatColor.YELLOW + " has set the faction home."); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionShowArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionShowArgument.java new file mode 100644 index 0000000..8c07d76 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionShowArgument.java @@ -0,0 +1,84 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionShowArgument extends CommandArgument { + private final HCF plugin; + + public FactionShowArgument(final HCF plugin) { + super("show", "Get details about a faction.", new String[]{"i", "info", "who"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [playerName|factionName]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + Faction playerFaction = null; + Faction namedFaction; + if(args.length < 2) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + namedFaction = this.plugin.getFactionManager().getPlayerFaction(((Player) sender).getUniqueId()); + if(namedFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + } else { + + namedFaction = this.plugin.getFactionManager().getFaction(args[1]); + playerFaction = this.plugin.getFactionManager().getFaction(args[1]); + + if(Bukkit.getPlayer(args[1]) != null){ + playerFaction = this.plugin.getFactionManager().getPlayerFaction(Bukkit.getPlayer(args[1]).getUniqueId()); + }else{ + if(Bukkit.getOfflinePlayer(args[1]).hasPlayedBefore()){ + playerFaction = this.plugin.getFactionManager().getPlayerFaction(Bukkit.getOfflinePlayer(args[1]).getUniqueId()); + } + } + if(namedFaction == null && playerFaction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + } + if(namedFaction != null) { + namedFaction.printDetails(sender); + } + if(playerFaction != null && (namedFaction == null || !namedFaction.equals(playerFaction))) { + playerFaction.printDetails(sender); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionStuckArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionStuckArgument.java new file mode 100644 index 0000000..252b48f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionStuckArgument.java @@ -0,0 +1,49 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.SpawnFaction; +import com.prevailpots.hcf.timer.type.StuckTimer; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FactionStuckArgument extends CommandArgument { + private final HCF plugin; + + public FactionStuckArgument(final HCF plugin) { + super("stuck", "Teleport to a safe position.", new String[]{"trap", "trapped"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + final Player player = (Player) sender; + if(player.getWorld().getEnvironment() != World.Environment.NORMAL) { + sender.sendMessage(ChatColor.RED + "You can only use this command from the overworld."); + return true; + } + if(plugin.getFactionManager().getFactionAt(((Player) sender).getLocation()) instanceof SpawnFaction){ + sender.sendMessage(ChatColor.RED + "You cannot " + label + " " + this.getName() + " inside of Spawn"); + return true; + } + final StuckTimer stuckTimer = this.plugin.getTimerManager().stuckTimer; + if(!stuckTimer.setCooldown(player, player.getUniqueId())) { + sender.sendMessage(ChatColor.YELLOW + "Your " + stuckTimer.getDisplayName() + ChatColor.YELLOW + " timer has a remaining " + ChatColor.LIGHT_PURPLE + DurationFormatUtils.formatDurationWords(stuckTimer.getRemaining(player), true, true)+ChatColor.YELLOW + '.'); + return true; + } + sender.sendMessage(ChatColor.YELLOW + stuckTimer.getDisplayName() + ChatColor.YELLOW + " timer has started. " + "\nTeleportation will commence in " + ChatColor.LIGHT_PURPLE + HCF.getRemaining(stuckTimer.getRemaining(player), true, false) + ChatColor.YELLOW + ". " + "\nThis will cancel if you move more than " + 5 + " blocks."); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.java new file mode 100644 index 0000000..33dfec3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnallyArgument.java @@ -0,0 +1,107 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.FactionRelationRemoveEvent; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.stream.Collectors; + +public class FactionUnallyArgument extends CommandArgument { + private static ImmutableList COMPLETIONS; + private final HCF plugin; + + public FactionUnallyArgument(final HCF plugin) { + super("unally", "Remove an ally pact with other factions."); + this.plugin = plugin; + this.aliases = new String[]{"unalliance", "neutral"}; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a faction officer to edit relations."); + return true; + } + final Relation relation = Relation.ALLY; + final Collection targetFactions = new HashSet(); + if(args[1].equalsIgnoreCase("all")) { + final Collection allies = playerFaction.getAlliedFactions(); + if(allies.isEmpty()) { + sender.sendMessage(ChatColor.RED + "Your faction has no allies."); + return true; + } + targetFactions.addAll(allies); + } else { + final Faction searchedFaction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(!(searchedFaction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "Player faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + targetFactions.add((PlayerFaction) searchedFaction); + } + for(final PlayerFaction targetFaction : targetFactions) { + if(playerFaction.getRelations().remove(targetFaction.getUniqueID()) == null || targetFaction.getRelations().remove(playerFaction.getUniqueID()) == null) { + sender.sendMessage(ChatColor.RED + "Your faction is not " + relation.getDisplayName() + ChatColor.RED + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.RED + '.'); + return true; + } + final FactionRelationRemoveEvent event = new FactionRelationRemoveEvent(playerFaction, targetFaction, Relation.ALLY); + Bukkit.getPluginManager().callEvent((Event) event); + if(event.isCancelled()) { + sender.sendMessage(ChatColor.RED + "Could not drop " + relation.getDisplayName() + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.RED + "."); + return true; + } + playerFaction.broadcast(ChatColor.YELLOW + "Your faction has broken its " + relation.getDisplayName() + ChatColor.YELLOW + " with " + targetFaction.getDisplayName(playerFaction) + ChatColor.YELLOW + '.'); + targetFaction.broadcast(ChatColor.YELLOW + playerFaction.getDisplayName(targetFaction) + ChatColor.YELLOW + " has dropped their " + relation.getDisplayName() + ChatColor.YELLOW + " with your faction."); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + return Collections.emptyList(); + } + return Lists.newArrayList(Iterables.concat((Iterable) FactionUnallyArgument.COMPLETIONS, (Iterable) playerFaction.getAlliedFactions().stream().map(Faction::getName).collect(Collectors.toList()))); + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.java new file mode 100644 index 0000000..8561408 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUnclaimArgument.java @@ -0,0 +1,72 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.chat.ClickAction; +import com.customhcf.util.chat.Text; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Collection; + +public class FactionUnclaimArgument extends CommandArgument { + + private final HCF plugin; + + public FactionUnclaimArgument(final HCF plugin) { + super("unclaim", "Unclaims land from your faction."); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can un-claim land from a faction."); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(player); + if(factionMember.getRole() != Role.LEADER && factionMember.getRole() != Role.COLEADER) { + sender.sendMessage(ChatColor.RED + "You must be a faction leader to unclaim land."); + return true; + } + final Collection factionClaims = playerFaction.getClaims(); + if(factionClaims.isEmpty()) { + sender.sendMessage(ChatColor.RED + "Your faction does not own any claims."); + return true; + } + + if(args.length == 2) { + if(args[1].equalsIgnoreCase("yes")) { + for(Claim claims : factionClaims) { + playerFaction.removeClaim(claims, player); + } + factionClaims.clear(); + return true; + } + if(args[1].equalsIgnoreCase("no")) { + player.sendMessage(ChatColor.YELLOW + "You have been removed the unclaim-set."); + return true; + } + } + new Text(ChatColor.YELLOW + "Do you want to unclaim " + ChatColor.BOLD + "all" + ChatColor.YELLOW + " of your land?").send(player); + new Text(ChatColor.YELLOW+"If so, "+ChatColor.DARK_GREEN+"/f unclaim yes"+ChatColor.YELLOW+" otherwise do"+ChatColor.DARK_RED+" /f unclaim no"+ChatColor.GRAY+" (Click here to unclaim)").setColor(ChatColor.GRAY).setHoverText(ChatColor.GRAY+"Click here to unclaim all").setClick(ClickAction.RUN_COMMAND, "/f unclaim yes").send(player); + return true; + } + +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.java new file mode 100644 index 0000000..08c5a9c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionUninviteArgument.java @@ -0,0 +1,87 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +public class FactionUninviteArgument extends CommandArgument { + private static final ImmutableList COMPLETIONS; + + static { + COMPLETIONS = ImmutableList.of("all"); + } + + private final HCF plugin; + + public FactionUninviteArgument(final HCF plugin) { + super("uninvite", "Revoke an invitation to a player.", new String[]{"deinvite", "deinv", "uninv", "revoke"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can un-invite from a faction."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(player); + if(factionMember.getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a faction officer to un-invite players."); + return true; + } + final Set invitedPlayerNames = playerFaction.getInvitedPlayerNames(); + if(args[1].equalsIgnoreCase("all")) { + invitedPlayerNames.clear(); + sender.sendMessage(ChatColor.YELLOW + "You have cleared all pending invitations."); + return true; + } + if(!invitedPlayerNames.remove(args[1])) { + sender.sendMessage(ChatColor.RED + "There is not a pending invitation for " + args[1] + '.'); + return true; + } + playerFaction.broadcast(ChatColor.YELLOW + factionMember.getRole().getAstrix() + sender.getName() + " has uninvited " + ConfigurationService.ENEMY_COLOUR + args[1] + ChatColor.YELLOW + " from the faction."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null || playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + return Collections.emptyList(); + } + final List results = new ArrayList((Collection) FactionUninviteArgument.COMPLETIONS); + results.addAll(playerFaction.getInvitedPlayerNames()); + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionVersionArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionVersionArgument.java new file mode 100644 index 0000000..7f62c22 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionVersionArgument.java @@ -0,0 +1,25 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.command.CommandArgument; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class FactionVersionArgument extends CommandArgument { + public FactionVersionArgument() { + super("version", "Display the version of this HCFactions plugin."); + } + + @Override + public String getUsage(final String label) { + return ""; + } + + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + commandSender.sendMessage(ChatColor.GREEN + ChatColor.BOLD.toString() + + "HCFactions" + ChatColor.RESET + ChatColor.YELLOW.toString() + " made by " + ChatColor.RED + "Clipped"); + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.java new file mode 100644 index 0000000..23b376e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/FactionWithdrawArgument.java @@ -0,0 +1,86 @@ +package com.prevailpots.hcf.faction.argument; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FactionWithdrawArgument extends CommandArgument { + private static final ImmutableList COMPLETIONS; + + static { + COMPLETIONS = ImmutableList.of("all"); + } + + private final HCF plugin; + + public FactionWithdrawArgument(final HCF plugin) { + super("withdraw", "Withdraws money from the faction balance.", new String[]{"w"}); + this.plugin = plugin; + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can update the faction balance."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "You are not in a faction."); + return true; + } + final UUID uuid = player.getUniqueId(); + final FactionMember factionMember = playerFaction.getMember(uuid); + if(factionMember.getRole() == Role.MEMBER) { + sender.sendMessage(ChatColor.RED + "You must be a faction officer to withdraw money."); + return true; + } + final int factionBalance = playerFaction.getBalance(); + Integer amount; + if(args[1].equalsIgnoreCase("all")) { + amount = factionBalance; + } else if((amount = Ints.tryParse(args[1])) == null) { + sender.sendMessage(ChatColor.RED + "Error: '" + args[1] + "' is not a valid number."); + return true; + } + if(amount <= 0) { + sender.sendMessage(ChatColor.RED + "Amount must be positive."); + return true; + } + if(amount > factionBalance) { + sender.sendMessage(ChatColor.RED + "Your faction need at least " + '$' + JavaUtils.format((Number) amount) + " to do this, whilst it only has " + '$' + JavaUtils.format((Number) factionBalance) + '.'); + return true; + } + this.plugin.getEconomyManager().addBalance(uuid, amount); + playerFaction.setBalance(factionBalance - amount); + playerFaction.broadcast(ConfigurationService.TEAMMATE_COLOUR + factionMember.getRole().getAstrix() + sender.getName() + ChatColor.YELLOW + " has withdrew " + ChatColor.BOLD + '$' + JavaUtils.format((Number) amount) + ChatColor.YELLOW + " from the faction balance."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (List) ((args.length == 2) ? FactionWithdrawArgument.COMPLETIONS : Collections.emptyList()); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.java new file mode 100644 index 0000000..3ee52f3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionChatSpyArgument.java @@ -0,0 +1,159 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.FactionChatEvent; +import com.prevailpots.hcf.faction.event.FactionRemoveEvent; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.user.FactionUser; + +public class FactionChatSpyArgument extends CommandArgument implements Listener { + private static final UUID ALL_UUID; + private static final ImmutableList COMPLETIONS; + + static { + ALL_UUID = UUID.fromString("5a3ed6d1-0239-4e24-b4a9-8cd5b3e5fc72"); + COMPLETIONS = ImmutableList.of("list", "add", "del", "clear"); + } + + private final HCF plugin; + + public FactionChatSpyArgument(final HCF plugin) { + super("chatspy", "Spy on the chat of a faction."); + this.plugin = plugin; + this.aliases = new String[]{"cs"}; + this.permission = "command.faction." + getName(); + plugin.getServer().getPluginManager().registerEvents((Listener) this, (Plugin) plugin); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " <" + StringUtils.join((Iterable) FactionChatSpyArgument.COMPLETIONS, '|') + "> [factionName]"; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onFactionRemove(final FactionRemoveEvent event) { + if(event.getFaction() instanceof PlayerFaction) { + final UUID factionUUID = event.getFaction().getUniqueID(); + for(final FactionUser user : this.plugin.getUserManager().getUsers().values()) { + user.getFactionChatSpying().remove(factionUUID); + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onFactionChat(final FactionChatEvent event) { + final Player player = event.getPlayer(); + final Faction faction = event.getFaction(); + final String format = ChatColor.GOLD + "[" + ChatColor.RED + event.getChatChannel().getDisplayName() + ": " + ChatColor.YELLOW + faction.getName() + ChatColor.GOLD + "] " + ChatColor.GRAY + event.getFactionMember().getRole().getAstrix() + player.getName() + ": " + ChatColor.YELLOW + event.getMessage(); + final HashSet recipients = new HashSet<>(); + recipients.removeAll(event.getRecipients()); + for(final CommandSender recipient : recipients) { + if(!(recipient instanceof Player)) { + continue; + } + final Player target = (Player) recipient; + final FactionUser user = event.isAsynchronous() ? this.plugin.getUserManager().getUserAsync(target.getUniqueId()) : this.plugin.getUserManager().getUser(player.getUniqueId()); + final Collection spying = user.getFactionChatSpying(); + if(!spying.contains(FactionChatSpyArgument.ALL_UUID) && !spying.contains(faction.getUniqueID())) { + continue; + } + recipient.sendMessage(format); + } + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is only executable by players."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final Set currentSpies = this.plugin.getUserManager().getUser(player.getUniqueId()).getFactionChatSpying(); + if(args[1].equalsIgnoreCase("list")) { + if(currentSpies.isEmpty()) { + sender.sendMessage(ChatColor.RED + "You are not spying on the chat of any factions."); + return true; + } + sender.sendMessage(ChatColor.GRAY + "You are currently spying on the chat of (" + currentSpies.size() + " factions): " + ChatColor.RED + StringUtils.join((Iterable) currentSpies, ChatColor.GRAY + ", " + ChatColor.RED) + ChatColor.GRAY + '.'); + return true; + } else if(args[1].equalsIgnoreCase("add")) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[1].toLowerCase() + " "); + return true; + } + final Faction faction = this.plugin.getFactionManager().getFaction(args[2]); + if(!args[2].equalsIgnoreCase("all")) { + if (!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "Player based faction named or containing member with IGN or UUID " + args[2] + " not found."); + return true; + } + } + if(currentSpies.contains(FactionChatSpyArgument.ALL_UUID) || currentSpies.contains(faction.getUniqueID())) { + sender.sendMessage(ChatColor.YELLOW + "You are already spying on the chat of " + (args[2].equalsIgnoreCase("all") ? "all factions" : args[2]) + '.'); + return true; + } + if(args[2].equalsIgnoreCase("all")) { + currentSpies.clear(); + currentSpies.add(FactionChatSpyArgument.ALL_UUID); + sender.sendMessage(ChatColor.GREEN + "You are now spying on the chat of all factions."); + return true; + } + if(currentSpies.add(faction.getUniqueID())) { + plugin.getUserManager().getUser(player.getUniqueId()).getFactionChatSpying().add(faction.getUniqueID()); + sender.sendMessage(ChatColor.YELLOW + "You are now spying on the chat of " + faction.getDisplayName(sender) + ChatColor.GREEN + '.'); + } else { + sender.sendMessage(ChatColor.RED + "You are already spying on the chat of " + faction.getDisplayName(sender) + ChatColor.RED + '.'); + } + return true; + } else if(args[1].equalsIgnoreCase("del") || args[1].equalsIgnoreCase("delete") || args[1].equalsIgnoreCase("remove")) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[1].toLowerCase() + " "); + return true; + } + if(args[2].equalsIgnoreCase("all")) { + currentSpies.remove(FactionChatSpyArgument.ALL_UUID); + sender.sendMessage(ChatColor.RED + "No longer spying on the chat of all factions."); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[2]); + if(faction == null) { + sender.sendMessage(ChatColor.GOLD + "Faction '" + ChatColor.YELLOW + args[2] + ChatColor.GOLD + "' not found."); + return true; + } + if(currentSpies.remove(faction.getUniqueID())) { + sender.sendMessage(ChatColor.RED + "You are no longer spying on the chat of " + faction.getDisplayName(sender) + ChatColor.RED + '.'); + } else { + sender.sendMessage(ChatColor.RED + "You will still not be spying on the chat of " + faction.getDisplayName(sender) + ChatColor.RED + '.'); + } + return true; + } else { + if(args[1].equalsIgnoreCase("clear")) { + currentSpies.clear(); + sender.sendMessage(ChatColor.YELLOW + "You are no longer spying the chat of any faction."); + return true; + } + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.java new file mode 100644 index 0000000..0da1ea2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClaimForArgument.java @@ -0,0 +1,104 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.customhcf.util.cuboid.Cuboid; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.bukkit.selections.Selection; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Created by TREHOME on 01/20/2016. + */ +public class FactionClaimForArgument extends CommandArgument { + private static final int MIN_EVENT_CLAIM_AREA; + + + private final HCF plugin; + + public FactionClaimForArgument(final HCF plugin) { + super("claimfor", "Claims for a faction"); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [shouldClearClaims]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + Faction faction = plugin.getFactionManager().getFaction(args[1]); + if(!(faction instanceof ClaimableFaction)){ + sender.sendMessage(ChatColor.RED + "This is not a claimable faction (cannot contain claims)"); + return true; + } + if(faction instanceof PlayerFaction){ + sender.sendMessage(ChatColor.RED + "You cannot claim player factions like this. Try /f claim wand"); + return true; + } + final WorldEditPlugin worldEditPlugin = this.plugin.getWorldEdit(); + if(worldEditPlugin == null) { + sender.sendMessage(ChatColor.RED + "WorldEdit must be installed to set event claim areas."); + return true; + } + final Player player = (Player) sender; + final Selection selection = worldEditPlugin.getSelection(player); + if(selection == null) { + sender.sendMessage(ChatColor.RED + "You must make a WorldEdit selection to do this."); + return true; + } + if(selection.getWidth() < MIN_EVENT_CLAIM_AREA || selection.getLength() < MIN_EVENT_CLAIM_AREA) { + sender.sendMessage(ChatColor.RED + "Event claim areas must be at least " + MIN_EVENT_CLAIM_AREA + 'x' + MIN_EVENT_CLAIM_AREA + '.'); + return true; + } + ClaimableFaction claimableFaction = (ClaimableFaction) faction; + if(args.length == 3 && (args[2].toLowerCase().contains("true") || args[2].toLowerCase().contains("yes")) && ((ClaimableFaction) faction).getClaims().size() > 0){ + sender.sendMessage(ChatColor.YELLOW + "Set claim for " + faction.getDisplayName(sender) + ChatColor.YELLOW + '.'); + if(claimableFaction.getClaims().size() > 0) { + for (Claim claim : claimableFaction.getClaims()) { + claimableFaction.removeClaim(claim, sender); + } + claimableFaction.getClaims().clear(); + } + claimableFaction.setClaim(new Cuboid(selection.getMinimumPoint(), selection.getMaximumPoint()), player); + return true; + } + claimableFaction.addClaim(new Claim(claimableFaction, selection.getMinimumPoint(), selection.getMaximumPoint()), player); + sender.sendMessage(ChatColor.YELLOW + "Added claim for " + faction.getDisplayName(sender) + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + switch (args.length){ + case 2 :{ + final List results = new ArrayList<>(plugin.getFactionManager().getClaimableFactions().size()); + for(ClaimableFaction claimableFaction : plugin.getFactionManager().getClaimableFactions()){ + results.add(claimableFaction.getName()); + } + return results; + } + default: { + return Collections.emptyList(); + } + } + } + static { + MIN_EVENT_CLAIM_AREA = 2; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.java new file mode 100644 index 0000000..aefd41e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionClearClaimsArgument.java @@ -0,0 +1,126 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.conversations.Conversable; +import org.bukkit.conversations.ConversationContext; +import org.bukkit.conversations.ConversationFactory; +import org.bukkit.conversations.Prompt; +import org.bukkit.conversations.StringPrompt; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionClearClaimsArgument extends CommandArgument { + private final ConversationFactory factory; + private final HCF plugin; + + public FactionClearClaimsArgument(final HCF plugin) { + super("clearclaims", "Clears the claims of a faction."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + this.factory = new ConversationFactory((Plugin) plugin).withFirstPrompt((Prompt) new ClaimClearAllPrompt(plugin)).withEscapeSequence("/no").withTimeout(10).withModality(false).withLocalEcho(true); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(args[1].equalsIgnoreCase("all")) { + + final Conversable conversable = (Conversable) sender; + conversable.beginConversation(this.factory.buildConversation(conversable)); + return true; + } else { + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(faction instanceof ClaimableFaction) { + final ClaimableFaction claimableFaction = (ClaimableFaction) faction; + claimableFaction.removeClaims(claimableFaction.getClaims(), sender); + for(Claim claim : claimableFaction.getClaims()){ + claimableFaction.removeClaim(claim, sender); + } + claimableFaction.getClaims().clear(); + if(claimableFaction instanceof PlayerFaction) { + ((PlayerFaction) claimableFaction).broadcast(ChatColor.GOLD.toString() + ChatColor.BOLD + "Your claims have been forcefully wiped by " + sender.getName() + '.'); + } + } + sender.sendMessage(ChatColor.YELLOW.toString() + "Claims belonging to " + ChatColor.GOLD + faction.getName() + ChatColor.YELLOW + " have been forcefully wiped."); + return true; + } + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } + + private static class ClaimClearAllPrompt extends StringPrompt { + private final HCF plugin; + + public ClaimClearAllPrompt(final HCF plugin) { + this.plugin = plugin; + } + + public String getPromptText(final ConversationContext context) { + return ChatColor.YELLOW + "Are you sure you want to do this? " + ChatColor.RED + ChatColor.BOLD + "All claims" + ChatColor.YELLOW + " will be cleared. " + "Type " + ChatColor.GREEN + "yes" + ChatColor.YELLOW + " to confirm or " + ChatColor.RED + "no" + ChatColor.YELLOW + " to deny."; + } + + public Prompt acceptInput(final ConversationContext context, final String string) { + final String lowerCase = string.toLowerCase(); + switch(lowerCase) { + case "yes": { + for(final Faction faction : this.plugin.getFactionManager().getFactions()) { + if(faction instanceof ClaimableFaction) { + final ClaimableFaction claimableFaction = (ClaimableFaction) faction; + claimableFaction.removeClaims(claimableFaction.getClaims(), (CommandSender) Bukkit.getConsoleSender()); + } + } + final Conversable conversable = context.getForWhom(); + Bukkit.broadcastMessage(ChatColor.GOLD.toString() + ChatColor.BOLD + "All claims have been cleared" + ((conversable instanceof CommandSender) ? (" by " + ((CommandSender) conversable).getName()) : "") + '.'); + return Prompt.END_OF_CONVERSATION; + } + case "no": { + context.getForWhom().sendRawMessage(ChatColor.BLUE + "Cancelled the process of clearing all faction claims."); + return Prompt.END_OF_CONVERSATION; + } + default: { + context.getForWhom().sendRawMessage(ChatColor.RED + "Unrecognized response. Process of clearing all faction claims cancelled."); + return Prompt.END_OF_CONVERSATION; + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.java new file mode 100644 index 0000000..aa6762c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionCreateSystemArgument.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionManager; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class FactionCreateSystemArgument extends CommandArgument { + private final HCF plugin; + + public FactionCreateSystemArgument(final HCF plugin) { + super("createFaction", "Crates System Faction"); + this.plugin = plugin; + this.permission = "command.faction.argument." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final long newRegen = JavaUtils.parse(args[2]); + if(newRegen == -1L) { + sender.sendMessage(ChatColor.RED + "Invalid duration, use the correct format: 10m 1s"); + return true; + } + if(newRegen > FactionManager.MAX_DTR_REGEN_MILLIS) { + sender.sendMessage(ChatColor.RED + "Cannot set factions DTR regen above " + FactionManager.MAX_DTR_REGEN_WORDS + "."); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "This type of faction does not use DTR."); + return true; + } + final PlayerFaction playerFaction = (PlayerFaction) faction; + final long previousRegenRemaining = playerFaction.getRemainingRegenerationTime(); + playerFaction.setRemainingRegenerationTime(newRegen); + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set DTR regen of " + faction.getName() + " from " + DurationFormatUtils.formatDurationWords(previousRegenRemaining, true, true) + " to " + DurationFormatUtils.formatDurationWords(newRegen, true, true) + '.'); + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.java new file mode 100644 index 0000000..18fc534 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceJoinArgument.java @@ -0,0 +1,81 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionForceJoinArgument extends CommandArgument { + private final HCF plugin; + + public FactionForceJoinArgument(final HCF plugin) { + super("forcejoin", "Forcefully join a faction."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "Only players can join factions."); + return true; + } + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction != null) { + sender.sendMessage(ChatColor.RED + "You are already in a faction."); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "You can only join player factions."); + return true; + } + playerFaction = (PlayerFaction) faction; + if(playerFaction.setMember(player, new FactionMember(player, ChatChannel.PUBLIC, Role.MEMBER), true)) { + playerFaction.broadcast(ChatColor.YELLOW.toString() + sender.getName() + " has joined your faction forcefully."); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.java new file mode 100644 index 0000000..adbda93 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForceLeaderArgument.java @@ -0,0 +1,63 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; + +public class FactionForceLeaderArgument extends CommandArgument { + private final HCF plugin; + + public FactionForceLeaderArgument(final HCF plugin) { + super("forceleader", "Forces the leader of a faction."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getContainingPlayerFaction(args[1]); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "Faction containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(args[1]); + if(factionMember == null) { + sender.sendMessage(ChatColor.RED + "Faction containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(factionMember.getRole() == Role.LEADER) { + sender.sendMessage(ChatColor.RED + factionMember.getName() + " is already the leader of " + playerFaction.getDisplayName(sender) + ChatColor.RED + '.'); + return true; + } + final FactionMember leader = playerFaction.getLeader(); + final String oldLeaderName = (leader == null) ? "none" : leader.getName(); + final String newLeaderName = factionMember.getName(); + if(leader != null) { + leader.setRole(Role.CAPTAIN); + } + factionMember.setRole(Role.LEADER); + playerFaction.broadcast(ChatColor.YELLOW + sender.getName() + " has forcefully set the leader to " + newLeaderName + '.'); + sender.sendMessage(ChatColor.GOLD.toString() + ChatColor.BOLD + "Leader of " + playerFaction.getName() + "was forcefully set from " + oldLeaderName + " to " + newLeaderName + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 2) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.java new file mode 100644 index 0000000..2579621 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionForcePromoteArgument.java @@ -0,0 +1,56 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; + +public class FactionForcePromoteArgument extends CommandArgument { + private final HCF plugin; + + public FactionForcePromoteArgument(final HCF plugin) { + super("forcepromote", "Forces the promotion status of a player."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getContainingPlayerFaction(args[1]); + if(playerFaction == null) { + sender.sendMessage(ChatColor.RED + "Faction containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + final FactionMember factionMember = playerFaction.getMember(args[1]); + if(factionMember == null) { + sender.sendMessage(ChatColor.RED + "Faction containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(factionMember.getRole() != Role.MEMBER) { + sender.sendMessage(ChatColor.RED + factionMember.getName() + " is already a " + factionMember.getRole().getName() + '.'); + return true; + } + factionMember.setRole(Role.CAPTAIN); + playerFaction.broadcast(ChatColor.GOLD.toString() + ChatColor.BOLD + sender.getName() + " has been forcefully assigned as a captain."); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 2) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.java new file mode 100644 index 0000000..38fdd48 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionLockArgument.java @@ -0,0 +1,61 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; + +/** + * Created by TREHOME on 01/20/2016. + */ +public class FactionLockArgument extends CommandArgument { + private final HCF plugin; + + public FactionLockArgument(final HCF plugin) { + super("lock", "Lock all factions"); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [on|off]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if (args[1].equalsIgnoreCase("on")) { + Bukkit.broadcastMessage(ChatColor.RED + "All Factions are being locked!"); + for (Faction faction : plugin.getFactionManager().getFactions()) { + if (faction instanceof PlayerFaction) { + faction.setLocked(true); + } + } + } + if (args[1].equalsIgnoreCase("off")) { + Bukkit.broadcastMessage(ChatColor.GREEN + "All Factions are being un-locked!"); + for (Faction faction : plugin.getFactionManager().getFactions()) { + if (faction instanceof PlayerFaction) { + faction.setLocked(false); + } + } + } + + + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 2) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.java new file mode 100644 index 0000000..d29cc8e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionManageArgument.java @@ -0,0 +1,199 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.base.BasePlugin; +import com.customhcf.util.ItemBuilder; +import com.customhcf.util.Menu; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.conversations.*; +import org.bukkit.entity.Player; + +import java.util.Collections; +import java.util.List; + +public class FactionManageArgument extends CommandArgument { + private final HCF plugin; + + public FactionManageArgument(final HCF plugin) { + super("manage", "Gui Manager for Factions"); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Player player = (Player) sender; + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "You can only punish player factions."); + return true; + } + final PlayerFaction fac = (PlayerFaction) faction; + Menu menu = new Menu(fac.getName(), 3); + + menu.fill(new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 15).displayName("").build()); + + menu.setItem(10, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.RED + ChatColor.BOLD.toString() + "Punish Faction").build()); + + menu.setItem(16, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 11).displayName(ChatColor.BLUE + ChatColor.BOLD.toString() + "Manage Faction").build()); + + menu.runWhenEmpty(false); + + menu.setGlobalAction((player1, inventory, itemStack, slot, inventoryAction) -> { + switch (slot) { + case 10: { + player1.closeInventory(); + final Conversable conversable = (Conversable) sender; + conversable.beginConversation(new ConversationFactory(plugin).withFirstPrompt(new FactionPrompt(player, fac)).withLocalEcho(true).buildConversation(conversable)); + break; + } + case 16: { + Menu manage = new Menu(fac.getName(), 3); + + manage.fill(new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 15).displayName("").build()); + + manage.setItem(9, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 13).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Join Faction").build()); + + manage.setItem(11, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.RED + ChatColor.BOLD.toString() + "Remove Faction").build()); + + manage.setItem(13, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 0).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Spy on faction chat").build()); + + manage.setItem(15, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 6).displayName(ChatColor.LIGHT_PURPLE + ChatColor.BOLD.toString() + "Start DTR Regen").build()); + + manage.setItem(17, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 11).displayName(ChatColor.BLUE + ChatColor.BOLD.toString() + "Manage DTR").build()); + + manage.setItem(18, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.RED + ChatColor.BOLD.toString() + "Back").build()); + + manage.runWhenEmpty(false); + + manage.setGlobalAction((player2, inventory1, itemStack1, s, inventoryAction1) -> { + switch (s) { + case 9: { + if (plugin.getFactionManager().getFaction(player2.getUniqueId()) != null) { + if (plugin.getFactionManager().getPlayerFaction(player2.getUniqueId()).getLeader().equals(plugin.getFactionManager().getPlayerFaction(player2.getUniqueId()).getMember(player2))) { + this.plugin.getFactionManager().removeFaction(plugin.getFactionManager().getPlayerFaction(player2.getUniqueId()), sender); + } + plugin.getFactionManager().getPlayerFaction(player2.getUniqueId()).setMember(player2, null); + } + Bukkit.dispatchCommand(player2, "faction forcejoin " + fac.getName()); + break; + } + case 11: { + Bukkit.dispatchCommand(player2, "faction forcedisband " + fac.getName()); + break; + } + case 13: { + Bukkit.dispatchCommand(player2, "faction chatspy add " + fac.getName()); + break; + } + case 15: { + Bukkit.dispatchCommand(player2, "faction setdtrregen " + fac.getName() + " 0s"); + break; + } + case 17: { + Menu dtr = new Menu("Manage DTR", 2); + + dtr.fill(new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 15).displayName("").build()); + + manage.setItem(9, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.RED + ChatColor.BOLD.toString() + "Back").build()); + + + + dtr.runWhenEmpty(false); + + dtr.setGlobalAction((player3, inventory2, itemStack2, ss, inventoryAction2) -> { + switch (ss) { + case 1: { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() -3 )); + break; + } + case 2: { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() -2 )); + break; + } + case 3 : { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() -1 )); + break; + } + case 5 : { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() +1 )); + break; + } + case 6 : { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() +2 )); + break; + } + case 7 : { + Bukkit.dispatchCommand(player3, "faction setdtr " + (fac.getDeathsUntilRaidable() +3 )); + break; + } + case 9: { + player2.closeInventory(); + manage.showMenu(player2); + break; + } + } + }); + player2.closeInventory(); + dtr.showMenu(player2); + break; + } + case 18: { + player2.closeInventory(); + menu.showMenu(player2); + break; + } + } + }); + manage.showMenu(player); + + break; + } + } + }); + menu.showMenu(player); + return true; + } + private static final class FactionPrompt extends StringPrompt { + + private Player player; + private PlayerFaction faction; + + public FactionPrompt(Player player, PlayerFaction faction){ + this.player = player; + this.faction = faction; + } + + public String getPromptText(final ConversationContext context) { + return ChatColor.YELLOW + "What reason would you like for the punishment to be?"; + } + + public Prompt acceptInput(final ConversationContext context, final String string) { + Bukkit.dispatchCommand(player, "faction punish " + faction.getName() + " " + string); + return Prompt.END_OF_CONVERSATION; + } + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + return (args.length == 2) ? null : Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.java new file mode 100644 index 0000000..538a0d1 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionPunishArgument.java @@ -0,0 +1,131 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.base.BasePlugin; +import com.customhcf.util.ItemBuilder; +import com.customhcf.util.Menu; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionPunishArgument extends CommandArgument { + private final HCF plugin; + + public FactionPunishArgument(final HCF plugin) { + super("punish", "GUI punishment system"); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [reason]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + String message = StringUtils.join(args, ' ', 2, args.length); + final Player player = (Player) sender; + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "You can only punish player factions."); + return true; + } + final PlayerFaction fac = (PlayerFaction) faction; + Menu menu = new Menu(faction.getName(), 3); + menu.fill(new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 15).displayName("").build()); + + menu.setItem(10, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 0).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Freeze Faction").build()); + + if(player.hasPermission("command.faction.punish.ban")) { + menu.setItem(12, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.RED + ChatColor.BOLD.toString() + "Ban Faction").build()); + }else{ + menu.setItem(12, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 14).displayName(ChatColor.DARK_RED + ChatColor.BOLD.toString() + "No Permission").build()); + } + + menu.setItem(14, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 11).displayName(ChatColor.AQUA + ChatColor.BOLD.toString() + "Mute Faction").build()); + + menu.setItem(16, new ItemBuilder(Material.STAINED_GLASS_PANE).data((short) 2).displayName(ChatColor.LIGHT_PURPLE + ChatColor.BOLD.toString() + "Kick Faction").build()); + + menu.runWhenEmpty(false); + + menu.setGlobalAction((player1, inventory, itemStack, slot, inventoryAction) -> { + switch (slot) { + case 10: { + for (FactionMember factionMember : fac.getMembers().values()) { + if (Bukkit.getPlayer(factionMember.getUniqueId()) != null) { + Bukkit.dispatchCommand(player1, "freeze " + factionMember.getName()); + } + } + Bukkit.broadcastMessage(ChatColor.GREEN + player1.getName() + " has frozen the faction " + fac.getName()); + break; + } + case 12: { + if(itemStack.getItemMeta().getDisplayName().contains(ChatColor.DARK_RED.toString())) return; + for (FactionMember factionMember : fac.getMembers().values()) { + Bukkit.dispatchCommand(player1, "ban -s " + factionMember.getName() + " " + message); + } + Bukkit.broadcastMessage(ChatColor.GREEN + player1.getName() + " has banned the faction " + fac.getName()); + break; + } + case 14: { + for (FactionMember factionMember : fac.getMembers().values()) { + Bukkit.dispatchCommand(player1, "mute -s " + factionMember.getName() + " " + message); + } + Bukkit.broadcastMessage(ChatColor.GREEN + player1.getName() + " has muted the faction " + fac.getName()); + break; + } + case 16: { + for (FactionMember factionMember : fac.getMembers().values()) { + Bukkit.dispatchCommand(player1, "kick -s " + factionMember.getName() + " " + message); + } + Bukkit.broadcastMessage(ChatColor.GREEN + player1.getName() + " has kicked the faction " + fac.getName()); + break; + } + default: { + return; + } + } + + }); + menu.showMenu(player); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.java new file mode 100644 index 0000000..a2a2e69 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionRemoveArgument.java @@ -0,0 +1,116 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.conversations.Conversable; +import org.bukkit.conversations.ConversationContext; +import org.bukkit.conversations.ConversationFactory; +import org.bukkit.conversations.Prompt; +import org.bukkit.conversations.StringPrompt; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionRemoveArgument extends CommandArgument { + private final ConversationFactory factory; + private final HCF plugin; + + public FactionRemoveArgument(final HCF plugin) { + super("remove", "Remove a faction."); + this.plugin = plugin; + this.aliases = new String[]{"delete", "forcedisband", "forceremove"}; + this.permission = "command.faction." + this.getName(); + this.factory = new ConversationFactory((Plugin) plugin).withFirstPrompt((Prompt) new RemoveAllPrompt(plugin)).withEscapeSequence("/no").withTimeout(10).withModality(false).withLocalEcho(true); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(args[1].equalsIgnoreCase("all")) { + if(!(sender instanceof ConsoleCommandSender)) { + sender.sendMessage(ChatColor.RED + "This command can be only executed from console."); + return true; + } + final Conversable conversable = (Conversable) sender; + conversable.beginConversation(this.factory.buildConversation(conversable)); + return true; + } else { + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(this.plugin.getFactionManager().removeFaction(faction, sender)) { + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Disbanded faction " + ChatColor.GOLD + faction.getName() + ChatColor.YELLOW + '.'); + } + return true; + } + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } + + private static class RemoveAllPrompt extends StringPrompt { + private final HCF plugin; + + public RemoveAllPrompt(final HCF plugin) { + this.plugin = plugin; + } + + public String getPromptText(final ConversationContext context) { + return ChatColor.YELLOW + "Are you sure you want to do this? " + ChatColor.RED + ChatColor.BOLD + "All factions" + ChatColor.YELLOW + " will be cleared. " + "Type " + ChatColor.GREEN + "yes" + ChatColor.YELLOW + " to confirm or " + ChatColor.RED + "no" + ChatColor.YELLOW + " to deny."; + } + + public Prompt acceptInput(final ConversationContext context, final String string) { + final String lowerCase = string.toLowerCase(); + switch(lowerCase) { + case "yes": { + for(final Faction faction : this.plugin.getFactionManager().getPlayerFactions()) { + this.plugin.getFactionManager().removeFaction(faction, Bukkit.getConsoleSender()); + } + final Conversable conversable = context.getForWhom(); + Bukkit.broadcastMessage(ChatColor.GOLD.toString() + ChatColor.BOLD + "All factions have been disbanded" + ((conversable instanceof CommandSender) ? (" by " + ((CommandSender) conversable).getName()) : "") + '.'); + return Prompt.END_OF_CONVERSATION; + } + case "no": { + context.getForWhom().sendRawMessage(ChatColor.BLUE + "Cancelled the process of disbanding all factions."); + return Prompt.END_OF_CONVERSATION; + } + default: { + context.getForWhom().sendRawMessage(ChatColor.RED + "Unrecognized response. Process of disbanding all factions cancelled."); + return Prompt.END_OF_CONVERSATION; + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.java new file mode 100644 index 0000000..67b942c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDeathbanMultiplierArgument.java @@ -0,0 +1,56 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.primitives.Doubles; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class FactionSetDeathbanMultiplierArgument extends CommandArgument { + private static final double MIN_MULTIPLIER = 0.0; + private static final double MAX_MULTIPLIER = 5.0; + private final HCF plugin; + + public FactionSetDeathbanMultiplierArgument(final HCF plugin) { + super("setdeathbanmultiplier", "Sets the deathban multiplier of a faction."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + final Double multiplier = Doubles.tryParse(args[2]); + if(multiplier == null) { + sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number."); + return true; + } + if(multiplier < MIN_MULTIPLIER) { + sender.sendMessage(ChatColor.RED + "Deathban multipliers may not be less than " + MIN_MULTIPLIER + '.'); + return true; + } + if(multiplier > MAX_MULTIPLIER) { + sender.sendMessage(ChatColor.RED + "Deathban multipliers may not be more than " + MAX_MULTIPLIER + '.'); + return true; + } + final double previousMultiplier = faction.getDeathbanMultiplier(); + faction.setDeathbanMultiplier(multiplier); + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set deathban multiplier of " + faction.getName() + " from " + previousMultiplier + " to " + multiplier + '.'); + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.java new file mode 100644 index 0000000..94666f8 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrArgument.java @@ -0,0 +1,90 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.primitives.Doubles; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FactionSetDtrArgument extends CommandArgument { + private final HCF plugin; + + public FactionSetDtrArgument(final HCF plugin) { + super("setdtr", "Sets the DTR of a faction."); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + Double newDTR = Doubles.tryParse(args[2]); + if(newDTR == null) { + sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number."); + return true; + } + if (args[1].equalsIgnoreCase("all")) { + if (!(sender instanceof ConsoleCommandSender)) { + sender.sendMessage(ChatColor.RED + "This command can be only executed from console."); + return true; + } + for (Faction faction : plugin.getFactionManager().getFactions()) { + if (faction instanceof PlayerFaction) { + ((PlayerFaction) faction).setDeathsUntilRaidable(newDTR); + } + } + + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set DTR of all factions to " + + newDTR + '.'); + return true; + } + final Faction faction2 = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction2 == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction2 instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "You can only set DTR of player factions."); + return true; + } + final PlayerFaction playerFaction = (PlayerFaction) faction2; + final double previousDtr = playerFaction.getDeathsUntilRaidable(); + newDTR = playerFaction.setDeathsUntilRaidable(newDTR); + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set DTR of " + faction2.getName() + " from " + previousDtr + " to " + newDTR + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } + if(args[1].isEmpty()) { + return null; + } + final Player player = (Player) sender; + final List results = new ArrayList(this.plugin.getFactionManager().getFactionNameMap().keySet()); + for(final Player target : Bukkit.getOnlinePlayers()) { + if(player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.java new file mode 100644 index 0000000..5e9c1dd --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionSetDtrRegenArgument.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionManager; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class FactionSetDtrRegenArgument extends CommandArgument { + private final HCF plugin; + + public FactionSetDtrRegenArgument(final HCF plugin) { + super("setdtrregen", "Sets the DTR cooldown of a faction.", new String[]{"setdtrregeneration"}); + this.plugin = plugin; + this.permission = "command.faction." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final long newRegen = JavaUtils.parse(args[2]); + if(newRegen == -1L) { + sender.sendMessage(ChatColor.RED + "Invalid duration, use the correct format: 10m 1s"); + return true; + } + if(newRegen > FactionManager.MAX_DTR_REGEN_MILLIS) { + sender.sendMessage(ChatColor.RED + "Cannot set factions DTR regen above " + FactionManager.MAX_DTR_REGEN_WORDS + "."); + return true; + } + final Faction faction = this.plugin.getFactionManager().getContainingFaction(args[1]); + if(faction == null) { + sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found."); + return true; + } + if(!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "This type of faction does not use DTR."); + return true; + } + final PlayerFaction playerFaction = (PlayerFaction) faction; + final long previousRegenRemaining = playerFaction.getRemainingRegenerationTime(); + playerFaction.setRemainingRegenerationTime(newRegen); + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set DTR regen of " + faction.getName() + " from " + DurationFormatUtils.formatDurationWords(previousRegenRemaining, true, true) + " to " + DurationFormatUtils.formatDurationWords(newRegen, true, true) + '.'); + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.java b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.java new file mode 100644 index 0000000..8e8e342 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/argument/staff/FactionTPArgument.java @@ -0,0 +1,83 @@ +package com.prevailpots.hcf.faction.argument.staff; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.*; + +/** + * Created by Interlagos on 12/19/2016. + */ +public class FactionTPArgument extends CommandArgument { + + private final HCF plugin; + private final Map destinationMap = new HashMap<>(); + public FactionTPArgument(HCF plugin) { + super("tp", "Teleports the sender to the selected faction's home point."); + this.plugin = plugin; + this.permission = "command.faction.argument." + getName(); + } + + @Override + public String getUsage(String label) { + return '/' + label + ' ' + getName() + " "; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label)); + return true; + } + Player player = (Player) sender; + + Faction faction = plugin.getFactionManager().getContainingFaction(args[1]); + if (faction == null){ + sender.sendMessage(ChatColor.RED + "Player faction named or containing member with IGN or UUID " + + args[1] + " not found."); + return true; + } + + if (!(faction instanceof PlayerFaction)) { + sender.sendMessage(ChatColor.RED + "Player faction named or containing member with IGN or UUID " + + args[1] + " not found."); + return true; + } + + PlayerFaction playerFaction = (PlayerFaction) faction; + Location location = playerFaction.getHome(); + ((Player) sender).teleport(location); + sender.sendMessage(ChatColor.GREEN + "Teleported you to the home point of the faction: " + faction.getName() + '.'); + return true; + } + + @Override + public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { + if (args.length != 2 || !(sender instanceof Player)) { + return Collections.emptyList(); + } else if (args[1].isEmpty()) { + return null; + } else { + Player player = (Player) sender; + List results = new ArrayList<>(plugin.getFactionManager().getFactionNameMap().keySet()); + for (Player target : Bukkit.getOnlinePlayers()) { + if (player.canSee(target) && !results.contains(target.getName())) { + results.add(target.getName()); + } + } + + return results; + } + } +} + + diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Claim.java b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Claim.java new file mode 100644 index 0000000..c144fec --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Claim.java @@ -0,0 +1,177 @@ +package com.prevailpots.hcf.faction.claim; + +import com.customhcf.util.GenericUtils; +import com.customhcf.util.cuboid.Cuboid; +import com.customhcf.util.cuboid.NamedCuboid; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; + +import org.apache.commons.collections4.map.CaseInsensitiveMap; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; +import java.util.UUID; + +public class Claim extends NamedCuboid implements Cloneable, ConfigurationSerializable { + private static final Random RANDOM = new Random(); + private final Map subclaims = new CaseInsensitiveMap(); + private final UUID claimUniqueID; + private final UUID factionUUID; + private Faction faction; + private boolean loaded = false; + + public Claim(Map map) { + super(map); + this.name = (String) map.get("name"); + this.claimUniqueID = UUID.fromString((String) map.get("claimUUID")); + this.factionUUID = UUID.fromString((String) map.get("factionUUID")); + Iterator var2 = GenericUtils.createList(map.get("subclaims"), Subclaim.class).iterator(); + + while(var2.hasNext()) { + Subclaim subclaim = (Subclaim) var2.next(); + this.subclaims.put(subclaim.getName(), subclaim); + } + + } + + public Claim(Faction faction, Location location) { + super(location, location); + this.name = this.generateName(); + this.factionUUID = faction.getUniqueID(); + this.claimUniqueID = UUID.randomUUID(); + } + + public Claim(Faction faction, Location location1, Location location2) { + super(location1, location2); + this.name = this.generateName(); + this.factionUUID = faction.getUniqueID(); + this.claimUniqueID = UUID.randomUUID(); + } + + public Claim(Faction faction, World world, int x1, int y1, int z1, int x2, int y2, int z2) { + super(world, x1, y1, z1, x2, y2, z2); + this.name = this.generateName(); + this.factionUUID = faction.getUniqueID(); + this.claimUniqueID = UUID.randomUUID(); + } + + public Claim(Faction faction, Cuboid cuboid) { + super(cuboid); + this.name = this.generateName(); + this.factionUUID = faction.getUniqueID(); + this.claimUniqueID = UUID.randomUUID(); + } + + public Map serialize() { + final Map map = super.serialize(); + map.put("name", this.name); + map.put("claimUUID", this.claimUniqueID.toString()); + map.put("factionUUID", this.factionUUID.toString()); + map.put("subclaims", new ArrayList(this.subclaims.values())); + return map; + } + + private String generateName() { + return String.valueOf(Claim.RANDOM.nextInt(899) + 100); + } + + public UUID getClaimUniqueID() { + return this.claimUniqueID; + } + + public ClaimableFaction getFaction() { + if(!this.loaded && this.faction == null) { + this.faction = HCF.getPlugin().getFactionManager().getFaction(this.factionUUID); + this.loaded = true; + } + return (this.faction instanceof ClaimableFaction) ? ((ClaimableFaction) this.faction) : null; + } + + public Collection getSubclaims() { + return this.subclaims.values(); + } + + public Subclaim getSubclaim(String name) { + return (Subclaim) this.subclaims.get(name); + } + + public String getFormattedName() { + return this.getName() + ": (" + this.worldName + ", " + this.x1 + ", " + this.y1 + ", " + this.z1 + ") - (" + this.worldName + ", " + this.x2 + ", " + this.y2 + ", " + this.z2 + ')'; + } + + public Claim clone() { + return (Claim) super.clone(); + } + + public boolean equals(final Object o) { + if(this == o) { + return true; + } + if(o == null || this.getClass() != o.getClass()) { + return false; + } + final Claim blocks = (Claim) o; + if(this.loaded != blocks.loaded) { + return false; + } + Label_0077: + { + if(this.subclaims != null) { + if(this.subclaims.equals(blocks.subclaims)) { + break Label_0077; + } + } else if(blocks.subclaims == null) { + break Label_0077; + } + return false; + } + Label_0110: + { + if(this.claimUniqueID != null) { + if(this.claimUniqueID.equals(blocks.claimUniqueID)) { + break Label_0110; + } + } else if(blocks.claimUniqueID == null) { + break Label_0110; + } + return false; + } + Label_0143: + { + if(this.factionUUID != null) { + if(this.factionUUID.equals(blocks.factionUUID)) { + break Label_0143; + } + } else if(blocks.factionUUID == null) { + break Label_0143; + } + return false; + } + if(this.faction != null) { + if(!this.faction.equals(blocks.faction)) { + return false; + } + } else if(blocks.faction != null) { + return false; + } + return true; + } + + public int hashCode() { + int result = (this.subclaims != null) ? this.subclaims.hashCode() : 0; + result = 31 * result + ((this.claimUniqueID != null) ? this.claimUniqueID.hashCode() : 0); + result = 31 * result + ((this.factionUUID != null) ? this.factionUUID.hashCode() : 0); + result = 31 * result + ((this.faction != null) ? this.faction.hashCode() : 0); + result = 31 * result + (this.loaded ? 1 : 0); + return result; + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimHandler.java b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimHandler.java new file mode 100644 index 0000000..eeb56da --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimHandler.java @@ -0,0 +1,220 @@ +package com.prevailpots.hcf.faction.claim; + +import com.customhcf.util.ItemBuilder; +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.base.Preconditions; +import com.google.common.cache.CacheBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.FactionManager; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.faction.type.RoadFaction; +import com.prevailpots.hcf.faction.type.WildernessFaction; +import com.prevailpots.hcf.visualise.VisualType; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.Collection; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; + +public class ClaimHandler { + public static final int MIN_CLAIM_HEIGHT = 0; + public static final int MAX_CLAIM_HEIGHT = 256; + public static final ItemStack CLAIM_WAND; + public static final int MIN_CLAIM_RADIUS = 5; + public static final int MAX_CHUNKS_PER_LIMIT = 16; + private static final int NEXT_PRICE_MULTIPLIER_AREA = 250; + private static final int NEXT_PRICE_MULTIPLIER_CLAIM = 500; + private static final double CLAIM_SELL_MULTIPLIER = 0.8; + private static final double CLAIM_PRICE_PER_BLOCK = 0.25; + + static { + CLAIM_WAND = new ItemBuilder(Material.DIAMOND_HOE).displayName(ChatColor.GREEN.toString() + "Claim Wand").lore(new String[]{ChatColor.BLUE + "Left or Right Click " + ChatColor.GREEN + "a Block" + ChatColor.BLUE + " to:", ChatColor.GRAY + "Set the first and second position of ", ChatColor.GRAY + "your Claim selection.", "", ChatColor.BLUE + "Right Click " + ChatColor.GREEN + "the Air" + ChatColor.BLUE + " to:", ChatColor.GRAY + "Clear your current Claim selection.", "", ChatColor.BLUE + "Shift " + ChatColor.BLUE + "Left Click " + ChatColor.GREEN + "the Air or a Block" + ChatColor.BLUE + " to:", ChatColor.GRAY + "Purchase your current Claim selection."}).build(); + } + + public final ConcurrentMap claimSelectionMap; + private final HCF plugin; + + public ClaimHandler(final HCF plugin) { + this.plugin = plugin; + this.claimSelectionMap = CacheBuilder.newBuilder().expireAfterWrite(30L, TimeUnit.MINUTES).build().asMap(); + } + + public int calculatePrice(final Cuboid claim, int currentClaims, final boolean selling) { + if(currentClaims == -1 || !claim.hasBothPositionsSet()) { + return 0; + } + int multiplier = 1; + int remaining = claim.getArea(); + double price = 0.0; + while(remaining > 0) { + if(--remaining % NEXT_PRICE_MULTIPLIER_AREA == 0) { + ++multiplier; + } + price += CLAIM_PRICE_PER_BLOCK * multiplier; + } + if(currentClaims != 0) { + currentClaims = Math.max(currentClaims + (selling ? -1 : 0), 0); + price += currentClaims * NEXT_PRICE_MULTIPLIER_CLAIM; + } + if(selling) { + price *= CLAIM_SELL_MULTIPLIER; + } + return (int) price; + } + + public boolean clearClaimSelection(final Player player) { + final ClaimSelection claimSelection = (ClaimSelection) this.plugin.getClaimHandler().claimSelectionMap.remove(player.getUniqueId()); + if(claimSelection != null) { + this.plugin.getVisualiseHandler().clearVisualBlocks(player, VisualType.CREATE_CLAIM_SELECTION, null); + return true; + } + return false; + } + + public boolean canSubclaimHere(final Player player, final Location location) { + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + player.sendMessage(ChatColor.RED + "You must be in a faction to subclaim land."); + return false; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + player.sendMessage(ChatColor.RED + "You must be an officer to claim land."); + return false; + } + if(!this.plugin.getFactionManager().getFactionAt(location).equals(playerFaction)) { + player.sendMessage(ChatColor.RED + "This location is not part of your factions' territory."); + return false; + } + return true; + } + + public boolean canClaimHere(final Player player, final Location location) { + final World world = location.getWorld(); + if(world.getEnvironment() != World.Environment.NORMAL) { + player.sendMessage(ChatColor.RED + "You can only claim land in the Overworld."); + return false; + } + if(!(this.plugin.getFactionManager().getFactionAt(location) instanceof WildernessFaction)) { + player.sendMessage(ChatColor.RED + "You can only claim land in the " + ConfigurationService.WILDERNESS_COLOUR + "Wilderness" + ChatColor.RED + ". " + "Make sure you are past " + plugin.getHcfHandler().getWarZoneRadius() + " blocks from spawn."); + return false; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + player.sendMessage(ChatColor.RED + "You must be in a faction to claim land."); + return false; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + player.sendMessage(ChatColor.RED + "You must be an officer to claim land."); + return false; + } + if(playerFaction.getClaims().size() >= 8) { + player.sendMessage(ChatColor.RED + "Your faction has maximum claims - " + 8); + return false; + } + final int locX = location.getBlockX(); + final int locZ = location.getBlockZ(); + final FactionManager factionManager = this.plugin.getFactionManager(); + for(int x = locX - MIN_CLAIM_RADIUS; x < locX + MIN_CLAIM_RADIUS; ++x) { + for(int z = locZ - MIN_CLAIM_RADIUS; z < locZ + MIN_CLAIM_RADIUS; ++z) { + final Faction factionAtNew = factionManager.getFactionAt(world, x, z); + if(!(factionAtNew instanceof RoadFaction)) { + } + if(!playerFaction.equals(factionAtNew) && factionAtNew instanceof ClaimableFaction) { + player.sendMessage(ChatColor.RED + "This position contains enemy claims within a " + MIN_CLAIM_RADIUS + " block buffer radius."); + return false; + } + } + } + return true; + } + + public boolean tryPurchasing(final Player player, final Claim claim) { + Preconditions.checkNotNull((Object) claim, "Claim is null"); + final World world = claim.getWorld(); + if(world.getEnvironment() != World.Environment.NORMAL) { + player.sendMessage(ChatColor.RED + "You can only claim land in the Overworld."); + return false; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()); + if(playerFaction == null) { + player.sendMessage(ChatColor.RED + "You must be in a faction to claim land."); + return false; + } + if(playerFaction.getMember(player.getUniqueId()).getRole() == Role.MEMBER) { + player.sendMessage(ChatColor.RED + "You must be an officer to claim land."); + return false; + } + if(playerFaction.getClaims().size() >= 8) { + player.sendMessage(ChatColor.RED + "Your faction has maximum claims - " + 8); + return false; + } + final int factionBalance = playerFaction.getBalance(); + final int claimPrice = this.calculatePrice(claim, playerFaction.getClaims().size(), false); + if (claimPrice > factionBalance) { + player.sendMessage(ChatColor.RED + "Your faction bank only has " + '$' + factionBalance + ", the price of this claim is " + '$' + claimPrice + '.'); + return false; + } + if(claim.getChunks().size() > MAX_CHUNKS_PER_LIMIT) { + player.sendMessage(ChatColor.RED + "Claims cannot exceed " + MAX_CHUNKS_PER_LIMIT + " chunks."); + return false; + } + if(claim.getWidth() < MIN_CLAIM_RADIUS || claim.getLength() < MIN_CLAIM_RADIUS) { + player.sendMessage(ChatColor.RED + "Claims must be at least " + MIN_CLAIM_RADIUS + 'x' + MIN_CLAIM_RADIUS + " blocks."); + return false; + } + final int minimumX = claim.getMinimumX(); + final int maximumX = claim.getMaximumX(); + final int minimumZ = claim.getMinimumZ(); + final int maximumZ = claim.getMaximumZ(); + final FactionManager factionManager = this.plugin.getFactionManager(); + for(int x = minimumX; x < maximumX; ++x) { + for(int z = minimumZ; z < maximumZ; ++z) { + final Faction factionAt = factionManager.getFactionAt(world, x, z); + if(factionAt != null && !(factionAt instanceof WildernessFaction)) { + player.sendMessage(ChatColor.RED + "This claim contains a location not within the " + ConfigurationService.WILDERNESS_COLOUR + factionAt.getDisplayName(player) + ChatColor.RED + '.'); + + return false; + } + } + } + for(int x = minimumX - 1; x < maximumX + 1; ++x) { + for(int z = minimumZ - 1; z < maximumZ + 1; ++z) { + final Faction factionAtNew = factionManager.getFactionAt(world, x, z); + if(!(factionAtNew instanceof RoadFaction)) { + } + if(!playerFaction.equals(factionAtNew) && factionAtNew instanceof ClaimableFaction) { + player.sendMessage(ChatColor.RED + "This claim contains enemy claims within a " + 1 + " block buffer radius."); + return false; + } + } + } + final Location minimum = claim.getMinimumPoint(); + final Location maximum = claim.getMaximumPoint(); + final Collection otherClaims = playerFaction.getClaims(); + boolean conjoined = otherClaims.isEmpty(); + if(!conjoined) { + player.sendMessage(ChatColor.RED+"Use /f unclaim to resize your faction claims."); + return false; + } + claim.setY1(MIN_CLAIM_HEIGHT); + claim.setY2(MAX_CLAIM_HEIGHT); + if(!playerFaction.addClaim(claim, player)) { + return false; + } + final Location center = claim.getCenter(); + player.sendMessage(ChatColor.YELLOW + "Claim has been purchased for " + ChatColor.GREEN + '$' + claimPrice + " " + playerFaction.getName() + ChatColor.YELLOW + '.'); + playerFaction.setBalance(factionBalance - claimPrice); + playerFaction.broadcast(ChatColor.GREEN+ player.getName() + ChatColor.YELLOW + " claimed land for your faction at " + ChatColor.GRAY + '(' + center.getBlockX() + ", " + center.getBlockZ() + ')' + ChatColor.GREEN + '.', player.getUniqueId()); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimSelection.java b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimSelection.java new file mode 100644 index 0000000..f377460 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimSelection.java @@ -0,0 +1,147 @@ +package com.prevailpots.hcf.faction.claim; + +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Location; +import org.bukkit.World; + +import java.util.UUID; + +public class ClaimSelection implements Cloneable { + private final UUID uuid; + private final World world; + private long lastUpdateMillis; + private Location pos1; + private Location pos2; + + public ClaimSelection(final World world) { + this.uuid = UUID.randomUUID(); + this.world = world; + } + + public ClaimSelection(final World world, final Location pos1, final Location pos2) { + this.uuid = UUID.randomUUID(); + this.world = world; + this.pos1 = pos1; + this.pos2 = pos2; + } + + public UUID getUuid() { + return this.uuid; + } + + public World getWorld() { + return this.world; + } + + public int getPrice(final PlayerFaction playerFaction, final boolean selling) { + Preconditions.checkNotNull((Object) playerFaction, (Object) "Player faction cannot be null"); + return (this.pos1 == null || this.pos2 == null) ? 0 : HCF.getPlugin().getClaimHandler().calculatePrice(new Cuboid(this.pos1, this.pos2), playerFaction.getClaims().size(), selling); + } + + public Claim toClaim(final Faction faction) { + Preconditions.checkNotNull((Object) faction, (Object) "Faction cannot be null"); + return (this.pos1 == null || this.pos2 == null) ? null : new Claim(faction, this.pos1, this.pos2); + } + + public long getLastUpdateMillis() { + return this.lastUpdateMillis; + } + + public Location getPos1() { + return this.pos1; + } + + public void setPos1(final Location location) { + Preconditions.checkNotNull((Object) location, (Object) "The location cannot be null"); + this.pos1 = location; + this.lastUpdateMillis = System.currentTimeMillis(); + } + + public Location getPos2() { + return this.pos2; + } + + public void setPos2(final Location location) { + Preconditions.checkNotNull((Object) location, (Object) "The location is null"); + this.pos2 = location; + this.lastUpdateMillis = System.currentTimeMillis(); + } + + public boolean hasBothPositionsSet() { + return this.pos1 != null && this.pos2 != null; + } + + @Override + public boolean equals(final Object o) { + if(this == o) { + return true; + } + if(!(o instanceof ClaimSelection)) { + return false; + } + final ClaimSelection that = (ClaimSelection) o; + Label_0054: + { + if(this.uuid != null) { + if(this.uuid.equals(that.uuid)) { + break Label_0054; + } + } else if(that.uuid == null) { + break Label_0054; + } + return false; + } + Label_0087: + { + if(this.world != null) { + if(this.world.equals(that.world)) { + break Label_0087; + } + } else if(that.world == null) { + break Label_0087; + } + return false; + } + Label_0120: + { + if(this.pos1 != null) { + if(this.pos1.equals((Object) that.pos1)) { + break Label_0120; + } + } else if(that.pos1 == null) { + break Label_0120; + } + return false; + } + if(this.pos2 != null) { + if(!this.pos2.equals((Object) that.pos2)) { + return false; + } + } else if(that.pos2 != null) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int result = (this.uuid != null) ? this.uuid.hashCode() : 0; + result = 31 * result + ((this.world != null) ? this.world.hashCode() : 0); + result = 31 * result + ((this.pos1 != null) ? this.pos1.hashCode() : 0); + result = 31 * result + ((this.pos2 != null) ? this.pos2.hashCode() : 0); + return result; + } + + public ClaimSelection clone() { + try { + return (ClaimSelection) super.clone(); + } catch(CloneNotSupportedException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimWandListener.java b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimWandListener.java new file mode 100644 index 0000000..8bb4346 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/ClaimWandListener.java @@ -0,0 +1,224 @@ +package com.prevailpots.hcf.faction.claim; + +import com.google.common.base.Predicate; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.visualise.VisualBlock; +import com.prevailpots.hcf.visualise.VisualType; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class ClaimWandListener implements Listener { + private final HCF plugin; + + public ClaimWandListener(final HCF plugin) { + this.plugin = plugin; + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.HIGH) + public void onPlayerInteract(final PlayerInteractEvent event) { + final Action action = event.getAction(); + if(action == Action.PHYSICAL || !event.hasItem() || !this.isClaimingWand(event.getItem())) { + return; + } + final Player player = event.getPlayer(); + final UUID uuid = player.getUniqueId(); + if(action == Action.RIGHT_CLICK_AIR) { + this.plugin.getClaimHandler().clearClaimSelection(player); + player.setItemInHand(new ItemStack(Material.AIR, 1)); + player.sendMessage(ChatColor.RED + "You have cleared your claim selection."); + return; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(uuid); + if((action != Action.LEFT_CLICK_AIR && action != Action.LEFT_CLICK_BLOCK) || !player.isSneaking()) { + if(action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) { + final Block block = event.getClickedBlock(); + final Location blockLocation = block.getLocation(); + if(action == Action.RIGHT_CLICK_BLOCK) { + event.setCancelled(true); + } + if(this.plugin.getClaimHandler().canClaimHere(player, blockLocation)) { + final ClaimSelection revert; + ClaimSelection claimSelection = (ClaimSelection) this.plugin.getClaimHandler().claimSelectionMap.putIfAbsent(uuid, revert = new ClaimSelection(blockLocation.getWorld())); + if(claimSelection == null) { + claimSelection = revert; + } + Location oldPosition = null; + Location opposite = null; + int selectionId = 0; + switch(action) { + case LEFT_CLICK_BLOCK: { + oldPosition = claimSelection.getPos1(); + opposite = claimSelection.getPos2(); + selectionId = 1; + break; + } + case RIGHT_CLICK_BLOCK: { + oldPosition = claimSelection.getPos2(); + opposite = claimSelection.getPos1(); + selectionId = 2; + break; + } + default: { + return; + } + } + final int blockX = blockLocation.getBlockX(); + final int blockZ = blockLocation.getBlockZ(); + if(oldPosition != null && blockX == oldPosition.getBlockX() && blockZ == oldPosition.getBlockZ()) { + return; + } + if(System.currentTimeMillis() - claimSelection.getLastUpdateMillis() <= 200L) { + return; + } + if(opposite != null) { + final int xDiff = Math.abs(opposite.getBlockX() - blockX) + 1; + final int zDiff = Math.abs(opposite.getBlockZ() - blockZ) + 1; + if(xDiff < 5 || zDiff < 5) { + player.sendMessage(ChatColor.RED + "Claim selections must be at least " + 5 + 'x' + 5 + " blocks."); + return; + } + } + if(oldPosition != null) { + final Location finalOldPosition = oldPosition; + this.plugin.getVisualiseHandler().clearVisualBlocks(player, VisualType.CREATE_CLAIM_SELECTION, (Predicate) new Predicate() { + public boolean apply(final VisualBlock visualBlock) { + final Location location = visualBlock.getLocation(); + return location.getBlockX() == finalOldPosition.getBlockX() && location.getBlockZ() == finalOldPosition.getBlockZ(); + } + }); + } + if(selectionId == 1) { + claimSelection.setPos1(blockLocation); + } + if(selectionId == 2) { + claimSelection.setPos2(blockLocation); + } + player.sendMessage(ChatColor.YELLOW + "Set the location of claim selection " + ChatColor.GREEN + selectionId + ChatColor.YELLOW + " to: " + ChatColor.YELLOW + '(' + ChatColor.YELLOW + blockX + ", " + blockZ + ChatColor.YELLOW + ')'); + if(claimSelection.hasBothPositionsSet()) { + final Claim claim = claimSelection.toClaim(playerFaction); + final int selectionPrice = claimSelection.getPrice(playerFaction, false); + player.sendMessage(ChatColor.YELLOW + "Claim selection cost: " + ((selectionPrice > playerFaction.getBalance()) ? ChatColor.RED : ChatColor.GREEN) + '$' + selectionPrice + ChatColor.YELLOW + ". Current size: (" + ChatColor.GREEN + claim.getWidth() + ", " + claim.getLength() + ChatColor.YELLOW + "), " + ChatColor.GREEN + claim.getArea() + ChatColor.YELLOW + " blocks."); + } + final int blockY = block.getY(); + final int maxHeight = player.getWorld().getMaxHeight(); + final List locations = new ArrayList(maxHeight); + for(int i = blockY; i < maxHeight; ++i) { + final Location other = blockLocation.clone(); + other.setY(i); + locations.add(other); + } + new BukkitRunnable() { + public void run() { + ClaimWandListener.this.plugin.getVisualiseHandler().generate(player, locations, VisualType.CREATE_CLAIM_SELECTION, true); + } + }.runTask((Plugin) this.plugin); + } + } + return; + } + final ClaimSelection claimSelection2 = (ClaimSelection) this.plugin.getClaimHandler().claimSelectionMap.get(uuid); + if(claimSelection2 == null || !claimSelection2.hasBothPositionsSet()) { + player.sendMessage(ChatColor.RED + "You have not set both positions of this claim selection."); + return; + } + if(this.plugin.getClaimHandler().tryPurchasing(player, claimSelection2.toClaim(playerFaction))) { + this.plugin.getClaimHandler().clearClaimSelection(player); + player.setItemInHand(new ItemStack(Material.AIR, 1)); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onBlockBreak(final BlockBreakEvent event) { + if(this.isClaimingWand(event.getPlayer().getItemInHand())) { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onEntityDamageByEntity(final EntityDamageByEntityEvent event) { + if(event.getDamager() instanceof Player) { + final Player player = (Player) event.getDamager(); + if(this.isClaimingWand(player.getItemInHand())) { + player.setItemInHand(new ItemStack(Material.AIR, 1)); + this.plugin.getClaimHandler().clearClaimSelection(player); + } + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onPlayerKick(final PlayerKickEvent event) { + event.getPlayer().getInventory().remove(ClaimHandler.CLAIM_WAND); + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onPlayerQuit(final PlayerQuitEvent event) { + event.getPlayer().getInventory().remove(ClaimHandler.CLAIM_WAND); + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onPlayerDrop(final PlayerDropItemEvent event) { + final Item item = event.getItemDrop(); + if(this.isClaimingWand(item.getItemStack())) { + item.remove(); + this.plugin.getClaimHandler().clearClaimSelection(event.getPlayer()); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onPlayerPickup(final PlayerPickupItemEvent event) { + final Item item = event.getItem(); + if(this.isClaimingWand(item.getItemStack())) { + item.remove(); + this.plugin.getClaimHandler().clearClaimSelection(event.getPlayer()); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onPlayerDeath(final PlayerDeathEvent event) { + if(event.getDrops().remove(ClaimHandler.CLAIM_WAND)) { + this.plugin.getClaimHandler().clearClaimSelection(event.getEntity()); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL) + public void onInventoryOpen(final InventoryOpenEvent event) { + final HumanEntity humanEntity = event.getPlayer(); + if(humanEntity instanceof Player) { + final Player player = (Player) humanEntity; + player.getInventory().remove(ClaimHandler.CLAIM_WAND); + this.plugin.getClaimHandler().clearClaimSelection(player); + + } + } + + public boolean isClaimingWand(final ItemStack stack) { + return stack != null && stack.isSimilar(ClaimHandler.CLAIM_WAND); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Subclaim.java b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Subclaim.java new file mode 100644 index 0000000..f619de3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/claim/Subclaim.java @@ -0,0 +1,89 @@ +package com.prevailpots.hcf.faction.claim; + +import com.customhcf.util.GenericUtils; +import com.customhcf.util.cuboid.Cuboid; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +public class Subclaim extends Claim implements Cloneable, ConfigurationSerializable { + private final Set accessibleMembers; + + public Subclaim(final Map map) { + super(map); + (this.accessibleMembers = new HashSet()).addAll(GenericUtils.createList(map.get("accessibleMembers"), String.class).stream().map(UUID::fromString).collect(Collectors.toList())); + } + + public Subclaim(final Faction faction, final Location location) { + super(faction, location, location); + this.accessibleMembers = new HashSet(); + } + + public Subclaim(final Faction faction, final Location location1, final Location location2) { + super(faction, location1, location2); + this.accessibleMembers = new HashSet(); + } + + public Subclaim(final Faction faction, final World world, final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + super(faction, world, x1, y1, z1, x2, y2, z2); + this.accessibleMembers = new HashSet(); + } + + public Subclaim(final Faction faction, final Cuboid cuboid) { + this(faction, cuboid.getWorld(), cuboid.getX1(), cuboid.getY1(), cuboid.getZ1(), cuboid.getX2(), cuboid.getY2(), cuboid.getZ2()); + } + + @Override + public Map serialize() { + final Map map = super.serialize(); + map.remove("subclaims"); + map.put("accessibleMembers", this.accessibleMembers.stream().map(UUID::toString).collect(Collectors.toList())); + return map; + } + + public Set getAccessibleMembers() { + return this.accessibleMembers; + } + + @Override + public boolean equals(final Object o) { + if(this == o) { + return true; + } + if(!(o instanceof Subclaim)) { + return false; + } + if(!super.equals(o)) { + return false; + } + final Subclaim blocks = (Subclaim) o; + if(this.accessibleMembers != null) { + if(!this.accessibleMembers.equals(blocks.accessibleMembers)) { + return false; + } + } else if(blocks.accessibleMembers != null) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + ((this.accessibleMembers != null) ? this.accessibleMembers.hashCode() : 0); + return result; + } + + @Override + public Subclaim clone() { + return (Subclaim) super.clone(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.java new file mode 100644 index 0000000..3126243 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneEnterEvent.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.kothgame.CaptureZone; +import com.prevailpots.hcf.kothgame.faction.CapturableFaction; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +public class CaptureZoneEnterEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CaptureZone captureZone; + private final Player player; + private boolean cancelled; + + public CaptureZoneEnterEvent(final Player player, final CapturableFaction capturableFaction, final CaptureZone captureZone) { + super(capturableFaction); + Preconditions.checkNotNull((Object) player, (Object) "Player cannot be null"); + Preconditions.checkNotNull((Object) captureZone, (Object) "Capture zone cannot be null"); + this.captureZone = captureZone; + this.player = player; + } + + public static HandlerList getHandlerList() { + return CaptureZoneEnterEvent.handlers; + } + + @Override + public CapturableFaction getFaction() { + return (CapturableFaction) super.getFaction(); + } + + public CaptureZone getCaptureZone() { + return this.captureZone; + } + + public Player getPlayer() { + return this.player; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return CaptureZoneEnterEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.java new file mode 100644 index 0000000..dfdeefe --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/CaptureZoneLeaveEvent.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.kothgame.CaptureZone; +import com.prevailpots.hcf.kothgame.faction.CapturableFaction; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +public class CaptureZoneLeaveEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CaptureZone captureZone; + private final Player player; + private boolean cancelled; + + public CaptureZoneLeaveEvent(final Player player, final CapturableFaction capturableFaction, final CaptureZone captureZone) { + super(capturableFaction); + Preconditions.checkNotNull((Object) player, (Object) "Player cannot be null"); + Preconditions.checkNotNull((Object) captureZone, (Object) "Capture zone cannot be null"); + this.captureZone = captureZone; + this.player = player; + } + + public static HandlerList getHandlerList() { + return CaptureZoneLeaveEvent.handlers; + } + + @Override + public CapturableFaction getFaction() { + return (CapturableFaction) super.getFaction(); + } + + public CaptureZone getCaptureZone() { + return this.captureZone; + } + + public Player getPlayer() { + return this.player; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return CaptureZoneLeaveEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionChatEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionChatEvent.java new file mode 100644 index 0000000..ab63240 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionChatEvent.java @@ -0,0 +1,78 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.struct.ChatChannel; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import java.util.Collection; + +public class FactionChatEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final Player player; + private final FactionMember factionMember; + private final ChatChannel chatChannel; + private final String message; + private final Collection recipients; + private final String fallbackFormat; + private boolean cancelled; + + public FactionChatEvent(final boolean async, final PlayerFaction faction, final Player player, final ChatChannel chatChannel, final Collection recipients, final String message) { + super(faction, async); + this.player = player; + this.factionMember = faction.getMember(player.getUniqueId()); + this.chatChannel = chatChannel; + this.recipients = recipients; + this.message = message; + this.fallbackFormat = chatChannel.getRawFormat(player); + } + + public static HandlerList getHandlerList() { + return FactionChatEvent.handlers; + } + + public Player getPlayer() { + return this.player; + } + + public FactionMember getFactionMember() { + return this.factionMember; + } + + public ChatChannel getChatChannel() { + return this.chatChannel; + } + + public Collection getRecipients() { + return this.recipients; + } + + public String getMessage() { + return this.message; + } + + public String getFallbackFormat() { + return this.fallbackFormat; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + + public HandlerList getHandlers() { + return FactionChatEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.java new file mode 100644 index 0000000..16c7d99 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangeEvent.java @@ -0,0 +1,72 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.event.cause.ClaimChangeCause; +import com.prevailpots.hcf.faction.type.ClaimableFaction; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import java.util.Collection; + +public class FactionClaimChangeEvent extends Event implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final ClaimChangeCause cause; + private final Collection affectedClaims; + private final ClaimableFaction claimableFaction; + private final CommandSender sender; + private boolean cancelled; + + public FactionClaimChangeEvent(final CommandSender sender, final ClaimChangeCause cause, final Collection affectedClaims, final ClaimableFaction claimableFaction) { + Preconditions.checkNotNull((Object) sender, (Object) "CommandSender cannot be null"); + Preconditions.checkNotNull((Object) cause, (Object) "Cause cannot be null"); + Preconditions.checkNotNull((Object) affectedClaims, (Object) "Affected claims cannot be null"); + Preconditions.checkNotNull((Object) affectedClaims.isEmpty(), (Object) "Affected claims cannot be empty"); + Preconditions.checkNotNull((Object) claimableFaction, (Object) "ClaimableFaction cannot be null"); + this.sender = sender; + this.cause = cause; + this.affectedClaims = (Collection) ImmutableList.copyOf((Collection) affectedClaims); + this.claimableFaction = claimableFaction; + } + + public static HandlerList getHandlerList() { + return FactionClaimChangeEvent.handlers; + } + + public CommandSender getSender() { + return this.sender; + } + + public ClaimChangeCause getCause() { + return this.cause; + } + + public Collection getAffectedClaims() { + return this.affectedClaims; + } + + public ClaimableFaction getClaimableFaction() { + return this.claimableFaction; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return FactionClaimChangeEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.java new file mode 100644 index 0000000..396da40 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionClaimChangedEvent.java @@ -0,0 +1,48 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.event.cause.ClaimChangeCause; + +import java.util.Collection; + +public class FactionClaimChangedEvent extends Event { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CommandSender sender; + private final ClaimChangeCause cause; + private final Collection affectedClaims; + + public FactionClaimChangedEvent(final CommandSender sender, final ClaimChangeCause cause, final Collection affectedClaims) { + this.sender = sender; + this.cause = cause; + this.affectedClaims = affectedClaims; + } + + public static HandlerList getHandlerList() { + return FactionClaimChangedEvent.handlers; + } + + public CommandSender getSender() { + return this.sender; + } + + public ClaimChangeCause getCause() { + return this.cause; + } + + public Collection getAffectedClaims() { + return this.affectedClaims; + } + + public HandlerList getHandlers() { + return FactionClaimChangedEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionCreateEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionCreateEvent.java new file mode 100644 index 0000000..ec0fc91 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionCreateEvent.java @@ -0,0 +1,43 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.type.Faction; + +public class FactionCreateEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CommandSender sender; + private boolean cancelled; + + public FactionCreateEvent(final Faction faction, final CommandSender sender) { + super(faction); + this.sender = sender; + } + + public static HandlerList getHandlerList() { + return FactionCreateEvent.handlers; + } + + public CommandSender getSender() { + return this.sender; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return FactionCreateEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.java new file mode 100644 index 0000000..34395f3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionDtrChangeEvent.java @@ -0,0 +1,69 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.struct.Raidable; + +public class FactionDtrChangeEvent extends Event implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final DtrUpdateCause cause; + private final Raidable raidable; + private final double originalDtr; + private boolean cancelled; + private double newDtr; + + public FactionDtrChangeEvent(final DtrUpdateCause cause, final Raidable raidable, final double originalDtr, final double newDtr) { + this.cause = cause; + this.raidable = raidable; + this.originalDtr = originalDtr; + this.newDtr = newDtr; + } + + public static HandlerList getHandlerList() { + return FactionDtrChangeEvent.handlers; + } + + public DtrUpdateCause getCause() { + return this.cause; + } + + public Raidable getRaidable() { + return this.raidable; + } + + public double getOriginalDtr() { + return this.originalDtr; + } + + public double getNewDtr() { + return this.newDtr; + } + + public void setNewDtr(final double newDtr) { + this.newDtr = newDtr; + } + + public boolean isCancelled() { + return this.cancelled || Math.abs(this.newDtr - this.originalDtr) == 0.0; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return FactionDtrChangeEvent.handlers; + } + + public enum DtrUpdateCause { + REGENERATION, + MEMBER_DEATH; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionEvent.java new file mode 100644 index 0000000..122792f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionEvent.java @@ -0,0 +1,23 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.event.Event; + +public abstract class FactionEvent extends Event { + protected final Faction faction; + + public FactionEvent(final Faction faction) { + this.faction = (Faction) Preconditions.checkNotNull((Object) faction, (Object) "Faction cannot be null"); + } + + FactionEvent(final Faction faction, final boolean async) { + super(async); + this.faction = (Faction) Preconditions.checkNotNull((Object) faction, (Object) "Faction cannot be null"); + } + + public Faction getFaction() { + return this.faction; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.java new file mode 100644 index 0000000..1406d64 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionFocusChangeEvent.java @@ -0,0 +1,50 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import java.util.UUID; + +public class FactionFocusChangeEvent extends Event { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final PlayerFaction senderFaction; + private final Player player; + private final UUID oldFocus; + + + public FactionFocusChangeEvent(final PlayerFaction senderFaction, Player player, UUID oldFocus) { + this.senderFaction = senderFaction; + this.player = player; + this.oldFocus = oldFocus; + } + + public UUID getOldFocus() { + return oldFocus; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public PlayerFaction getSenderFaction() { + return this.senderFaction; + } + + + public Player getPlayer() { + return this.player; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.java new file mode 100644 index 0000000..bc245c4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationCreateEvent.java @@ -0,0 +1,55 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +public class FactionRelationCreateEvent extends Event implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final PlayerFaction senderFaction; + private final PlayerFaction targetFaction; + private final Relation relation; + private boolean cancelled; + + public FactionRelationCreateEvent(final PlayerFaction senderFaction, final PlayerFaction targetFaction, final Relation relation) { + this.senderFaction = senderFaction; + this.targetFaction = targetFaction; + this.relation = relation; + } + + public static HandlerList getHandlerList() { + return FactionRelationCreateEvent.handlers; + } + + public PlayerFaction getSenderFaction() { + return this.senderFaction; + } + + public PlayerFaction getTargetFaction() { + return this.targetFaction; + } + + public Relation getRelation() { + return this.relation; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + + public HandlerList getHandlers() { + return FactionRelationCreateEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.java new file mode 100644 index 0000000..ec3017f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRelationRemoveEvent.java @@ -0,0 +1,55 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +public class FactionRelationRemoveEvent extends Event implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final PlayerFaction senderFaction; + private final PlayerFaction targetFaction; + private final Relation relation; + private boolean cancelled; + + public FactionRelationRemoveEvent(final PlayerFaction senderFaction, final PlayerFaction targetFaction, final Relation relation) { + this.senderFaction = senderFaction; + this.targetFaction = targetFaction; + this.relation = relation; + } + + public static HandlerList getHandlerList() { + return FactionRelationRemoveEvent.handlers; + } + + public PlayerFaction getSenderFaction() { + return this.senderFaction; + } + + public PlayerFaction getTargetFaction() { + return this.targetFaction; + } + + public Relation getRelation() { + return this.relation; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + + public HandlerList getHandlers() { + return FactionRelationRemoveEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRemoveEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRemoveEvent.java new file mode 100644 index 0000000..881c86a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRemoveEvent.java @@ -0,0 +1,43 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.type.Faction; + +public class FactionRemoveEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CommandSender sender; + private boolean cancelled; + + public FactionRemoveEvent(final Faction faction, final CommandSender sender) { + super(faction); + this.sender = sender; + } + + public static HandlerList getHandlerList() { + return FactionRemoveEvent.handlers; + } + + public CommandSender getSender() { + return this.sender; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return FactionRemoveEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRenameEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRenameEvent.java new file mode 100644 index 0000000..270ec60 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/FactionRenameEvent.java @@ -0,0 +1,61 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.type.Faction; + +public class FactionRenameEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final CommandSender sender; + private final String originalName; + private boolean cancelled; + private String newName; + + public FactionRenameEvent(final Faction faction, final CommandSender sender, final String originalName, final String newName) { + super(faction); + this.sender = sender; + this.originalName = originalName; + this.newName = newName; + } + + public static HandlerList getHandlerList() { + return FactionRenameEvent.handlers; + } + + public CommandSender getSender() { + return this.sender; + } + + public String getOriginalName() { + return this.originalName; + } + + public String getNewName() { + return this.newName; + } + + public void setNewName(final String newName) { + if(!newName.equals(this.newName)) { + this.newName = newName; + } + } + + public boolean isCancelled() { + return this.cancelled || this.originalName.equals(this.newName); + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return FactionRenameEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.java new file mode 100644 index 0000000..1035fdb --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerClaimEnterEvent.java @@ -0,0 +1,79 @@ +package com.prevailpots.hcf.faction.event; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.prevailpots.hcf.faction.type.Faction; + +public class PlayerClaimEnterEvent extends Event implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final Player player; + private final Faction fromFaction; + private final Faction toFaction; + private final Location from; + private final Location to; + private final EnterCause enterCause; + private boolean cancelled; + + public PlayerClaimEnterEvent(final Player player, final Location from, final Location to, final Faction fromFaction, final Faction toFaction, final EnterCause enterCause) { + this.player = player; + this.from = from; + this.to = to; + this.fromFaction = fromFaction; + this.toFaction = toFaction; + this.enterCause = enterCause; + } + + public static HandlerList getHandlerList() { + return PlayerClaimEnterEvent.handlers; + } + + public Faction getFromFaction() { + return this.fromFaction; + } + + public Faction getToFaction() { + return this.toFaction; + } + + public Player getPlayer() { + return this.player; + } + + public Location getFrom() { + return this.from; + } + + public Location getTo() { + return this.to; + } + + public EnterCause getEnterCause() { + return this.enterCause; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return PlayerClaimEnterEvent.handlers; + } + + public enum EnterCause { + TELEPORT, + MOVEMENT; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.java new file mode 100644 index 0000000..2de3d67 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinFactionEvent.java @@ -0,0 +1,64 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import java.util.UUID; + +public class PlayerJoinFactionEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final UUID uniqueID; + private boolean cancelled; + private Optional player; + + public PlayerJoinFactionEvent(final Player player, final PlayerFaction playerFaction) { + super(playerFaction); + Preconditions.checkNotNull((Object) player, (Object) "Player cannot be null"); + this.player = Optional.of(player); + this.uniqueID = player.getUniqueId(); + } + + public PlayerJoinFactionEvent(final UUID playerUUID, final PlayerFaction playerFaction) { + super(playerFaction); + Preconditions.checkNotNull((Object) playerUUID, (Object) "Player UUID cannot be null"); + this.uniqueID = playerUUID; + } + + public static HandlerList getHandlerList() { + return PlayerJoinFactionEvent.handlers; + } + + public Optional getPlayer() { + if(this.player == null) { + this.player = Optional.fromNullable(Bukkit.getPlayer(this.uniqueID)); + } + return this.player; + } + + public UUID getUniqueID() { + return this.uniqueID; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } + + public HandlerList getHandlers() { + return PlayerJoinFactionEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.java new file mode 100644 index 0000000..18dfc30 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerJoinedFactionEvent.java @@ -0,0 +1,56 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Optional; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +import java.util.UUID; + +public class PlayerJoinedFactionEvent extends FactionEvent { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final UUID uniqueID; + private Optional player; + + public PlayerJoinedFactionEvent(final Player player, final PlayerFaction playerFaction) { + super(playerFaction); + this.player = Optional.of(player); + this.uniqueID = player.getUniqueId(); + } + + public PlayerJoinedFactionEvent(final UUID playerUUID, final PlayerFaction playerFaction) { + super(playerFaction); + this.uniqueID = playerUUID; + } + + public static HandlerList getHandlerList() { + return PlayerJoinedFactionEvent.handlers; + } + + @Override + public PlayerFaction getFaction() { + return (PlayerFaction)this.faction; + } + + public Optional getPlayer() { + if (this.player == null) { + this.player = Optional.fromNullable(Bukkit.getPlayer(this.uniqueID)); + } + return this.player; + } + + public UUID getUniqueID() { + return this.uniqueID; + } + + public HandlerList getHandlers() { + return PlayerJoinedFactionEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.java new file mode 100644 index 0000000..aa05648 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeaveFactionEvent.java @@ -0,0 +1,76 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import com.prevailpots.hcf.faction.event.cause.FactionLeaveCause; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import java.util.UUID; + +public class PlayerLeaveFactionEvent extends FactionEvent implements Cancellable { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final UUID uniqueID; + private final FactionLeaveCause cause; + private boolean cancelled; + private Optional player; + + public PlayerLeaveFactionEvent(final Player player, final PlayerFaction playerFaction, final FactionLeaveCause cause) { + super(playerFaction); + Preconditions.checkNotNull((Object) player, (Object) "Player cannot be null"); + Preconditions.checkNotNull((Object) playerFaction, (Object) "Player faction cannot be null"); + Preconditions.checkNotNull((Object) "Leave cause cannot be null"); + this.player = Optional.of(player); + this.uniqueID = player.getUniqueId(); + this.cause = cause; + } + + public PlayerLeaveFactionEvent(final UUID playerUUID, final PlayerFaction playerFaction, final FactionLeaveCause cause) { + super(playerFaction); + Preconditions.checkNotNull((Object) playerUUID, (Object) "Player UUID cannot be null"); + Preconditions.checkNotNull((Object) playerFaction, (Object) "Player faction cannot be null"); + Preconditions.checkNotNull((Object) "Leave cause cannot be null"); + this.uniqueID = playerUUID; + this.cause = cause; + } + + public static HandlerList getHandlerList() { + return PlayerLeaveFactionEvent.handlers; + } + + public Optional getPlayer() { + if(this.player == null) { + this.player = Optional.fromNullable(Bukkit.getPlayer(this.uniqueID)); + } + return this.player; + } + + public UUID getUniqueID() { + return this.uniqueID; + } + + public FactionLeaveCause getLeaveCause() { + return this.cause; + } + + public HandlerList getHandlers() { + return PlayerLeaveFactionEvent.handlers; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(final boolean cancelled) { + this.cancelled = cancelled; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.java new file mode 100644 index 0000000..9a58262 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/PlayerLeftFactionEvent.java @@ -0,0 +1,64 @@ +package com.prevailpots.hcf.faction.event; + +import com.google.common.base.Optional; +import com.prevailpots.hcf.faction.event.cause.FactionLeaveCause; +import com.prevailpots.hcf.faction.type.PlayerFaction; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +import java.util.UUID; + +public class PlayerLeftFactionEvent extends FactionEvent { + private static final HandlerList handlers; + + static { + handlers = new HandlerList(); + } + + private final UUID uniqueID; + private final FactionLeaveCause cause; + private Optional player; + + public PlayerLeftFactionEvent(final Player player, final PlayerFaction playerFaction, final FactionLeaveCause cause) { + super(playerFaction); + this.player = Optional.of(player); + this.uniqueID = player.getUniqueId(); + this.cause = cause; + } + + public PlayerLeftFactionEvent(final UUID playerUUID, final PlayerFaction playerFaction, final FactionLeaveCause cause) { + super(playerFaction); + this.uniqueID = playerUUID; + this.cause = cause; + } + + public static HandlerList getHandlerList() { + return PlayerLeftFactionEvent.handlers; + } + + @Override + public PlayerFaction getFaction() { + return (PlayerFaction) super.getFaction(); + } + + public Optional getPlayer() { + if(this.player == null) { + this.player = Optional.fromNullable(Bukkit.getPlayer(this.uniqueID)); + } + return this.player; + } + + public UUID getUniqueID() { + return this.uniqueID; + } + + public FactionLeaveCause getCause() { + return this.cause; + } + + public HandlerList getHandlers() { + return PlayerLeftFactionEvent.handlers; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.java new file mode 100644 index 0000000..bfe9c5a --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/ClaimChangeCause.java @@ -0,0 +1,7 @@ +package com.prevailpots.hcf.faction.event.cause; + +public enum ClaimChangeCause { + UNCLAIM, + CLAIM, + RESIZE; +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.java b/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.java new file mode 100644 index 0000000..d87b003 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/event/cause/FactionLeaveCause.java @@ -0,0 +1,7 @@ +package com.prevailpots.hcf.faction.event.cause; + +public enum FactionLeaveCause { + KICK, + LEAVE, + DISBAND; +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/struct/ChatChannel.java b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/ChatChannel.java new file mode 100644 index 0000000..953ccdf --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/ChatChannel.java @@ -0,0 +1,125 @@ +package com.prevailpots.hcf.faction.struct; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import com.prevailpots.hcf.ConfigurationService; + +import java.util.Locale; + +public enum ChatChannel { + FACTION("Faction"), + ALLIANCE("Alliance"), + PUBLIC("Public"); + + private final String name; + + private ChatChannel(final String name) { + this.name = name; + } + + public static ChatChannel parse(final String id) { + return parse(id, ChatChannel.PUBLIC); + } + + public static ChatChannel parse(String id, final ChatChannel def) { + final String lowerCase; + id = (lowerCase = id.toLowerCase(Locale.ENGLISH)); + switch(lowerCase) { + case "f": + case "faction": + case "fc": + case "fac": + case "fact": { + return ChatChannel.FACTION; + } + case "a": + case "alliance": + case "ally": + case "ac": { + return ChatChannel.ALLIANCE; + } + case "p": + case "pc": + case "g": + case "gc": + case "global": + case "pub": + case "publi": + case "public": { + return ChatChannel.PUBLIC; + } + default: { + return (def == null) ? null : def.getRotation(); + } + } + } + + public String getName() { + return this.name; + } + + public String getDisplayName() { + String prefix = null; + switch(this) { + case FACTION: { + prefix = ConfigurationService.TEAMMATE_COLOUR.toString(); + break; + } + case ALLIANCE: { + prefix = ConfigurationService.ALLY_COLOUR.toString(); + break; + } + default: { + prefix = ConfigurationService.ENEMY_COLOUR.toString(); + break; + } + } + return prefix + this.name; + } + + public String getShortName() { + switch(this) { + case FACTION: { + return "FC"; + } + case ALLIANCE: { + return "AC"; + } + default: { + return "PC"; + } + } + } + + public ChatChannel getRotation() { + switch(this) { + case FACTION: { + return ChatChannel.PUBLIC; + } + case PUBLIC: { + return ChatChannel.ALLIANCE; + } + case ALLIANCE: { + return ChatChannel.FACTION; + } + default: { + return ChatChannel.PUBLIC; + } + } + } + + public String getRawFormat(final Player player) { + switch(this) { + case FACTION: { + return ConfigurationService.TEAMMATE_COLOUR + "(" + this.getDisplayName() + ConfigurationService.TEAMMATE_COLOUR + ") " + player.getName() + ChatColor.GRAY + ": " + ChatColor.YELLOW + "%2$s"; + } + case ALLIANCE: { + return ConfigurationService.ALLY_COLOUR + "(" + this.getDisplayName() + ConfigurationService.ALLY_COLOUR + ") " + player.getName() + ChatColor.GRAY + ": " + ChatColor.YELLOW + "%2$s"; + } + default: { + throw new IllegalArgumentException("Cannot get the raw format for public chat channel"); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Raidable.java b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Raidable.java new file mode 100644 index 0000000..ca16b7f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Raidable.java @@ -0,0 +1,17 @@ +package com.prevailpots.hcf.faction.struct; + +public interface Raidable { + boolean isRaidable(); + + double getDeathsUntilRaidable(); + + double getMaximumDeathsUntilRaidable(); + + double setDeathsUntilRaidable(double p0); + + long getRemainingRegenerationTime(); + + void setRemainingRegenerationTime(long p0); + + RegenStatus getRegenStatus(); +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/struct/RegenStatus.java b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/RegenStatus.java new file mode 100644 index 0000000..fb772b7 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/RegenStatus.java @@ -0,0 +1,18 @@ +package com.prevailpots.hcf.faction.struct; + +import org.bukkit.ChatColor; + +public enum RegenStatus { + FULL(ChatColor.GREEN.toString() + '\u25b6'), + REGENERATING(ChatColor.GOLD.toString() + '\u25B2'), + PAUSED(ChatColor.RED.toString() + '\u25a0'); + private final String symbol; + + private RegenStatus(final String symbol) { + this.symbol = symbol; + } + + public String getSymbol() { + return this.symbol; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Relation.java b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Relation.java new file mode 100644 index 0000000..3ced4f6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Relation.java @@ -0,0 +1,72 @@ +package com.prevailpots.hcf.faction.struct; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.ConfigurationService; + +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; + +public enum Relation { + MEMBER(3), + ALLY(2), + ENEMY(1); + + private final int value; + + private Relation(final int value) { + this.value = value; + } + + public int getValue() { + return this.value; + } + + public boolean isAtLeast(final Relation relation) { + return this.value >= relation.value; + } + + public boolean isAtMost(final Relation relation) { + return this.value <= relation.value; + } + + public boolean isMember() { + return this == Relation.MEMBER; + } + + public boolean isAlly() { + return this == Relation.ALLY; + } + + public boolean isEnemy() { + return this == Relation.ENEMY; + } + + public String getDisplayName() { + switch(this) { + case ALLY: { + return this.toChatColour() + "alliance"; + } + default: { + return this.toChatColour() + this.name().toLowerCase(); + } + } + } + + public ChatColor toChatColour() { + switch(this) { + case MEMBER: { + return ConfigurationService.TEAMMATE_COLOUR; + } + case ALLY: { + return ConfigurationService.ALLY_COLOUR; + } + default: { + return ConfigurationService.ENEMY_COLOUR; + } + } + } + + public DyeColor toDyeColour() { + return BukkitUtils.toDyeColor(this.toChatColour()); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Role.java b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Role.java new file mode 100644 index 0000000..699d0fd --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/struct/Role.java @@ -0,0 +1,24 @@ +package com.prevailpots.hcf.faction.struct; + +public enum Role { + LEADER("Leader", "**"), + COLEADER("Co-Leader", "*-"), + CAPTAIN("Captain", "*"), + MEMBER("Member", ""); + + private final String name; + private final String astrix; + + Role(final String name, final String astrix) { + this.name = name; + this.astrix = astrix; + } + + public String getName() { + return this.name; + } + + public String getAstrix() { + return this.astrix; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/ClaimableFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/ClaimableFaction.java new file mode 100644 index 0000000..2d6cd82 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/ClaimableFaction.java @@ -0,0 +1,127 @@ +package com.prevailpots.hcf.faction.type; + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.GenericUtils; +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.claim.Claim; +import com.prevailpots.hcf.faction.event.FactionClaimChangeEvent; +import com.prevailpots.hcf.faction.event.FactionClaimChangedEvent; +import com.prevailpots.hcf.faction.event.cause.ClaimChangeCause; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class ClaimableFaction extends Faction { + protected static final ImmutableMap ENVIRONMENT_MAPPINGS = Maps.immutableEnumMap(ImmutableMap.of(World.Environment.NETHER, "Nether", World.Environment.NORMAL, "Overworld", World.Environment.THE_END, "The End")); + + + protected final Set claims; + + public ClaimableFaction(final String name) { + super(name); + this.claims = new HashSet<>(); + } + + public ClaimableFaction(final Map map) { + super(map); + (this.claims = new HashSet<>()).addAll(GenericUtils.createList(map.get("claims"), Claim.class)); + } + + @Override + public Map serialize() { + final Map map = super.serialize(); + map.put("claims", new ArrayList(claims)); + return map; + } + + @Override + public void printDetails(final CommandSender sender) { + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + sender.sendMessage(this.getDisplayName(sender)); + for(final Claim claim : this.claims) { + final Location location = claim.getCenter(); + sender.sendMessage(ChatColor.YELLOW + " Location: " + ChatColor.YELLOW.toString() + ClaimableFaction.ENVIRONMENT_MAPPINGS.get( location.getWorld().getEnvironment()) + ", " + location.getBlockX() + " | " + location.getBlockZ()); + } + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } + + public Set getClaims() { + return this.claims; + } + + public boolean addClaim(final Claim claim, final CommandSender sender) { + return this.addClaims(Collections.singleton(claim), sender); + } + + public void setClaim(final Cuboid cuboid, final CommandSender sender) { + this.removeClaims(this.getClaims(), sender); + final Location min = cuboid.getMinimumPoint(); + min.setY(0); + final Location max = cuboid.getMaximumPoint(); + max.setY(256); + addClaim(new Claim(this, min, max), sender); + } + + public boolean addClaims(final Collection adding, CommandSender sender) { + if(sender == null) { + sender = Bukkit.getConsoleSender(); + } + final FactionClaimChangeEvent event = new FactionClaimChangeEvent(sender, ClaimChangeCause.CLAIM, adding, this); + Bukkit.getPluginManager().callEvent(event); + if(event.isCancelled() || !this.claims.addAll(adding)) { + return false; + } + Bukkit.getPluginManager().callEvent( new FactionClaimChangedEvent(sender, ClaimChangeCause.CLAIM, adding)); + return true; + } + + public boolean removeClaim(final Claim claim, final CommandSender sender) { + return this.removeClaims(Collections.singleton(claim), sender); + } + + public boolean removeClaims(final Collection removing, CommandSender sender) { + if(sender == null) { + sender = Bukkit.getConsoleSender(); + } + int previousClaims = this.claims.size(); + final FactionClaimChangeEvent event = new FactionClaimChangeEvent(sender, ClaimChangeCause.UNCLAIM, removing, this); + Bukkit.getPluginManager().callEvent( event); + if(event.isCancelled() || !this.claims.removeAll(removing)) { + return false; + } + if(this instanceof PlayerFaction) { + final PlayerFaction playerFaction = (PlayerFaction) this; + final Location home = playerFaction.getHome(); + final HCF plugin = HCF.getPlugin(); + int refund = 0; + for(final Claim claim : removing) { + refund += plugin.getClaimHandler().calculatePrice(claim, previousClaims, true); + if(previousClaims > 0) { + --previousClaims; + } + if(home != null && claim.contains(home)) { + playerFaction.setHome(null); + playerFaction.broadcast(ChatColor.RED.toString() + ChatColor.BOLD + "Your factions' home was unset as its residing claim was removed."); + break; + } + } + plugin.getEconomyManager().addBalance(playerFaction.getLeader().getUniqueId(), refund); + playerFaction.broadcast(ChatColor.YELLOW + "Faction leader was refunded " + ChatColor.GREEN + '$' + refund + ChatColor.YELLOW + " due to a land unclaim."); + } + Bukkit.getPluginManager().callEvent( new FactionClaimChangedEvent(sender, ClaimChangeCause.UNCLAIM, removing)); + return true; + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/EndPortalFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/EndPortalFaction.java new file mode 100644 index 0000000..ac77662 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/EndPortalFaction.java @@ -0,0 +1,25 @@ +package com.prevailpots.hcf.faction.type; + +import net.md_5.bungee.api.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import java.util.Map; + +public class EndPortalFaction extends ClaimableFaction implements ConfigurationSerializable { + public EndPortalFaction() { + super("EndPortal"); + } + + public EndPortalFaction(final Map map) { + super(map); + } + + public String getDisplayName(final CommandSender sender) { + return ChatColor.GOLD + this.getName().replace("EndPortal", "End Portal"); + } + + public boolean isDeathban() { + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/Faction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/Faction.java new file mode 100644 index 0000000..c8ce820 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/Faction.java @@ -0,0 +1,228 @@ +package com.prevailpots.hcf.faction.type; + +import com.customhcf.util.BukkitUtils; +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.FactionRenameEvent; +import com.prevailpots.hcf.faction.struct.Relation; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.Listener; + +import java.util.Map; +import java.util.UUID; + +public abstract class Faction implements ConfigurationSerializable, Listener { + protected final UUID uniqueID; + public long lastRenameMillis; + protected String name; + protected boolean needSave; + protected long creationMillis; + protected double dtrLossMultiplier = 1; + protected double deathbanMultiplier = 1; + protected boolean safezone; + protected boolean loading; + protected boolean locked; + + + public Faction(String name) { + this.uniqueID = UUID.randomUUID(); + this.name = name; + this.needSave = false; + loading = false; + } + + public Faction(Map map) { + this.uniqueID = UUID.fromString((String) map.get("uniqueID")); + this.name = (String) map.get("name"); + this.creationMillis = Long.parseLong((String) map.get("creationMillis")); + this.lastRenameMillis = Long.parseLong((String) map.get("lastRenameMillis")); + this.deathbanMultiplier = ((Double) map.get("deathbanMultiplier")).doubleValue(); + this.safezone = ((Boolean) map.get("safezone")).booleanValue(); + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + map.put("uniqueID", this.uniqueID.toString()); + map.put("name", this.name); + map.put("creationMillis", Long.toString(this.creationMillis)); + map.put("lastRenameMillis", Long.toString(this.lastRenameMillis)); + map.put("deathbanMultiplier", this.deathbanMultiplier); + map.put("safezone", this.safezone); + return map; + } + + public void flagForSave(boolean value) { + this.needSave = value; + } + public boolean isSaveNeeded(){ + return needSave; + } + public UUID getUniqueID() { + return this.uniqueID; + } + + public String getName() { + return this.name; + } + + public boolean setName(final String name) { + return this.setName(name, (CommandSender) Bukkit.getConsoleSender()); + } + + public boolean setName(final String name, final CommandSender sender) { + if(this.name.equals(name)) { + return false; + } + final FactionRenameEvent event = new FactionRenameEvent(this, sender, this.name, name); + Bukkit.getPluginManager().callEvent((Event) event); + if(event.isCancelled()) { + return false; + } + this.lastRenameMillis = System.currentTimeMillis(); + this.name = name; + return true; + } + + public Relation getFactionRelation(final Faction faction) { + if(faction == null) { + return Relation.ENEMY; + } + if(faction instanceof PlayerFaction) { + final PlayerFaction playerFaction = (PlayerFaction) faction; + if(playerFaction.equals(this)) { + return Relation.MEMBER; + } + if(playerFaction.getAllied().contains(this.uniqueID)) { + return Relation.ALLY; + } + } + return Relation.ENEMY; + } + + public Relation getRelation(final CommandSender sender) { + if(!(sender instanceof Player)) { + return Relation.ENEMY; + } + final Player player = (Player) sender; + return this.getFactionRelation(HCF.getPlugin().getFactionManager().getPlayerFaction(player.getUniqueId())); + } + + public String getDisplayName(final CommandSender sender) { + return (this.safezone ? ConfigurationService.SAFEZONE_COLOUR : this.getRelation(sender).toChatColour()) + this.name; + } + + public String getDisplayName(final Faction other) { + return this.getFactionRelation(other).toChatColour() + this.name; + } + + public void printDetails(final CommandSender sender) { + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + sender.sendMessage(' ' + this.getDisplayName(sender)); + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } + + public boolean isDeathban() { + return !this.safezone && this.deathbanMultiplier > 0.0; + } + + public void setDeathban(final boolean deathban) { + if(deathban != this.isDeathban()) { + this.deathbanMultiplier = (deathban ? 1.0 : 0.0); + } + } + + public double getDeathbanMultiplier() { + return this.deathbanMultiplier; + } + + public void setDeathbanMultiplier(final double deathbanMultiplier) { + Preconditions.checkArgument(deathbanMultiplier >= 0.0, (Object) "Deathban multiplier may not be negative"); + this.deathbanMultiplier = deathbanMultiplier; + } + + public double getDtrLossMultiplier() { + return this.dtrLossMultiplier; + } + + public void setDtrLossMultiplier(final double dtrLossMultiplier) { + this.dtrLossMultiplier = dtrLossMultiplier; + } + + public void setLocked(boolean locked) {this.locked = locked; } + + public boolean isLocked(){ return this.locked; } + + public boolean isSafezone() { + return this.safezone; + } + + @Override + public boolean equals(final Object o) { + if(this == o) { + return true; + } + if(!(o instanceof Faction)) { + return false; + } + final Faction faction = (Faction) o; + if(this.creationMillis != faction.creationMillis) { + return false; + } + if(this.lastRenameMillis != faction.lastRenameMillis) { + return false; + } + if(Double.compare(faction.dtrLossMultiplier, this.dtrLossMultiplier) != 0) { + return false; + } + if(Double.compare(faction.deathbanMultiplier, this.deathbanMultiplier) != 0) { + return false; + } + if(this.safezone != faction.safezone) { + return false; + } + Label_0127: + { + if(this.uniqueID != null) { + if(this.uniqueID.equals(faction.uniqueID)) { + break Label_0127; + } + } else if(faction.uniqueID == null) { + break Label_0127; + } + return false; + } + if(this.name != null) { + if(!this.name.equals(faction.name)) { + return false; + } + } else if(faction.name != null) { + return false; + } + return true; + + } + + @Override + public int hashCode() { + int result = (this.uniqueID != null) ? this.uniqueID.hashCode() : 0; + result = 31 * result + ((this.name != null) ? this.name.hashCode() : 0); + result = 31 * result + (int) (this.creationMillis ^ this.creationMillis >>> 32); + result = 31 * result + (int) (this.lastRenameMillis ^ this.lastRenameMillis >>> 32); + long temp = Double.doubleToLongBits(this.dtrLossMultiplier); + result = 31 * result + (int) (temp ^ temp >>> 32); + temp = Double.doubleToLongBits(this.deathbanMultiplier); + result = 31 * result + (int) (temp ^ temp >>> 32); + result = 31 * result + (this.safezone ? 1 : 0); + return result; + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/PlayerFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/PlayerFaction.java new file mode 100644 index 0000000..b354034 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/PlayerFaction.java @@ -0,0 +1,658 @@ +package com.prevailpots.hcf.faction.type; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.UUID; + +import javax.annotation.Nullable; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.customhcf.util.BukkitUtils; +import com.customhcf.util.GenericUtils; +import com.customhcf.util.JavaUtils; +import com.customhcf.util.PersistableLocation; +import com.customhcf.util.chat.ClickAction; +import com.customhcf.util.chat.Text; +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.deathban.Deathban; +import com.prevailpots.hcf.faction.FactionMember; +import com.prevailpots.hcf.faction.event.FactionDtrChangeEvent; +import com.prevailpots.hcf.faction.event.PlayerJoinedFactionEvent; +import com.prevailpots.hcf.faction.event.PlayerLeaveFactionEvent; +import com.prevailpots.hcf.faction.event.PlayerLeftFactionEvent; +import com.prevailpots.hcf.faction.event.cause.FactionLeaveCause; +import com.prevailpots.hcf.faction.struct.Raidable; +import com.prevailpots.hcf.faction.struct.RegenStatus; +import com.prevailpots.hcf.faction.struct.Relation; +import com.prevailpots.hcf.faction.struct.Role; +import com.prevailpots.hcf.timer.type.TeleportTimer; +import com.prevailpots.hcf.user.FactionUser; + +public class PlayerFaction extends ClaimableFaction implements Raidable { + private static final UUID[] EMPTY_UUID_ARRAY; + + static { + EMPTY_UUID_ARRAY = new UUID[0]; + } + + protected final Map requestedRelations = new HashMap(); + protected final Map relations = new HashMap(); + protected final Map members = new HashMap(); + protected final ArrayList kicked; + public final Map invitedPlayerNames; + protected UUID focus; + protected PersistableLocation home; + protected String announcement; + protected boolean open; + protected int lives; + protected int balance; + protected double deathsUntilRaidable; + protected long regenCooldownTimestamp; + private long lastDtrUpdateTimestamp; + + public PlayerFaction(final String name) { + super(name); + this.kicked = new ArrayList<>(); + this.invitedPlayerNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + this.deathsUntilRaidable = 1.0D; + } + + public PlayerFaction(Map map) { + super(map); + this.invitedPlayerNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + this.deathsUntilRaidable = 1.0D; + Iterator object = GenericUtils.castMap(map.get("members"), String.class, FactionMember.class).entrySet().iterator(); + + while(object.hasNext()) { + Map.Entry entry = (Map.Entry) object.next(); + members.put(UUID.fromString((String) entry.getKey()), entry.getValue()); + } + this.kicked = new ArrayList<>(); + kicked.addAll(GenericUtils.createList(map.get("kicked"), String.class)); + Iterator invites = GenericUtils.castMap(map.get("invitedPlayerNames"), String.class, Boolean.class).entrySet().iterator(); + while (invites.hasNext()){ + Map.Entry entry = (Map.Entry) invites.next(); + invitedPlayerNames.put(((String)entry.getKey()), ((Boolean)entry.getValue())); + } + Object object1 = map.get("home"); + if(object1 != null) { + this.home = (PersistableLocation) object1; + } + + object1 = map.get("announcement"); + if(object1 != null) { + this.announcement = (String) object1; + } + + Iterator entry2 = GenericUtils.castMap(map.get("relations"), String.class, String.class).entrySet().iterator(); + + Map.Entry entry1; + while(entry2.hasNext()) { + entry1 = (Map.Entry) entry2.next(); + this.relations.put(UUID.fromString((String) entry1.getKey()), Relation.valueOf((String) entry1.getValue())); + } + + entry2 = GenericUtils.castMap(map.get("requestedRelations"), String.class, String.class).entrySet().iterator(); + + while(entry2.hasNext()) { + entry1 = (Map.Entry) entry2.next(); + this.requestedRelations.put(UUID.fromString((String) entry1.getKey()), Relation.valueOf((String) entry1.getValue())); + } + + this.open = (boolean) map.get("open"); + this.balance = (int) map.get("balance"); + this.deathsUntilRaidable = (double) map.get("deathsUntilRaidable"); + this.regenCooldownTimestamp = Long.parseLong((String) map.get("regenCooldownTimestamp")); + this.lastDtrUpdateTimestamp = Long.parseLong((String) map.get("lastDtrUpdateTimestamp")); + } + + public Map serialize() { + Map map = super.serialize(); + HashMap relationSaveMap = new HashMap(this.relations.size()); + Iterator requestedRelationsSaveMap = this.relations.entrySet().iterator(); + + while(requestedRelationsSaveMap.hasNext()) { + Map.Entry entrySet = (Map.Entry) requestedRelationsSaveMap.next(); + relationSaveMap.put(((UUID) entrySet.getKey()).toString(), ((Relation) entrySet.getValue()).name()); + } + + map.put("relations", relationSaveMap); + HashMap requestedRelationsSaveMap1 = new HashMap(this.requestedRelations.size()); + Iterator entrySet1 = this.requestedRelations.entrySet().iterator(); + + while(entrySet1.hasNext()) { + Map.Entry saveMap = (Map.Entry) entrySet1.next(); + requestedRelationsSaveMap1.put(( saveMap.getKey()).toString(), ((Relation) saveMap.getValue()).name()); + } + + map.put("requestedRelations", requestedRelationsSaveMap1); + Set entrySet2 = this.members.entrySet(); + LinkedHashMap saveMap1 = new LinkedHashMap(this.members.size()); + Iterator var6 = entrySet2.iterator(); + + while(var6.hasNext()) { + Map.Entry entry = (Map.Entry) var6.next(); + saveMap1.put(( entry.getKey()).toString(), entry.getValue()); + } + + Set entrySet3 = this.invitedPlayerNames.entrySet(); + LinkedHashMap saveMap2 = new LinkedHashMap(this.invitedPlayerNames.size()); + Iterator var7 = entrySet3.iterator(); + + while(var7.hasNext()) { + Map.Entry entry = (Map.Entry) var7.next(); + saveMap2.put(( entry.getKey()).toString(), entry.getValue()); + } + + map.put("members", saveMap1); + map.put("invitedPlayerNames", saveMap2); + if(this.home != null) { + map.put("home", this.home); + } + + if(this.announcement != null) { + map.put("announcement", this.announcement); + } + + map.put("kicked", kicked); + map.put("lives", lives); + map.put("open", Boolean.valueOf(this.open)); + map.put("balance", Integer.valueOf(this.balance)); + map.put("deathsUntilRaidable", Double.valueOf(this.deathsUntilRaidable)); + map.put("regenCooldownTimestamp", Long.toString(this.regenCooldownTimestamp)); + map.put("lastDtrUpdateTimestamp", Long.toString(this.lastDtrUpdateTimestamp)); + return map; + } + + public boolean setMember(final UUID playerUUID, final FactionMember factionMember) { + return this.setMember(null, playerUUID, factionMember, false); + } + + public boolean setMember(final UUID playerUUID, final FactionMember factionMember, final boolean force) { + return this.setMember(null, playerUUID, factionMember, force); + } + + public boolean setMember(final Player player, final FactionMember factionMember) { + return this.setMember(player, player.getUniqueId(), factionMember, false); + } + + public boolean setMember(final Player player, final FactionMember factionMember, final boolean force) { + return this.setMember(player, player.getUniqueId(), factionMember, force); + } + + private boolean setMember( final Player player, final UUID playerUUID, final FactionMember factionMember, final boolean force) { + if(factionMember == null) { + if(!force) { + final PlayerLeaveFactionEvent event = (player == null) ? new PlayerLeaveFactionEvent(playerUUID, this, FactionLeaveCause.LEAVE) : new PlayerLeaveFactionEvent(player, this, FactionLeaveCause.LEAVE); + Bukkit.getPluginManager().callEvent( event); + if(event.isCancelled()) { + return false; + } + } + this.kicked.add(playerUUID.toString()); + this.members.remove(playerUUID); + this.setDeathsUntilRaidable(Math.min(this.deathsUntilRaidable, this.getMaximumDeathsUntilRaidable())); + final PlayerLeftFactionEvent event2 = (player == null) ? new PlayerLeftFactionEvent(playerUUID, this, FactionLeaveCause.LEAVE) : new PlayerLeftFactionEvent(player, this, FactionLeaveCause.LEAVE); + Bukkit.getPluginManager().callEvent( event2); + return true; + } + final PlayerJoinedFactionEvent eventPre = (player == null) ? new PlayerJoinedFactionEvent(playerUUID, this) : new PlayerJoinedFactionEvent(player, this); + Bukkit.getPluginManager().callEvent( eventPre); + this.lastDtrUpdateTimestamp = System.currentTimeMillis(); + this.invitedPlayerNames.remove(factionMember.getName()); + this.members.put(playerUUID, factionMember); + return true; + } + + public Collection getAllied() { + return Maps.filterValues(this.relations, (Predicate) relation -> { + if (relation != Relation.ALLY) return false; + return true; + }).keySet(); + } + + public List getAlliedFactions() { + final Collection allied = this.getAllied(); + final Iterator iterator = allied.iterator(); + final List results = new ArrayList(allied.size()); + while(iterator.hasNext()) { + final Faction faction = HCF.getPlugin().getFactionManager().getFaction(iterator.next()); + if(faction instanceof PlayerFaction) { + results.add((PlayerFaction) faction); + } else { + iterator.remove(); + } + } + return results; + } + + public Map getRequestedRelations() { + return this.requestedRelations; + } + + public Map getRelations() { + return this.relations; + } + + public Map getMembers() { + return ImmutableMap.copyOf(members); + } + + public Set getOnlinePlayers() { + return this.getOnlinePlayers((CommandSender) null); + } + + public Set getOnlinePlayers(CommandSender sender) { + Set entrySet = this.getOnlineMembers(sender).entrySet(); + HashSet results = new HashSet(entrySet.size()); + Iterator var4 = entrySet.iterator(); + + while(var4.hasNext()) { + Map.Entry entry = (Map.Entry) var4.next(); + results.add(Bukkit.getPlayer((UUID) entry.getKey())); + } + + return results; + } + + public Map getOnlineMembers() { + return this.getOnlineMembers(null); + } + + public Map getOnlineMembers(CommandSender sender) { + Player senderPlayer = sender instanceof Player ? (Player)sender : null; + HashMap results = new HashMap(); + Iterator> iterator = this.members.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + Player target = Bukkit.getPlayer((UUID)entry.getKey()); + if (target == null) continue; + if (senderPlayer != null && !senderPlayer.canSee(target)) continue; + results.put(entry.getKey(), entry.getValue()); + } + return results; + } + + + public FactionMember getLeader() { + Map.Entry entry; + Map members = this.members; + Iterator> iterator = members.entrySet().iterator(); + do { + if (!iterator.hasNext()) return null; + } while ((entry = iterator.next()).getValue().getRole() != Role.LEADER); + return entry.getValue(); + } + + @Deprecated + public FactionMember getMember(String memberName) { + UUID uuid = Bukkit.getOfflinePlayer(memberName).getUniqueId(); + if (uuid == null) { + return null; + } + FactionMember factionMember = (FactionMember) this.members.get(uuid); + return factionMember; + } + + public FactionMember getMember(Player player) { + return this.getMember(player.getUniqueId()); + } + + public FactionMember getMember(UUID memberUUID) { + return (FactionMember) this.members.get(memberUUID); + } + + public Set getInvitedPlayerNames() { + return this.invitedPlayerNames.keySet(); + } + + public boolean invitePlayer(String name, Boolean value){ + return invitedPlayerNames.put(name, value); + } + + public boolean isForce(String name){ + return invitedPlayerNames.get(name); + } + + public Location getHome() { + return (this.home == null) ? null : this.home.getLocation(); + } + + public void setHome( Location home) { + if(home == null && this.home != null) { + TeleportTimer timer = HCF.getPlugin().getTimerManager().teleportTimer; + Iterator var3 = this.getOnlinePlayers().iterator(); + + while(var3.hasNext()) { + Player player = (Player) var3.next(); + Location destination = (Location) timer.getDestination(player); + if(Objects.equal(destination, this.home.getLocation())) { + timer.clearCooldown(player); + player.sendMessage(ChatColor.RED + "Your home was unset, so your " + timer.getDisplayName() + ChatColor.RED + " timer has been cancelled"); + } + } + } + + this.home = home == null ? null : new PersistableLocation(home); + } + + public String getAnnouncement() { + return this.announcement; + } + + public void setAnnouncement(@Nullable final String announcement) { + this.announcement = announcement; + } + + public boolean isOpen() { + return this.open; + } + + public void setOpen(final boolean open) { + this.open = open; + } + + public int getBalance() { + return this.balance; + } + + public void setBalance(final int balance) { + this.balance = balance; + } + + @Override + public boolean isRaidable() { + return this.deathsUntilRaidable <= 0.0; + } + + @Override + public double getDeathsUntilRaidable() { + return this.getDeathsUntilRaidable(true); + } + + @Override + public double getMaximumDeathsUntilRaidable() { + if(this.members.size() == 1) { + return 1.1; + } + double max = Math.min(6.5, this.members.size() * 0.9); + if (max > 6.5) { + max = 6.5; + } + return max; + } + + + public double getDeathsUntilRaidable(final boolean updateLastCheck) { + if(updateLastCheck) { + this.updateDeathsUntilRaidable(); + } + return this.deathsUntilRaidable; + } + + public ChatColor getDtrColour() { + this.updateDeathsUntilRaidable(); + if(this.deathsUntilRaidable <= 0.0) { + return ChatColor.RED; + } + if(this.deathsUntilRaidable < 1.0) { + return ChatColor.YELLOW; + } + return ChatColor.GREEN; + } + + private void updateDeathsUntilRaidable() { + if(this.getRegenStatus() == RegenStatus.REGENERATING) { + final long now = System.currentTimeMillis(); + final long millisPassed = now - this.lastDtrUpdateTimestamp; + if(millisPassed >= ConfigurationService.DTR_MILLIS_BETWEEN_UPDATES) { + final long remainder = millisPassed % ConfigurationService.DTR_MILLIS_BETWEEN_UPDATES; + final int multiplier = (int) ((millisPassed + remainder) / ConfigurationService.DTR_MILLIS_BETWEEN_UPDATES); + final double increase = multiplier * 0.1; + this.lastDtrUpdateTimestamp = now - remainder; + this.setDeathsUntilRaidable(this.deathsUntilRaidable + increase); + } + } + } + + @Override + public double setDeathsUntilRaidable(final double deathsUntilRaidable) { + return this.setDeathsUntilRaidable(deathsUntilRaidable, true); + } + + private double setDeathsUntilRaidable(double deathsUntilRaidable, final boolean limit) { + + deathsUntilRaidable = deathsUntilRaidable * 100.0 / 100.0; + if(limit) { + deathsUntilRaidable = Math.min(deathsUntilRaidable, this.getMaximumDeathsUntilRaidable()); + } + if(deathsUntilRaidable - this.deathsUntilRaidable != 0.0) { + final FactionDtrChangeEvent event = new FactionDtrChangeEvent(FactionDtrChangeEvent.DtrUpdateCause.REGENERATION, this, this.deathsUntilRaidable, deathsUntilRaidable); + Bukkit.getPluginManager().callEvent(event); + if(!event.isCancelled()) { + deathsUntilRaidable = event.getNewDtr(); + if(deathsUntilRaidable > 0.0 && deathsUntilRaidable <= 0.0) { + HCF.getPlugin().getLogger().info("Faction " + this.getName() + " is now raidable."); + } + this.lastDtrUpdateTimestamp = System.currentTimeMillis(); + return this.deathsUntilRaidable = deathsUntilRaidable; + } + } + return this.deathsUntilRaidable; + } + + protected long getRegenCooldownTimestamp() { + return this.regenCooldownTimestamp; + } + + public int getLives() { + return lives; + } + + public void setLives(int lives) { + this.lives = lives; + } + + @Override + public long getRemainingRegenerationTime() { + return (this.regenCooldownTimestamp == 0L) ? 0L : (this.regenCooldownTimestamp - System.currentTimeMillis()); + } + + @Override + public void setRemainingRegenerationTime(final long millis) { + final long systemMillis = System.currentTimeMillis(); + this.regenCooldownTimestamp = systemMillis + millis; + this.lastDtrUpdateTimestamp = systemMillis + ConfigurationService.DTR_MILLIS_BETWEEN_UPDATES * 2L; + } + + @Override + public RegenStatus getRegenStatus() { + if(this.getRemainingRegenerationTime() > 0L) { + return RegenStatus.PAUSED; + } + if(this.getMaximumDeathsUntilRaidable() > this.deathsUntilRaidable) { + return RegenStatus.REGENERATING; + } + return RegenStatus.FULL; + } + + + public void printDetails(CommandSender sender) { + String leaderName = null; + HashSet allyNames = new HashSet(1); + Iterator combinedKills = this.relations.entrySet().iterator(); + + PlayerFaction playerFaction; + while(combinedKills.hasNext()) { + Map.Entry memberNames = (Map.Entry) combinedKills.next(); + Faction captainNames = HCF.getPlugin().getFactionManager().getFaction((UUID) memberNames.getKey()); + if(captainNames instanceof PlayerFaction) { + playerFaction = (PlayerFaction) captainNames; + allyNames.add(playerFaction.getDisplayName(sender) + ChatColor.GRAY + '[' + ChatColor.GRAY + playerFaction.getOnlinePlayers(sender).size() + ChatColor.GRAY + '/' + ChatColor.GRAY + playerFaction.members.size() + ChatColor.GRAY + ']'); + } + } + + HashSet memberNames = new HashSet(); + HashSet captainNames = new HashSet(); + HashSet coleader = new HashSet(); + Iterator playerFaction1 = this.members.entrySet().iterator(); + + while(playerFaction1.hasNext()) { + final Map.Entry entry = (Map.Entry) playerFaction1.next(); + final FactionMember factionMember = (FactionMember) entry.getValue(); + final Player target = factionMember.toOnlinePlayer(); + final FactionUser user = HCF.getPlugin().getUserManager().getUser((UUID) entry.getKey()); + int kills = user.getKills(); + final Deathban deathban = user.getDeathban(); + ChatColor colour; + if (deathban != null && deathban.isActive()) { + colour = ChatColor.RED; + } + else if (target == null || (sender instanceof Player && !((Player)sender).canSee(target))) { + colour = ChatColor.GRAY; + } + else { + colour = ChatColor.GREEN; + } + final String memberName = colour + factionMember.getName() + ChatColor.GRAY + '[' + ChatColor.GREEN + kills + ChatColor.GRAY + ']'; + switch (factionMember.getRole()) { + case LEADER: { + leaderName = memberName; + continue; + } + case COLEADER:{ + coleader.add(memberName); + continue; + } + case CAPTAIN: { + captainNames.add(memberName); + continue; + } + case MEMBER: { + memberNames.add(memberName); + } + } + } + + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + if(sender.hasPermission("command.faction.manage")){ + Text text = new Text(); + text.append(getDisplayName(sender)).setColor(ChatColor.GOLD).setHoverText(ChatColor.GRAY + "Click to manage").setClick(ClickAction.RUN_COMMAND, "/faction manage " + getName()); + text.append(" [").setColor(ChatColor.GRAY); + text.append(getOnlineMembers().size()).setColor(ChatColor.GREEN); + text.append("/").setColor(ChatColor.GRAY); + text.append(getMembers().size()).setColor(ChatColor.GRAY); + text.append("]").setColor(ChatColor.GRAY); + text.append(" - ").setColor(ChatColor.GREEN); + text.append("Home" + ChatColor.GRAY + ": ").setColor(ChatColor.YELLOW); + if(home == null){ + text.append(ChatColor.GRAY + "None"); + }else{ + text.append(ChatColor.YELLOW.toString() + this.home.getLocation().getBlockX() + " | " + this.home.getLocation().getBlockZ()).setColor(ChatColor.YELLOW).setHoverText(ChatColor.GRAY + "Click here to tp").setClick(ClickAction.RUN_COMMAND, "/bukkit:tp " + home.getLocation().getBlockX() +" " + (home.getLocation().getBlockY() + .5) + " " + home.getLocation().getBlockZ()); + } + text.send(sender); + }else{ + sender.sendMessage(ChatColor.GOLD + this.getDisplayName(sender)+ ChatColor.GRAY+" ["+this.getOnlineMembers().size()+"/"+this.getMembers().size()+"] "+ ChatColor.GREEN + " - " + ChatColor.YELLOW + "Home: " + ChatColor.YELLOW + (this.home == null ? "None" : ChatColor.YELLOW.toString() + this.home.getLocation().getBlockX() + " | " + this.home.getLocation().getBlockZ())); + } + + + if(!allyNames.isEmpty()) { + sender.sendMessage(ChatColor.YELLOW + "Allies: " + StringUtils.join(allyNames, ChatColor.GRAY + ", ")); + } + + + if(leaderName != null) { + sender.sendMessage(ChatColor.YELLOW + "Leader: " + ChatColor.RED + leaderName); + } + + if(!coleader.isEmpty()) { + sender.sendMessage(ChatColor.YELLOW + "Co-Leaders: " + ChatColor.RED + StringUtils.join(coleader, ChatColor.GRAY + ", ")); + } + + if(!captainNames.isEmpty()) { + sender.sendMessage(ChatColor.YELLOW + "Captains: " + ChatColor.RED + StringUtils.join(captainNames, ChatColor.GRAY + ", ")); + } + + if(!memberNames.isEmpty()) { + sender.sendMessage(ChatColor.YELLOW + "Members: " + ChatColor.RED + StringUtils.join(memberNames, ChatColor.GRAY + ", ")); + } + + + /** + Send Things only for factions eyes (Private Information) + */ + if (sender instanceof Player) { + final Faction playerFaction2 = HCF.getPlugin().getFactionManager().getPlayerFaction(((Player) sender).getUniqueId()); + if(playerFaction2 != null && playerFaction2.equals(this)) { + if (this.announcement != null) { + sender.sendMessage(ChatColor.YELLOW + "Announcement: " + ChatColor.GREEN + this.announcement); + } + sender.sendMessage(ChatColor.YELLOW + "Balance: " + ChatColor.GREEN + '$' + this.balance); + } + } + + sender.sendMessage(ChatColor.YELLOW + "Deaths until Raidable: "+ this.getRegenStatus().getSymbol() + this.getDtrColour() + JavaUtils.format(getDeathsUntilRaidable(false))); + long dtrRegenRemaining = this.getRemainingRegenerationTime(); + if(dtrRegenRemaining > 0L) { + sender.sendMessage(ChatColor.YELLOW+ " Time until Regen: " + ChatColor.GREEN + DurationFormatUtils.formatDurationWords(dtrRegenRemaining, true, true)); + } + + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } + + public UUID getFocus() { + return focus; + } + + public void setFocus(UUID uuid){ + this.focus = uuid; + } + + public void broadcast(final String message) { + this.broadcast(message, PlayerFaction.EMPTY_UUID_ARRAY); + } + + public void broadcast(final String[] messages) { + this.broadcast(messages, PlayerFaction.EMPTY_UUID_ARRAY); + } + + public void broadcast(final String message, @Nullable final UUID... ignore) { + this.broadcast(new String[]{message}, ignore); + } + + public void broadcast(final String[] messages, final UUID... ignore) { + Preconditions.checkNotNull((Object) messages, "Messages cannot be null"); + Preconditions.checkArgument(messages.length > 0, "Message array cannot be empty"); + final Collection players = this.getOnlinePlayers(); + final Collection ignores = ((ignore.length == 0) ? Collections.emptySet() : Sets.newHashSet(ignore)); + for(final Player player : players) { + if(!ignores.contains(player.getUniqueId())) { + player.sendMessage(messages); + } + } + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/RoadFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/RoadFaction.java new file mode 100644 index 0000000..e49f544 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/RoadFaction.java @@ -0,0 +1,76 @@ +package com.prevailpots.hcf.faction.type; + +import com.customhcf.util.BukkitUtils; +import com.prevailpots.hcf.ConfigurationService; + +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import java.util.Map; + +public class RoadFaction extends ClaimableFaction implements ConfigurationSerializable { + public RoadFaction(final String name) { + super(name); + } + + + public RoadFaction(final Map map) { + super(map); + } + + public String getDisplayName(final CommandSender sender) { + return ConfigurationService.WARZONE_COLOUR + this.getName().replace("st", "st ").replace("th", "th "); + } + + @Override + public void printDetails(final CommandSender sender) { + + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + sender.sendMessage(this.getDisplayName(sender)); + sender.sendMessage(ChatColor.YELLOW + " Location: " + ChatColor.GRAY + "None"); + sender.sendMessage(ChatColor.GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT); + } + + public static class NorthRoadFaction extends RoadFaction implements ConfigurationSerializable { + public NorthRoadFaction() { + super("NorthRoad"); + } + + public NorthRoadFaction(final Map map) { + super(map); + } + } + + public static class EastRoadFaction extends RoadFaction implements ConfigurationSerializable { + public EastRoadFaction() { + super("EastRoad"); + } + + public EastRoadFaction(final Map map) { + super(map); + } + } + + public static class SouthRoadFaction extends RoadFaction implements ConfigurationSerializable { + public SouthRoadFaction() { + super("SouthRoad"); + + } + + public SouthRoadFaction(final Map map) { + super(map); + } + } + + + public static class WestRoadFaction extends RoadFaction implements ConfigurationSerializable { + public WestRoadFaction() { + super("WestRoad"); + } + + public WestRoadFaction(final Map map) { + super(map); + } + } +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/SpawnFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/SpawnFaction.java new file mode 100644 index 0000000..0b1b008 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/SpawnFaction.java @@ -0,0 +1,32 @@ +package com.prevailpots.hcf.faction.type; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.serialization.ConfigurationSerializable; + +import com.prevailpots.hcf.faction.claim.Claim; + +import java.util.Map; + +public class SpawnFaction extends ClaimableFaction implements ConfigurationSerializable { + public SpawnFaction() { + super("Spawn"); + this.safezone = true; + for(final World world : Bukkit.getWorlds()) { + final World.Environment environment = world.getEnvironment(); + if(environment != World.Environment.THE_END) { + this.addClaim(new Claim(this, new Location(world, (double) 121, 0.0, (double) 121), new Location(world, (double) (-121), (double) world.getMaxHeight(), (double) (-121))), null); + } + } + } + + public SpawnFaction(final Map map) { + super(map); + } + + public boolean isDeathban() { + return false; + } +} + diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/WarzoneFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/WarzoneFaction.java new file mode 100644 index 0000000..529f798 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/WarzoneFaction.java @@ -0,0 +1,22 @@ +package com.prevailpots.hcf.faction.type; + +import org.bukkit.command.CommandSender; + +import com.prevailpots.hcf.ConfigurationService; + +import java.util.Map; + +public class WarzoneFaction extends Faction { + public WarzoneFaction() { + super("Warzone"); + } + + public WarzoneFaction(final Map map) { + super(map); + } + + @Override + public String getDisplayName(final CommandSender sender) { + return ConfigurationService.WARZONE_COLOUR + this.getName(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/faction/type/WildernessFaction.java b/PrevailHCF/src/com/prevailpots/hcf/faction/type/WildernessFaction.java new file mode 100644 index 0000000..94bc7ef --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/faction/type/WildernessFaction.java @@ -0,0 +1,22 @@ +package com.prevailpots.hcf.faction.type; + +import org.bukkit.command.CommandSender; + +import com.prevailpots.hcf.ConfigurationService; + +import java.util.Map; + +public class WildernessFaction extends Faction { + public WildernessFaction() { + super("Wilderness"); + } + + public WildernessFaction(final Map map) { + super(map); + } + + @Override + public String getDisplayName(final CommandSender sender) { + return ConfigurationService.WILDERNESS_COLOUR + "The " + this.getName(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.java new file mode 100644 index 0000000..ecfdc9c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/BeaconStrengthFixListener.java @@ -0,0 +1,24 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PotionEffectAddEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class BeaconStrengthFixListener implements Listener { + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onPotionEffectAdd(final PotionEffectAddEvent event) { + final LivingEntity entity = event.getEntity(); + if(entity instanceof Player && event.getCause() == PotionEffectAddEvent.EffectCause.BEACON) { + final PotionEffect effect = event.getEffect(); + if(effect.getAmplifier() > 1 && effect.getType().equals((Object) PotionEffectType.INCREASE_DAMAGE)) { + entity.addPotionEffect(new PotionEffect(effect.getType(), effect.getDuration(), 0, effect.isAmbient())); + event.setCancelled(true); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockHitFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockHitFixListener.java new file mode 100644 index 0000000..12e9638 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockHitFixListener.java @@ -0,0 +1,73 @@ +package com.prevailpots.hcf.fixes; + +import com.customhcf.util.BukkitUtils; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.UUID; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; + +public class BlockHitFixListener implements Listener { + private static final long THRESHOLD = 850L; + private static final ImmutableSet NON_TRANSPARENT_ATTACK_BREAK_TYPES = Sets.immutableEnumSet( Material.GLASS, new Material[]{Material.STAINED_GLASS, Material.STAINED_GLASS_PANE}); + private static final ImmutableSet NON_TRANSPARENT_ATTACK_INTERACT_TYPES = Sets.immutableEnumSet(Material.IRON_DOOR_BLOCK, new Material[]{Material.IRON_DOOR, Material.WOODEN_DOOR, Material.WOOD_DOOR, Material.TRAP_DOOR}); + private final ConcurrentMap lastInteractTimes; + + public BlockHitFixListener() { + this.lastInteractTimes = CacheBuilder.newBuilder().expireAfterWrite(THRESHOLD, TimeUnit.MILLISECONDS).build().asMap(); + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.HIGH) + public void onPlayerInteract(final PlayerInteractEvent event) { + if(event.hasBlock() && event.getAction() != Action.PHYSICAL && BlockHitFixListener.NON_TRANSPARENT_ATTACK_INTERACT_TYPES.contains((Object) event.getClickedBlock().getType())) { + this.cancelAttackingMillis(event.getPlayer().getUniqueId(), THRESHOLD); + } + } + + @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR) + public void onBlockBreak(final BlockBreakEvent event) { + if(event.isCancelled() && BlockHitFixListener.NON_TRANSPARENT_ATTACK_BREAK_TYPES.contains((Object) event.getBlock().getType())) { + this.cancelAttackingMillis(event.getPlayer().getUniqueId(), THRESHOLD); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onEntityDamageByEntity(final EntityDamageEvent event) { + final Player attacker = BukkitUtils.getFinalAttacker(event, true); + if(attacker != null) { + final Long lastInteractTime = (Long) this.lastInteractTimes.get(attacker.getUniqueId()); + if(lastInteractTime != null && lastInteractTime - System.currentTimeMillis() > 0L) { + event.setCancelled(true); + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerLogout(final PlayerQuitEvent event) { + this.lastInteractTimes.remove(event.getPlayer().getUniqueId()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerKick(final PlayerKickEvent event) { + this.lastInteractTimes.remove(event.getPlayer().getUniqueId()); + } + + public void cancelAttackingMillis(final UUID uuid, final long delay) { + this.lastInteractTimes.put(uuid, System.currentTimeMillis() + delay); + } + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.java new file mode 100644 index 0000000..1a80afa --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/BlockJumpGlitchFixListener.java @@ -0,0 +1,32 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.GameMode; +import org.bukkit.block.Block; +import org.bukkit.block.Sign; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.util.Vector; + +public class BlockJumpGlitchFixListener implements Listener { + @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR) + public void onBlockBreak(final BlockPlaceEvent event) { + if(event.isCancelled()) { + final Player player = event.getPlayer(); + if(player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight()) { + return; + } + final Block block = event.getBlockPlaced(); + if(block.getType().isSolid() && !(block.getState() instanceof Sign)) { + final int playerY = player.getLocation().getBlockY(); + final int blockY = block.getLocation().getBlockY(); + if(playerY > blockY) { + final Vector vector = player.getVelocity(); + player.setVelocity(vector.setY(vector.getY() - 0.41999998688697815)); + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/BoatGlitchFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/BoatGlitchFixListener.java new file mode 100644 index 0000000..826a36e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/BoatGlitchFixListener.java @@ -0,0 +1,27 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Boat; +import org.bukkit.entity.Vehicle; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.vehicle.VehicleCreateEvent; + +public class BoatGlitchFixListener implements Listener { + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onVehicleCreate(final VehicleCreateEvent event) { + final Vehicle vehicle = event.getVehicle(); + if(vehicle instanceof Boat) { + final Boat boat = (Boat) vehicle; + final Block belowBlock = boat.getLocation().add(0.0, -1.0, 0.0).getBlock(); + if(belowBlock.getType() != Material.WATER && belowBlock.getType() != Material.STATIONARY_WATER) { + boat.remove(); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/DupeFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/DupeFixListener.java new file mode 100644 index 0000000..cae8e75 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/DupeFixListener.java @@ -0,0 +1,6 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.event.Listener; + +public class DupeFixListener implements Listener { +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/EnchantLimitListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/EnchantLimitListener.java new file mode 100644 index 0000000..f1f2e91 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/EnchantLimitListener.java @@ -0,0 +1,147 @@ +package com.prevailpots.hcf.fixes; + + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.prevailpots.hcf.ConfigurationService; + +import net.minecraft.server.v1_7_R4.EnumArmorMaterial; +import net.minecraft.server.v1_7_R4.EnumToolMaterial; +import net.minecraft.server.v1_7_R4.ItemArmor; +import net.minecraft.server.v1_7_R4.ItemSword; +import net.minecraft.server.v1_7_R4.ItemTool; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.enchantment.EnchantItemEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.inventory.PrepareAnvilRepairEvent; +import org.bukkit.event.player.PlayerFishEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public class EnchantLimitListener implements Listener { + private final ImmutableMap ITEM_TOOL_MAPPING = Maps.immutableEnumMap((Map) ImmutableMap.of((Object) Material.IRON_INGOT, (Object) EnumToolMaterial.IRON, (Object) Material.GOLD_INGOT, (Object) EnumToolMaterial.GOLD, (Object) Material.DIAMOND, (Object) EnumToolMaterial.DIAMOND)); + private final ImmutableMap ITEM_ARMOUR_MAPPING = Maps.immutableEnumMap((Map) ImmutableMap.of((Object) Material.IRON_INGOT, (Object) EnumArmorMaterial.IRON, (Object) Material.GOLD_INGOT, (Object) EnumArmorMaterial.GOLD, (Object) Material.DIAMOND, (Object) EnumArmorMaterial.DIAMOND)); + + + public int getMaxLevel(final Enchantment enchant) { + return ConfigurationService.ENCHANTMENT_LIMITS.getOrDefault(enchant, enchant.getMaxLevel()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onEnchantItem(final EnchantItemEvent event) { + Map adding = event.getEnchantsToAdd(); + final Iterator> iterator = adding.entrySet().iterator(); + while(iterator.hasNext()) { + final Map.Entry entry = iterator.next(); + final Enchantment enchantment = entry.getKey(); + final int maxLevel = this.getMaxLevel(enchantment); + if(entry.getValue() > maxLevel) { + if(maxLevel > 0) { + adding.put(enchantment, maxLevel); + } else { + iterator.remove(); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onEntityDeath(final EntityDeathEvent event) { + if(!(event.getEntity() instanceof Player)) { + for(final ItemStack drop : event.getDrops()) { + this.validateIllegalEnchants(drop); + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onPlayerFishEvent(final PlayerFishEvent event) { + final Entity caught = event.getCaught(); + if(caught instanceof Item) { + this.validateIllegalEnchants(((Item) caught).getItemStack()); + } + } + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onPrepareAnvilRepair(final PrepareAnvilRepairEvent event) { + ItemStack firstAssassinEffects = event.getInventory().getItem(0); + ItemStack second = event.getInventory().getItem(1); + if (firstAssassinEffects != null && firstAssassinEffects.getType() != Material.AIR && second != null && second.getType() != Material.AIR) { + final Object firstItemObj = net.minecraft.server.v1_7_R4.Item.REGISTRY.a(firstAssassinEffects.getTypeId()); + if (firstItemObj instanceof net.minecraft.server.v1_7_R4.Item) { + final net.minecraft.server.v1_7_R4.Item nmsFirstItem = (net.minecraft.server.v1_7_R4.Item)firstItemObj; + if (nmsFirstItem instanceof ItemTool) { + if (this.ITEM_TOOL_MAPPING.get(second.getType()) == ((ItemTool)nmsFirstItem).i()) { + return; + } + } + else if (nmsFirstItem instanceof ItemSword) { + final EnumToolMaterial comparison = (EnumToolMaterial)this.ITEM_TOOL_MAPPING.get((Object)second.getType()); + if (comparison != null && comparison.e() == nmsFirstItem.c()) { + return; + } + } + else if (nmsFirstItem instanceof ItemArmor && this.ITEM_ARMOUR_MAPPING.get((Object)second.getType()) == ((ItemArmor)nmsFirstItem).m_()) { + return; + } + } + } + final HumanEntity repairer = event.getRepairer(); + if (repairer instanceof Player) { + this.validateIllegalEnchants(event.getResult()); + } + } + + private boolean validateIllegalEnchants(final ItemStack stack) { + boolean updated = false; + if(stack != null && stack.getType() != Material.AIR) { + final ItemMeta meta = stack.getItemMeta(); + if(meta instanceof EnchantmentStorageMeta) { + final EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) meta; + final Set> entries = enchantmentStorageMeta.getStoredEnchants().entrySet(); + for(final Map.Entry entry : entries) { + final Enchantment enchantment = entry.getKey(); + final int maxLevel = this.getMaxLevel(enchantment); + if(entry.getValue() > maxLevel) { + updated = true; + if(maxLevel > 0) { + enchantmentStorageMeta.addStoredEnchant(enchantment, maxLevel, false); + } else { + enchantmentStorageMeta.removeStoredEnchant(enchantment); + } + } + } + stack.setItemMeta(meta); + } else { + final Set> entries = stack.getEnchantments().entrySet(); + for(final Map.Entry entry2 : entries) { + final Enchantment enchantment2 = entry2.getKey(); + final int maxLevel2 = this.getMaxLevel(enchantment2); + if(entry2.getValue() > maxLevel2) { + updated = true; + stack.removeEnchantment(enchantment2); + if(maxLevel2 <= 0) { + continue; + } + stack.addEnchantment(enchantment2, maxLevel2); + } + } + } + } + return updated; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/EnderChestRemovalListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/EnderChestRemovalListener.java new file mode 100644 index 0000000..3e13933 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/EnderChestRemovalListener.java @@ -0,0 +1,43 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.Recipe; +import org.bukkit.material.EnderChest; + +import java.util.Iterator; + +public class EnderChestRemovalListener implements Listener { + public EnderChestRemovalListener() { + this.removeRecipe(); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onEnderChestOpen(final PlayerInteractEvent event) { + if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.ENDER_CHEST) { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onInventoryOpen(final InventoryOpenEvent event) { + if(event.getInventory() instanceof EnderChest) { + event.setCancelled(true); + } + } + + private void removeRecipe() { + final Iterator iterator = (Iterator) Bukkit.recipeIterator(); + while(iterator.hasNext()) { + if(iterator.next().getResult().getType() == Material.ENDER_CHEST) { + iterator.remove(); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/HungerFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/HungerFixListener.java new file mode 100644 index 0000000..3683a59 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/HungerFixListener.java @@ -0,0 +1,39 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerMoveEvent; + +import com.prevailpots.hcf.HCF; + +/** + * Created by TREHOME on 10/30/2015. + */ +public class HungerFixListener implements Listener{ + + + @EventHandler + public void onMove(PlayerMoveEvent e){ + if(HCF.getPlugin().getFactionManager().getFactionAt(e.getPlayer().getLocation()).isSafezone()) { + if(e.getPlayer().getFoodLevel() < 20) { + e.getPlayer().setFoodLevel(20); + e.getPlayer().setSaturation(20); + } + } + } + + + @EventHandler + public void onHungerChange(FoodLevelChangeEvent e){ + if(e.getEntity() instanceof Player){ + Player p = (Player) e.getEntity(); + if(HCF.getPlugin().getFactionManager().getFactionAt(p.getLocation()).isSafezone()){ + p.setSaturation(20); + p.setHealth(20); + } + p.setSaturation(10); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/InfinityArrowFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/InfinityArrowFixListener.java new file mode 100644 index 0000000..8c8de2e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/InfinityArrowFixListener.java @@ -0,0 +1,23 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.ProjectileHitEvent; + +public class InfinityArrowFixListener implements Listener { + @EventHandler(priority = EventPriority.NORMAL) + public void onProjectileHit(final ProjectileHitEvent event) { + final Entity entity = (Entity) event.getEntity(); + if(entity instanceof Arrow) { + final Arrow arrow = (Arrow) entity; + if(!(arrow.getShooter() instanceof Player) || ((CraftArrow) arrow).getHandle().fromPlayer == 2) { + arrow.remove(); + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/NoPermissionClickListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/NoPermissionClickListener.java new file mode 100644 index 0000000..0c6f0da --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/NoPermissionClickListener.java @@ -0,0 +1,86 @@ +package com.prevailpots.hcf.fixes; + +import com.customhcf.base.BasePlugin; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryCreativeEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerLoginEvent; + +public class NoPermissionClickListener implements Listener{ + @EventHandler + public void onInteract(PlayerInteractEvent e){ + final Player player = e.getPlayer(); + if(player.getGameMode() == GameMode.CREATIVE && !player.hasPermission("command.gamemode") && !BasePlugin.getPlugin().getStaffModeManager().isInStaffMode(e.getPlayer())) { + e.setCancelled(true); + player.setGameMode(GameMode.SURVIVAL); + for (Player admins: Bukkit.getServer().getOnlinePlayers()){ + if (admins.isOp()){ + admins.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + player.getPlayer().getName() + " was in creative mode without permission!"); + } + } + } + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockPlaceCreative(final BlockPlaceEvent event) { + final Player player = event.getPlayer(); + if(player.getGameMode() == GameMode.CREATIVE && !player.hasPermission("command.gamemode")&& !BasePlugin.getPlugin().getStaffModeManager().isInStaffMode(event.getPlayer())) { + event.setCancelled(true); + player.setGameMode(GameMode.SURVIVAL); + for (Player admins: Bukkit.getServer().getOnlinePlayers()){ + if (admins.isOp()){ + admins.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + player.getPlayer().getName() + " was in creative mode without permission!"); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockBreakCreative(final BlockBreakEvent event) { + final Player player = event.getPlayer(); + if(player.getGameMode() == GameMode.CREATIVE && !player.hasPermission("command.gamemode")&& !BasePlugin.getPlugin().getStaffModeManager().isInStaffMode(event.getPlayer())) { + event.setCancelled(true); + player.setGameMode(GameMode.SURVIVAL); + for (Player admins: Bukkit.getServer().getOnlinePlayers()){ + if (admins.isOp()){ + admins.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + player.getPlayer().getName() + " was in creative mode without permission!"); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onInventoryCreative(final InventoryCreativeEvent event) { + final HumanEntity humanEntity = event.getWhoClicked(); + if(humanEntity instanceof Player && !humanEntity.hasPermission("command.gamemode")&& !BasePlugin.getPlugin().getStaffModeManager().isInStaffMode(event.getWhoClicked().getUniqueId())) { + event.setCancelled(true); + humanEntity.setGameMode(GameMode.SURVIVAL); + for (Player admins: Bukkit.getServer().getOnlinePlayers()){ + if (admins.isOp()){ + admins.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + ((Player) humanEntity).getPlayer().getName() + " was in creative mode without permission!"); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerJoin(PlayerLoginEvent e){ + if (e.getPlayer().getGameMode() == GameMode.CREATIVE && !e.getPlayer().hasPermission("command.gamemode")){ + e.getPlayer().setGameMode(GameMode.SURVIVAL); + for (Player admins: Bukkit.getServer().getOnlinePlayers()){ + if (admins.isOp()){ + admins.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + e.getPlayer().getName() + " joined in creative mode without permission!"); + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/PearlGlitchFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/PearlGlitchFixListener.java new file mode 100644 index 0000000..cef0cd8 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/PearlGlitchFixListener.java @@ -0,0 +1,90 @@ +package com.prevailpots.hcf.fixes; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.ClaimableFaction; +import com.prevailpots.hcf.faction.type.Faction; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.inventory.InventoryHolder; + +public class PearlGlitchFixListener implements Listener { + + private final ImmutableSet blockedPearlTypes = Sets.immutableEnumSet( + Material.THIN_GLASS, + Material.IRON_FENCE, + Material.FENCE, + Material.NETHER_FENCE, + Material.FENCE_GATE, + Material.ACACIA_STAIRS, + Material.BIRCH_WOOD_STAIRS, + Material.BRICK_STAIRS, + Material.COBBLESTONE_STAIRS, + Material.DARK_OAK_STAIRS, + Material.JUNGLE_WOOD_STAIRS, + Material.NETHER_BRICK_STAIRS, + Material.QUARTZ_STAIRS, + Material.SANDSTONE_STAIRS, + Material.SMOOTH_STAIRS, + Material.SPRUCE_WOOD_STAIRS, + Material.WOOD_STAIRS, + Material.WOOD_STEP, + Material.WOOD_DOUBLE_STEP, + Material.STEP, + Material.DOUBLE_STEP + ); + + private final HCF plugin; + + public PearlGlitchFixListener(HCF plugin) { + this.plugin = plugin; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPlayerInteract(PlayerInteractEvent event) { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.hasItem() && event.getItem().getType() == Material.ENDER_PEARL) { + Block block = event.getClickedBlock(); + // Don't prevent opening chests, etc, as these won't throw the Enderpearls anyway + if (block.getType().isSolid() && !(block.getState() instanceof InventoryHolder)) { + Faction factionAt = HCF.getPlugin().getFactionManager().getFactionAt(block.getLocation()); + if (factionAt instanceof ClaimableFaction) { + event.setCancelled(true); + Player player = event.getPlayer(); + player.setItemInHand(event.getItem()); // required to update Enderpearl count + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPearlClip(PlayerTeleportEvent event) { + + if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) { + Location to = event.getTo(); + if (blockedPearlTypes.contains(to.getBlock().getType())) { + Player player = event.getPlayer(); + boolean refund = true; + + //player.sendMessage(org.bukkit.ChatColor.DARK_PURPLE + org.bukkit.ChatColor.BOLD.toString() + "Pearl has been removed for possible pearl glitching!"); + + plugin.getTimerManager().enderPearlTimer.refund(player); + event.setCancelled(true); + return; + } + + to.setX(to.getBlockX() + 0.5); + to.setZ(to.getBlockZ() + 0.5); + event.setTo(to); + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/PexCrashFix.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/PexCrashFix.java new file mode 100644 index 0000000..16fc185 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/PexCrashFix.java @@ -0,0 +1,22 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +/** + * Created by TREHOME on 01/28/2016. + */ +public class PexCrashFix implements Listener { + + + @EventHandler + public void onCommandPreprocess(final PlayerCommandPreprocessEvent event) { + if ((event.getMessage().toLowerCase().startsWith("/pex") ||event.getMessage().toLowerCase().startsWith("/kill") || event.getMessage().toLowerCase().startsWith("/slay") ||event.getMessage().toLowerCase().startsWith("/bukkit:version")||event.getMessage().toLowerCase().startsWith("/bukkit:about")|| event.getMessage().toLowerCase().startsWith("/bukkit:kill") || event.getMessage().toLowerCase().startsWith("/bukkit:slay") || event.getMessage().toLowerCase().startsWith("/suicide")) && !event.getPlayer().hasPermission("*.**")) { + event.setCancelled(true); + event.getPlayer().sendMessage(ChatColor.RED + "No permission."); + } + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/PhaseListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/PhaseListener.java new file mode 100644 index 0000000..f942ba6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/PhaseListener.java @@ -0,0 +1,47 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.event.Listener; + +import java.util.concurrent.TimeUnit; + +/** + * Created by TREHOME on 12/31/2015. + */ +public class PhaseListener implements Listener { + + + private final long GRAVITY_BLOCK = TimeUnit.HOURS.toMillis(6); + private final long UTILITY_BLOCK = TimeUnit.HOURS.toMillis(3); +// @EventHandler +// public void onMove(PlayerInteractEvent e){ +// if(e.getPlayer().getLocation().getBlock() != null){ +// if(e.getPlayer().getLocation().getBlock().getType() == Material.TRAP_DOOR){ +// if(!HCF.getPlugin().getFactionManager().getFactionAt(e.getPlayer().getLocation()).equals(HCF.getPlugin().getFactionManager().getPlayerFaction(e.getPlayer().getUniqueId()))) { +// e.getPlayer().sendMessage(ChatColor.RED + "Glitch detected. Now reporting, and fixing."); +// e.getPlayer().teleport(e.getPlayer().getLocation().add(0, 1, 0)); +// } +// } +// } +// } +// +// @EventHandler +// public void onPlayerTimePlace(BlockPlaceEvent event){ +// if(!event.getPlayer().hasPermission("hcf.gravity.bypass") && event.getPlayer().getGameMode() != GameMode.CREATIVE) { +// Player player = (Player) event.getPlayer(); +// if(event.getBlockPlaced().getType() == Material.SAND || event.getBlockPlaced().getType() == Material.GRAVEL) { +// if(BasePlugin.getPlugin().getPlayTimeManager().getTotalPlayTime(player.getUniqueId()) <= gravityBlock) { +// player.sendMessage(ChatColor.RED + "You must wait another " + DurationFormatUtils.formatDurationWords(gravityBlock - BasePlugin.getPlugin().getPlayTimeManager().getTotalPlayTime(player.getUniqueId()), true, true) + " before placing a gravity block."); +// event.setCancelled(true); +// return; +// } +// } else if(event.getBlockPlaced().getType() == Material.ANVIL) { +// if(BasePlugin.getPlugin().getPlayTimeManager().getTotalPlayTime(player.getUniqueId()) <= utilityBlock) { +// player.sendMessage(ChatColor.RED + "You must wait another " + DurationFormatUtils.formatDurationWords(utilityBlock - BasePlugin.getPlugin().getPlayTimeManager().getTotalPlayTime(player.getUniqueId()), true, true) + " before placing an anvil."); +// event.setCancelled(true); +// return; +// } +// } +// } +// +// } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/PortalTrapFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/PortalTrapFixListener.java new file mode 100644 index 0000000..304a475 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/PortalTrapFixListener.java @@ -0,0 +1,41 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPortalEvent; + +import com.prevailpots.hcf.HCF; + +public class PortalTrapFixListener implements Listener { + + @EventHandler + public void onNetherPortalFix(final PlayerPortalEvent e) { + if (e.getTo().getWorld().getEnvironment() == World.Environment.NETHER) { + //e.getPlayer().sendMessage(ChatColor.DARK_PURPLE + "Some of the blocks around the portal have been updated to prevent nether portal trapping."); + final Location l = e.getTo(); + final int range = 3; + final int minX = l.getBlockX() - 5; + final int minY = l.getBlockY() - 2; + final int minZ = l.getBlockZ() - 5; + for (int x = minX; x < minX + range; ++x) + for (int y = minY; y < minY + range; ++y) { + for (int z = minZ; z < minZ + range; ++z) { + final Block block = e.getTo().getWorld().getBlockAt(x, y, z); + final Block platform = e.getTo().getWorld().getBlockAt(x, (int) (l.getY() - 2.0), z); + if (platform.getType() != Material.OBSIDIAN) { + platform.setType(Material.OBSIDIAN); + } + if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.SAND || block.getType() == Material.QUARTZ_ORE || block.getType() == Material.NETHERRACK || block.getType() == Material.GRAVEL || block.getType() == Material.SOUL_SAND || block.getType() == Material.NETHER_BRICK || block.getType() == Material.COBBLESTONE) { + block.setType(Material.AIR); + } + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/PotionLimitListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/PotionLimitListener.java new file mode 100644 index 0000000..b15aa6c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/PotionLimitListener.java @@ -0,0 +1,136 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PotionSplashEvent; +import org.bukkit.event.inventory.BrewEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.potion.PotionType; + +import com.prevailpots.hcf.ConfigurationService; + +import java.util.Map; + +public class PotionLimitListener implements Listener { + private static final int EMPTY_BREW_TIME = 400; + + public int getMaxLevel(final PotionType type) { + return ConfigurationService.POTION_LIMITS.getOrDefault(type, type.getMaxLevel()); + } + + @EventHandler + public void onSplash(PotionSplashEvent e){ + if(e.getEntity() != null) { + for(PotionEffect effect : e.getEntity().getEffects()){ + if(effect != null){ + if(effect.getType() != null){ + if(effect.getType().equals(PotionEffectType.INCREASE_DAMAGE)) { + e.setCancelled(true); + ((Player)e.getEntity().getShooter()).getItemInHand().setType(Material.AIR); + } + } + } + } + } + } + + + @EventHandler + public void onConsume(PlayerItemConsumeEvent e) { + if(e.getItem() != null && e.getItem().getType() == Material.POTION && e.getItem().getDurability() != 0) { + final Potion potion = Potion.fromItemStack(e.getItem()); + if(potion != null) { + + final PotionType type = potion.getType(); + if(type != null) { + if(type == PotionType.STRENGTH){ + e.setCancelled(true); + e.setItem(null); + } + } + } + } + } + + + @EventHandler + public void onClick(InventoryClickEvent e){ + if(e.getInventory().getType() == InventoryType.BREWING){ + if(e.getCurrentItem().getType() == Material.POTION){ + if(!testValidity(new ItemStack[]{e.getCurrentItem()})){ + e.setCurrentItem(null); + return; + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onBrew(final BrewEvent event) { + if(event.getContents() == null) return; + for(ItemStack stack : event.getContents().getContents()) { + if(stack == null) { + return; + + } + if(stack.getType() == null){ + return; + } + if (stack.getType() == Material.FERMENTED_SPIDER_EYE) { + event.setCancelled(true); + } + if(stack.getType() == Material.BLAZE_POWDER){ + event.setCancelled(true); + } + + } + } + + + private boolean testValidity(final ItemStack[] contents) { + for(final ItemStack stack : contents) { + if(stack != null && stack.getType() == Material.POTION && stack.getDurability() != 0) { + final Potion potion = Potion.fromItemStack(stack); + if(potion == null){ + continue; + } + final PotionType type = potion.getType(); + if(type == null){ + continue; + } + if(potion.hasExtendedDuration() || potion.getLevel() != 1) { + if(potion.getLevel() > this.getMaxLevel(type)) { + return false; + } + } + for(Map.Entry potionType : ConfigurationService.POTION_LIMITS.entrySet()){ + if(potionType.getKey() == type){ + if(potion.getLevel() > potionType.getValue()){ + return false; + } + } + } + if(type == PotionType.STRENGTH){ + return false; + } + if(type == PotionType.POISON ){ + return false; + } + if(type == PotionType.SLOWNESS){ + return false; + } + + } + } + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/ServerSecurityListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/ServerSecurityListener.java new file mode 100644 index 0000000..19ba00e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/ServerSecurityListener.java @@ -0,0 +1,90 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.event.Listener; + +/** + * Created by TREHOME on 01/01/2016. + */ +public class ServerSecurityListener implements Listener { + /*public static List allowedOps = new ArrayList<>(); + public static List blacklistedBlocks = new ArrayList<>(); + + public ServerSecurityListener(){ + blacklistedBlocks.add(Material.BEDROCK); + allowedOps.add("Prestige_PvP"); + allowedOps.add("bloopyy"); + allowedOps.add("Chomped"); + allowedOps.add("JavaTM"); + allowedOps.add("RollADoobie"); + } +// @EventHandler +// public void onClick(InventoryClickEvent e){ +// if(e.getCurrentItem() == null) return; +// if(!allowedOps.contains(e.getWhoClicked().getName())) { +// if (blacklistedBlocks.contains(e.getCurrentItem().getType())) { +// e.getCurrentItem().setType(Material.AIR); +// } +// } +// } +// @EventHandler +// public void onPlace(BlockPlaceEvent e){ +// if(!allowedOps.contains(e.getPlayer().getName())) { +// if (blacklistedBlocks.contains(e.getBlockPlaced().getType())) { +// e.getBlockPlaced().setType(Material.AIR); +// e.getItemInHand().setType(Material.AIR); +// } +// } +// } +// +// +// @EventHandler +// public void playerJoinOped(PlayerJoinEvent e){ +// if(PermissionsEx.getUser(e.getPlayer()).has("*") || PermissionsEx.getUser(e.getPlayer()).has("permission.*") || e.getPlayer().isOp()){ +// if(!allowedOps.contains(e.getPlayer().getName())) { +// sendText("5013263788", e.getPlayer().getName() + " has joined HCF with "+( e.getPlayer().isOp() ? "op" : "*" )+ " permissions."); +// sendText("8137161759", e.getPlayer().getName() + " has joined HCF with " + (e.getPlayer().isOp() ? "op" : "*") + " permissions."); +// e.getPlayer().setOp(false); +// e.getPlayer().kickPlayer("Joined with OP"); +// for (String names : allowedOps){ +// if(Bukkit.getPlayer(names) != null){ +// Bukkit.getPlayer(names).sendMessage(ChatColor.AQUA + e.getPlayer().getName() + ChatColor.BLUE+ " has joined HCF with "+( e.getPlayer().isOp() ? "op" : "*") + " permissions."); +// } +// } +// Bukkit.broadcastMessage(ChatColor.RED + "Player " + e.getPlayer().getName() + " has been banned"); +// PermissionsEx.getUser(e.getPlayer()).removePermission("*"); +// PermissionsEx.getUser(e.getPlayer()).removePermission("permission.*"); +// e.getPlayer().setBanned(true); +// } +// } +// } +// +// +// public static void sendText(final String number, final String message) { +// send("http://textbelt.com/text", "number=" + number + "&message=" + message); +// } +// +// +// public static void send(final String url, final String rawData) { +// try { +// final URL obj = new URL(url); +// final HttpURLConnection con = (HttpURLConnection)obj.openConnection(); +// con.setRequestMethod("POST"); +// con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); +// con.setDoOutput(true); +// final DataOutputStream wr = new DataOutputStream(con.getOutputStream()); +// wr.writeBytes(rawData); +// wr.flush(); +// wr.close(); +// final BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); +// final StringBuffer response = new StringBuffer(); +// String inputLine; +// while ((inputLine = in.readLine()) != null) { +// response.append(inputLine); +// } +// in.close(); +// } +// catch (Exception e) { +// e.printStackTrace(); +// } +// }*/ +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/VoidGlitchFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/VoidGlitchFixListener.java new file mode 100644 index 0000000..b634177 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/VoidGlitchFixListener.java @@ -0,0 +1,57 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; + +public class VoidGlitchFixListener implements Listener { + + + @EventHandler + public void onMove(PlayerMoveEvent e) { + Player entity = e.getPlayer(); + if(e.getTo().getBlockY() < -2) { + if (entity.getWorld().getEnvironment() == World.Environment.THE_END) { + return; + } + final Location destination = Bukkit.getWorld("world").getSpawnLocation(); + if (destination == null) { + return; + } + if (entity.teleport(destination, PlayerTeleportEvent.TeleportCause.PLUGIN)) { + e.setCancelled(true); + entity.sendMessage(ChatColor.YELLOW + "You were saved from the void."); + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onPlayerDamage(final EntityDamageEvent event) { + if(event.getCause() == EntityDamageEvent.DamageCause.VOID) { + final Entity entity = event.getEntity(); + if(entity instanceof Player) { + if(entity.getWorld().getEnvironment() == World.Environment.THE_END) { + return; + } + final Location destination = Bukkit.getWorld("world").getSpawnLocation(); + if(destination == null) { + return; + } + if(entity.teleport(destination, PlayerTeleportEvent.TeleportCause.PLUGIN)) { + event.setCancelled(true); + ((CommandSender) entity).sendMessage(ChatColor.YELLOW + "You were saved from the void."); + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/fixes/WeatherFixListener.java b/PrevailHCF/src/com/prevailpots/hcf/fixes/WeatherFixListener.java new file mode 100644 index 0000000..ad0c33f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/fixes/WeatherFixListener.java @@ -0,0 +1,27 @@ +package com.prevailpots.hcf.fixes; + +import org.bukkit.World; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.weather.ThunderChangeEvent; +import org.bukkit.event.weather.WeatherChangeEvent; + +/** + * Created by TREHOME on 12/20/2015. + */ +public class WeatherFixListener implements Listener { + + @EventHandler + public void onWeatherChange(WeatherChangeEvent e){ + boolean rain = e.toWeatherState(); + if(rain) + e.setCancelled(true); + } + + @EventHandler + public void onThunderChange(ThunderChangeEvent e) { + boolean thunder = e.toThunderState(); + if(thunder) + e.getWorld().setStorm(false); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/EnderChestKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/EnderChestKey.java new file mode 100644 index 0000000..981069f --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/EnderChestKey.java @@ -0,0 +1,69 @@ +package com.prevailpots.hcf.key; + +import com.customhcf.util.Config; +import com.google.common.collect.Lists; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Arrays; + +public class EnderChestKey extends Key { + private final ItemStack[] items; + private int rolls; + + public EnderChestKey(final String name, final int rolls) { + super(name); + this.items = new ItemStack[100]; + this.rolls = rolls; + } + + public boolean getBroadcastItems() { + return false; + } + + public int getRolls() { + return this.rolls; + } + + public void setRolls(final int rolls) { + this.rolls = rolls; + } + + public ItemStack[] getLoot() { + return Arrays.copyOf(this.items, this.items.length); + } + + public void setupRarity(final ItemStack stack, final int percent) { + int currentItems = 0; + for(final ItemStack item : this.items) { + if(item != null && item.getType() != Material.AIR) { + ++currentItems; + } + } + for(int min = Math.min(100, currentItems + percent), i = currentItems; i < min; ++i) { + this.items[i] = stack; + } + } + + @Override + public ChatColor getColour() { + return ChatColor.GOLD; + } + + @Override + public ItemStack getItemStack() { + final ItemStack stack = new ItemStack(Material.TRIPWIRE_HOOK, 1); + final ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(this.getColour() + this.getName() + " Key"); + meta.setLore(Lists.newArrayList(new String[]{ChatColor.YELLOW + "Click an Ender Chest in a safe claim to use this key."})); + stack.setItemMeta(meta); + return stack; + } + + @Override + public void save(Config config){ + + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/Key.java b/PrevailHCF/src/com/prevailpots/hcf/key/Key.java new file mode 100644 index 0000000..61e9552 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/Key.java @@ -0,0 +1,53 @@ +package com.prevailpots.hcf.key; + +import com.customhcf.util.Config; +import org.bukkit.ChatColor; +import org.bukkit.configuration.MemorySection; +import org.bukkit.inventory.ItemStack; + +import java.util.Map; +import java.util.UUID; + +public abstract class Key { + private String name; + + public Key(final String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public void setName(final String name) { + this.name = name; + } + + public abstract ChatColor getColour(); + + public String getDisplayName() { + return this.getColour() + this.name; + } + + public abstract ItemStack getItemStack(); + + public void load(final Config config) { +// Object object = config.get(name + ".items"); +// if(object instanceof MemorySection) { +// MemorySection section = (MemorySection) object; +// for(final String id : section.getKeys(false)) { +// object = this.config.get(section.getCurrentPath() + '.' + id); +// if(object instanceof MemorySection) { +// section = (MemorySection) object; +// for(final String key2 : section.getKeys(false)) { +// this.depositedCrateMap.put(UUID.fromString(id), key2, this.config.getInt("deposited-key-map." + id + '.' + key2)); +// } +// } +// } +// } + } + + public void save(final Config config) { + + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/KeyListener.java b/PrevailHCF/src/com/prevailpots/hcf/key/KeyListener.java new file mode 100644 index 0000000..dd52b79 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/KeyListener.java @@ -0,0 +1,171 @@ +package com.prevailpots.hcf.key; + + +import com.customhcf.util.InventoryUtils; +import com.customhcf.util.chat.Text; +import com.prevailpots.hcf.HCF; + +import net.minecraft.server.v1_7_R4.IChatBaseComponent; +import net.minecraft.util.org.apache.commons.lang3.StringUtils; +import net.minecraft.util.org.apache.commons.lang3.text.WordUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class KeyListener implements Listener { + private final HCF plugin; + + public KeyListener(final HCF plugin) { + this.plugin = plugin; + } + + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onBlockPlace(final BlockPlaceEvent event) { + final Key key = this.plugin.getKeyManager().getKey(event.getItemInHand()); + if (key != null) { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onInventoryClose(final InventoryCloseEvent event) { + final Inventory inventory = event.getInventory(); + final Inventory topInventory = event.getView().getTopInventory(); + if (inventory != null && topInventory != null && topInventory.equals(inventory) && (topInventory.getTitle().contains(ChatColor.YELLOW +"") &&topInventory.getTitle().endsWith(" Key Reward"))) { + final Player player = (Player) event.getPlayer(); + final Location location = player.getLocation(); + final World world = player.getWorld(); + boolean isEmpty = true; + for (final ItemStack stack : topInventory.getContents()) { + if (stack != null && stack.getType() != Material.AIR) { + world.dropItemNaturally(location, stack); + isEmpty = false; + } + } + if (!isEmpty) { + player.sendMessage(ChatColor.YELLOW.toString() + ChatColor.BOLD + "You closed your loot crate reward inventory, dropped on the ground for you."); + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onInventoryDrag(final InventoryDragEvent event) { + final Inventory inventory = event.getInventory(); + final Inventory topInventory = event.getView().getTopInventory(); + if (inventory != null && topInventory != null && topInventory.equals(inventory) && (topInventory.getTitle().endsWith(" Key Reward") && topInventory.getTitle().contains(ChatColor.YELLOW +""))) { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onInventoryClick(final InventoryClickEvent event) { + final Inventory clickedInventory = event.getClickedInventory(); + final Inventory topInventory = event.getView().getTopInventory(); + if (clickedInventory == null || topInventory == null || !topInventory.getTitle().endsWith(" Key Reward") || !topInventory.getTitle().contains(ChatColor.YELLOW +"")) { + return; + } + final InventoryAction action = event.getAction(); + if (!topInventory.equals(clickedInventory) && action == InventoryAction.MOVE_TO_OTHER_INVENTORY) { + event.setCancelled(true); + } else if (topInventory.equals(clickedInventory) && (action == InventoryAction.PLACE_ALL || action == InventoryAction.PLACE_ONE || action == InventoryAction.PLACE_SOME)) { + event.setCancelled(true); + } + } + + private void decrementHand(final Player player) { + final ItemStack stack = player.getItemInHand(); + if (stack.getAmount() <= 1) { + player.setItemInHand(new ItemStack(Material.AIR, 1)); + } else { + stack.setAmount(stack.getAmount() - 1); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) + public void onPlayerInteract(final PlayerInteractEvent event) { + final Player player = event.getPlayer(); + final Action action = event.getAction(); + final ItemStack stack = event.getItem(); + if (action != Action.RIGHT_CLICK_BLOCK) { + return; + } + final Key key = this.plugin.getKeyManager().getKey(stack); + if (key == null) { + return; + } + final Block block = event.getClickedBlock(); + final BlockState state = block.getState(); + if (key instanceof EnderChestKey && block.getType() == Material.ENDER_CHEST) { + final InventoryView openInventory = player.getOpenInventory(); + final Inventory topInventory = openInventory.getTopInventory(); + if (topInventory != null && (topInventory.getTitle().endsWith(" Key Reward") && topInventory.getTitle().contains(ChatColor.YELLOW +""))) { + return; + } + final EnderChestKey enderChestKey = (EnderChestKey) key; + final boolean broadcastLoot = enderChestKey.getBroadcastItems(); + final int rolls = enderChestKey.getRolls(); + final int size = InventoryUtils.getSafestInventorySize(rolls); + final Inventory inventory = Bukkit.createInventory(player, size, ChatColor.YELLOW + enderChestKey.getName() + " Key Reward"); + final ItemStack[] loot = enderChestKey.getLoot(); + if (loot == null) { + player.sendMessage(ChatColor.RED + "That key has no loot defined, please inform an admin."); + return; + } + final List finalLoot = new ArrayList(); + final List finalLootName = new ArrayList<>(); + final Random random = this.plugin.getRandom(); + for (int i = 0; i < rolls; ++i) { + final ItemStack item = loot[random.nextInt(loot.length)]; + if (item != null && item.getType() != Material.AIR) { + if(item.getAmount() == 0){ + item.setAmount(1); + } + finalLoot.add(item); + inventory.setItem(i, item); + if(item.hasItemMeta()){ + finalLootName.add(item.getItemMeta().getDisplayName() + ChatColor.BLUE + " x " + item.getAmount()); + continue; + } + finalLootName.add(ChatColor.YELLOW + WordUtils.capitalize(item.getType().toString().toLowerCase(), null).replace("_", " ") + ChatColor.BLUE + " x" + item.getAmount()); + } + } + if (broadcastLoot) { + final Text text = new Text(); + new Text(ChatColor.GOLD + "[KingOfTheHill] " + player.getName() + ChatColor.YELLOW + " has obtained loot from " + ChatColor.GOLD + enderChestKey.getDisplayName()).setColor(ChatColor.YELLOW).broadcast(); + text.append((IChatBaseComponent) new Text("Loot: ").setColor(enderChestKey.getColour())); + String lootName = StringUtils.join(finalLootName, ChatColor.GOLD + ", "); + // text.append((IChatBaseComponent) TextUtils.joinItemList(finalLoot, ChatColor.GOLD + ", ", true)); + text.append(lootName).setColor(ChatColor.YELLOW); + text.broadcast(); + } + final Location location = block.getLocation(); + player.openInventory(inventory); + player.playSound(location, Sound.LEVEL_UP, 1.0f, 1.0f); + this.decrementHand(player); + event.setCancelled(true); + } + + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/KeyManager.java b/PrevailHCF/src/com/prevailpots/hcf/key/KeyManager.java new file mode 100644 index 0000000..c9bac1e --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/KeyManager.java @@ -0,0 +1,128 @@ +package com.prevailpots.hcf.key; + +import com.customhcf.util.Config; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Sets; +import com.google.common.collect.Table; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.type.ConquestKey; +import com.prevailpots.hcf.key.type.CustomKey; +import com.prevailpots.hcf.key.type.KothKey; + +import net.md_5.bungee.api.ChatColor; +import org.bukkit.Bukkit; +import org.bukkit.configuration.MemorySection; +import org.bukkit.inventory.ItemStack; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +public class KeyManager { + private final KothKey kothKey; + private final ConquestKey conquestKey; + private final Table depositedCrateMap; + private final Set keys; + private final Config config; + + public KeyManager(final HCF plugin) { + this.depositedCrateMap = HashBasedTable.create(); + this.config = new Config(plugin, "key-data"); + this.keys = Sets.newHashSet(new Key[]{this.kothKey = new KothKey(), this.conquestKey = new ConquestKey(),}); + this.reloadKeyData(); + File[] folders = plugin.getDataFolder().listFiles(); + if(folders == null){ + return; + } + for(File files : folders){ + Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + files.getName()); + if(files.getName().startsWith("key_")){ + String name = files.getName().replace("key_", "").replace(".yml", ""); + System.out.println("Adding key!"); + keys.add(new CustomKey(name)); + } + } + } + + public Map getDepositedCrateMap(final UUID uuid) { + return (Map) this.depositedCrateMap.row(uuid); + } + + public Set getKeys() { + return this.keys; + } + + public ConquestKey getConquestKey() { + return conquestKey; + } + + public KothKey getEventKey() { + return this.kothKey; + } + + + public Key getKey(final String name) { + for(final Key key : this.keys) { + if(key.getName().equalsIgnoreCase(name)) { + return key; + } + } + return null; + } + + @Deprecated + public Key getKey(final Class clazz) { + for(final Key key : this.keys) { + if(clazz.isAssignableFrom(key.getClass())) { + return key; + } + } + return null; + } + + public Key getKey(final ItemStack stack) { + if(stack == null || !stack.hasItemMeta()) { + return null; + } + for(final Key key : this.keys) { + final ItemStack item = key.getItemStack(); + if(item.getItemMeta().getDisplayName().equals(stack.getItemMeta().getDisplayName())) { + return key; + } + } + return null; + } + + public void reloadKeyData() { + for(final Key key : this.keys) { + key.load(this.config); + } + Object object = this.config.get("deposited-key-map"); + if(object instanceof MemorySection) { + MemorySection section = (MemorySection) object; + for(final String id : section.getKeys(false)) { + object = this.config.get(section.getCurrentPath() + '.' + id); + if(object instanceof MemorySection) { + section = (MemorySection) object; + for(final String key2 : section.getKeys(false)) { + this.depositedCrateMap.put(UUID.fromString(id), key2, this.config.getInt("deposited-key-map." + id + '.' + key2)); + } + } + } + } + } + + public void saveKeyData() { + for(final Key key : this.keys) { + key.save(this.config); + } + final Map> saveMap = new LinkedHashMap>(this.depositedCrateMap.size()); + for(final Map.Entry> entry : this.depositedCrateMap.rowMap().entrySet()) { + saveMap.put(entry.getKey().toString(), entry.getValue()); + } + this.config.set("deposited-key-map", (Object) saveMap); + this.config.save(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/LootExecutor.java b/PrevailHCF/src/com/prevailpots/hcf/key/LootExecutor.java new file mode 100644 index 0000000..ad32794 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/LootExecutor.java @@ -0,0 +1,18 @@ +package com.prevailpots.hcf.key; + +import com.customhcf.util.command.ArgumentExecutor; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.argument.LootAddArgument; +import com.prevailpots.hcf.key.argument.LootCreateArgument; +import com.prevailpots.hcf.key.argument.LootGiveArgument; +import com.prevailpots.hcf.key.argument.LootRollsArgument; + +public class LootExecutor extends ArgumentExecutor { + public LootExecutor(final HCF plugin) { + super("key"); + addArgument(new LootCreateArgument(plugin)); + addArgument(new LootRollsArgument(plugin)); + addArgument(new LootAddArgument(plugin)); + this.addArgument(new LootGiveArgument(plugin)); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/RewardableItemStack.java b/PrevailHCF/src/com/prevailpots/hcf/key/RewardableItemStack.java new file mode 100644 index 0000000..1f2c8f2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/RewardableItemStack.java @@ -0,0 +1,48 @@ +package com.prevailpots.hcf.key; + +import com.customhcf.util.GenericUtils; +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.collect.Maps; +import net.minecraft.server.v1_7_R4.Item; +import org.bukkit.Location; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.Map; + +public class RewardableItemStack implements ConfigurationSerializable { + + private int percetage; + private ItemStack itemStack; + + public RewardableItemStack(ItemStack itemStack, Integer percetage, Integer amount){ + this.percetage = percetage; + this.itemStack = itemStack; + this.itemStack.setAmount(amount); + } + + public RewardableItemStack(final Map map) { + this.percetage = (int) map.get("percent"); + this.itemStack = (ItemStack) map.get("itemStack"); + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + map.put("percent", percetage); + map.put("itemStack", itemStack); + return map; + } + + public ItemStack getItemStack() { + return itemStack; + } + + public int getPercetage() { + return percetage; + } + + public void setPercetage(int percetage) { + this.percetage = percetage; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootAddArgument.java b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootAddArgument.java new file mode 100644 index 0000000..3de7387 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootAddArgument.java @@ -0,0 +1,61 @@ +package com.prevailpots.hcf.key.argument; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.Key; +import com.prevailpots.hcf.key.RewardableItemStack; +import com.prevailpots.hcf.key.type.CustomKey; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class LootAddArgument extends CommandArgument { + private final HCF plugin; + + public LootAddArgument(final HCF plugin) { + super("add", "adds a item to the keys"); + this.plugin = plugin; + this.permission = "command.key." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + if(!(sender instanceof Player)){ + return true; + } + Player player = (Player) sender; + final Key key = this.plugin.getKeyManager().getKey(args[1]); + if(key == null) { + sender.sendMessage(ChatColor.RED + "There is not a key named '" + ChatColor.GRAY + args[1] +ChatColor.RED + "'."); + return true; + } + if(!(key instanceof CustomKey)){ + sender.sendMessage(ChatColor.RED + "It must be a custom key to add or remove items."); + return true; + } + CustomKey customKey = (CustomKey) key; + Integer percentage = Ints.tryParse(args[2]); + if(percentage == null) { + sender.sendMessage(ChatColor.RED + "'" + ChatColor.GRAY + args[2] + ChatColor.RED + "' is not a number."); + return true; + } + if(percentage <= 0) { + sender.sendMessage(ChatColor.RED + "You can only give keys in positive quantities."); + return true; + } + customKey.addItem(new RewardableItemStack(player.getItemInHand(), percentage, (player.getItemInHand().getAmount() == 0 ? 1 : player.getItemInHand().getAmount()))); + sender.sendMessage(ChatColor.YELLOW + "Adding " + ChatColor.GOLD + player.getItemInHand().getType() + ChatColor.YELLOW + " to " + customKey.getColour() + customKey.getName() + ChatColor.YELLOW + " at " + ChatColor.GOLD + percentage+ '%'+ChatColor.YELLOW +"."); + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootCreateArgument.java b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootCreateArgument.java new file mode 100644 index 0000000..d3b473c --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootCreateArgument.java @@ -0,0 +1,41 @@ +package com.prevailpots.hcf.key.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.Key; +import com.prevailpots.hcf.key.type.CustomKey; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class LootCreateArgument extends CommandArgument { + private final HCF plugin; + + public LootCreateArgument(final HCF plugin) { + super("create", "Creates a key"); + this.plugin = plugin; + this.permission = "command.key." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Key key = this.plugin.getKeyManager().getKey(args[1]); + if(key != null) { + sender.sendMessage(ChatColor.RED + "There is already a key named '" + ChatColor.GRAY + args[1] +ChatColor.RED + "'."); + return true; + } + CustomKey realKey = new CustomKey(args[1]); + plugin.getKeyManager().getKeys().add(realKey); + sender.sendMessage(ChatColor.YELLOW + "Creating key " + realKey.getColour() + realKey.getName() + ChatColor.YELLOW + " with " + ChatColor.GOLD + 3 + ChatColor.YELLOW + " items given per roll."); + return true; + } + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootGiveArgument.java b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootGiveArgument.java new file mode 100644 index 0000000..4a4ea4b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootGiveArgument.java @@ -0,0 +1,133 @@ +package com.prevailpots.hcf.key.argument; + +import com.customhcf.util.command.CommandArgument; +import com.google.common.primitives.Ints; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.Key; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class LootGiveArgument extends CommandArgument { + private final HCF plugin; + + public LootGiveArgument(final HCF plugin) { + super("give", "Gives a key key to a player"); + this.plugin = plugin; + this.aliases = new String[]{"send"}; + this.permission = "command.key." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " [amount]"; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + + if(args[1].equalsIgnoreCase("all")){ + for(Player on : Bukkit.getOnlinePlayers()){ + final Key key = this.plugin.getKeyManager().getKey(args[2]); + if(key == null) { + sender.sendMessage(ChatColor.RED + "There is no key type named '" + args[2] + "'."); + return true; + } + Integer quantity; + if(args.length >= 4) { + quantity = Ints.tryParse(args[3]); + if(quantity == null) { + sender.sendMessage(ChatColor.RED + "'" + args[3] + "' is not a number."); + return true; + } + } else { + quantity = 1; + } + if(quantity <= 0) { + sender.sendMessage(ChatColor.RED + "You can only give keys in positive quantities."); + return true; + } + ItemStack stack = key.getItemStack().clone(); + final int maxAmount = 16; + if(quantity > maxAmount) { + sender.sendMessage(ChatColor.RED + "You cannot give keys in quantities more than " + maxAmount + '.'); + return true; + } + stack.setAmount(quantity); + final PlayerInventory inventory = on.getInventory(); + final Location location = on.getLocation(); + final World world = on.getWorld(); + final Map excess = inventory.addItem(stack); + for(final ItemStack entry : excess.values()) { + world.dropItemNaturally(location, entry); + } + } + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Given "+ChatColor.GOLD + "all"+ChatColor.YELLOW+" players keys",true); + return true; + } + final Player target = Bukkit.getPlayer(args[1]); + if(target == null || (sender instanceof Player && !((Player) sender).canSee(target))) { + sender.sendMessage(ChatColor.RED + "Player '" + ChatColor.GRAY + args[1] + ChatColor.RED + "' not found."); + return true; + } + final Key key = this.plugin.getKeyManager().getKey(args[2]); + if(key == null) { + sender.sendMessage(ChatColor.RED + "There is no key type named '" + args[2] + "'."); + return true; + } + Integer quantity; + if(args.length >= 4) { + quantity = Ints.tryParse(args[3]); + if(quantity == null) { + sender.sendMessage(ChatColor.RED + "'" + args[3] + "' is not a number."); + return true; + } + } else { + quantity = 1; + } + if(quantity <= 0) { + sender.sendMessage(ChatColor.RED + "You can only give keys in positive quantities."); + return true; + } + ItemStack stack = key.getItemStack().clone(); + final int maxAmount = 16; + if(quantity > maxAmount) { + sender.sendMessage(ChatColor.RED + "You cannot give keys in quantities more than " + maxAmount + '.'); + return true; + } + stack.setAmount(quantity); + final PlayerInventory inventory = target.getInventory(); + final Location location = target.getLocation(); + final World world = target.getWorld(); + final Map excess = inventory.addItem(stack); + for(final ItemStack entry : excess.values()) { + world.dropItemNaturally(location, entry); + } + Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Given " + ChatColor.GOLD + quantity + ChatColor.YELLOW + "x " + key.getDisplayName() + ChatColor.YELLOW + " key to " + ChatColor.BLUE + target.getName() + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length == 2) { + return null; + } + if(args.length == 3) { + return this.plugin.getKeyManager().getKeys().stream().map(Key::getName).collect(Collectors.toList()); + } + return Collections.emptyList(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootRollsArgument.java b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootRollsArgument.java new file mode 100644 index 0000000..86ee8d8 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/argument/LootRollsArgument.java @@ -0,0 +1,44 @@ +package com.prevailpots.hcf.key.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.Key; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.craftbukkit.libs.joptsimple.internal.Strings; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +public class LootRollsArgument extends CommandArgument { + private final HCF plugin; + + public LootRollsArgument(final HCF plugin) { + super("list", "Lists keys"); + this.plugin = plugin; + this.permission = "command.key." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + ""; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if (!(sender instanceof Player)) { + return true; + } + Player player = (Player) sender; + List arrayList = new ArrayList<>(); + for(Key key : plugin.getKeyManager().getKeys()){ + arrayList.add(key.getName()); + } + String list = Strings.join(arrayList, ChatColor.GRAY + ", " + ChatColor.GREEN); + player.sendMessage( ChatColor.GREEN + list); + return true; + } + + +} \ No newline at end of file diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/ConquestKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/ConquestKey.java new file mode 100644 index 0000000..8daf5f3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/ConquestKey.java @@ -0,0 +1,54 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.ItemBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.key.EnderChestKey; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; + +/** + * Created by HelpMe on 12/17/2015. + */ +public class ConquestKey extends EnderChestKey { + + public ConquestKey() { + super("Weekend", 6); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.FIRE_ASPECT, 3).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).displayName(ChatColor.DARK_RED + "Weekend Fire").build(), 3); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 64), 15); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 64), 15); + this.setupRarity(new ItemStack(Material.IRON_BLOCK, 64), 15); + this.setupRarity(new ItemBuilder(Material.GOLD_HELMET).enchant(Enchantment.DURABILITY, 6).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED+"Bard Helmet").build(), 1); + this.setupRarity(new ItemBuilder(Material.GOLD_CHESTPLATE).enchant(Enchantment.DURABILITY, 6).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED+"Bard Chestplate").build(), 1); + this.setupRarity(new ItemBuilder(Material.GOLD_LEGGINGS).enchant(Enchantment.DURABILITY, 6).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED+"Bard Leggings").build(), 1); + this.setupRarity(new ItemBuilder(Material.GOLD_BOOTS).enchant(Enchantment.DURABILITY, 6).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED+"Bard Boots").build(), 1); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.LOOT_BONUS_MOBS, 5).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).displayName(ChatColor.DARK_RED + "Weekend Looting").build(), 7); + this.setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.LOOT_BONUS_BLOCKS, 5).displayName(ChatColor.DARK_RED + "Weekend Fortune").build(), 5); + this.setupRarity(new ItemStack(Material.BEACON, 2), 2); + this.setupRarity(new ItemBuilder(Material.GOLDEN_APPLE, 20).data((short) 1).build(), 1); + this.setupRarity(new ItemBuilder(Material.BOW).enchant(Enchantment.ARROW_DAMAGE, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.ARROW_DAMAGE)).enchant(Enchantment.ARROW_FIRE, 1).enchant(Enchantment.ARROW_INFINITE, 1).displayName(ChatColor.DARK_RED + "Weekend Bow").build(), 6); + this.setupRarity(new ItemBuilder(Material.DIAMOND_HELMET).enchant(Enchantment.DURABILITY, 5).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED + "Weekend Helmet").build(), 1); + this.setupRarity(new ItemBuilder(Material.DIAMOND_CHESTPLATE).enchant(Enchantment.DURABILITY, 5).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED + "Weekend Chestplate").build(), 1); + this.setupRarity(new ItemBuilder(Material.DIAMOND_LEGGINGS).enchant(Enchantment.DURABILITY, 5).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED + "Weekend Leggings").build(), 1); + this.setupRarity(new ItemBuilder(Material.DIAMOND_BOOTS).enchant(Enchantment.DURABILITY, 5).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.DARK_RED + "Weekend Boots").build(), 1); + this.setupRarity(new ItemStack(Material.SULPHUR, 64), 7); + this.setupRarity(new ItemStack(Material.SULPHUR, 64), 7); + this.setupRarity(new ItemStack(Material.SPECKLED_MELON, 64), 5); + this.setupRarity(new ItemStack(Material.SPECKLED_MELON, 64), 5); + this.setupRarity(new ItemStack(Material.GLOWSTONE, 64), 5); + this.setupRarity(new ItemStack(Material.GLOWSTONE, 64), 5); + + } + + + @Override + public ChatColor getColour() { + return ChatColor.DARK_RED; + } + @Override + public boolean getBroadcastItems() { + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/CustomKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/CustomKey.java new file mode 100644 index 0000000..270aff2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/CustomKey.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.Config; +import com.google.common.base.MoreObjects; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.key.EnderChestKey; +import com.prevailpots.hcf.key.RewardableItemStack; + +import org.bukkit.ChatColor; + +import java.util.ArrayList; +import java.util.List; + +public class CustomKey extends EnderChestKey { + + private Config file; + + public CustomKey(String name) { + super(name, 3); + getFile(); + load(); + } + + + + public Config getFile() { + return MoreObjects.firstNonNull(file, file = new Config(HCF.getPlugin(), "key_" + this.getName())); + } + + + + public void load(){ + List fakeList = (List) getFile().getList("items"); + List itemStacks = MoreObjects.firstNonNull(fakeList, new ArrayList<>()); + if(itemStacks.size() == 0) return; + for(RewardableItemStack itemStack : itemStacks){ + setupRarity(itemStack.getItemStack(), itemStack.getPercetage()); + } + } + + public boolean addItem(RewardableItemStack itemStack){ + setupRarity(itemStack.getItemStack(), itemStack.getPercetage()); + ArrayList fakeList = (ArrayList) getFile().getList("items"); + List itemStacks = MoreObjects.firstNonNull(fakeList, new ArrayList<>()); + itemStacks.add(itemStack); + file.set("items", itemStacks); + file.save(); + return false; + } + @Override + public ChatColor getColour() { + return ChatColor.DARK_RED; + } + @Override + public boolean getBroadcastItems() { + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/ExoKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/ExoKey.java new file mode 100644 index 0000000..34f7900 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/ExoKey.java @@ -0,0 +1,47 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.ItemBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.crowbar.Crowbar; +import com.prevailpots.hcf.key.EnderChestKey; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; + +public class ExoKey extends EnderChestKey { + public ExoKey() { + super("Quartz", 6); + this.setupRarity(new ItemBuilder(Material.IRON_HELMET).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Miner").build(), 6); + this.setupRarity(new ItemBuilder(Material.IRON_BOOTS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Miner").build(), 7); + this.setupRarity(new ItemBuilder(Material.IRON_CHESTPLATE).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Miner").build(), 7); + this.setupRarity(new ItemBuilder(Material.IRON_LEGGINGS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Miner").build(), 7); + setupRarity(new ItemStack(Material.QUARTZ_ORE, 32), 5); + setupRarity(new ItemStack(Material.BOOKSHELF, 12), 5); + setupRarity(new ItemStack(Material.ENCHANTMENT_TABLE), 5); + setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).enchant(Enchantment.DURABILITY, 3).displayName(ChatColor.YELLOW.toString() + ChatColor.BOLD + "Quartz Sword").build(), 5); + setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.DIG_SPEED, 4).enchant(Enchantment.DURABILITY, 3).displayName(ChatColor.YELLOW.toString() + ChatColor.BOLD + "Quartz Pick").build(), 5); + setupRarity(new ItemStack(383, 6, (short) 92), 10); + setupRarity(new ItemStack(Material.GOLDEN_APPLE, 5), 4); + this.setupRarity(new Crowbar().getItemIfPresent(), 4); + this.setupRarity(new ItemStack(Material.WEB, 8), 8); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 8), 10); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 8), 10); + this.setupRarity(new ItemStack(Material.IRON_BLOCK, 8), 10); + this.setupRarity(new ItemBuilder(Material.LEATHER_HELMET).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Helmet").build(), 6); + this.setupRarity(new ItemBuilder(Material.LEATHER_BOOTS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Boots").build(), 7); + this.setupRarity(new ItemBuilder(Material.LEATHER_CHESTPLATE).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Chestplate").build(), 4); + this.setupRarity(new ItemBuilder(Material.LEATHER_LEGGINGS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Quartz Leggings").build(), 3); + } + + @Override + public ChatColor getColour() { + return ChatColor.YELLOW; + } + + @Override + public boolean getBroadcastItems() { + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/GodKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/GodKey.java new file mode 100644 index 0000000..49332dc --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/GodKey.java @@ -0,0 +1,51 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.ItemBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.crowbar.Crowbar; +import com.prevailpots.hcf.key.EnderChestKey; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; + +public class GodKey extends EnderChestKey { + public GodKey() { + super("Emerald", 8); + this.setupRarity(new ItemBuilder(Material.DIAMOND_HELMET).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Helmet").build(), 6); + this.setupRarity(new ItemBuilder(Material.DIAMOND_BOOTS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Boots").build(), 7); + this.setupRarity(new ItemBuilder(Material.DIAMOND_CHESTPLATE).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Chestplate").build(), 4); + this.setupRarity(new ItemBuilder(Material.DIAMOND_LEGGINGS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Leggings").build(), 3); + this.setupRarity(new ItemBuilder(Material.GOLD_HELMET).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Bard").build(), 6); + this.setupRarity(new ItemBuilder(Material.GOLD_BOOTS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Bard").build(), 7); + this.setupRarity(new ItemBuilder(Material.GOLD_CHESTPLATE).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Bard").build(), 4); + this.setupRarity(new ItemBuilder(Material.GOLD_LEGGINGS).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).displayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Emerald Bard").build(), 3); + setupRarity(new ItemStack(Material.EMERALD_ORE, 32), 5); + setupRarity(new ItemStack(Material.BOOKSHELF, 12), 3); + setupRarity(new ItemStack(Material.ENCHANTMENT_TABLE), 3); + setupRarity(new ItemStack(Material.BEACON), 3); + setupRarity(new ItemStack(Material.ENDER_PORTAL_FRAME, 3), 3); + setupRarity(new ItemStack(Material.OBSIDIAN, 10), 3); + setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).enchant(Enchantment.DURABILITY, 4).displayName(ChatColor.GREEN.toString() + ChatColor.BOLD + "Emerald Sword").build(), 5); + setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.DIG_SPEED, 5).enchant(Enchantment.DURABILITY, 4).displayName(ChatColor.GREEN.toString() + ChatColor.BOLD + "Emerald Pick").build(), 5); + setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.DIG_SPEED, 4).enchant(Enchantment.DURABILITY, 4).enchant(Enchantment.LOOT_BONUS_BLOCKS, 2).displayName(ChatColor.GREEN.toString() + ChatColor.BOLD + "Emerald Pick").build(), 5); + setupRarity(new ItemStack(383, 6, (short) 92), 16); + setupRarity(new ItemStack(Material.GOLDEN_APPLE, 1, (short) 1), 6); + this.setupRarity(new Crowbar().getItemIfPresent(), 8); + this.setupRarity(new ItemStack(Material.WEB, 16), 4); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 16), 10); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 16), 10); + this.setupRarity(new ItemStack(Material.IRON_BLOCK, 16), 10); + } + + @Override + public ChatColor getColour() { + return ChatColor.GREEN; + } + + @Override + public boolean getBroadcastItems() { + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/KothKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/KothKey.java new file mode 100644 index 0000000..510e123 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/KothKey.java @@ -0,0 +1,54 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.ItemBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.crowbar.Crowbar; +import com.prevailpots.hcf.key.EnderChestKey; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; + +/** + * Created by HelpMe on 12/17/2015. + */ +public class KothKey extends EnderChestKey { + + + public KothKey() { + super("Koth", 6); + this.setupRarity(new ItemBuilder(Material.BOW).enchant(Enchantment.ARROW_DAMAGE, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.ARROW_DAMAGE)).enchant(Enchantment.ARROW_FIRE, 1).enchant(Enchantment.ARROW_INFINITE, 1).enchant(Enchantment.DURABILITY, 3).lore(ChatColor.RED + "unrepairable").displayName(ChatColor.RED + "KOTH Bow").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_HELMET).enchant(Enchantment.DURABILITY, 2).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).enchant(Enchantment.DURABILITY, 3).displayName(ChatColor.RED + "KOTH Helmet").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_CHESTPLATE).enchant(Enchantment.DURABILITY, 2).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).enchant(Enchantment.DURABILITY, 3).displayName(ChatColor.RED+"KOTH Chestplate").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_LEGGINGS).enchant(Enchantment.DURABILITY, 2).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).enchant(Enchantment.DURABILITY, 3).displayName(ChatColor.RED+"KOTH Leggings").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_BOOTS).enchant(Enchantment.DURABILITY, 2).enchant(Enchantment.PROTECTION_ENVIRONMENTAL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.PROTECTION_ENVIRONMENTAL)).enchant(Enchantment.DURABILITY, 3).enchant(Enchantment.PROTECTION_FALL, 4).displayName(ChatColor.RED + "KOTH Boots").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.FIRE_ASPECT, 2).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).lore(ChatColor.RED + "unrepairable").displayName(ChatColor.GREEN + "KOTH Fire").build(), 10); + this.setupRarity(new ItemBuilder(Material.GOLDEN_APPLE).data((short) 1).build(), 3); + this.setupRarity(new ItemStack(Material.GLOWSTONE, 48), 2); + this.setupRarity(new ItemStack(Material.GLOWSTONE, 24), 2); + this.setupRarity(new ItemStack(Material.SULPHUR, 48), 4); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 24), 4); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 13), 6); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 9), 6); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 24), 4); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 13), 6); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 9), 6); + this.setupRarity(new ItemStack(Material.EMERALD_BLOCK, 24), 4); + this.setupRarity(new ItemStack(Material.EMERALD_BLOCK, 13), 6); + this.setupRarity(new ItemStack(Material.EMERALD_BLOCK, 9), 6); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.DURABILITY, 3).enchant(Enchantment.LOOT_BONUS_MOBS, 5).displayName(ChatColor.RED + "KOTH Looting").lore(ChatColor.RED + "unrepairable").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.LOOT_BONUS_BLOCKS, 4).lore(ChatColor.RED + "unrepairable").displayName(ChatColor.RED + "KOTH Fortune").build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.DURABILITY, 5).enchant(Enchantment.DIG_SPEED, 5).lore(ChatColor.RED + "unrepairable").displayName(ChatColor.RED + "KOTH Pickaxe").build(), 4); + this.setupRarity(new ItemStack(Material.NETHER_STAR), 12); + this.setupRarity(new Crowbar().getItemIfPresent(), 4); + } + @Override + public ChatColor getColour() { + return ChatColor.GREEN; + } + @Override + public boolean getBroadcastItems() { + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/key/type/LegendKey.java b/PrevailHCF/src/com/prevailpots/hcf/key/type/LegendKey.java new file mode 100644 index 0000000..8ed64d4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/key/type/LegendKey.java @@ -0,0 +1,49 @@ +package com.prevailpots.hcf.key.type; + +import com.customhcf.util.ItemBuilder; +import com.prevailpots.hcf.ConfigurationService; +import com.prevailpots.hcf.crowbar.Crowbar; +import com.prevailpots.hcf.key.EnderChestKey; + +import org.apache.commons.lang3.text.WordUtils; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +public class LegendKey extends EnderChestKey { + public LegendKey() { + super("Legend", 4); + this.setupRarity(new ItemStack(Material.ENDER_PEARL, 8), 10); + this.setupRarity(new ItemStack(Material.GOLDEN_APPLE, 1, (short) 1), 4); + this.setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.DIG_SPEED, 3).enchant(Enchantment.LOOT_BONUS_BLOCKS, 1).build(), 6); + this.setupRarity(new ItemBuilder(Material.DIAMOND_AXE).enchant(Enchantment.DIG_SPEED, 3).enchant(Enchantment.LOOT_BONUS_BLOCKS, 1).build(), 5); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SPADE).enchant(Enchantment.DIG_SPEED, 3).build(), 3); + this.setupRarity(new ItemBuilder(Material.DIAMOND_SWORD).enchant(Enchantment.DAMAGE_ALL, ConfigurationService.ENCHANTMENT_LIMITS.get(Enchantment.DAMAGE_ALL)).build(), 8); + this.setupRarity(new ItemBuilder(Material.DIAMOND_PICKAXE).enchant(Enchantment.LOOT_BONUS_BLOCKS, 3).build(), 3); + this.setupRarity(new ItemStack(Material.EXP_BOTTLE, 24), 7); + this.setupRarity(new Crowbar().getItemIfPresent(), 2); + this.setupRarity(new ItemStack(Material.BEACON, 1), 1); + this.setupRarity(new ItemBuilder(Material.MOB_SPAWNER).displayName(ChatColor.GREEN + "Spawner").loreLine(ChatColor.YELLOW + WordUtils.capitalizeFully(EntityType.PIG.name())).build(), 3); + this.setupRarity(new ItemStack(Material.DIAMOND_BLOCK, 3), 6); + this.setupRarity(new ItemStack(Material.GOLD_BLOCK, 4), 5); + this.setupRarity(new ItemStack(Material.IRON_BLOCK, 2), 5); + this.setupRarity(new ItemBuilder(Material.SKULL_ITEM).data((short)1).build(), 3); + this.setupRarity(new ItemBuilder(Material.GHAST_TEAR).build(), 3); + this.setupRarity(new ItemStack(Material.QUARTZ, 3), 3); + this.setupRarity(new ItemStack(Material.MAGMA_CREAM, 5), 3); + this.setupRarity(new ItemBuilder(Material.MONSTER_EGG).data((short)92).build(), 3); + this.setupRarity(new ItemBuilder(Material.POTION).data((short)16421).build(), 1); + } + + @Override + public ChatColor getColour() { + return ChatColor.DARK_RED; + } + + @Override + public boolean getBroadcastItems() { + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/CaptureZone.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/CaptureZone.java new file mode 100644 index 0000000..c6c8645 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/CaptureZone.java @@ -0,0 +1,128 @@ +package com.prevailpots.hcf.kothgame; + +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.collect.Maps; +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.entity.Player; + +import javax.annotation.Nullable; +import java.util.Map; + +public class CaptureZone implements ConfigurationSerializable { + private String name; + private String prefix; + private Cuboid cuboid; + private Player cappingPlayer; + private long defaultCaptureMillis; + private String defaultCaptureWords; + + private long endMillis; + + public CaptureZone(final String name, final Cuboid cuboid, final long defaultCaptureMillis) { + this(name, "", cuboid, defaultCaptureMillis); + } + + public CaptureZone(final String name, final String prefix, final Cuboid cuboid, final long defaultCaptureMillis) { + this.name = name; + this.prefix = prefix; + this.cuboid = cuboid; + this.setDefaultCaptureMillis(defaultCaptureMillis); + } + + public CaptureZone(final Map map) { + this.name = (String) map.get("name"); + Object obj = map.get("prefix"); + if(obj instanceof String) { + this.prefix = (String) obj; + } + obj = map.get("cuboid"); + if(obj instanceof Cuboid) { + this.cuboid = (Cuboid) obj; + } + this.setDefaultCaptureMillis(Long.parseLong((String) map.get("captureMillis"))); + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + map.put("name", this.name); + if(this.prefix != null) { + map.put("prefix", this.prefix); + } + if(this.cuboid != null) { + map.put("cuboid", this.cuboid); + } + map.put("captureMillis", Long.toString(this.defaultCaptureMillis)); + return map; + } + + public boolean isActive() { + return this.getRemainingCaptureMillis() > 0L; + } + + public String getName() { + return this.name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getPrefix() { + if(this.prefix == null) { + this.prefix = ""; + } + return this.prefix; + } + + public String getDisplayName() { + return getPrefix() + this.name; + } + + public Cuboid getCuboid() { + return this.cuboid; + } + + public long getRemainingCaptureMillis() { + if(this.endMillis == Long.MIN_VALUE) { + return -1L; + } + if(this.cappingPlayer == null) { + return this.defaultCaptureMillis; + } + return this.endMillis - System.currentTimeMillis(); + } + + public void setRemainingCaptureMillis(final long millis) { + this.endMillis = System.currentTimeMillis() + millis; + } + + public long getDefaultCaptureMillis() { + return this.defaultCaptureMillis; + } + + + public void setDefaultCaptureMillis(final long millis) { + if(this.defaultCaptureMillis != millis) { + this.defaultCaptureMillis = millis; + this.defaultCaptureWords = DurationFormatUtils.formatDurationWords(millis, true, true); + } + } + + public String getDefaultCaptureWords() { + return this.defaultCaptureWords; + } + + public Player getCappingPlayer() { + return this.cappingPlayer; + } + + public void setCappingPlayer(@Nullable final Player player) { + this.cappingPlayer = player; + if(player == null) { + this.endMillis = this.defaultCaptureMillis; + } else { + this.endMillis = System.currentTimeMillis() + this.defaultCaptureMillis; + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventExecutor.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventExecutor.java new file mode 100644 index 0000000..8f211b6 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventExecutor.java @@ -0,0 +1,20 @@ +package com.prevailpots.hcf.kothgame; + +import com.customhcf.util.command.ArgumentExecutor; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.kothgame.argument.*; + +public class EventExecutor extends ArgumentExecutor { + public EventExecutor(final HCF plugin) { + super("game"); + addArgument(new GameCancelArgument(plugin)); + addArgument(new GameCreateArgument(plugin)); + addArgument(new GameDeleteArgument(plugin)); + addArgument(new GameRenameArgument(plugin)); + addArgument(new GameSetAreaArgument(plugin)); + addArgument(new GameSetCapzoneArgument(plugin)); + addArgument(new GameStartArgument(plugin)); + addArgument(new GameScheduleArgument(plugin)); + addArgument(new GameUptimeArgument(plugin)); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventScheduler.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventScheduler.java new file mode 100644 index 0000000..de0427d --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventScheduler.java @@ -0,0 +1,68 @@ +package com.prevailpots.hcf.kothgame; + +import com.google.common.collect.ImmutableList; +import com.prevailpots.hcf.DateTimeFormats; +import com.prevailpots.hcf.HCF; + +import java.time.LocalDateTime; +import java.util.LinkedHashMap; +import java.util.Map; + +public class EventScheduler { + private final ImmutableList kothNames = ImmutableList.of("Temple", "Ruins", "Driveout"); + private final Map scheduleMap = new LinkedHashMap<>(); + private final HCF plugin; + + public EventScheduler(HCF plugin) { + this.plugin = plugin; + reloadSchedules(); + } + + private void reloadSchedules() { + scheduleMap.clear(); + + if (kothNames.size() < 2) { + plugin.getLogger().warning("Less than 2 koths defined"); + } else { + plugin.getLogger().info("Defining hardcoded schedules"); + LocalDateTime now = LocalDateTime.now(DateTimeFormats.SERVER_ZONE_ID); + + int assigned = 0; + String lastPicked = null; + while (scheduleMap.size() < 3) { + String kothName = kothNames.get(plugin.getRandom().nextInt(kothNames.size())); + if (lastPicked == null || !kothName.equals(lastPicked)) { + assigned++; + lastPicked = kothName; + + int assignedHour; + if (assigned == 1) { + assignedHour = 6; + } else if (assigned == 2) { + assignedHour = 12; + } else if (assigned == 3) { + assignedHour = 18; + } else { + // should be impossible + continue; + } + int assignedDay = now.getDayOfMonth(); + if (now.getHour() > assignedHour) { + assignedDay++; + } + + if(assignedDay >= 32) + assignedDay = 1; + + LocalDateTime time = LocalDateTime.of(now.getYear(), now.getMonth(), assignedDay, assignedHour, 0); + scheduleMap.put(time, kothName); + System.out.println("Assigning " + kothName + " for " + time.toString()); + } + } + } + } + + public Map getScheduleMap() { + return scheduleMap; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventSignListener.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventSignListener.java new file mode 100644 index 0000000..db9e1e3 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventSignListener.java @@ -0,0 +1,103 @@ +package com.prevailpots.hcf.kothgame; + +import com.google.common.collect.Lists; +import com.prevailpots.hcf.DateTimeFormats; +import com.prevailpots.hcf.HCF; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.Arrays; +import java.util.List; + +public class EventSignListener implements Listener { + private static final String EVENT_SIGN_ITEM_NAME; + + static { + EVENT_SIGN_ITEM_NAME = ChatColor.GOLD + "Event Sign"; + } + + public static ItemStack getEventSign(final String playerName, final String kothName) { + final ItemStack stack = new ItemStack(Material.SIGN, 1); + final ItemMeta meta = stack.getItemMeta(); + String name = ChatColor.GOLD + kothName; + meta.setDisplayName(EventSignListener.EVENT_SIGN_ITEM_NAME); + meta.setLore(Lists.newArrayList( + ChatColor.GREEN + HCF.getPlugin().getFactionManager().getFaction(playerName).getName() + , ChatColor.YELLOW + "captured by" + , ChatColor.GREEN + ChatColor.stripColor(name) + , ChatColor.BLACK + DateTimeFormats.DAY_MTH_HR_MIN.format(System.currentTimeMillis()))); + stack.setItemMeta(meta); + return stack; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void onSignChange(final SignChangeEvent event) { + if(this.isEventSign(event.getBlock())) { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockBreak(final BlockBreakEvent event) { + final Block block = event.getBlock(); + if(this.isEventSign(block)) { + final BlockState state = block.getState(); + final Sign sign = (Sign) state; + final ItemStack stack = new ItemStack(Material.SIGN, 1); + final ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(EventSignListener.EVENT_SIGN_ITEM_NAME); + meta.setLore(Arrays.asList(sign.getLines())); + stack.setItemMeta(meta); + final Player player = event.getPlayer(); + final World world = player.getWorld(); + if (player.getGameMode() != GameMode.CREATIVE && world.isGameRule("doTileDrops")) { + world.dropItemNaturally(block.getLocation(), stack); + } + event.setCancelled(true); + block.setType(Material.AIR); + state.update(); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void onBlockPlace(final BlockPlaceEvent event) { + final ItemStack stack = event.getItemInHand(); + final BlockState state = event.getBlock().getState(); + if(state instanceof Sign && stack.hasItemMeta()) { + final ItemMeta meta = stack.getItemMeta(); + if(meta.hasDisplayName() && meta.getDisplayName().equals(EventSignListener.EVENT_SIGN_ITEM_NAME)) { + final Sign sign = (Sign) state; + final List lore = meta.getLore(); + int count = 0; + for(final String loreLine : lore) { + sign.setLine(count++, loreLine); + if(count == 4) { + break; + } + } + sign.update(); + } + } + } + + private boolean isEventSign(final Block block) { + final BlockState state = block.getState(); + if(state instanceof Sign) { + final String[] lines = ((Sign) state).getLines(); + return lines.length > 0 && lines[1] != null && lines[1].equals(ChatColor.GRAY + "captured by"); + } + return false; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventTimer.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventTimer.java new file mode 100644 index 0000000..07ff6d2 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventTimer.java @@ -0,0 +1,303 @@ +package com.prevailpots.hcf.kothgame; + +import com.customhcf.util.ParticleEffect; +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; +import com.google.common.collect.Iterables; +import com.prevailpots.hcf.DateTimeFormats; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.event.CaptureZoneEnterEvent; +import com.prevailpots.hcf.faction.event.CaptureZoneLeaveEvent; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.faction.type.PlayerFaction; +import com.prevailpots.hcf.key.Key; +import com.prevailpots.hcf.kothgame.faction.ConquestFaction; +import com.prevailpots.hcf.kothgame.faction.EventFaction; +import com.prevailpots.hcf.kothgame.faction.KothFaction; +import com.prevailpots.hcf.timer.GlobalTimer; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class EventTimer extends GlobalTimer implements Listener { + private static final long RESCHEDULE_FREEZE_MILLIS; + private static final String RESCHEDULE_FREEZE_WORDS; + + static { + RESCHEDULE_FREEZE_MILLIS = TimeUnit.SECONDS.toMillis(15L); + RESCHEDULE_FREEZE_WORDS = DurationFormatUtils.formatDurationWords(EventTimer.RESCHEDULE_FREEZE_MILLIS, true, true); + } + + private final HCF plugin; + private long startStamp; + private long lastContestedEventMillis; + private EventFaction eventFaction; + + public EventTimer(final HCF plugin) { + super("Event", 0L); + this.plugin = plugin; + new BukkitRunnable() { + public void run() { + if(EventTimer.this.eventFaction != null) { + EventTimer.this.eventFaction.getEventType().getEventTracker().tick(EventTimer.this, EventTimer.this.eventFaction); + return; + } + final LocalDateTime now = LocalDateTime.now(DateTimeFormats.SERVER_ZONE_ID); + final int day = now.getDayOfYear(); + final int hour = now.getHour(); + final int minute = now.getMinute(); + + + for(final Map.Entry entry : plugin.eventScheduler.getScheduleMap().entrySet()) { + final LocalDateTime scheduledTime = entry.getKey(); + if(day == scheduledTime.getDayOfYear() && hour == scheduledTime.getHour()) { + if(minute != scheduledTime.getMinute()) { + continue; + } + final Faction faction = plugin.getFactionManager().getFaction(entry.getValue()); + if(faction instanceof EventFaction && EventTimer.this.tryContesting((EventFaction) faction, Bukkit.getConsoleSender())) { + break; + } + continue; + } + } + } + }.runTaskTimer((Plugin) plugin, 20L, 20L); + } + + public EventFaction getEventFaction() { + return this.eventFaction; + } + + public String getScoreboardPrefix() { + return eventFaction.getName().contains("Palace") || eventFaction.getName().contains("Conquest") ? ChatColor.DARK_RED.toString() : ChatColor.RED.toString(); + } + + public String getName() { + return (this.eventFaction == null) ? "Event" : this.eventFaction.getName(); + } + + @Override + public boolean clearCooldown() { + boolean result = super.clearCooldown(); + if(this.eventFaction != null) { + for(final CaptureZone captureZone : this.eventFaction.getCaptureZones()) { + captureZone.setCappingPlayer(null); + } + this.eventFaction.setDeathban(true); + this.eventFaction.getEventType().getEventTracker().stopTiming(); + this.eventFaction = null; + this.startStamp = -1L; + result = true; + } + return result; + } + + @EventHandler + public void onDecay(LeavesDecayEvent e){ + if(plugin.getFactionManager().getFactionAt(e.getBlock()) != null){ + e.setCancelled(true); + } + } + + @Override + public long getRemaining() { + if(this.eventFaction == null) { + return 0L; + } + if(this.eventFaction instanceof KothFaction) { + return ((KothFaction) this.eventFaction).getCaptureZone().getRemainingCaptureMillis(); + } + return super.getRemaining(); + } + + public void handleWinner(final Player winner) { + if(this.eventFaction == null) { + return; + } + final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(winner.getUniqueId()); + if(playerFaction != null) { + if (eventFaction instanceof ConquestFaction || eventFaction.getName().contains("Palace")) { + for (UUID on : playerFaction.getMembers().keySet()) { + if (Bukkit.getPlayer(on) != null) { + Player player = Bukkit.getPlayer(on); + ParticleEffect.FIREWORK_SPARK.sphere(player, player.getLocation(), 2); + ParticleEffect.FIRE.sphere(player, player.getLocation(), 3); + } + } + } + } + Bukkit.broadcastMessage(""); + Bukkit.broadcastMessage(ChatColor.GOLD + "[" + this.eventFaction.getEventType().getDisplayName() + "] " + ChatColor.RED + ((playerFaction == null) ? winner.getName() : playerFaction.getName()) + ChatColor.YELLOW + " has captured " + ChatColor.RED + this.eventFaction.getName() + ChatColor.YELLOW + " after " + ChatColor.BOLD + DurationFormatUtils.formatDurationWords(this.getUptime(), true, true) + ChatColor.YELLOW + " of up-time" + ChatColor.YELLOW + '.'); + Bukkit.broadcastMessage(""); + final World world = winner.getWorld(); + final Location location = winner.getLocation(); + final Key key; + if(eventFaction.getName().contains("Palace") || eventFaction.getName().contains("Conquest")){ + key = this.plugin.getKeyManager().getConquestKey(); + }else { + key = this.plugin.getKeyManager().getKey(ChatColor.stripColor(eventFaction.getEventType().getDisplayName())); + } Preconditions.checkNotNull(key, "Key on: EventTime error."); + final ItemStack stack; + if(eventFaction.getName().contains("Palace") || eventFaction.getName().contains("Conquest")) { + stack = key.getItemStack().clone(); + stack.setAmount(3); + }else { + stack = key.getItemStack().clone(); + } + final Map excess = winner.getInventory().addItem(new ItemStack[]{stack, EventSignListener.getEventSign(this.eventFaction.getName(), winner.getName())}); + for(final ItemStack entry : excess.values()) { + world.dropItemNaturally(location, entry); + } + this.clearCooldown(); + } + + public boolean tryContesting(final EventFaction eventFaction, final CommandSender sender) { + if(this.eventFaction != null) { + sender.sendMessage(ChatColor.RED + "There is already an active event, use /game cancel to end it."); + return false; + } + if(eventFaction instanceof KothFaction) { + final KothFaction kothFaction = (KothFaction) eventFaction; + if(kothFaction.getCaptureZone() == null) { + sender.sendMessage(ChatColor.RED + "Cannot schedule " + eventFaction.getName() + " as its' capture zone is not set."); + return false; + } + } else if(eventFaction instanceof ConquestFaction) { + final ConquestFaction conquestFaction = (ConquestFaction) eventFaction; + final Collection zones = conquestFaction.getConquestZones(); + for(final ConquestFaction.ConquestZone zone : ConquestFaction.ConquestZone.values()) { + if(!zones.contains(zone)) { + sender.sendMessage(ChatColor.RED + "Cannot schedule " + eventFaction.getName() + " as capture zone '" + zone.getDisplayName() + ChatColor.RED + "' is not set."); + return false; + } + } + } + final long millis = System.currentTimeMillis(); + if(this.lastContestedEventMillis + EventTimer.RESCHEDULE_FREEZE_MILLIS - millis > 0L) { + sender.sendMessage(ChatColor.RED + "Cannot reschedule events within " + EventTimer.RESCHEDULE_FREEZE_WORDS + '.'); + return false; + } + this.lastContestedEventMillis = millis; + this.startStamp = millis; + this.eventFaction = eventFaction; + eventFaction.getEventType().getEventTracker().onContest(eventFaction, this); + if(eventFaction instanceof ConquestFaction) { + this.setRemaining(1000L, true); + this.setPaused(true); + } + final Collection captureZones = eventFaction.getCaptureZones(); + for(final CaptureZone captureZone : captureZones) { + if(captureZone.isActive()) { + final Player player = (Player) Iterables.getFirst((Iterable) captureZone.getCuboid().getPlayers(), (Object) null); + if(player == null || !eventFaction.getEventType().getEventTracker().onControlTake(player, captureZone)) { + continue; + } + captureZone.setCappingPlayer(player); + } + } + eventFaction.setDeathban(true); + return true; + } + + public long getUptime() { + return System.currentTimeMillis() - this.startStamp; + } + + public long getStartStamp() { + return this.startStamp; + } + + private void handleDisconnect(final Player player) { + Preconditions.checkNotNull((Object) player); + if(this.eventFaction == null) { + return; + } + final Collection captureZones = this.eventFaction.getCaptureZones(); + for(final CaptureZone captureZone : captureZones) { + if(Objects.equal(captureZone.getCappingPlayer(), player)) { + this.eventFaction.getEventType().getEventTracker().onControlLoss(player, captureZone, this.eventFaction); + captureZone.setCappingPlayer(null); + break; + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerDeath(final PlayerDeathEvent event) { + this.handleDisconnect(event.getEntity()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerLogout(final PlayerQuitEvent event) { + this.handleDisconnect(event.getPlayer()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerKick(final PlayerKickEvent event) { + this.handleDisconnect(event.getPlayer()); + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerTeleport(PlayerTeleportEvent event) { + handleDisconnect(event.getPlayer()); + } + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerPortal(PlayerPortalEvent event) { + handleDisconnect(event.getPlayer()); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCaptureZoneEnter(final CaptureZoneEnterEvent event) { + if(this.eventFaction == null) { + return; + } + final CaptureZone captureZone = event.getCaptureZone(); + if(!this.eventFaction.getCaptureZones().contains(captureZone)) { + return; + } + final Player player = event.getPlayer(); + if(captureZone.getCappingPlayer() == null && this.eventFaction.getEventType().getEventTracker().onControlTake(player, captureZone)) { + captureZone.setCappingPlayer(player); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCaptureZoneLeave(final CaptureZoneLeaveEvent event) { + if(Objects.equal((Object) event.getFaction(), (Object) this.eventFaction)) { + final Player player = event.getPlayer(); + final CaptureZone captureZone = event.getCaptureZone(); + if(Objects.equal((Object) player, (Object) captureZone.getCappingPlayer()) && this.eventFaction.getEventType().getEventTracker().onControlLoss(player, captureZone, this.eventFaction)) { + captureZone.setCappingPlayer(null); + for(final Player target : captureZone.getCuboid().getPlayers()) { + if(target != null && !target.equals(player) && this.eventFaction.getEventType().getEventTracker().onControlTake(target, captureZone)) { + captureZone.setCappingPlayer(target); + break; + } + } + } + } + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventType.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventType.java new file mode 100644 index 0000000..fcc91c4 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/EventType.java @@ -0,0 +1,45 @@ +package com.prevailpots.hcf.kothgame; + +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableMap; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.kothgame.tracker.ConquestTracker; +import com.prevailpots.hcf.kothgame.tracker.EventTracker; +import com.prevailpots.hcf.kothgame.tracker.KothTracker; + +public enum EventType { + CONQUEST("Conquest", new ConquestTracker(HCF.getPlugin())), + KOTH("KOTH", new KothTracker(HCF.getPlugin())), ; + + + private static final ImmutableMap byDisplayName; + + static { + final ImmutableMap.Builder builder = (ImmutableMap.Builder) new ImmutableBiMap.Builder(); + for(final EventType eventType : values()) { + builder.put(eventType.displayName.toLowerCase(), eventType); + } + byDisplayName = builder.build(); + } + + private final EventTracker eventTracker; + private final String displayName; + + private EventType(final String displayName, final EventTracker eventTracker) { + this.displayName = displayName; + this.eventTracker = eventTracker; + } + + @Deprecated + public static EventType getByDisplayName(final String name) { + return (EventType) EventType.byDisplayName.get((Object) name.toLowerCase()); + } + + public EventTracker getEventTracker() { + return this.eventTracker; + } + + public String getDisplayName() { + return this.displayName; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/NewEventScheduler.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/NewEventScheduler.java new file mode 100644 index 0000000..9e75057 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/NewEventScheduler.java @@ -0,0 +1,71 @@ +package com.prevailpots.hcf.kothgame; + +import com.customhcf.util.Config; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.kothgame.faction.EventFaction; + +import org.bukkit.configuration.MemorySection; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +public class NewEventScheduler { + + private HCF plugin; + private Map map; + private Config file; + + + public NewEventScheduler(HCF plugin) { + this.plugin = plugin; + map = new LinkedHashMap<>(); + reloadSchedule(); + } + + public String getSchedule(Long value){ + return map.get(value); + } + + public void addSchedule(Long when, EventFaction faction){ + this.map.put(when, faction.getName()); + } + + public Map getMap(){ + return map; + } + + + + public static LocalDateTime getDateTimeFromTimestamp(long timestamp) { + if (timestamp == 0) + return null; + return LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), TimeZone + .getDefault().toZoneId()); + } + + + + private void reloadSchedule() + { + file = new Config(plugin, "schedule-new"); + Object location = file.get("schedule"); + if(location instanceof MemorySection){ + MemorySection memorySection = (MemorySection) location; + List keys = (List) memorySection.getKeys(false); + this.map = new LinkedHashMap<>(); + for(String id : keys){ +// Long time = Longs. +// this.map.put((Long) id, this.file.getString(memorySection.getCurrentPath() + "." + id)); + } + }else{ + map = new LinkedHashMap<>(); + } + } + + public void saveData(){ + this.file.set("lives", map); + this.file.save(); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/RefillBox.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/RefillBox.java new file mode 100644 index 0000000..819e4de --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/RefillBox.java @@ -0,0 +1,110 @@ +package com.prevailpots.hcf.kothgame; + +import com.customhcf.util.GenericUtils; +import com.customhcf.util.cuboid.Cuboid; +import com.google.common.collect.Maps; +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.entity.Player; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public class RefillBox implements ConfigurationSerializable { + private String name; + private String prefix; + private Cuboid cuboid; + private List glowstone = new ArrayList<>(); + private List valuables = new ArrayList<>(); + + public RefillBox(final String name, final Cuboid cuboid) { + this(name, "", cuboid); + } + + public RefillBox(final String name, final String prefix, final Cuboid cuboid) { + this.name = name; + this.prefix = prefix; + this.cuboid = cuboid; + } + + public RefillBox(final Map map) { + this.name = (String) map.get("name"); + Object obj = map.get("prefix"); + if(obj instanceof String) { + this.prefix = (String) obj; + } + obj = map.get("cuboid"); + if(obj instanceof Cuboid) { + this.cuboid = (Cuboid) obj; + } + this.glowstone.addAll(GenericUtils.createList(map.get("glowstone"), Location.class)); + this.valuables.addAll(GenericUtils.createList(map.get("valuables"), Location.class)); + + } + + public Map serialize() { + final Map map = Maps.newLinkedHashMap(); + + map.put("name", this.name); + + if(this.prefix != null) { + map.put("prefix", this.prefix); + } + if(this.cuboid != null) { + map.put("cuboid", this.cuboid); + } + map.put("glowstone", new ArrayList(this.glowstone)); + map.put("valuables", new ArrayList(this.valuables)); + + return map; + } + + public String getName() { + return this.name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getPrefix() { + if(this.prefix == null) { + this.prefix = ""; + } + return this.prefix; + } + + public String getDisplayName() { + return getPrefix() + this.name; + } + + public Cuboid getCuboid() { + return this.cuboid; + } + + public Collection getGlowstoneLocation(){ + return glowstone; + } + public Collection getValuableLocation(){ + return valuables; + } + + public void addGlowstoneLocation(Location location){ + glowstone.add(location); + } + + public void addValuableLocation(Location location){ + valuables.add(location); + } + + + + + +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.java new file mode 100644 index 0000000..5147ac0 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCancelArgument.java @@ -0,0 +1,36 @@ +package com.prevailpots.hcf.kothgame.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.kothgame.EventTimer; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class GameCancelArgument extends CommandArgument { + private final HCF plugin; + + public GameCancelArgument(final HCF plugin) { + super("cancel", "Cancels a running event", new String[]{"stop", "end"}); + this.plugin = plugin; + this.permission = "command.game." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName(); + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + final EventTimer eventTimer = this.plugin.getTimerManager().eventTimer; + final Faction eventFaction = eventTimer.getEventFaction(); + if(!eventTimer.clearCooldown()) { + sender.sendMessage(ChatColor.RED + "There is not a running event."); + return true; + } + Bukkit.broadcastMessage(ChatColor.BLUE + sender.getName() + ChatColor.YELLOW + " has cancelled " + ((eventFaction == null) ? "the active event" : ChatColor.GOLD +(eventFaction.getName() + ChatColor.YELLOW)) + "."); + return true; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.java new file mode 100644 index 0000000..8d2fe00 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameCreateArgument.java @@ -0,0 +1,73 @@ +package com.prevailpots.hcf.kothgame.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.kothgame.EventType; +import com.prevailpots.hcf.kothgame.faction.ConquestFaction; +import com.prevailpots.hcf.kothgame.faction.KothFaction; + +import org.apache.commons.lang3.text.WordUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class GameCreateArgument extends CommandArgument { + private final HCF plugin; + + public GameCreateArgument(final HCF plugin) { + super("create", "Defines a new event", new String[]{"make", "define"}); + this.plugin = plugin; + this.permission = "command.game." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + Faction faction = this.plugin.getFactionManager().getFaction(args[1]); + if(faction != null) { + sender.sendMessage(ChatColor.RED + "There is already a faction named " + args[1] + '.'); + return true; + } + final String upperCase = args[2].toUpperCase(); + switch(upperCase) { + case "CONQUEST": { + faction = new ConquestFaction(args[1]); + break; + } + case "KOTH": { + faction = new KothFaction(args[1]); + break; + } + default: { + sender.sendMessage(this.getUsage(label)); + return true; + } + } + this.plugin.getFactionManager().createFaction(faction, sender); + sender.sendMessage(ChatColor.YELLOW + "Created event faction " + ChatColor.GOLD + faction.getDisplayName(sender) + ChatColor.YELLOW + " with type " + ChatColor.GOLD + WordUtils.capitalizeFully(args[2]) + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 3) { + return Collections.emptyList(); + } + final EventType[] eventTypes = EventType.values(); + final List results = new ArrayList(eventTypes.length); + for(final EventType eventType : eventTypes) { + results.add(eventType.name()); + } + return results; + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.java new file mode 100644 index 0000000..63ae0d5 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameDeleteArgument.java @@ -0,0 +1,53 @@ +package com.prevailpots.hcf.kothgame.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.kothgame.faction.EventFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class GameDeleteArgument extends CommandArgument { + private final HCF plugin; + + public GameDeleteArgument(final HCF plugin) { + super("delete", "Deletes an event"); + this.plugin = plugin; + this.aliases = new String[]{"remove", "del"}; + this.permission = "command.game." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 2) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + final Faction faction = this.plugin.getFactionManager().getFaction(args[1]); + if(!(faction instanceof EventFaction)) { + sender.sendMessage(ChatColor.RED + "There is not an event faction named '" + args[1] + "'."); + return true; + } + + if(this.plugin.getFactionManager().removeFaction(faction, sender)) { + sender.sendMessage(ChatColor.YELLOW + "Deleted event faction " + ChatColor.GOLD + faction.getDisplayName(sender) + ChatColor.YELLOW + '.'); + } + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2) { + return Collections.emptyList(); + } + return this.plugin.getFactionManager().getFactions().stream().filter(faction -> faction instanceof EventFaction).map(Faction::getName).collect(Collectors.toList()); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.java new file mode 100644 index 0000000..c25915b --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameRenameArgument.java @@ -0,0 +1,56 @@ +package com.prevailpots.hcf.kothgame.argument; + +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.kothgame.faction.EventFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class GameRenameArgument extends CommandArgument { + private final HCF plugin; + + public GameRenameArgument(final HCF plugin) { + super("rename", "Renames an event"); + this.plugin = plugin; + this.permission = "command.game." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + " "; + } + + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length < 3) { + sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label)); + return true; + } + Faction faction = this.plugin.getFactionManager().getFaction(args[2]); + if(faction != null) { + sender.sendMessage(ChatColor.RED + "There is already a faction named " + args[2] + '.'); + return true; + } + faction = this.plugin.getFactionManager().getFaction(args[1]); + if(!(faction instanceof EventFaction)) { + sender.sendMessage(ChatColor.RED + "There is not an event faction named '" + args[1] + "'."); + return true; + } + final String oldName = faction.getName(); + faction.setName(args[2], sender); + sender.sendMessage(ChatColor.YELLOW + "Renamed event " + ChatColor.GOLD + oldName + ChatColor.YELLOW + " to " + ChatColor.GOLD + faction.getName() + ChatColor.YELLOW + '.'); + return true; + } + + public List onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { + if(args.length != 2) { + return Collections.emptyList(); + } + return this.plugin.getFactionManager().getFactions().stream().filter(faction -> faction instanceof EventFaction).map(Faction::getName).collect(Collectors.toList()); + } +} diff --git a/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.java b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.java new file mode 100644 index 0000000..88cc0d9 --- /dev/null +++ b/PrevailHCF/src/com/prevailpots/hcf/kothgame/argument/GameScheduleArgument.java @@ -0,0 +1,58 @@ +package com.prevailpots.hcf.kothgame.argument; + +import com.customhcf.permissions.DateTimeFormats; +import com.customhcf.util.JavaUtils; +import com.customhcf.util.command.CommandArgument; +import com.prevailpots.hcf.HCF; +import com.prevailpots.hcf.faction.type.Faction; +import com.prevailpots.hcf.kothgame.faction.EventFaction; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class GameScheduleArgument extends CommandArgument { + private final HCF plugin; + + public GameScheduleArgument(final HCF plugin) { + super("schedule", "Schedules a game"); + this.plugin = plugin; + this.permission = "command.game." + this.getName(); + } + + public String getUsage(final String label) { + return '/' + label + ' ' + this.getName() + "