+
+
+
+
+
+
\ 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 extends Vector>) 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 extends Vector>) 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 extends Vector>) 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 extends Player> 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