- Fixed water permanently [MCL]
- Fixed team balancing [MCL] - Fixed overjoining [MCL] - Changed bans for quitting ranked matches [MCL]
This commit is contained in:
parent
b105ccb5f1
commit
156982460f
@ -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_STRIKE_EXPIRY = "SELECT strikesExpire FROM rankedBans WHERE accountId = ?;";
|
||||||
private static String GRAB_BAN_EXPIRY = "SELECT banEnd 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 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)
|
public EloRepository(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
@ -133,9 +133,40 @@ public class EloRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void addRankedBan(int accountId)
|
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);
|
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));
|
executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,23 +55,23 @@ public abstract class RankedTeamGame extends TeamGame
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onTeleport(PlayerPrepareTeleportEvent event)
|
public void onTeleport(PlayerPrepareTeleportEvent event)
|
||||||
{
|
{
|
||||||
if (GetPlayers(true).size() >= MaxPlayers)
|
if (GetTeam(event.GetPlayer()).GetPlayers(true).size() > MaxPerTeam)
|
||||||
{
|
|
||||||
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 (MaxPerTeam != -1)
|
if (MaxPerTeam != -1)
|
||||||
{
|
{
|
||||||
SetPlayerState(event.GetPlayer(), GameTeam.PlayerState.OUT);
|
SetPlayerState(event.GetPlayer(), GameTeam.PlayerState.OUT);
|
||||||
Manager.addSpectator(event.GetPlayer(), true);
|
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!"));
|
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)
|
if (MaxPlayers == -1)
|
||||||
return;
|
return;
|
||||||
if (GetPlayers(true).size() < MaxPlayers)
|
if (Bukkit.getOnlinePlayers().size() < MaxPlayers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String message = ChatColor.RED + "This game has reached maximum capacity!";
|
String message = ChatColor.RED + "This game has reached maximum capacity!";
|
||||||
if (Manager.GetClients().Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.HELPER, false))
|
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!";
|
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
|
@EventHandler
|
||||||
@ -111,7 +110,10 @@ public abstract class RankedTeamGame extends TeamGame
|
|||||||
{
|
{
|
||||||
if (InProgress())
|
if (InProgress())
|
||||||
{
|
{
|
||||||
Manager.getEloManager().banFromRanked(getAccountId(event.getPlayer()));
|
if (!Manager.IsObserver(event.getPlayer()))
|
||||||
|
{
|
||||||
|
Manager.getEloManager().banFromRanked(getAccountId(event.getPlayer()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user