diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java index 976e2052f..b0468daf8 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java @@ -80,7 +80,10 @@ public class LobbyBalancer implements Listener, Runnable } if (_bestServerIndex < _sortedLobbies.size()) + { event.setTarget(_plugin.getProxy().getServerInfo(_sortedLobbies.get(_bestServerIndex).getName())); + System.out.println("Sending " + event.getPlayer().getName() + " to " + _sortedLobbies.get(_bestServerIndex).getName() + "(" + _sortedLobbies.get(_bestServerIndex).getPublicAddress() + ")"); + } _playersSentToBestServer++; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 0a36b9ddb..c9e7b76e2 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -11,7 +11,7 @@ public enum Rank OWNER("Owner", ChatColor.DARK_RED), DEVELOPER("Dev", ChatColor.RED), ADMIN("Admin", ChatColor.RED), - SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), + SNR_MODERATOR("Sr.Mod", ChatColor.GRAY), MODERATOR("Mod", ChatColor.GOLD), HELPER("Helper", ChatColor.GREEN), MAPDEV("Mapper", ChatColor.BLUE), diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 53eb34d07..638ad7db6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -115,6 +115,9 @@ public class UtilAlg public static T Random(List list) { + if (list.isEmpty()) + return null; + return list.get(UtilMath.r(list.size())); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index d8c9218bd..15f9813b8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -50,7 +50,7 @@ public class UpdateRank extends CommandBase final Rank rank = tempRank; - if (rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV) + if (rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) { Plugin.getRepository().MatchPlayerName(new Callback>() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 2b2aeda75..1f22634d8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -142,13 +142,13 @@ public enum Achievement BLOCK_HUNT_HUNTER_OF_THE_YEAR("Hunter of the Year", 1200, new String[] {"Block Hunt.HunterOfTheYear"}, new String[] {"Kill 7 Hiders in a single game"}, - new int[] {100}, + new int[] {1}, AchievementCategory.BLOCK_HUNT), BLOCK_HUNT_BAD_HIDER("Bad Hider", 1000, new String[] {"Block Hunt.BadHider"}, new String[] {"Win as Hider without disguising"}, - new int[] {100}, + new int[] {1}, AchievementCategory.BLOCK_HUNT), //Draw My Thing diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java index e035964f6..9b07b368e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java @@ -46,7 +46,7 @@ public abstract class MultiCommandBase extends Co { newArgs = new String[args.length - 1]; - for (int i = 0 ; i < newArgs.length; i++) + for (int i = 0 ; i < newArgs.length; i++) { newArgs[i] = args[i+1]; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 7ce56efee..0771f34f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -1,12 +1,14 @@ package mineplex.core.cosmetic.ui.page; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; import mineplex.core.cosmetic.ui.CosmeticShop; @@ -49,7 +51,7 @@ public class Menu extends ShopPageBase else { */ - AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)", 1, false)); + AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false)); //} final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster")); @@ -66,7 +68,7 @@ public class Menu extends ShopPageBase @Override public void ClickedLeft(Player player) { - if (Shop.getBoosterEnabled()) + if (Shop.getBoosterEnabled() && Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster") > 0) { ActivateGemBoosterEvent boosterEvent = new ActivateGemBoosterEvent(player); Bukkit.getServer().getPluginManager().callEvent(boosterEvent); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 7251dc428..34dc35492 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -132,8 +132,6 @@ public class Hub extends JavaPlugin implements IRelation //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); - - MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java index 3742307ab..9b251ecb2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java @@ -10,7 +10,7 @@ public class HubClient public String PurchaseString = " Purchase Ultra Rank at mineplex.com to unlock all game benefits!"; public int PurchaseIndex = 0; - + public String UltraString = " Thank you for your support!"; public int UltraIndex = 0; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index ec1a5020b..7ce466096 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -73,6 +73,7 @@ import mineplex.core.task.TaskManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.commands.ForcefieldRadius; +import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.JumpManager; @@ -309,6 +310,7 @@ public class HubManager extends MiniClientPlugin public void AddCommands() { AddCommand(new NewsCommand(this)); + AddCommand(new GameModeCommand(this)); } @EventHandler(priority = EventPriority.HIGHEST) @@ -463,7 +465,7 @@ public class HubManager extends MiniClientPlugin @EventHandler(priority = EventPriority.LOW) public void AdminOP(PlayerJoinEvent event) { - if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.ADMIN)) + if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER)) event.getPlayer().setOp(true); else event.getPlayer().setOp(false); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java new file mode 100644 index 000000000..28e921f4e --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java @@ -0,0 +1,25 @@ +package mineplex.hub.commands; + +import org.bukkit.GameMode; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.hub.HubManager; + +public class GameModeCommand extends CommandBase +{ + public GameModeCommand(HubManager plugin) + { + super(plugin, Rank.ADMIN, new String[] {"gm"}); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (caller.getGameMode() == GameMode.SURVIVAL) + caller.setGameMode(GameMode.CREATIVE); + else + caller.setGameMode(GameMode.SURVIVAL); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java index e3d47524c..937497aec 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java @@ -119,7 +119,7 @@ public class PollManager extends MiniClientPlugin { String[] answers = poll.getAnswers(); - player.sendMessage(C.cGold + C.Bold + "-----------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "-----------"); + player.sendMessage(C.cGold + C.Bold + "--------------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "--------------"); player.sendMessage(poll.getQuestion()); player.sendMessage(""); for (int i = 1; i <= answers.length; i++) @@ -151,7 +151,7 @@ public class PollManager extends MiniClientPlugin } player.sendMessage(""); player.sendMessage("Click an answer to receive " + C.cGreen + poll.getCoinReward() + " Gems"); - player.sendMessage(C.cGold + C.Bold + "--------------------------"); + player.sendMessage(C.cGold + C.Bold + "--------------------------------"); player.playSound(player.getEyeLocation(), Sound.ORB_PICKUP, 2f, 0f); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java index 123c3af16..9d25b9c0f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/command/PollCommand.java @@ -102,7 +102,7 @@ public class PollCommand extends CommandBase UtilPlayer.message(caller, "Reward: " + C.cYellow + poll.getCoinReward()); UtilPlayer.message(caller, ""); - DecimalFormat decimalFormat = new DecimalFormat("#.##"); + DecimalFormat decimalFormat = new DecimalFormat("#.#"); double aPercent = stats.getAPercent(); double bPercent = stats.getBPercent(); double cPercent = stats.getCPercent(); @@ -123,7 +123,7 @@ public class PollCommand extends CommandBase percent = dPercent; UtilPlayer.message(caller, answer); - UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(percent) + "%" + C.cWhite + ")"); + UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(100d*percent) + "%" + C.cWhite + ")"); } } UtilPlayer.message(caller, " "); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 4203e8771..b56dabae8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -187,7 +187,6 @@ public class ServerManager extends MiniPlugin try { Collections.sort(serverList, new ServerSorter(slots)); - boolean hasUltra = _clientManager.Get(player).GetRank().Has(Rank.ULTRA); for (ServerInfo serverInfo : serverList) { @@ -302,13 +301,15 @@ public class ServerManager extends MiniPlugin _serverInfoMap.remove(serverName); } - public void addServerGroup(String serverKey, String serverTag) + public void addServerGroup(String serverKey, String...serverTag) { _serverKeyInfoMap.put(serverKey, new HashSet()); - _serverKeyTagMap.put(serverTag, serverKey); + + for (String tag : serverTag) + _serverKeyTagMap.put(tag, serverKey); } - public void AddServerNpc(String serverNpcName, String serverTag) + public void AddServerNpc(String serverNpcName, String...serverTag) { addServerGroup(serverNpcName, serverTag); _serverNpcShopMap.put(serverNpcName, new ServerNpcShop(this, _clientManager, _donationManager, serverNpcName)); @@ -492,12 +493,6 @@ public class ServerManager extends MiniPlugin if (partyPlayer == null) continue; - if (serverInfo.Name.contains("BETA")) - { - if (!_clientManager.Get(partyPlayer).GetRank().Has(Rank.ULTRA)) - continue; - } - if (!_clientManager.Get(partyPlayer).GetRank().Has(Rank.MODERATOR) && serverInfo.CurrentPlayers >= serverInfo.MaxPlayers * 1.5) continue; @@ -517,12 +512,6 @@ public class ServerManager extends MiniPlugin if (partyPlayer == null) continue; - if (serverInfo.Name.contains("BETA")) - { - if (!_clientManager.Get(partyPlayer).GetRank().Has(Rank.ULTRA)) - continue; - } - if (!_clientManager.Get(partyPlayer).GetRank().Has(Rank.MODERATOR) && serverInfo.CurrentPlayers >= serverInfo.MaxPlayers * 1.5) continue; @@ -609,7 +598,7 @@ public class ServerManager extends MiniPlugin while (line != null) { String serverNpcName = line.substring(0, line.indexOf('|')).trim(); - String serverTag = line.substring(line.indexOf('|') + 1, line.indexOf('|', line.indexOf('|') + 1)).trim(); + String[] serverTags = line.substring(line.indexOf('|') + 1, line.indexOf('|', line.indexOf('|') + 1)).trim().split(","); String[] locations = line.substring(line.indexOf('|', line.indexOf('|') + 1) + 1).trim().split(","); for (String location : locations) @@ -619,7 +608,7 @@ public class ServerManager extends MiniPlugin if (!HasServerNpc(serverNpcName)) { - AddServerNpc(serverNpcName, serverTag); + AddServerNpc(serverNpcName, serverTags); } npcNames.add(serverNpcName); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 4e4680c77..25068829a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -54,7 +54,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "death with the other teams.", })); - this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] + this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Search for chests to find loot and ", @@ -150,10 +150,9 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", ChatColor.RESET + "Super Paintball", - ChatColor.RESET + "Turf Forts", + ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl", - ChatColor.RESET + "Squid Sauce" + ChatColor.RESET + "Bacon Brawl" })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(122, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 832e84af7..d9f6a9fa7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -305,7 +305,7 @@ public class ServerNpcPage extends ShopPageBase im { int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType); - if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))) + if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))) { PlayDenySound(player); return; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java index 880d2f845..436d82b17 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java @@ -14,6 +14,7 @@ public class SkillSalesPackage extends SalesPackageBase super("Champions " + skill.GetName(), Material.BOOK, (byte)0, skill.GetDesc(0), skill.GetGemCost()); Free = skill.IsFree(); KnownPackage = false; + CurrencyCostMap.put(CurrencyType.Gems, skill.GetGemCost()); } @Override diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java index 00976ecda..a07e52ba4 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java @@ -84,7 +84,8 @@ public class ServerGroup public boolean getAddNoCheat() { return _addNoCheat; } // The set of active MinecraftServers that belong to this server group - private Set servers; + private Set _servers; + public Set getServers() { return _servers; } /** * Class constructor @@ -124,7 +125,7 @@ public class ServerGroup */ public int getServerCount() { - return servers.size(); + return _servers.size(); } /** @@ -135,7 +136,7 @@ public class ServerGroup { int joinable = 0; - for (MinecraftServer server : servers) + for (MinecraftServer server : _servers) { if (server.isJoinable()) { @@ -154,7 +155,7 @@ public class ServerGroup { int playerCount = 0; - for (MinecraftServer server : servers) + for (MinecraftServer server : _servers) { playerCount += server.getPlayerCount(); } @@ -170,7 +171,7 @@ public class ServerGroup { int maxPlayerCount = 0; - for (MinecraftServer server : servers) + for (MinecraftServer server : _servers) { maxPlayerCount += server.getMaxPlayerCount(); } @@ -186,7 +187,7 @@ public class ServerGroup { Collection emptyServers = new HashSet(); - for (MinecraftServer server : servers) + for (MinecraftServer server : _servers) { if (server.isEmpty()) { @@ -203,14 +204,14 @@ public class ServerGroup */ private void fetchServers(Region region) { - this.servers = new HashSet(); + this._servers = new HashSet(); ServerRepository repository = ServerManager.getServerRepository(region); for (MinecraftServer server : repository.getServerStatuses()) { if (_name.equalsIgnoreCase(server.getGroup())) { - servers.add(server); + _servers.add(server); } } } @@ -226,7 +227,7 @@ public class ServerGroup { boolean uniqueId = true; - for (MinecraftServer server : servers) + for (MinecraftServer server : _servers) { String serverName = server.getName(); try @@ -255,5 +256,4 @@ public class ServerGroup } } } - } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 308538ef0..29bd07db9 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -18,6 +18,7 @@ import java.util.Map.Entry; import java.util.logging.FileHandler; import java.util.logging.Logger; +import mineplex.core.common.util.NautHashMap; import mineplex.serverdata.DedicatedServer; import mineplex.serverdata.DedicatedServerSorter; import mineplex.serverdata.MinecraftServer; @@ -105,21 +106,26 @@ public class ServerMonitor iterator.remove(); } - // TODO: Check with Jonathan to see if we still need this duplication server code - /*for (GroupStatusData groupStatus : groupStatusList.values()) + for (ServerGroup groupStatus : serverGroups) { - for (ServerStatusData serverToKill : groupStatus.KillServers) - { - System.out.println("----DUPLICATE SERVER----> " + serverToKill.Address + ", " + serverToKill.Name); - killServer(serverToKill); - } + NautHashMap _serverMap = new NautHashMap(); - for (ServerStatusData serverToKill : groupStatus.Servers.values()) + for (Iterator serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();) { - if (serverTracker.containsKey(serverToKill.Name)) - serverTracker.remove(serverToKill.Name); + MinecraftServer server = serverIterator.next(); + int serverNum = Integer.parseInt(server.getName().split("-")[1]); + + if (_serverMap.containsKey(serverNum)) + { + killServer(server.getName(), server.getPublicAddress(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true); + serverIterator.remove(); + } + else + { + _serverMap.put(serverNum, server); + } } - }*/ + } HashSet onlineServers = new HashSet(); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index b04ef8736..c4cea7af3 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -3,10 +3,11 @@ package mineplex.staffServer.customerSupport; import java.text.SimpleDateFormat; import java.util.HashSet; +import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.AsyncPlayerChatEvent; @@ -17,13 +18,9 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; -import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; @@ -99,8 +96,10 @@ public class CustomerSupport extends MiniPlugin for (CoinTransactionToken transaction : donor.getCoinTransactions()) { - if (transaction.Source.equalsIgnoreCase("purchase")) - caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins"); + if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward")) + continue; + + caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins - Applied via " + transaction.Source); } for (TransactionToken transaction : donor.getTransactions()) @@ -112,6 +111,13 @@ public class CustomerSupport extends MiniPlugin _salesPackageManager.displaySalesPackages(caller, playerName); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); } + + @EventHandler + public void blockBreak(BlockBreakEvent event) + { + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); + } @EventHandler public void removeMapping(PlayerQuitEvent event) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/ChangePasswordCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/ChangePasswordCommand.java new file mode 100644 index 000000000..055b1ff0f --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/ChangePasswordCommand.java @@ -0,0 +1,23 @@ +package mineplex.staffServer.password; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class ChangePasswordCommand extends CommandBase +{ + public ChangePasswordCommand(Password plugin) + { + super(plugin, Rank.ADMIN, "changepassword"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null && args.length == 1) + { + Plugin.changePassword(caller, args[0]); + } + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java index 7cd6a7c09..8836fdb8f 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java @@ -9,10 +9,13 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.common.util.F; +import mineplex.core.recharge.Recharge; public class Password extends MiniPlugin { private HashSet _accepted = new HashSet(); + + private String _password = "ClothStarRust"; public Password(JavaPlugin plugin) { @@ -23,6 +26,7 @@ public class Password extends MiniPlugin public void AddCommands() { AddCommand(new PasswordCommand(this)); + AddCommand(new ChangePasswordCommand(this)); } @EventHandler @@ -35,17 +39,23 @@ public class Password extends MiniPlugin public void run() { if (!_accepted.contains(event.getPlayer())) - event.getPlayer().kickPlayer("You don't know the password little twerp."); + event.getPlayer().kickPlayer("You don't know the password!"); } }, 200L); } public void checkPassword(Player caller, String attempt) { - if (attempt.equals("ClothStarRust")) + if (attempt.equals(_password)) { _accepted.add(caller); caller.sendMessage(F.main(GetName(), "I guess you get to stay.")); } } + + public void changePassword(Player caller, String password) + { + _password = password; + caller.sendMessage(F.main(GetName(), "Password changed to " + _password)); + } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java index eedca6380..908e15d48 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java @@ -17,6 +17,7 @@ public class PasswordCommand extends CommandBase { if (args != null && args.length == 1) { + resetCommandCharge(caller); Plugin.checkPassword(caller, args[0]); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java index b447b164b..977bfa9eb 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java @@ -23,7 +23,7 @@ public class CoinCommand extends CommandBase String playerName = args[0]; int amount = Integer.parseInt(args[1]); - Plugin.getDonationManager().RewardCoins(null, "purchase", playerName, amount); + Plugin.getDonationManager().RewardCoins(null, caller.getName(), playerName, amount); caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " coins to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/HeroCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/HeroCommand.java index 5d061fefb..0d6bb4b1a 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/HeroCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/HeroCommand.java @@ -28,7 +28,7 @@ public class HeroCommand extends CommandBase Bukkit.getServer().getPluginManager().callEvent(event); resetCommandCharge(caller); - event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 60"); + event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 90"); Bukkit.getServer().getPluginManager().callEvent(event); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeHeroCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeHeroCommand.java new file mode 100644 index 000000000..38676174b --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeHeroCommand.java @@ -0,0 +1,33 @@ +package mineplex.staffServer.salespackage.command; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class LifetimeHeroCommand extends CommandBase +{ + public LifetimeHeroCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "lifetimehero"); + } + + @Override + public void Execute(Player caller, String[] args) + { + resetCommandCharge(caller); + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " HERO true"); + Bukkit.getServer().getPluginManager().callEvent(event); + + resetCommandCharge(caller); + event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 40000"); + Bukkit.getServer().getPluginManager().callEvent(event); + + resetCommandCharge(caller); + event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 180"); + Bukkit.getServer().getPluginManager().callEvent(event); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeUltraCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeUltraCommand.java new file mode 100644 index 000000000..970221cfe --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeUltraCommand.java @@ -0,0 +1,33 @@ +package mineplex.staffServer.salespackage.command; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class LifetimeUltraCommand extends CommandBase +{ + public LifetimeUltraCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "lifetimeultra"); + } + + @Override + public void Execute(Player caller, String[] args) + { + resetCommandCharge(caller); + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ULTRA true"); + Bukkit.getServer().getPluginManager().callEvent(event); + + resetCommandCharge(caller); + event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 20000"); + Bukkit.getServer().getPluginManager().callEvent(event); + + resetCommandCharge(caller); + event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 60"); + Bukkit.getServer().getPluginManager().callEvent(event); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java index 7103aecbb..b5edb5362 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java @@ -17,6 +17,8 @@ public class Sales extends MultiCommandBase AddCommand(new BoosterCommand(plugin)); AddCommand(new UltraCommand(plugin)); AddCommand(new HeroCommand(plugin)); + AddCommand(new LifetimeUltraCommand(plugin)); + AddCommand(new LifetimeHeroCommand(plugin)); } @Override diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeHero.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeHero.java index 610eb524b..caf8b8eab 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeHero.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeHero.java @@ -13,7 +13,10 @@ public class LifetimeHero extends SalesPackageBase public void displayToAgent(Player agent, String playerName) { - addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero Rank."); + addButton(agent, "/sales coin " + playerName + " 40000", " 40,000 Coins"); + addButton(agent, "/sales booster " + playerName + " 180", " 180 Gem Boosters"); + addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero (Also, unlocks kits)."); + addButton(agent, "Apply All", "/sales lifetimehero " + playerName, " Apply all above."); agent.sendMessage(" "); addBackButton(agent, playerName); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeUltra.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeUltra.java index b00b44ca9..991c1551e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeUltra.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeUltra.java @@ -13,7 +13,10 @@ public class LifetimeUltra extends SalesPackageBase public void displayToAgent(Player agent, String playerName) { - addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra Rank."); + addButton(agent, "/sales coin " + playerName + " 20000", " 20,000 Coins"); + addButton(agent, "/sales booster " + playerName + " 60", " 60 Gem Boosters"); + addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra (Also, unlocks kits)."); + addButton(agent, "Apply All", "/sales lifetimeultra " + playerName, " Apply all above."); agent.sendMessage(" "); addBackButton(agent, playerName); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MonthlyHero.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MonthlyHero.java index 66102b208..ad82d4d83 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MonthlyHero.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MonthlyHero.java @@ -14,7 +14,7 @@ public class MonthlyHero extends SalesPackageBase public void displayToAgent(Player agent, String playerName) { addButton(agent, "/sales coin " + playerName + " 15000", " 15,000 Coins"); - addButton(agent, "/sales booster " + playerName + " 60", " 60 Gem Boosters"); + addButton(agent, "/sales booster " + playerName + " 90", " 90 Gem Boosters"); addButton(agent, "/sales rank " + playerName + " HERO false", " Monthly Hero."); addButton(agent, "Apply All", "/sales hero " + playerName, " Apply all above."); agent.sendMessage(" "); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 8816eeec6..7765d4375 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -178,6 +178,54 @@ public class Arcade extends JavaPlugin { config.Tournament = Boolean.parseBoolean(tokens[1]); } + else if (tokens[0].equals("TEAM_REJOIN")) + { + config.TeamRejoin = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("TEAM_AUTO_JOIN")) + { + config.TeamAutoJoin = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("TEAM_FORCE_BALANCE")) + { + config.TeamForceBalance = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("GAME_AUTO_START")) + { + config.GameAutoStart = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("GAME_TIMEOUT")) + { + config.GameTimeout = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("REWARD_GEMS")) + { + config.RewardGems = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("REWARD_ITEMS")) + { + config.RewardItems = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("REWARD_STATS")) + { + config.RewardStats = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("REWARD_ACHIEVEMENTS")) + { + config.RewardAchievements = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("HOTBAR_INVENTORY")) + { + config.HotbarInventory = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("HOTBAR_HUB_CLOCK")) + { + config.HotbarHubClock = Boolean.parseBoolean(tokens[1]); + } + else if (tokens[0].equals("PLAYER_KICK_IDLE")) + { + config.PlayerKickIdle = Boolean.parseBoolean(tokens[1]); + } //Games else { @@ -233,7 +281,26 @@ public class Arcade extends JavaPlugin out.write("SERVER_TYPE=" + config.ServerType + "\n"); out.write("PLAYERS_MIN=" + config.MinPlayers + "\n"); out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n"); + out.write("\nTOURNAMENT=" + config.Tournament + "\n"); + + out.write("\nTEAM_REJOIN=" + config.TeamRejoin + "\n"); + out.write("TEAM_AUTO_JOIN=" + config.TeamAutoJoin + "\n"); + out.write("TEAM_FORCE_BALANCE=" + config.TeamForceBalance + "\n"); + + out.write("\nGAME_AUTO_START=" + config.GameAutoStart + "\n"); + out.write("GAME_TIMEOUT=" + config.GameTimeout + "\n"); + + out.write("\nREWARD_GEMS=" + config.RewardGems + "\n"); + out.write("REWARD_ITEMS=" + config.RewardItems + "\n"); + out.write("REWARD_STATS=" + config.RewardStats + "\n"); + out.write("REWARD_ACHIEVEMENTS=" + config.RewardAchievements + "\n"); + + out.write("\nHOTBAR_INVENTORY=" + config.HotbarInventory + "\n"); + out.write("HOTBAR_HUB_CLOCK=" + config.HotbarHubClock + "\n"); + + out.write("\nPLAYER_KICK_IDLE=" + config.PlayerKickIdle + "\n"); + out.write("\n\nGames List;\n"); for (GameType type : GameType.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 3c8f047d6..c577e8e82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -526,6 +526,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation public void HubClock(Player player) { + if (!IsHotbarHubClock()) + return; + if (_game != null && !_game.GiveClock) return; @@ -816,6 +819,66 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _serverConfig.Tournament; } + public boolean IsTeamRejoin() + { + return _serverConfig.TeamRejoin; + } + + public boolean IsTeamAutoJoin() + { + return _serverConfig.TeamAutoJoin; + } + + public boolean IsGameAutoStart() + { + return _serverConfig.GameAutoStart; + } + + public boolean IsGameTimeout() + { + return _serverConfig.GameTimeout; + } + + public boolean IsTeamBalance() + { + return _serverConfig.TeamForceBalance; + } + + public boolean IsRewardGems() + { + return _serverConfig.RewardGems; + } + + public boolean IsRewardItems() + { + return _serverConfig.RewardItems; + } + + public boolean IsRewardStats() + { + return _serverConfig.RewardStats; + } + + public boolean IsRewardAchievements() + { + return _serverConfig.RewardAchievements; + } + + public boolean IsHotbarInventory() + { + return _serverConfig.HotbarInventory; + } + + public boolean IsHotbarHubClock() + { + return _serverConfig.HotbarHubClock; + } + + public boolean IsPlayerKickIdle() + { + return _serverConfig.PlayerKickIdle; + } + public int GetDesiredPlayerAmount() { return _serverConfig.MaxPlayers; @@ -855,6 +918,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation public void setTournamentTeam(Player player, GameTeam team) { + if (!IsTeamRejoin()) + return; + _tournamentTeam.put(player.getName(), team.GetName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index b79839c7f..78ed62c1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -371,7 +371,12 @@ public abstract class Game implements Listener System.out.println(GetName() + " state set to " + state.toString()); } - + + public void SetStateTime(long time) + { + _gameStateTime = time; + } + public long GetStateTime() { return _gameStateTime; @@ -446,7 +451,7 @@ public abstract class Game implements Listener //Use this to parse in extra location data from maps } - public void SetPlayerTeam(Player player, GameTeam team) + public void SetPlayerTeam(Player player, GameTeam team, boolean in) { //Clean Old Team GameTeam pastTeam = this.GetTeam(player); @@ -455,7 +460,7 @@ public abstract class Game implements Listener pastTeam.RemovePlayer(player); } - team.AddPlayer(player); + team.AddPlayer(player, in); //Ensure Valid Kit ValidateKit(player, team); @@ -467,8 +472,7 @@ public abstract class Game implements Listener Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); //Save Tournament Team - if (Manager.IsTournamentServer()) - Manager.setTournamentTeam(player, team); + Manager.setTournamentTeam(player, team); } public GameTeam ChooseTeam(Player player) @@ -811,7 +815,7 @@ public abstract class Game implements Listener public boolean CanJoinTeam(GameTeam team) { - return (AutoBalance && !Manager.IsTournamentServer()) ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true; + return (AutoBalance && Manager.IsTeamBalance()) ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true; } public GameTeam GetTeamPreference(Player player) @@ -879,7 +883,7 @@ public abstract class Game implements Listener for (String line : this.GetDesc()) { - UtilPlayer.message(player, C.cWhite + "- " + line); + UtilPlayer.message(player, C.cWhite + " " + line); } UtilPlayer.message(player, ""); @@ -1017,13 +1021,13 @@ public abstract class Game implements Listener return; if (_helpColor == ChatColor.YELLOW) - _helpColor = ChatColor.GREEN; + _helpColor = ChatColor.GOLD; else _helpColor = ChatColor.YELLOW; _helpTimer = System.currentTimeMillis(); - String msg = C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _helpColor + _help[_helpIndex]; + String msg = C.cWhite + C.Bold + "TIP> " + ChatColor.RESET + _helpColor + _help[_helpIndex]; for (Player player : UtilServer.getPlayers()) { @@ -1076,7 +1080,6 @@ public abstract class Game implements Listener Announce(F.elem(player.getName()) + " used a " + F.elem(C.cGreen + "Gem Booster") + " for " + F.elem("+" + (100-(GemBoosters.size()*25)) + "% Gems") + "!"); GemBoosters.add(player.getName()); - Manager.getInventoryManager().addItemToInventory(player, "Utility", "Gem Booster", -1); } public double GetGemBoostAmount() @@ -1091,6 +1094,9 @@ public abstract class Game implements Listener public void AddStat(Player player, String stat, int amount, boolean limitTo1, boolean global) { + if (!Manager.IsRewardStats()) + return; + if (!_stats.containsKey(player)) _stats.put(player, new HashMap()); @@ -1099,6 +1105,9 @@ public abstract class Game implements Listener else stat = GetName() + "." + stat; + if (Manager.IsTournamentServer()) + stat += ".Tournament"; + int past = 0; if (_stats.get(player).containsKey(stat)) past = _stats.get(player).get(stat); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java index 01ce1d93b..10d206029 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java @@ -10,8 +10,27 @@ public class GameServerConfig public int MinPlayers = -1; public int MaxPlayers = -1; public ArrayList GameList = new ArrayList(); + + //Flags public boolean Tournament = false; + public boolean TeamRejoin = false; + public boolean TeamAutoJoin = true; + public boolean TeamForceBalance = true; + + public boolean GameAutoStart = true; + public boolean GameTimeout = true; + + public boolean RewardGems = true; + public boolean RewardItems = true; + public boolean RewardStats = true; + public boolean RewardAchievements = true; + + public boolean HotbarInventory = true; + public boolean HotbarHubClock = true; + + public boolean PlayerKickIdle = true; + public boolean IsValid() { return ServerType != null && MinPlayers != -1 && MaxPlayers != -1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index b4be28aa3..69ef05849 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -134,9 +134,9 @@ public class GameTeam return _spawns.get(UtilMath.r(_spawns.size())); } - public void AddPlayer(Player player) + public void AddPlayer(Player player, boolean in) { - _players.put(player, PlayerState.IN); + _players.put(player, in ? PlayerState.IN : PlayerState.OUT); UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _name + " Team") + "."); @@ -226,7 +226,12 @@ public class GameTeam public void SpawnTeleport() { - for (Player player : GetPlayers(true)) + SpawnTeleport(true); + } + + public void SpawnTeleport(boolean aliveOnly) + { + for (Player player : GetPlayers(aliveOnly)) { SpawnTeleport(player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java index b34578ce8..0729d6de9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/SoloGame.java @@ -131,7 +131,7 @@ public abstract class SoloGame extends Game { List places = _players.GetPlacements(true); - if (places.isEmpty()) + if (places.isEmpty() || !places.get(0).isOnline()) return Arrays.asList(); else return Arrays.asList(places.get(0)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index f6b7a19b5..29eb24571 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -97,7 +97,7 @@ public abstract class TeamGame extends Game GameTeam team = RejoinTeam.remove(event.getPlayer().getName()); if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null) { - team.AddPlayer(event.getPlayer()); + team.AddPlayer(event.getPlayer(), true); Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 28ec0d01f..429a69ef9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -239,7 +239,7 @@ public class DeathTag extends SoloGame if (GetTeam(player) != null) GetTeam(player).SetPlacement(player, PlayerState.OUT); - SetPlayerTeam(player, _chasers); + SetPlayerTeam(player, _chasers, true); //Kit Kit newKit = GetKits()[5]; //Normal diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 109eacde6..927a914aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -18,7 +18,9 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -43,6 +45,27 @@ import nautilus.game.arcade.stats.WinMapStatTracker; public class DragonEscape extends SoloGame { + public static class PlayerFinishEvent extends PlayerEvent + { + private static final HandlerList HANDLER_LIST = new HandlerList(); + + public static HandlerList getHandlerList() + { + return HANDLER_LIST; + } + + public PlayerFinishEvent(Player who) + { + super(who); + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + } + private ArrayList _ranks = new ArrayList(); private ArrayList _lastScoreboard = new ArrayList(); @@ -254,6 +277,8 @@ public class DragonEscape extends SoloGame _winner = player; this.SetCustomWinLine(player.getName() + " reached the end of the course!"); + Bukkit.getPluginManager().callEvent(new PlayerFinishEvent(player)); + return true; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index f2afd6711..23955f66c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -206,7 +206,7 @@ public class Draw extends SoloGame for (Player player : _drawers.GetPlayers(false)) { _drawers.RemovePlayer(player); - _guessers.AddPlayer(player); + _guessers.AddPlayer(player, true); UtilInv.Clear(player); player.setAllowFlight(false); @@ -228,7 +228,7 @@ public class Draw extends SoloGame //Select New Drawer Player drawer = _roundPlayer.remove(0); _guessers.RemovePlayer(drawer); - _drawers.AddPlayer(drawer); + _drawers.AddPlayer(drawer, true); //Get Word String word = _words[UtilMath.r(_words.length)]; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index dac9493dc..49e5724de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -958,7 +958,7 @@ public class HideSeek extends TeamGame public void SetSeeker(Player player, boolean forced) { - SetPlayerTeam(player, _seekers); + SetPlayerTeam(player, _seekers, true); Manager.GetDisguise().undisguise(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 579b47a02..de3ad6e56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -284,7 +284,7 @@ public class MilkCow extends SoloGame if (GetTeam(player) != null) GetTeam(player).SetPlacement(player, PlayerState.OUT); - SetPlayerTeam(player, _cows); + SetPlayerTeam(player, _cows, true); //Kit Kit newKit = GetKits()[2]; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index e87a257f5..0ded820e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -148,7 +148,7 @@ public class ZombieSurvival extends SoloGame GetTeam(player).SetPlacement(player, PlayerState.OUT); //Change to Undead - SetPlayerTeam(player, _undead); + SetPlayerTeam(player, _undead, true); //Kit Kit newKit = this.GetKits()[4]; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java index 19b7dd2a1..cecba6342 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java @@ -1,7 +1,5 @@ package nautilus.game.arcade.managers; -import java.util.HashMap; - import mineplex.core.achievement.Achievement; import mineplex.core.achievement.AchievementData; import mineplex.core.achievement.AchievementLog; @@ -46,7 +44,7 @@ public class GameAchievementManager implements Listener @EventHandler(priority = EventPriority.MONITOR) public void processAchievementLog(final GameStateChangeEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardAchievements()) return; if (event.GetState() != GameState.Dead) @@ -67,6 +65,9 @@ public class GameAchievementManager implements Listener public void displayAchievementLog(final Player player, Game game, NautHashMap log) { + if (!Manager.IsRewardAchievements()) + return; + if (log == null) return; @@ -82,7 +83,7 @@ public class GameAchievementManager implements Listener //Display for (final Achievement type : log.keySet()) { - UtilPlayer.message(player, ""); + AchievementData data = Manager.GetAchievement().get(player, type); @@ -100,6 +101,7 @@ public class GameAchievementManager implements Listener //Finishing for the first time if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName())) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") + " " + F.elem(C.cGreen + C.Bold + "+" + type.getGemReward() + " Gems")); @@ -122,6 +124,7 @@ public class GameAchievementManager implements Listener //Multi-Level Achievements else if (log.get(type).LevelUp) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!")); @@ -132,6 +135,7 @@ public class GameAchievementManager implements Listener //Single Level if (type.getMaxLevel() == 1) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); } @@ -140,12 +144,14 @@ public class GameAchievementManager implements Listener //Multi Level - Almost Finished if (data.getLevel() == type.getMaxLevel() - 1) { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); } //Multi Level - Many levels to go else { + UtilPlayer.message(player, ""); UtilPlayer.message(player, nameLevel + " " + progress + " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 262e76a4b..7c3a4b666 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -43,7 +43,7 @@ public class GameGemManager implements Listener @EventHandler public void PlayerKillAward(CombatDeathEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; Game game = Manager.GetGame(); @@ -91,7 +91,7 @@ public class GameGemManager implements Listener @EventHandler public void PlayerQuit(PlayerQuitEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; Game game = Manager.GetGame(); @@ -103,7 +103,7 @@ public class GameGemManager implements Listener @EventHandler(priority = EventPriority.MONITOR) public void PlayerStateChange(PlayerStateChangeEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; if (event.GetState() != PlayerState.OUT) @@ -118,7 +118,7 @@ public class GameGemManager implements Listener @EventHandler(priority = EventPriority.MONITOR) public void GameStateChange(GameStateChangeEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; if (event.GetState() != GameState.Dead) @@ -130,7 +130,7 @@ public class GameGemManager implements Listener public void RewardGems(Game game, Player player, boolean give) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; //Inform Gems @@ -143,7 +143,7 @@ public class GameGemManager implements Listener public void GiveGems(Game game, Player player, HashMap gems, double gameMult) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; if (gems == null) @@ -183,7 +183,7 @@ public class GameGemManager implements Listener public void AnnounceGems(Game game, Player player, HashMap gems, boolean give) { - if (Manager.IsTournamentServer()) + if (!Manager.IsRewardGems()) return; if (gems == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 251c54dad..42d3a857f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -1157,7 +1157,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener @EventHandler public void InventoryUpdate(UpdateEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsHotbarInventory()) return; if (event.getType() != UpdateType.FAST) @@ -1182,7 +1182,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener @EventHandler(priority = EventPriority.LOWEST) public void GemBoosterInteract(ActivateGemBoosterEvent event) { - if (Manager.IsTournamentServer() || Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit) + if (!Manager.IsHotbarInventory() || Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit) { event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 77035d669..fc421c197 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -123,7 +123,7 @@ public class GameManager implements Listener if (game.GetCountdown() != -1) StateCountdown(game, -1, false); - else if (game.AutoStart && !Manager.IsTournamentServer()) + else if (game.AutoStart && Manager.IsGameAutoStart()) { if (UtilServer.getPlayers().length >= Manager.GetPlayerFull()) StateCountdown(game, 20, false); @@ -160,7 +160,7 @@ public class GameManager implements Listener } else if (game.GetState() == GameState.Live) { - if (UtilTime.elapsed(game.GetStateTime(), game.GameTimeout)) + if (UtilTime.elapsed(game.GetStateTime(), game.GameTimeout) && Manager.IsGameTimeout()) { game.HandleTimeout(); } @@ -274,6 +274,9 @@ public class GameManager implements Listener @EventHandler public void StatEnableDisable(GameStateChangeEvent event) { + if (!Manager.IsRewardStats()) + return; + if (event.GetState() != GameState.Live) return; @@ -288,6 +291,9 @@ public class GameManager implements Listener @EventHandler public void StatRegister(GameStateChangeEvent event) { + if (!Manager.IsRewardStats()) + return; + if (event.GetState() != GameState.Dead) return; @@ -389,7 +395,7 @@ public class GameManager implements Listener } else { - game.SetPlayerTeam(player, team); + game.SetPlayerTeam(player, team, true); } } } @@ -435,10 +441,10 @@ public class GameManager implements Listener //Player Swap queueIterator.remove(); - game.SetPlayerTeam(player, team); + game.SetPlayerTeam(player, team, true); //Other Swap - game.SetPlayerTeam(other, currentTeam); + game.SetPlayerTeam(other, currentTeam, true); break; } @@ -461,7 +467,7 @@ public class GameManager implements Listener { } - else if (!game.IsPlaying(player) && !Manager.IsTournamentServer()) + else if (!game.IsPlaying(player) && Manager.IsTeamAutoJoin()) { PlayerAdd(game, player, null); } @@ -523,7 +529,7 @@ public class GameManager implements Listener if (team == null) return false; - game.SetPlayerTeam(player, team); + game.SetPlayerTeam(player, team, true); //Game Mode player.setGameMode(GameMode.SURVIVAL); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java index a30efc30d..8939bc9cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java @@ -40,7 +40,7 @@ public class IdleManager implements Listener if (event.getType() != UpdateType.FAST) return; - if (Manager.IsTournamentServer()) + if (!Manager.IsPlayerKickIdle()) return; if (Manager.GetGame() == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index a13a2a247..a52a8db5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -113,7 +113,7 @@ public class MiscManager implements Listener @EventHandler public void HubClockUpdate(UpdateEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsHotbarHubClock()) return; if (event.getType() != UpdateType.FAST) @@ -137,7 +137,7 @@ public class MiscManager implements Listener @EventHandler(priority = EventPriority.LOWEST) public void HubClockInteract(PlayerInteractEvent event) { - if (Manager.IsTournamentServer()) + if (!Manager.IsHotbarHubClock()) return; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java index 1192bf03e..23a587b48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java @@ -50,7 +50,7 @@ public class BackstabKillStatTracker extends StatTracker if (player == null) return; - if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Backstab")) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains("Backstab")) { Set hasDamaged = _hasDamaged.get(player.getUniqueId()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java index 4098395aa..c112f622b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java @@ -1,16 +1,22 @@ package nautilus.game.arcade.stats; +import java.util.HashSet; import java.util.List; +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.player.PlayerQuitEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; public class LoseStatTracker extends StatTracker { + private final Set _losers = new HashSet<>(); + public LoseStatTracker(Game game) { super(game); @@ -27,6 +33,9 @@ public class LoseStatTracker extends StatTracker { for (Player loser : losers) { + if (_losers.contains(loser.getUniqueId())) + continue; + addStat(loser, "Losses", 1, false, false); if (getGame().GetKit(loser) != null) @@ -35,4 +44,18 @@ public class LoseStatTracker extends StatTracker } } } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPlayerQuit(PlayerQuitEvent event) + { + if (getGame().GetState() == Game.GameState.Live && getGame().IsAlive(event.getPlayer())) + { + addStat(event.getPlayer(), "Losses", 1, false, false); + + if (getGame().GetKit(event.getPlayer()) != null) + addStat(event.getPlayer(), getGame().GetKit(event.getPlayer()).GetName() + " Losses", 1, false, false); + + _losers.add(event.getPlayer().getUniqueId()); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java index 1c7630a6c..35ee8b797 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/StatTracker.java @@ -27,6 +27,6 @@ public class StatTracker implements Listener public void addStat(Player player, String stat, int value, boolean limitTo1, boolean global) { if (canAddStats()) - addStat(player, stat, value, limitTo1, global); + getGame().AddStat(player, stat, value, limitTo1, global); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java index c5721ab8c..487eb3639 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java @@ -43,7 +43,7 @@ public class TheLongestShotStatTracker extends StatTracker if (player == null) return; - if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("longshot")) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains("Longshot")) { if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java index 61e097f72..29b999f9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinMapStatTracker.java @@ -1,13 +1,10 @@ package nautilus.game.arcade.stats; -import java.util.List; - -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.dragonescape.DragonEscape; public class WinMapStatTracker extends StatTracker { @@ -17,17 +14,8 @@ public class WinMapStatTracker extends StatTracker } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onGameStateChange(GameStateChangeEvent event) + public void onDragonEscapePlayerFinish(DragonEscape.PlayerFinishEvent event) { - if (event.GetState() == Game.GameState.End) - { - List winners = getGame().getWinners(); - - if (winners != null) - { - for (Player winner : winners) - addStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false); - } - } + addStat(event.getPlayer(), "Win." + getGame().WorldData.MapName, 1, true, false); } } diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs index 34bf7c40f..aed5208f5 100644 --- a/Website/LOC.Website.Common/Models/AccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -93,7 +93,7 @@ } // Expire ranks - if ((account.Rank.Name == "ULTRA") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0) + if ((account.Rank.Name == "ULTRA" || account.Rank.Name == "HERO") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0) { account.Rank = repository.Where(x => x.Name == "ALL").First(); repository.Attach(account.Rank); @@ -556,6 +556,77 @@ account.RankExpire = DateTime.Now.AddMonths(1); account.RankPerm = token.Perm; + if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm == true) + { + repository.Attach(account); + repository.Edit(account); + + addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0); + addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Archer", 0, 0); + addAccountTransaction(repository, account, "The Bridges Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Brawler", 0, 0); + addAccountTransaction(repository, account, "The Bridges Miner", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Assassin", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Brawler", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Knight", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Archer", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Zombie", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Traitor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Disruptor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Warper", 0, 0); + addAccountTransaction(repository, account, "Dragons Marksman", 0, 0); + addAccountTransaction(repository, account, "Dragons Pyrotechnic", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Instant Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Shocking Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Radar Hunter", 0, 0); + addAccountTransaction(repository, account, "Block Hunt TNT Hunter", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Machine Gun", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Shotgun", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Brawler", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Enchanter", 0, 0); + addAccountTransaction(repository, account, "Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Runner Frosty", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Archer", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Brute", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Blaze", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Chicken", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Mad Cow", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Creeper", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Enderman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Undead Knight", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Magma Cube", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Pig", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Skeletal Horse", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Sky Squid", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Snowman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Witch", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither Skeleton", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wolf", 0, 0); + addAccountTransaction(repository, account, "Snake Super Snake", 0, 0); + addAccountTransaction(repository, account, "Snake Other Snake", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Ranged Assassin", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Revealer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Archer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Brawler", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Blaster", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Sniper", 0, 0); + addAccountTransaction(repository, account, "Survival Games Archer", 0, 0); + addAccountTransaction(repository, account, "Survival Games Assassin", 0, 0); + addAccountTransaction(repository, account, "Survival Games Beastmaster", 0, 0); + addAccountTransaction(repository, account, "Survival Games Bomber", 0, 0); + addAccountTransaction(repository, account, "Survival Games Brawler", 0, 0); + addAccountTransaction(repository, account, "Survival Games Necromancer", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Infiltrator", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Shredder", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Archer", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Rogue", 0, 0); + } + repository.CommitChanges(); return rank.Name.ToString(); @@ -710,5 +781,24 @@ return clientToken; } } + + private void addAccountTransaction(IRepository repository, Account account, string salesPackageName, int gems, int coins) + { + var accountTransaction = new AccountTransaction + { + Account = account, + SalesPackageName = salesPackageName, + Date = (long)TimeUtil.GetCurrentMilliseconds(), + Gems = gems, + Coins = coins + }; + + if (account.AccountTransactions == null) + account.AccountTransactions = new List { accountTransaction }; + else + { + account.AccountTransactions.Add(accountTransaction); + } + } } } \ No newline at end of file diff --git a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml index bd2a0d731..d6f0e2641 100644 --- a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml +++ b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml @@ -6,7 +6,6 @@ - @@ -17,8 +16,9 @@ - + + @@ -26,6 +26,7 @@ + @@ -56,7 +57,6 @@ - @@ -73,7 +73,6 @@ - @@ -86,7 +85,6 @@ - @@ -103,18 +101,20 @@ + - + + + - @@ -128,17 +128,16 @@ - - - + + @@ -149,7 +148,7 @@ - + @@ -178,8 +177,8 @@ - - + + @@ -188,6 +187,7 @@ + @@ -218,15 +218,15 @@ - - + + - + @@ -240,9 +240,9 @@ - + - + @@ -266,6 +266,7 @@ + @@ -279,7 +280,7 @@ - + @@ -287,6 +288,7 @@ + @@ -322,7 +324,6 @@ - @@ -337,7 +338,6 @@ - @@ -348,9 +348,11 @@ + + @@ -362,19 +364,18 @@ - - + - + @@ -384,16 +385,16 @@ - + + - @@ -410,11 +411,11 @@ - + - + @@ -428,16 +429,14 @@ - - - + @@ -449,23 +448,24 @@ + - + - + - + @@ -476,11 +476,11 @@ - + - - + + @@ -500,9 +500,9 @@ - + - + @@ -516,7 +516,7 @@ - + @@ -529,6 +529,7 @@ + @@ -542,15 +543,14 @@ - + - - + @@ -583,10 +583,10 @@ - + + - @@ -601,6 +601,7 @@ + @@ -612,6 +613,7 @@ + @@ -622,23 +624,24 @@ - - + + - + + - + - + @@ -647,9 +650,10 @@ - + + @@ -660,7 +664,6 @@ - @@ -671,7 +674,7 @@ - + @@ -688,18 +691,16 @@ - - + - + - - + @@ -711,24 +712,23 @@ - - + - + - + @@ -739,15 +739,15 @@ - + - + - + @@ -763,9 +763,9 @@ - + - + @@ -779,7 +779,7 @@ - + @@ -792,6 +792,7 @@ + @@ -805,15 +806,14 @@ - + - - + @@ -848,8 +848,8 @@ + - @@ -864,6 +864,7 @@ + @@ -875,6 +876,7 @@ + @@ -890,18 +892,19 @@ - + + - + - + @@ -910,9 +913,10 @@ - + + @@ -923,7 +927,6 @@ - @@ -934,7 +937,7 @@ - + @@ -952,17 +955,15 @@ - - - + @@ -974,24 +975,23 @@ - - + - + - + @@ -1002,7 +1002,7 @@ - + @@ -1026,9 +1026,9 @@ - + - + @@ -1042,7 +1042,7 @@ - + diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 2ad300218..3f9f119c2 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ