1.7.5 rc3

This commit is contained in:
Murphy 2023-07-29 15:54:12 -04:00
parent 062defa285
commit b01a4fd3c0
9 changed files with 76 additions and 25 deletions

View file

@ -67,6 +67,7 @@ public class Config {
dropItems, dropItems,
respawnAsSpectator, respawnAsSpectator,
waitTillNoneLeft, waitTillNoneLeft,
gameOverTitle,
regenHealth; regenHealth;
public static int public static int
@ -86,7 +87,8 @@ public class Config {
flightToggleItemPosition, flightToggleItemPosition,
teleportItemPosition, teleportItemPosition,
startingSeekerCount, startingSeekerCount,
delayedRespawnDelay; delayedRespawnDelay,
endGameDelay;
public static float public static float
seekerPingLeadingVolume, seekerPingLeadingVolume,
@ -196,6 +198,8 @@ public class Config {
saveInventory = config.getBoolean("saveInventory"); saveInventory = config.getBoolean("saveInventory");
respawnAsSpectator = config.getBoolean("respawnAsSpectator"); respawnAsSpectator = config.getBoolean("respawnAsSpectator");
dontRewardQuit = config.getBoolean("dontRewardQuit"); dontRewardQuit = config.getBoolean("dontRewardQuit");
endGameDelay = Math.max(0,config.getInt("endGameDelay"));
gameOverTitle = config.getBoolean("gameOverTitle");
try { try {
countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay")); countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay"));

View file

@ -15,12 +15,14 @@ public class Localization {
put("en-US", new String[][]{ put("en-US", new String[][]{
{"WORLDBORDER_DECREASING"}, {"WORLDBORDER_DECREASING"},
{"START","TAUNTED"}, {"START","TAUNTED"},
{"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"} {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"},
{"GAME_PLAYER_FOUND", "GAME_PLAYER_FOUND_BY"}
}); });
put("de-DE", new String[][]{ put("de-DE", new String[][]{
{}, {},
{"TAUNTED"}, {"TAUNTED"},
{"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"} {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"},
{"GAME_PLAYER_FOUND", "GAME_PLAYER_FOUND_BY"}
}); });
}}; }};

View file

@ -34,6 +34,10 @@ public class Board {
return Players.containsKey(player.getUniqueId()); return Players.containsKey(player.getUniqueId());
} }
public boolean containsUUID(UUID uuid) {
return Players.containsKey(uuid);
}
public boolean isHider(Player player) { public boolean isHider(Player player) {
return isHider(player.getUniqueId()); return isHider(player.getUniqueId());
} }
@ -418,13 +422,8 @@ class CustomBoard {
seekerTeam.setNameTagVisibility(NameTagVisibility.NEVER); seekerTeam.setNameTagVisibility(NameTagVisibility.NEVER);
} }
} }
if (Main.getInstance().supports(12)) { hiderTeam.setPrefix(message("HIDER_TEAM_NAME").toString() + " " + ChatColor.RESET);
hiderTeam.setColor(ChatColor.GOLD); seekerTeam.setPrefix(message("SEEKER_TEAM_NAME").toString() + " " + ChatColor.RESET);
seekerTeam.setColor(ChatColor.RED);
} else {
hiderTeam.setPrefix(ChatColor.translateAlternateColorCodes('&', "&6"));
seekerTeam.setPrefix(ChatColor.translateAlternateColorCodes('&', "&c"));
}
} }
public void setLine(String key, String message) { public void setLine(String key, String message) {

View file

@ -151,7 +151,7 @@ public class Game {
} }
Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type); Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type);
} }
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, 5*20); Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, endGameDelay*20);
} }
public void end() { public void end() {
@ -347,6 +347,12 @@ public class Game {
} }
} }
public void broadcastTitle(String title, String subtitle) {
for (Player player : board.getPlayers()) {
Titles.sendTitle(player, 10, 70, 20, title, subtitle);
}
}
public boolean isCurrentMapValid() { public boolean isCurrentMapValid() {
return currentMap != null && !currentMap.isNotSetup(); return currentMap != null && !currentMap.isNotSetup();
} }
@ -371,19 +377,30 @@ public class Game {
if (hiderLeft && dontRewardQuit) { if (hiderLeft && dontRewardQuit) {
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"));
if (gameOverTitle) broadcastTitle(message("GAME_TITLE_NO_WIN").toString(), message("GAME_GAMEOVER_HIDERS_QUIT").toString());
stop(WinType.NONE); stop(WinType.NONE);
} else { } else {
if (hiderCount < 1 || waitTillNoneLeft) {
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"));
if (gameOverTitle) broadcastTitle(message("GAME_TITLE_SEEKERS_WIN").toString(), message("GAME_GAMEOVER_HIDERS_FOUND").toString());
} else {
Player hider = board.getHiders().get(0);
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_LAST_HIDER").addPlayer(hider));
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_LAST_HIDER").addPlayer(hider));
if (gameOverTitle) broadcastTitle(message("GAME_TITLE_SINGLE_HIDER_WIN").addPlayer(hider).toString(), message("GAME_SUBTITLE_SINGLE_HIDER_WIN").addPlayer(hider).toString());
}
stop(WinType.SEEKER_WIN); stop(WinType.SEEKER_WIN);
} }
} else if (board.sizeSeeker() < 1) { } else if (board.sizeSeeker() < 1) {
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
if (gameOverTitle) broadcastTitle(message("GAME_TITLE_NO_WIN").toString(), message("GAME_GAMEOVER_SEEKERS_QUIT").toString());
stop(dontRewardQuit ? WinType.NONE : WinType.HIDER_WIN); stop(dontRewardQuit ? WinType.NONE : WinType.HIDER_WIN);
} 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"));
if (gameOverTitle) broadcastTitle(message("GAME_TITLE_HIDERS_WIN").toString(), message("GAME_GAMEOVER_TIME").toString());
stop(WinType.HIDER_WIN); stop(WinType.HIDER_WIN);
} }
hiderLeft = false; hiderLeft = false;

View file

@ -9,7 +9,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
public class ChatHandler implements Listener { public class ChatHandler implements Listener {
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onChat(AsyncPlayerChatEvent event) { public void onChat(AsyncPlayerChatEvent event) {
if (Main.getInstance().getBoard().isSpectator(event.getPlayer())) { if (Main.getInstance().getBoard().isSpectator(event.getPlayer())) {
event.setCancelled(true); event.setCancelled(true);

View file

@ -4,6 +4,7 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.database.Database; import net.tylermurphy.hideAndSeek.database.Database;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import net.tylermurphy.hideAndSeek.game.Board;
import net.tylermurphy.hideAndSeek.game.util.Status; import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -44,19 +45,26 @@ public class PAPIExpansion extends PlaceholderExpansion {
Database database = Main.getInstance().getDatabase(); Database database = Main.getInstance().getDatabase();
String[] args = params.split("_"); String[] args = params.split("_");
Status status = Main.getInstance().getGame().getStatus(); Status status = Main.getInstance().getGame().getStatus();
Board board = Main.getInstance().getBoard();
System.out.println(args);
if (args.length < 1) return null; if (args.length < 1) return null;
if (args.length == 1 && args[0] == "hiders") { if (args.length == 1 && args[0].equals("hiders")) {
if (status == Status.PLAYING || status == Status.STARTING) { if (!board.containsUUID(player.getUniqueId())) {
return "-";
} else if (status == Status.PLAYING || status == Status.STARTING) {
return "" + Main.getInstance().getBoard().getHiders().size(); return "" + Main.getInstance().getBoard().getHiders().size();
} else { } else {
return "-"; return "-";
} }
} }
if (args.length == 1 && args[0] == "seekers") { if (args.length == 1 && args[0].equals("seekers")) {
if (status == Status.PLAYING || status == Status.STARTING) { if (!board.containsUUID(player.getUniqueId())) {
return "-";
} else if (status == Status.PLAYING || status == Status.STARTING) {
return "" + Main.getInstance().getBoard().getSeekers().size(); return "" + Main.getInstance().getBoard().getSeekers().size();
} else { } else {
return "-"; return "-";

View file

@ -59,6 +59,7 @@ respawnAsSpectator: false
# If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning. # If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning.
# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one # If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one
# hider left, all inital seekers win along with the last hider. # hider left, all inital seekers win along with the last hider.
# default: true
waitTillNoneLeft: true waitTillNoneLeft: true
# By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be # By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be
@ -66,6 +67,14 @@ waitTillNoneLeft: true
# default: true # default: true
dontRewardQuit: true dontRewardQuit: true
# The amount of seconds the game will wait until the players are teleported to the lobby after a game over
# default: 5
endGameDelay: 5
# Along with a chat message, display a title describing the gameover
# default: false
gameOverTitle: false
# This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons, # This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons,
# and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this # and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this
# entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight # entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight

View file

@ -12,12 +12,18 @@ Localization:
COMMAND_ERROR: "Ein unbekannter Fehler ist aufgetreten." COMMAND_ERROR: "Ein unbekannter Fehler ist aufgetreten."
COMMAND_INVALID_ARG: "Ungültiges Argument: {AMOUNT}" COMMAND_INVALID_ARG: "Ungültiges Argument: {AMOUNT}"
GAME_PLAYER_DEATH: "&c{PLAYER}&f ist gestorben." GAME_PLAYER_DEATH: "&c{PLAYER}&f ist gestorben."
GAME_PLAYER_FOUND: "&e{PLAYER}&f wurde gefunden und ist nun ein Seeker." GAME_PLAYER_FOUND: "&e{PLAYER}&f wurde gefunden"
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden und ist nun ein Seeker." GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden"
GAME_GAMEOVER_HIDERS_FOUND: "Alle Hider wurden gefunden." GAME_GAMEOVER_HIDERS_FOUND: "Alle Hider wurden gefunden."
GAME_GAMEOVER_LAST_HIDER: "Der letzte Hider, &e{PLAYER}&f, hat gewonnen!"
GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen." GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen."
GAME_GAMEOVER_HIDERS_QUIT: "All Hider haben das Spiel verlassen." GAME_GAMEOVER_HIDERS_QUIT: "All Hider haben das Spiel verlassen."
GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!" GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!"
GAME_TITLE_HIDERS_WIN: "&aHiders haben gewonnen!"
GAME_TITLE_SINGLE_HIDER_WIN: "&a{PLAYER} haben gewonnen!"
GAME_TITLE_SEEKERS_WIN: "&cSeekers haben gewonnen!"
GAME_TITLE_NO_WIN: "&bSpiel ist aus"
GAME_SUBTITLE_SINGLE_HIDER_WIN: "{PLAYER} ist der letzte lebende Hider!"
GAME_SETUP: "Es gibt keine Setup-Karten! Führen Sie /hs map status auf einer Karte aus, um zu sehen, was Sie tun müssen." GAME_SETUP: "Es gibt keine Setup-Karten! Führen Sie /hs map status auf einer Karte aus, um zu sehen, was Sie tun müssen."
GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel." GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel."
GAME_NOT_INGAME: "Du bist weder in einer Lobby noch in einem Spiel." GAME_NOT_INGAME: "Du bist weder in einer Lobby noch in einem Spiel."
@ -128,5 +134,5 @@ Localization:
CONFIRMATION: "Führen Sie /hs confirm innerhalb von 10s aus, um zu bestätigen." CONFIRMATION: "Führen Sie /hs confirm innerhalb von 10s aus, um zu bestätigen."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 4 version: 5
type: "de-DE" type: "de-DE"

View file

@ -12,12 +12,18 @@ Localization:
COMMAND_ERROR: "An internal error has occurred." COMMAND_ERROR: "An internal error has occurred."
COMMAND_INVALID_ARG: "Invalid argument: {AMOUNT}" COMMAND_INVALID_ARG: "Invalid argument: {AMOUNT}"
GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed." GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed."
GAME_PLAYER_FOUND: "&e{PLAYER}&f was found and became a seeker." GAME_PLAYER_FOUND: "&e{PLAYER}&f was found"
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker." GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f"
GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found." GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found."
GAME_GAMEOVER_LAST_HIDER: "The last hider, &e{PLAYER}&f, has won!"
GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit." GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit."
GAME_GAMEOVER_HIDERS_QUIT: "All hiders have quit." GAME_GAMEOVER_HIDERS_QUIT: "All hiders have quit."
GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!" GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!"
GAME_TITLE_HIDERS_WIN: "&aHiders Win!"
GAME_TITLE_SINGLE_HIDER_WIN: "&a{PLAYER} Wins!"
GAME_TITLE_SEEKERS_WIN: "&cSeekers Win!"
GAME_TITLE_NO_WIN: "&bGame Over"
GAME_SUBTITLE_SINGLE_HIDER_WIN: "{PLAYER} is the last hider alive!"
GAME_SETUP: "There are no setup maps! Run /hs map status on a map to see what you need to do." GAME_SETUP: "There are no setup maps! Run /hs map status on a map to see what you need to do."
GAME_INGAME: "You are already in the lobby/game." GAME_INGAME: "You are already in the lobby/game."
GAME_NOT_INGAME: "You are not in a lobby/game." GAME_NOT_INGAME: "You are not in a lobby/game."
@ -128,5 +134,5 @@ Localization:
CONFIRMATION: "Run /hs confirm within 10s to confirm." CONFIRMATION: "Run /hs confirm within 10s to confirm."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 4 version: 5
type: "en-US" type: "en-US"