diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index dfa4dab7a..97f26c8c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -25,7 +25,7 @@ public class EloRepository extends MinecraftRepository private static String GRAB_STRIKE_EXPIRY = "SELECT strikesExpire FROM rankedBans WHERE accountId = ?;"; private static String GRAB_BAN_EXPIRY = "SELECT banEnd FROM rankedBans WHERE accountId = ?;"; private static String UPDATE_BAN = "INSERT INTO rankedBans (accountId, strikes, strikesExpire, banEnd) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE strikes=VALUES(strikes), strikesExpire=VALUES(strikesExpire), banEnd=VALUES(banEnd);"; - private static String DELETE_STRIKES = "UPDATE rankedBans SET strikes = 0 WHERE accountId = ?;"; + private static String DELETE_STRIKES = "UPDATE rankedBans SET strikes = 1 WHERE accountId = ?;"; public EloRepository(JavaPlugin plugin) { @@ -133,9 +133,40 @@ public class EloRepository extends MinecraftRepository public void addRankedBan(int accountId) { - long banEnd = System.currentTimeMillis() + UtilTime.convert(1 + getStrikes(accountId), TimeUnit.MINUTES, TimeUnit.MILLISECONDS); + int minutes = 1; + switch (getStrikes(accountId)) + { + case 0: + minutes = 1; + break; + case 1: + minutes = 5; + break; + case 2: + minutes = 10; + break; + case 3: + minutes = 20; + break; + case 4: + minutes = 30; + break; + case 5: + minutes = 60; + break; + case 6: + minutes = 120; + break; + case 7: + minutes = 180; + break; + case 8: + minutes = 240; + break; + } + long banEnd = System.currentTimeMillis() + UtilTime.convert(minutes, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); long strikesExpire = System.currentTimeMillis() + UtilTime.convert(1, TimeUnit.DAYS, TimeUnit.MILLISECONDS); - int newStrikes = Math.min(getStrikes(accountId) + 1, 9); + int newStrikes = Math.min(getStrikes(accountId) + 1, 8); executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/RankedTeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/RankedTeamGame.java index 9610a004d..450b3a4de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/RankedTeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/RankedTeamGame.java @@ -55,23 +55,23 @@ public abstract class RankedTeamGame extends TeamGame @EventHandler(priority = EventPriority.HIGHEST) public void onTeleport(PlayerPrepareTeleportEvent event) { - if (GetPlayers(true).size() >= MaxPlayers) - { - if (MaxPlayers != -1) - { - SetPlayerState(event.GetPlayer(), GameTeam.PlayerState.OUT); - Manager.addSpectator(event.GetPlayer(), true); - event.GetPlayer().sendMessage(F.main("Game", "This game has reached maximum capacity!")); - } - } - - if (GetTeam(event.GetPlayer()).GetPlayers(true).size() >= MaxPerTeam) + if (GetTeam(event.GetPlayer()).GetPlayers(true).size() > MaxPerTeam) { if (MaxPerTeam != -1) { SetPlayerState(event.GetPlayer(), GameTeam.PlayerState.OUT); Manager.addSpectator(event.GetPlayer(), true); + RemoveTeamPreference(event.GetPlayer()); + GetPlayerKits().remove(event.GetPlayer()); + GetPlayerGems().remove(event.GetPlayer()); + GameTeam team = GetTeam(event.GetPlayer()); + + if (team != null) + { + team.RemovePlayer(event.GetPlayer()); + } event.GetPlayer().sendMessage(F.main("Game", "This game has reached maximum capacity!")); + return; } } } @@ -88,9 +88,8 @@ public abstract class RankedTeamGame extends TeamGame } if (MaxPlayers == -1) return; - if (GetPlayers(true).size() < MaxPlayers) + if (Bukkit.getOnlinePlayers().size() < MaxPlayers) return; - String message = ChatColor.RED + "This game has reached maximum capacity!"; if (Manager.GetClients().Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.HELPER, false)) { @@ -103,7 +102,7 @@ public abstract class RankedTeamGame extends TeamGame message = message + " You may join for moderation purposes after the game has started!"; } } - event.disallow(Result.KICK_FULL, message); + event.disallow(Result.KICK_OTHER, message); } @EventHandler @@ -111,7 +110,10 @@ public abstract class RankedTeamGame extends TeamGame { if (InProgress()) { - Manager.getEloManager().banFromRanked(getAccountId(event.getPlayer())); + if (!Manager.IsObserver(event.getPlayer())) + { + Manager.getEloManager().banFromRanked(getAccountId(event.getPlayer())); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java index acb4180b5..970227fe3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java @@ -1864,6 +1864,10 @@ public class MinecraftLeague extends RankedTeamGame } } } + if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) + { + event.setCancelled(true); + } } @EventHandler(ignoreCancelled=true) @@ -2069,16 +2073,4 @@ public class MinecraftLeague extends RankedTeamGame } } } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onFlow(BlockFromToEvent event) - { - if (!IsLive()) - return; - - if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() == Material.STATIONARY_WATER) - { - event.setCancelled(true); - } - } }