Merge pull request #54 from bobby29831/1.4.3
More refactoring for cleaner code
This commit is contained in:
commit
6ec675b8be
15 changed files with 144 additions and 107 deletions
2
.github/workflows/beta.yml
vendored
2
.github/workflows/beta.yml
vendored
|
@ -30,7 +30,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: ${{ runner.os }}-m2
|
restore-keys: ${{ runner.os }}-m2
|
||||||
|
|
||||||
- name: Upload artificats
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: artifacts-beta
|
name: artifacts-beta
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SetBorder implements ICommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
worldborderEnabled = false;
|
worldBorderEnabled = false;
|
||||||
addToConfig("worldBorder.enabled",false);
|
addToConfig("worldBorder.enabled",false);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE"));
|
sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE"));
|
||||||
|
@ -68,26 +68,26 @@ public class SetBorder implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE"));
|
sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector newWorldborderPosition = new Vector();
|
Vector vec = new Vector();
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
newWorldborderPosition.setX(player.getLocation().getBlockX());
|
vec.setX(player.getLocation().getBlockX());
|
||||||
newWorldborderPosition.setY(0);
|
vec.setY(0);
|
||||||
newWorldborderPosition.setZ(player.getLocation().getBlockZ());
|
vec.setZ(player.getLocation().getBlockZ());
|
||||||
if (spawnPosition.distance(newWorldborderPosition) > 100) {
|
if (spawnPosition.distance(vec) > 100) {
|
||||||
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
|
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
worldborderPosition = newWorldborderPosition;
|
worldBorderPosition = vec;
|
||||||
worldborderSize = num;
|
worldBorderSize = num;
|
||||||
worldborderDelay = delay;
|
worldBorderDelay = delay;
|
||||||
worldborderChange = change;
|
worldBorderChange = change;
|
||||||
worldborderEnabled = true;
|
worldBorderEnabled = true;
|
||||||
addToConfig("worldBorder.x", worldborderPosition.getBlockX());
|
addToConfig("worldBorder.x", worldBorderPosition.getBlockX());
|
||||||
addToConfig("worldBorder.z", worldborderPosition.getBlockZ());
|
addToConfig("worldBorder.z", worldBorderPosition.getBlockZ());
|
||||||
addToConfig("worldBorder.delay", worldborderDelay);
|
addToConfig("worldBorder.delay", worldBorderDelay);
|
||||||
addToConfig("worldBorder.size", worldborderSize);
|
addToConfig("worldBorder.size", worldBorderSize);
|
||||||
addToConfig("worldBorder.enabled", true);
|
addToConfig("worldBorder.enabled", true);
|
||||||
addToConfig("worldBorder.move", worldborderChange);
|
addToConfig("worldBorder.move", worldBorderChange);
|
||||||
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
|
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
Main.getInstance().getGame().getBorder().resetWorldBorder(spawnWorld);
|
Main.getInstance().getGame().getBorder().resetWorldBorder(spawnWorld);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class Top implements ICommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(PlayerInfo info : infos) {
|
for(PlayerInfo info : infos) {
|
||||||
String name = Main.getInstance().getServer().getOfflinePlayer(info.uuid).getName();
|
String name = Main.getInstance().getServer().getOfflinePlayer(info.getUniqueId()).getName();
|
||||||
ChatColor color;
|
ChatColor color;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 1: color = ChatColor.YELLOW; break;
|
case 1: color = ChatColor.YELLOW; break;
|
||||||
|
@ -63,7 +63,7 @@ public class Top implements ICommand {
|
||||||
default: color = ChatColor.WHITE; break;
|
default: color = ChatColor.WHITE; break;
|
||||||
}
|
}
|
||||||
message.append(String.format("%s%s. %s%s %s%s\n",
|
message.append(String.format("%s%s. %s%s %s%s\n",
|
||||||
color, i, ChatColor.RED, info.seeker_wins+info.hider_wins, ChatColor.WHITE, name));
|
color, i, ChatColor.RED, info.getSeekerWins() +info.getHiderWins(), ChatColor.WHITE, name));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
sender.sendMessage(message.toString());
|
sender.sendMessage(message.toString());
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class Wins implements ICommand {
|
||||||
message = message + message("INFORMATION_FOR").addPlayer(name) + "\n";
|
message = message + message("INFORMATION_FOR").addPlayer(name) + "\n";
|
||||||
message = message + "==============================\n";
|
message = message + "==============================\n";
|
||||||
message = message + String.format("%sTOTAL WINS: %s%s\n%sHIDER WINS: %s%s\n%sSEEKER WINS: %s%s\n%sGAMES PLAYED: %s",
|
message = message + String.format("%sTOTAL WINS: %s%s\n%sHIDER WINS: %s%s\n%sSEEKER WINS: %s%s\n%sGAMES PLAYED: %s",
|
||||||
ChatColor.YELLOW, ChatColor.WHITE, info.seeker_wins+info.hider_wins, ChatColor.GOLD, ChatColor.WHITE, info.hider_wins,
|
ChatColor.YELLOW, ChatColor.WHITE, info.getSeekerWins() +info.getHiderWins(), ChatColor.GOLD, ChatColor.WHITE, info.getHiderWins(),
|
||||||
ChatColor.RED, ChatColor.WHITE, info.seeker_wins, ChatColor.WHITE, info.seeker_games+info.hider_games);
|
ChatColor.RED, ChatColor.WHITE, info.getSeekerWins(), ChatColor.WHITE, info.getSeekerGames() +info.getHiderGames());
|
||||||
message = message + ChatColor.WHITE + "" + ChatColor.BOLD + "\n==============================";
|
message = message + ChatColor.WHITE + "" + ChatColor.BOLD + "\n==============================";
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SetSpawnLocation implements ICommand {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
LocationUtils.setLocation(player, Locations.GAME, vector -> {
|
LocationUtils.setLocation(player, Locations.GAME, vector -> {
|
||||||
if (worldborderEnabled && vector.distance(worldborderPosition) > 100) {
|
if (worldBorderEnabled && vector.distance(worldBorderPosition) > 100) {
|
||||||
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
|
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
|
||||||
throw new RuntimeException("World border not enabled or not in valid position!");
|
throw new RuntimeException("World border not enabled or not in valid position!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ public class Config {
|
||||||
messagePrefix,
|
messagePrefix,
|
||||||
errorPrefix,
|
errorPrefix,
|
||||||
tauntPrefix,
|
tauntPrefix,
|
||||||
worldborderPrefix,
|
worldBorderPrefix,
|
||||||
abortPrefix,
|
abortPrefix,
|
||||||
gameoverPrefix,
|
gameOverPrefix,
|
||||||
warningPrefix,
|
warningPrefix,
|
||||||
spawnWorld,
|
spawnWorld,
|
||||||
exitWorld,
|
exitWorld,
|
||||||
|
@ -62,13 +62,13 @@ public class Config {
|
||||||
spawnPosition,
|
spawnPosition,
|
||||||
lobbyPosition,
|
lobbyPosition,
|
||||||
exitPosition,
|
exitPosition,
|
||||||
worldborderPosition;
|
worldBorderPosition;
|
||||||
|
|
||||||
public static boolean
|
public static boolean
|
||||||
nametagsVisible,
|
nameTagsVisible,
|
||||||
permissionsRequired,
|
permissionsRequired,
|
||||||
announceMessagesToNonPlayers,
|
announceMessagesToNonPlayers,
|
||||||
worldborderEnabled,
|
worldBorderEnabled,
|
||||||
tauntEnabled,
|
tauntEnabled,
|
||||||
tauntCountdown,
|
tauntCountdown,
|
||||||
tauntLast,
|
tauntLast,
|
||||||
|
@ -87,10 +87,10 @@ public class Config {
|
||||||
|
|
||||||
public static int
|
public static int
|
||||||
minPlayers,
|
minPlayers,
|
||||||
worldborderSize,
|
worldBorderSize,
|
||||||
worldborderDelay,
|
worldBorderDelay,
|
||||||
currentWorldborderSize,
|
currentWorldborderSize,
|
||||||
worldborderChange,
|
worldBorderChange,
|
||||||
gameLength,
|
gameLength,
|
||||||
saveMinX,
|
saveMinX,
|
||||||
saveMinZ,
|
saveMinZ,
|
||||||
|
@ -183,15 +183,15 @@ public class Config {
|
||||||
exitWorld = config.getString("spawns.exit.world");
|
exitWorld = config.getString("spawns.exit.world");
|
||||||
|
|
||||||
//World border
|
//World border
|
||||||
worldborderPosition = new Vector(
|
worldBorderPosition = new Vector(
|
||||||
config.getInt("worldBorder.x"),
|
config.getInt("worldBorder.x"),
|
||||||
0,
|
0,
|
||||||
config.getInt("worldBorder.z")
|
config.getInt("worldBorder.z")
|
||||||
);
|
);
|
||||||
worldborderSize = Math.max(100, config.getInt("worldBorder.size"));
|
worldBorderSize = Math.max(100, config.getInt("worldBorder.size"));
|
||||||
worldborderDelay = Math.max(1, config.getInt("worldBorder.delay"));
|
worldBorderDelay = Math.max(1, config.getInt("worldBorder.delay"));
|
||||||
worldborderEnabled = config.getBoolean("worldBorder.enabled");
|
worldBorderEnabled = config.getBoolean("worldBorder.enabled");
|
||||||
worldborderChange = config.getInt("worldBorder.moveAmount");
|
worldBorderChange = config.getInt("worldBorder.moveAmount");
|
||||||
|
|
||||||
//Prefix
|
//Prefix
|
||||||
char SYMBOLE = '\u00A7';
|
char SYMBOLE = '\u00A7';
|
||||||
|
@ -200,9 +200,9 @@ public class Config {
|
||||||
messagePrefix = config.getString("prefix.default").replace("&", SYMBOLE_STRING);
|
messagePrefix = config.getString("prefix.default").replace("&", SYMBOLE_STRING);
|
||||||
errorPrefix = config.getString("prefix.error").replace("&", SYMBOLE_STRING);
|
errorPrefix = config.getString("prefix.error").replace("&", SYMBOLE_STRING);
|
||||||
tauntPrefix = config.getString("prefix.taunt").replace("&", SYMBOLE_STRING);
|
tauntPrefix = config.getString("prefix.taunt").replace("&", SYMBOLE_STRING);
|
||||||
worldborderPrefix = config.getString("prefix.border").replace("&", SYMBOLE_STRING);
|
worldBorderPrefix = config.getString("prefix.border").replace("&", SYMBOLE_STRING);
|
||||||
abortPrefix = config.getString("prefix.abort").replace("&", SYMBOLE_STRING);
|
abortPrefix = config.getString("prefix.abort").replace("&", SYMBOLE_STRING);
|
||||||
gameoverPrefix = config.getString("prefix.gameover").replace("&", SYMBOLE_STRING);
|
gameOverPrefix = config.getString("prefix.gameover").replace("&", SYMBOLE_STRING);
|
||||||
warningPrefix = config.getString("prefix.warning").replace("&", SYMBOLE_STRING);
|
warningPrefix = config.getString("prefix.warning").replace("&", SYMBOLE_STRING);
|
||||||
|
|
||||||
//Map Bounds
|
//Map Bounds
|
||||||
|
@ -248,7 +248,7 @@ public class Config {
|
||||||
ringingSound = ringingOptional.orElse(XSound.BLOCK_NOTE_BLOCK_PLING);
|
ringingSound = ringingOptional.orElse(XSound.BLOCK_NOTE_BLOCK_PLING);
|
||||||
|
|
||||||
//Other
|
//Other
|
||||||
nametagsVisible = config.getBoolean("nametagsVisible");
|
nameTagsVisible = config.getBoolean("nametagsVisible");
|
||||||
permissionsRequired = config.getBoolean("permissionsRequired");
|
permissionsRequired = config.getBoolean("permissionsRequired");
|
||||||
gameLength = config.getInt("gameLength");
|
gameLength = config.getInt("gameLength");
|
||||||
pvpEnabled = config.getBoolean("pvp");
|
pvpEnabled = config.getBoolean("pvp");
|
||||||
|
|
|
@ -23,25 +23,62 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerInfo {
|
public class PlayerInfo {
|
||||||
|
|
||||||
public final UUID uuid;
|
private final UUID uniqueId;
|
||||||
public final int hider_wins;
|
private final int hiderWins;
|
||||||
public final int seeker_wins;
|
private final int seekerWins;
|
||||||
public final int hider_games;
|
private final int hiderGames;
|
||||||
public final int seeker_games;
|
private final int seekerGames;
|
||||||
public final int hider_kills;
|
private final int hiderKills;
|
||||||
public final int seeker_kills;
|
private final int seekerKills;
|
||||||
public final int hider_deaths;
|
private final int hiderDeaths;
|
||||||
public final int seeker_deaths;
|
private final int seekerDeaths;
|
||||||
|
|
||||||
public PlayerInfo(UUID uuid, int hider_wins, int seeker_wins, int hider_games, int seeker_games, int hider_kills, int seeker_kills, int hider_deaths, int seeker_deaths) {
|
public PlayerInfo(UUID uniqueId, int hiderWins, int seekerWins, int hiderGames, int seekerGames, int hiderKills, int seekerKills, int hiderDeaths, int seekerDeaths) {
|
||||||
this.uuid = uuid;
|
this.uniqueId = uniqueId;
|
||||||
this.hider_wins = hider_wins;
|
this.hiderWins = hiderWins;
|
||||||
this.seeker_wins = seeker_wins;
|
this.seekerWins = seekerWins;
|
||||||
this.hider_games = hider_games;
|
this.hiderGames = hiderGames;
|
||||||
this.seeker_games = seeker_games;
|
this.seekerGames = seekerGames;
|
||||||
this.hider_kills = hider_kills;
|
this.hiderKills = hiderKills;
|
||||||
this.seeker_kills = seeker_kills;
|
this.seekerKills = seekerKills;
|
||||||
this.hider_deaths = hider_deaths;
|
this.hiderDeaths = hiderDeaths;
|
||||||
this.seeker_deaths = seeker_deaths;
|
this.seekerDeaths = seekerDeaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHiderWins() {
|
||||||
|
return hiderWins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeekerWins() {
|
||||||
|
return seekerWins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHiderGames() {
|
||||||
|
return hiderGames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeekerGames() {
|
||||||
|
return seekerGames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHiderKills() {
|
||||||
|
return hiderKills;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeekerKills() {
|
||||||
|
return seekerKills;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHiderDeaths() {
|
||||||
|
return hiderDeaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeekerDeaths() {
|
||||||
|
return seekerDeaths;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,14 +177,14 @@ public class PlayerInfoTable {
|
||||||
}
|
}
|
||||||
try(Connection connection = database.connect(); PreparedStatement statement = connection.prepareStatement(sql)) {
|
try(Connection connection = database.connect(); PreparedStatement statement = connection.prepareStatement(sql)) {
|
||||||
statement.setBytes(1, database.encodeUUID(uuid));
|
statement.setBytes(1, database.encodeUUID(uuid));
|
||||||
statement.setInt(2, info.hider_wins + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0));
|
statement.setInt(2, info.getHiderWins() + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0));
|
||||||
statement.setInt(3, info.seeker_wins + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0));
|
statement.setInt(3, info.getSeekerWins() + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0));
|
||||||
statement.setInt(4, info.hider_games + (board.isHider(uuid) || (board.isSeeker(uuid) && !board.getFirstSeeker().getUniqueId().equals(uuid)) ? 1 : 0));
|
statement.setInt(4, info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && !board.getFirstSeeker().getUniqueId().equals(uuid)) ? 1 : 0));
|
||||||
statement.setInt(5, info.seeker_games + (board.getFirstSeeker().getUniqueId().equals(uuid) ? 1 : 0));
|
statement.setInt(5, info.getSeekerGames() + (board.getFirstSeeker().getUniqueId().equals(uuid) ? 1 : 0));
|
||||||
statement.setInt(6, info.hider_kills + hider_kills.getOrDefault(uuid.toString(), 0));
|
statement.setInt(6, info.getHiderKills() + hider_kills.getOrDefault(uuid.toString(), 0));
|
||||||
statement.setInt(7, info.seeker_kills + seeker_kills.getOrDefault(uuid.toString(), 0));
|
statement.setInt(7, info.getSeekerKills() + seeker_kills.getOrDefault(uuid.toString(), 0));
|
||||||
statement.setInt(8, info.hider_deaths + hider_deaths.getOrDefault(uuid.toString(), 0));
|
statement.setInt(8, info.getHiderDeaths() + hider_deaths.getOrDefault(uuid.toString(), 0));
|
||||||
statement.setInt(9, info.seeker_deaths + seeker_deaths.getOrDefault(uuid.toString(), 0));
|
statement.setInt(9, info.getSeekerDeaths() + seeker_deaths.getOrDefault(uuid.toString(), 0));
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
|
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
|
||||||
|
|
|
@ -265,7 +265,7 @@ public class Board {
|
||||||
String value = getTeam(player);
|
String value = getTeam(player);
|
||||||
board.setLine(String.valueOf(i), line.replace("{TEAM}", value));
|
board.setLine(String.valueOf(i), line.replace("{TEAM}", value));
|
||||||
} else if (line.contains("{BORDER}")) {
|
} else if (line.contains("{BORDER}")) {
|
||||||
if (!worldborderEnabled) continue;
|
if (!worldBorderEnabled) continue;
|
||||||
if (worldBorder == null || status == Status.STARTING) {
|
if (worldBorder == null || status == Status.STARTING) {
|
||||||
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replace("{AMOUNT}", "0")));
|
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replace("{AMOUNT}", "0")));
|
||||||
} else if (!worldBorder.isRunning()) {
|
} else if (!worldBorder.isRunning()) {
|
||||||
|
@ -401,7 +401,7 @@ class CustomBoard {
|
||||||
for(Player player : Main.getInstance().getBoard().getSeekers())
|
for(Player player : Main.getInstance().getBoard().getSeekers())
|
||||||
seekerTeam.addEntry(player.getName());
|
seekerTeam.addEntry(player.getName());
|
||||||
if (Version.atLeast("1.9")) {
|
if (Version.atLeast("1.9")) {
|
||||||
if (nametagsVisible) {
|
if (nameTagsVisible) {
|
||||||
hiderTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
hiderTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||||
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OTHER_TEAMS);
|
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OTHER_TEAMS);
|
||||||
} else {
|
} else {
|
||||||
|
@ -409,7 +409,7 @@ class CustomBoard {
|
||||||
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
|
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (nametagsVisible) {
|
if (nameTagsVisible) {
|
||||||
hiderTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
hiderTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
||||||
seekerTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OWN_TEAM);
|
seekerTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OWN_TEAM);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class Game {
|
||||||
board.reloadGameBoards();
|
board.reloadGameBoards();
|
||||||
gameTimer--;
|
gameTimer--;
|
||||||
}
|
}
|
||||||
if (worldborderEnabled) worldBorder.update();
|
if (worldBorderEnabled) worldBorder.update();
|
||||||
if (tauntEnabled) taunt.update();
|
if (tauntEnabled) taunt.update();
|
||||||
if (glowEnabled) glow.update();
|
if (glowEnabled) glow.update();
|
||||||
}
|
}
|
||||||
|
@ -336,12 +336,12 @@ public class Game {
|
||||||
private void checkWinConditions() {
|
private void checkWinConditions() {
|
||||||
if (board.sizeHider() < 1) {
|
if (board.sizeHider() < 1) {
|
||||||
if (hiderLeft) {
|
if (hiderLeft) {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
stop(WinType.NONE);
|
stop(WinType.NONE);
|
||||||
} else {
|
} else {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
stop(WinType.SEEKER_WIN);
|
stop(WinType.SEEKER_WIN);
|
||||||
}
|
}
|
||||||
} else if (board.sizeSeeker() < 1) {
|
} else if (board.sizeSeeker() < 1) {
|
||||||
|
@ -349,8 +349,8 @@ public class Game {
|
||||||
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
stop(WinType.NONE);
|
stop(WinType.NONE);
|
||||||
} else if (gameTimer < 1) {
|
} else if (gameTimer < 1) {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
stop(WinType.HIDER_WIN);
|
stop(WinType.HIDER_WIN);
|
||||||
}
|
}
|
||||||
hiderLeft = false;
|
hiderLeft = false;
|
||||||
|
|
|
@ -13,31 +13,31 @@ public class Border {
|
||||||
private boolean running;
|
private boolean running;
|
||||||
|
|
||||||
public Border() {
|
public Border() {
|
||||||
delay = 60 * worldborderDelay;
|
delay = 60 * worldBorderDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
if (delay == 30 && !running) {
|
if (delay == 30 && !running) {
|
||||||
Main.getInstance().getGame().broadcastMessage(worldborderPrefix + message("WORLDBORDER_WARN"));
|
Main.getInstance().getGame().broadcastMessage(worldBorderPrefix + message("WORLDBORDER_WARN"));
|
||||||
} else if (delay == 0) {
|
} else if (delay == 0) {
|
||||||
if (running) {
|
if (running) {
|
||||||
delay = 60 * worldborderDelay;
|
delay = 60 * worldBorderDelay;
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
else decreaceWorldborder();
|
else decreaseWorldBorder();
|
||||||
}
|
}
|
||||||
delay--;
|
delay--;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decreaceWorldborder() {
|
private void decreaseWorldBorder() {
|
||||||
if (currentWorldborderSize == 100) return;
|
if (currentWorldborderSize == 100) return;
|
||||||
int change = worldborderChange;
|
int change = worldBorderChange;
|
||||||
if (currentWorldborderSize-worldborderChange < 100) {
|
if (currentWorldborderSize-worldBorderChange < 100) {
|
||||||
change = currentWorldborderSize-100;
|
change = currentWorldborderSize-100;
|
||||||
}
|
}
|
||||||
running = true;
|
running = true;
|
||||||
Main.getInstance().getGame().broadcastMessage(worldborderPrefix + message("WORLDBORDER_DECREASING").addAmount(change));
|
Main.getInstance().getGame().broadcastMessage(worldBorderPrefix + message("WORLDBORDER_DECREASING").addAmount(change));
|
||||||
currentWorldborderSize -= worldborderChange;
|
currentWorldborderSize -= worldBorderChange;
|
||||||
World world = Bukkit.getWorld(Main.getInstance().getGame().getGameWorld());
|
World world = Bukkit.getWorld(Main.getInstance().getGame().getGameWorld());
|
||||||
assert world != null;
|
assert world != null;
|
||||||
org.bukkit.WorldBorder border = world.getWorldBorder();
|
org.bukkit.WorldBorder border = world.getWorldBorder();
|
||||||
|
@ -49,15 +49,15 @@ public class Border {
|
||||||
World world = Bukkit.getWorld(worldName);
|
World world = Bukkit.getWorld(worldName);
|
||||||
assert world != null;
|
assert world != null;
|
||||||
org.bukkit.WorldBorder border = world.getWorldBorder();
|
org.bukkit.WorldBorder border = world.getWorldBorder();
|
||||||
if (worldborderEnabled) {
|
if (worldBorderEnabled) {
|
||||||
border.setSize(worldborderSize);
|
border.setSize(worldBorderSize);
|
||||||
border.setCenter(worldborderPosition.getX(), worldborderPosition.getZ());
|
border.setCenter(worldBorderPosition.getX(), worldBorderPosition.getZ());
|
||||||
currentWorldborderSize = worldborderSize;
|
currentWorldborderSize = worldBorderSize;
|
||||||
} else {
|
} else {
|
||||||
border.setSize(30000000);
|
border.setSize(30000000);
|
||||||
border.setCenter(0, 0);
|
border.setCenter(0, 0);
|
||||||
}
|
}
|
||||||
delay = 60 * worldborderDelay;
|
delay = 60 * worldBorderDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDelay() {
|
public int getDelay() {
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class CommandHandler {
|
||||||
try {
|
try {
|
||||||
COMMAND_REGISTER.get(args[0].toLowerCase()).execute(sender,Arrays.copyOfRange(args, 1, args.length));
|
COMMAND_REGISTER.get(args[0].toLowerCase()).execute(sender,Arrays.copyOfRange(args, 1, args.length));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
sender.sendMessage(errorPrefix + "An error has occured.");
|
sender.sendMessage(errorPrefix + "An error has occurred.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
||||||
if (args[0].equals("rank-score")) {
|
if (args[0].equals("rank-score")) {
|
||||||
return getValue(info, args[1]);
|
return getValue(info, args[1]);
|
||||||
} else {
|
} else {
|
||||||
return Main.getInstance().getServer().getOfflinePlayer(info.uuid).getName();
|
return Main.getInstance().getServer().getOfflinePlayer(info.getUniqueId()).getName();
|
||||||
}
|
}
|
||||||
} else if (args[0].equals("rank-place") && args.length == 2) {
|
} else if (args[0].equals("rank-place") && args.length == 2) {
|
||||||
if (getRanking(args[1]) == null) { return placeholderError; }
|
if (getRanking(args[1]) == null) { return placeholderError; }
|
||||||
|
@ -83,29 +83,29 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
||||||
if (query == null) return null;
|
if (query == null) return null;
|
||||||
switch (query) {
|
switch (query) {
|
||||||
case "total-wins":
|
case "total-wins":
|
||||||
return String.valueOf(info.hider_wins + info.seeker_wins);
|
return String.valueOf(info.getHiderWins() + info.getSeekerWins());
|
||||||
case "hider-wins":
|
case "hider-wins":
|
||||||
return String.valueOf(info.hider_wins);
|
return String.valueOf(info.getHiderWins());
|
||||||
case "seeker-wins":
|
case "seeker-wins":
|
||||||
return String.valueOf(info.seeker_wins);
|
return String.valueOf(info.getSeekerWins());
|
||||||
case "total-games":
|
case "total-games":
|
||||||
return String.valueOf(info.hider_games + info.seeker_games);
|
return String.valueOf(info.getHiderGames() + info.getSeekerGames());
|
||||||
case "hider-games":
|
case "hider-games":
|
||||||
return String.valueOf(info.hider_games);
|
return String.valueOf(info.getHiderGames());
|
||||||
case "seeker-games":
|
case "seeker-games":
|
||||||
return String.valueOf(info.seeker_games);
|
return String.valueOf(info.getSeekerGames());
|
||||||
case "total-kills":
|
case "total-kills":
|
||||||
return String.valueOf(info.hider_kills + info.seeker_kills);
|
return String.valueOf(info.getHiderKills() + info.getSeekerKills());
|
||||||
case "hider-kills":
|
case "hider-kills":
|
||||||
return String.valueOf(info.hider_kills);
|
return String.valueOf(info.getHiderKills());
|
||||||
case "seeker-kills":
|
case "seeker-kills":
|
||||||
return String.valueOf(info.seeker_kills);
|
return String.valueOf(info.getSeekerKills());
|
||||||
case "total-deaths":
|
case "total-deaths":
|
||||||
return String.valueOf(info.hider_deaths + info.seeker_deaths);
|
return String.valueOf(info.getHiderDeaths() + info.getSeekerDeaths());
|
||||||
case "hider-deaths":
|
case "hider-deaths":
|
||||||
return String.valueOf(info.hider_deaths);
|
return String.valueOf(info.getHiderDeaths());
|
||||||
case "seeker-deaths":
|
case "seeker-deaths":
|
||||||
return String.valueOf(info.seeker_deaths);
|
return String.valueOf(info.getSeekerDeaths());
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue