From 6239acb08a43d6bfef51f6abc8b7cc65687c51c7 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 25 Dec 2021 08:16:03 -0600 Subject: 1.3.3 beta 2 --- src/main/resources/config.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7366476..ae130f8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -79,9 +79,21 @@ prefix: gameover: '&aGame Over > &f' warning: '&cWarning > &f' +# This is the section if you want a standard "waiting for players" lobby. You can specify +# the standard countdown length under [countdown] (min 10 seconds). Then once the lobby gets to a size specified +# by [changeCountdown], the timer will automatically go to 10 seconds. [min] is the minimum players +# to start the countdown. [max] is the lobby cap, set to -1 to remove maximum cap. +lobby: + countdown: 60 + changeCountdown: 5 + min: 3 + max: 10 + enabled: true + + # Changes the default plugin language. Currently, Supported localizations are: -# en-US (United States) -# de-DE (German) +# en-US (English - United States) +# de-DE (German - Germany) local: "en-US" # ---------------------------------------------------------- # -- cgit v1.2.3-freya From 35d9e912d593164d6520bbeb5cfa69cdf5b530d8 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 25 Dec 2021 08:21:06 -0600 Subject: Pre merge --- src/main/resources/plugin.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/resources') diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ce62925..bd391c9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: HideAndSeek main: net.tylermurphy.hideAndSeek.Main -version: 1.3.2 +version: 1.3.3 author: KenshinEto load: STARTUP api-version: 1.14 @@ -28,6 +28,7 @@ permissions: hideandseek.savemap: true hideandseek.join: true hideandseek.leave: true + hideandseek.leavebounds: true hideandseek.about: description: Allows you to run the about command default: true @@ -70,3 +71,6 @@ permissions: hideandseek.leave: description: Allows you to leave the game manual lobby default: true + hideandseek.leavebounds: + description: Allows players to leave specified game bounderies + default: op -- cgit v1.2.3-freya From 6e09da9150bb8b178a168f463136759d95a2f8d4 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 25 Dec 2021 22:46:22 -0600 Subject: 1.3.3 beta 2 --- pom.xml | 5 + .../java/net/tylermurphy/hideAndSeek/Main.java | 17 +++- .../net/tylermurphy/hideAndSeek/command/Stop.java | 3 +- .../net/tylermurphy/hideAndSeek/command/Top.java | 60 ++++++++++++ .../net/tylermurphy/hideAndSeek/command/Wins.java | 66 +++++++++++++ .../hideAndSeek/configuration/ConfigManager.java | 1 - .../tylermurphy/hideAndSeek/database/Database.java | 30 ++++++ .../hideAndSeek/database/PlayerInfo.java | 18 ++++ .../hideAndSeek/database/PlayerInfoTable.java | 109 +++++++++++++++++++++ .../net/tylermurphy/hideAndSeek/game/Game.java | 67 ++++++++----- .../net/tylermurphy/hideAndSeek/game/WinType.java | 7 ++ .../net/tylermurphy/hideAndSeek/util/Board.java | 4 + .../hideAndSeek/util/CommandHandler.java | 6 +- .../tylermurphy/hideAndSeek/util/UUIDFetcher.java | 84 ++++++++++++++++ .../net/tylermurphy/hideAndSeek/util/Util.java | 21 ++++ src/main/resources/lang/localization_de-DE.yml | 3 +- src/main/resources/lang/localization_en-US.yml | 2 + 17 files changed, 470 insertions(+), 33 deletions(-) create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/Top.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/database/Database.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/game/WinType.java create mode 100644 src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java (limited to 'src/main/resources') diff --git a/pom.xml b/pom.xml index de10b5b..7c10eb1 100644 --- a/pom.xml +++ b/pom.xml @@ -39,5 +39,10 @@ ProtocolLib 4.7.0 + + org.xerial + sqlite-jdbc + 3.36.0.3 + \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java index 050d96b..b9aaa94 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java @@ -7,7 +7,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.tylermurphy.hideAndSeek.database.Database; import net.tylermurphy.hideAndSeek.game.Status; +import net.tylermurphy.hideAndSeek.util.UUIDFetcher; import org.bukkit.Bukkit; import org.bukkit.command.Command; @@ -36,6 +38,7 @@ public class Main extends JavaPlugin implements Listener { public Board board; public WorldLoader worldLoader; public Status status = Status.STANDBY; + public Database database; private BukkitTask onTickTask; public void onEnable() { @@ -63,11 +66,20 @@ public class Main extends JavaPlugin implements Listener { //Board board = new Board(); board.reload(); - + + //Database + database = new Database(); + database.init(); + + //UUIDFetcher Cache + UUIDFetcher.init(); + + //Init game + game = new Game(); + // Start Tick Timer onTickTask = Bukkit.getServer().getScheduler().runTaskTimer(this, () -> { try{ - game = new Game(); game.onTick(); } catch (Exception e) { e.printStackTrace(); @@ -79,6 +91,7 @@ public class Main extends JavaPlugin implements Listener { public void onDisable() { if(onTickTask != null) onTickTask.cancel(); + UUIDFetcher.cleanup(); } public boolean onCommand(CommandSender sender, Command cmd,String label, String[] args) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java index f444f34..2fef77c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java @@ -3,6 +3,7 @@ package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; import net.tylermurphy.hideAndSeek.game.Status; +import net.tylermurphy.hideAndSeek.game.WinType; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -20,7 +21,7 @@ public class Stop implements ICommand { if(Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING) { if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP")); else Util.broadcastMessage(abortPrefix + message("STOP")); - Main.plugin.game.stop(); + Main.plugin.game.stop(WinType.NONE); } else { sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS")); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java new file mode 100644 index 0000000..c394378 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java @@ -0,0 +1,60 @@ +package net.tylermurphy.hideAndSeek.command; + +import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.database.PlayerInfo; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + +import java.util.List; + +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.*; + +public class Top implements ICommand { + + public void execute(CommandSender sender, String[] args) { + int page; + if(args.length == 0) page = 1; + else try{ + page = Integer.parseInt(args[0]); + } catch(Exception e){ + sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0])); + return; + } + if(page < 1){ + sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(page)); + return; + } + String message = String.format( + "%s------- %sLEADERBOARD %s(Page %s) %s-------\n", + ChatColor.WHITE, ChatColor.BOLD, ChatColor.GRAY, page, ChatColor.WHITE); + List infos = Main.plugin.database.playerInfo.getInfoPage(page); + int i = 1 + (page-1)*10; + for(PlayerInfo info : infos){ + String name = Main.plugin.getServer().getOfflinePlayer(info.uuid).getName(); + ChatColor color; + switch (i){ + case 1: color = ChatColor.YELLOW; break; + case 2: color = ChatColor.GRAY; break; + case 3: color = ChatColor.GOLD; break; + default: color = ChatColor.WHITE; break; + } + message = message + String.format("%s%s. %s%s %s%s\n", + color, i, ChatColor.RED, info.wins, ChatColor.WHITE, name); + i++; + } + sender.sendMessage(message); + } + + public String getLabel() { + return "top"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Gets the top players in the server."; + } +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java new file mode 100644 index 0000000..d99229d --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java @@ -0,0 +1,66 @@ +package net.tylermurphy.hideAndSeek.command; + +import com.comphenix.protocol.PacketType; +import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.database.PlayerInfo; +import net.tylermurphy.hideAndSeek.util.CommandHandler; +import net.tylermurphy.hideAndSeek.util.UUIDFetcher; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.util.UUID; + +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.*; + +public class Wins implements ICommand { + + public void execute(CommandSender sender, String[] args) { + Main.plugin.getServer().getScheduler().runTaskAsynchronously(Main.plugin, () -> { + + UUID uuid; + String name; + if(args.length == 0) { + uuid = Main.plugin.getServer().getPlayer(sender.getName()).getUniqueId(); + name = sender.getName(); + } + else { + try { + name = args[0]; + uuid = UUIDFetcher.getUUID(args[0]); + } catch (Exception e){ + sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0])); + return; + } + } + PlayerInfo info = Main.plugin.database.playerInfo.getInfo(uuid); + if(info == null){ + sender.sendMessage(errorPrefix + message("NO_GAME_INFO")); + return; + } + String message = ChatColor.WHITE + "" + ChatColor.BOLD + "==============================\n"; + message = message + message("INFORMATION_FOR").addPlayer(name) + "\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", + ChatColor.YELLOW, ChatColor.WHITE, info.wins, ChatColor.GOLD, ChatColor.WHITE, info.hider_wins, + ChatColor.RED, ChatColor.WHITE, info.seeker_wins, ChatColor.WHITE, info.games_played); + message = message + ChatColor.WHITE + "" + ChatColor.BOLD + "\n=============================="; + sender.sendMessage(message); + + }); + } + + public String getLabel() { + return "wins"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Get the win information for yourself or another player."; + } +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index c1757d1..11caa96 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -173,7 +173,6 @@ public class ConfigManager { if(entry.getValue() instanceof String){ replace = "\"" + replace + "\""; } - System.out.println(entry.getKey() + " " + index + " " + start + " " + end); StringBuilder builder = new StringBuilder(yamlString); builder.replace(start+1, end, replace); yamlString = builder.toString(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java new file mode 100644 index 0000000..2254ec2 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java @@ -0,0 +1,30 @@ +package net.tylermurphy.hideAndSeek.database; + +import net.tylermurphy.hideAndSeek.Main; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class Database { + + private final File databaseFile = new File(Main.data, "database.db"); + + public PlayerInfoTable playerInfo; + + protected Connection connect() { + Connection conn = null; + try { + String url = "jdbc:sqlite:"+databaseFile; + conn = DriverManager.getConnection(url); + } catch (SQLException e) { + System.out.println(e.getMessage()); + } + return conn; + } + + public void init(){ + playerInfo = new PlayerInfoTable(); + } +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java new file mode 100644 index 0000000..c1e0070 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java @@ -0,0 +1,18 @@ +package net.tylermurphy.hideAndSeek.database; + +import java.util.UUID; + +public class PlayerInfo { + + public UUID uuid; + public int wins, hider_wins, seeker_wins, games_played; + + public PlayerInfo(UUID uuid, int wins, int hider_wins, int seeker_wins, int games_played){ + this.uuid = uuid; + this.wins = wins; + this.hider_wins = hider_wins; + this.seeker_wins = seeker_wins; + this.games_played = games_played; + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java new file mode 100644 index 0000000..07fb2ee --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java @@ -0,0 +1,109 @@ +package net.tylermurphy.hideAndSeek.database; + +import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.game.WinType; +import net.tylermurphy.hideAndSeek.util.Util; + +import java.io.IOException; +import java.io.InputStream; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class PlayerInfoTable { + + protected PlayerInfoTable(){ + + String sql = "CREATE TABLE IF NOT EXISTS player_info (\n" + + " uuid BINARY(16) PRIMARY KEY,\n" + + " wins int NOT NULL,\n" + + " seeker_wins int NOT NULL,\n" + + " hider_wins int NOT NULL,\n" + + " games_played int NOT NULL\n" + + ");"; + + try(Connection connection = Main.plugin.database.connect(); Statement statement = connection.createStatement()){ + statement.execute(sql); + } catch (SQLException e){ + Main.plugin.getLogger().severe("SQL Error: " + e.getMessage()); + } + } + + public PlayerInfo getInfo(UUID uuid){ + String sql = "SELECT * FROM player_info WHERE uuid = ?;"; + try(Connection connection = Main.plugin.database.connect(); PreparedStatement statement = connection.prepareStatement(sql)){ + InputStream is = Util.convertUniqueId(uuid); + byte[] bytes = new byte[is.available()]; + is.read(bytes); + statement.setBytes(1, bytes); + ResultSet rs = statement.executeQuery(); + if(rs.next()){ + PlayerInfo info = new PlayerInfo( + uuid, + rs.getInt("wins"), + rs.getInt("seeker_wins"), + rs.getInt("hider_wins"), + rs.getInt("games_played") + ); + return info; + } + } catch (SQLException e){ + Main.plugin.getLogger().severe("SQL Error: " + e.getMessage()); + } catch (IOException e) { + Main.plugin.getLogger().severe("IO Error: " + e.getMessage()); + e.printStackTrace(); + } + return new PlayerInfo(uuid, 0, 0, 0, 0); + } + + public List getInfoPage(int page){ + String sql = "SELECT * FROM player_info ORDER BY wins DESC LIMIT 10 OFFSET ?;"; + try(Connection connection = Main.plugin.database.connect(); PreparedStatement statement = connection.prepareStatement(sql)){ + statement.setInt(1, (page-1)*10); + ResultSet rs = statement.executeQuery(); + List infoList = new ArrayList<>(); + while(rs.next()){ + PlayerInfo info = new PlayerInfo( + Util.convertBinaryStream(rs.getBinaryStream("uuid")), + rs.getInt("wins"), + rs.getInt("seeker_wins"), + rs.getInt("hider_wins"), + rs.getInt("games_played") + ); + infoList.add(info); + } + return infoList; + } catch (SQLException e){ + Main.plugin.getLogger().severe("SQL Error: " + e.getMessage()); + } + return null; + } + + public boolean addWins(List uuids, List winners, WinType type){ + for(UUID uuid : uuids){ + String sql = "INSERT OR REPLACE INTO player_info (uuid, wins, seeker_wins, hider_wins, games_played) VALUES (?,?,?,?,?)"; + PlayerInfo info = getInfo(uuid); + try(Connection connection = Main.plugin.database.connect(); PreparedStatement statement = connection.prepareStatement(sql)){ + InputStream is = Util.convertUniqueId(uuid); + byte[] bytes = new byte[is.available()]; + is.read(bytes); + statement.setBytes(1, bytes); + statement.setInt(2, info.wins + (winners.contains(uuid) ? 1 : 0)); + statement.setInt(3, info.seeker_wins + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0)); + statement.setInt(4, info.hider_wins + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0)); + statement.setInt(5, info.games_played + 1); + statement.execute(); + } catch (SQLException e){ + Main.plugin.getLogger().severe("SQL Error: " + e.getMessage()); + e.printStackTrace(); + return false; + } catch (IOException e) { + Main.plugin.getLogger().severe("IO Error: " + e.getMessage()); + e.printStackTrace(); + } + } + return true; + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index 50e970e..5af8063 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -10,6 +10,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import net.tylermurphy.hideAndSeek.Main; @@ -18,7 +19,11 @@ import net.tylermurphy.hideAndSeek.util.Util; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import java.util.ArrayList; +import java.util.List; import java.util.Random; +import java.util.UUID; +import java.util.stream.Collectors; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; import static net.tylermurphy.hideAndSeek.configuration.Config.*; @@ -80,43 +85,51 @@ public class Game { Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(3), Main.plugin.game.gameId, 20 * 27); Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(2), Main.plugin.game.gameId, 20 * 28); Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(1), Main.plugin.game.gameId, 20 * 29); - Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, new Runnable() { - public void run() { - if(temp != Main.plugin.game.gameId) return; - Util.broadcastMessage(messagePrefix + message("START")); - Main.plugin.status = Status.PLAYING; - for(Player player : Main.plugin.board.getPlayers()) { - Util.resetPlayer(player); - } + if(gameLength > 0) { + timeLeft = gameLength; + } + Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, () -> { + if(temp != Main.plugin.game.gameId) return; + Util.broadcastMessage(messagePrefix + message("START")); - if(worldborderEnabled) { - worldborder = new Worldborder(Main.plugin.game.gameId); - worldborder.schedule(); - } + for(Player player : Main.plugin.board.getPlayers()) { + Util.resetPlayer(player); + } - if(tauntEnabled) { - taunt = new Taunt(Main.plugin.game.gameId); - taunt.schedule(); - } + if(worldborderEnabled) { + worldborder = new Worldborder(Main.plugin.game.gameId); + worldborder.schedule(); + } - if (glowEnabled) { - glow = new Glow(Main.plugin.game.gameId); - } + if(tauntEnabled) { + taunt = new Taunt(Main.plugin.game.gameId); + taunt.schedule(); + } - if(gameLength > 0) { - timeLeft = gameLength; - } + if (glowEnabled) { + glow = new Glow(Main.plugin.game.gameId); } + + Main.plugin.status = Status.PLAYING; }, 20 * 30); } - public void stop(){ + public void stop(WinType type){ if(Main.plugin.status == Status.STANDBY) return; tick = 0; countdownTime = -1; Main.plugin.status = Status.STANDBY; Main.plugin.game.gameId++; timeLeft = 0; + List players = Main.plugin.board.getPlayers().stream().map(Entity::getUniqueId).collect(Collectors.toList()); + if(type == WinType.HIDER_WIN){ + List winners = Main.plugin.board.getHiders().stream().map(Entity::getUniqueId).collect(Collectors.toList()); + Main.plugin.database.playerInfo.addWins(players, winners, type); + } else if(type == WinType.SEEKER_WIN){ + List winners = new ArrayList<>(); + winners.add(Main.plugin.board.getFirstSeeker().getUniqueId()); + Main.plugin.database.playerInfo.addWins(players, winners, type); + } Worldborder.resetWorldborder("hideandseek_"+spawnWorld); for(Player player : Main.plugin.board.getPlayers()) { Main.plugin.board.createLobbyBoard(player); @@ -146,12 +159,12 @@ public class Game { if(( Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING ) && Main.plugin.board.sizeHider() < 1) { if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); - stop(); + stop(WinType.SEEKER_WIN); } if(( Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING ) && Main.plugin.board.sizeSeeker() < 1) { if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); else Util.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); - stop(); + stop(WinType.NONE); } tick++; @@ -209,7 +222,7 @@ public class Game { if(distance < 20) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f); break; } - + } if(tick%20 == 0) { @@ -219,7 +232,7 @@ public class Game { if(timeLeft < 1) { if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME")); else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME")); - stop(); + stop(WinType.HIDER_WIN); } } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/WinType.java b/src/main/java/net/tylermurphy/hideAndSeek/game/WinType.java new file mode 100644 index 0000000..3e01f21 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/WinType.java @@ -0,0 +1,7 @@ +package net.tylermurphy.hideAndSeek.game; + +public enum WinType { + HIDER_WIN, + SEEKER_WIN, + NONE +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java index 6b0c7b5..6b61f16 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java @@ -72,6 +72,10 @@ public class Board { public List getSeekers(){ return Seeker.stream().map(playerName -> playerList.get(playerName)).collect(Collectors.toList()); } + + public Player getFirstSeeker(){ + return playerList.get(Seeker.get(0)); + } public List getSpectators(){ return Spectator.stream().map(playerName -> playerList.get(playerName)).collect(Collectors.toList()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/CommandHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/util/CommandHandler.java index 18a2c8c..e66f7ed 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/CommandHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/CommandHandler.java @@ -3,6 +3,8 @@ package net.tylermurphy.hideAndSeek.util; import static net.tylermurphy.hideAndSeek.configuration.Config.*; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; @@ -38,6 +40,8 @@ public class CommandHandler { registerCommand(new SetBounds()); registerCommand(new Join()); registerCommand(new Leave()); + registerCommand(new Top()); + registerCommand(new Wins()); } public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) { @@ -65,5 +69,5 @@ public class CommandHandler { } return true; } - + } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java new file mode 100644 index 0000000..8a5406a --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java @@ -0,0 +1,84 @@ +package net.tylermurphy.hideAndSeek.util; + +import net.tylermurphy.hideAndSeek.Main; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public final class UUIDFetcher { + + private static final Map CACHE = new HashMap<>(); + + private static final String UUID_URL = "https://api.mojang.com/users/profiles/minecraft/"; + private static int cacheTask; + + public static void init(){ + cacheTask = Main.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Main.plugin, CACHE::clear,600*20, 600*20); + } + + public static void cleanup(){ + Main.plugin.getServer().getScheduler().cancelTask(cacheTask); + } + + public static UUID getUUID(String playername) { + + if(CACHE.containsKey(playername)) return CACHE.get(playername); + + String output = callURL(UUID_URL + playername); + StringBuilder result = new StringBuilder(); + readData(output, result); + String u = result.toString(); + StringBuilder uuid = new StringBuilder(); + for (int i = 0; i <= 31; i++) { + uuid.append(u.charAt(i)); + if (i == 7 || i == 11 || i == 15 || i == 19) { + uuid.append('-'); + } + } + return UUID.fromString(uuid.toString()); + } + + private static void readData(String toRead, StringBuilder result) { + for (int i = toRead.length() - 3; i >= 0; i--) { + if (toRead.charAt(i) != '"') { + result.insert(0, toRead.charAt(i)); + } else { + break; + } + } + } + + private static String callURL(String urlStr) { + StringBuilder sb = new StringBuilder(); + URLConnection urlConn; + InputStreamReader in; + try { + URL url = new URL(urlStr); + urlConn = url.openConnection(); + if (urlConn != null) { + urlConn.setReadTimeout(60 * 1000); + } + if (urlConn != null && urlConn.getInputStream() != null) { + in = new InputStreamReader(urlConn.getInputStream(), + Charset.defaultCharset()); + BufferedReader bufferedReader = new BufferedReader(in); + int cp; + while ((cp = bufferedReader.read()) != -1) { + sb.append((char) cp); + } + bufferedReader.close(); + in.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return sb.toString(); + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java index 513ac16..8112f74 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java @@ -3,10 +3,13 @@ package net.tylermurphy.hideAndSeek.util; import static net.tylermurphy.hideAndSeek.configuration.Config.*; import java.io.*; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; +import com.google.common.io.ByteStreams; import net.md_5.bungee.api.ChatColor; import net.tylermurphy.hideAndSeek.configuration.Items; import net.tylermurphy.hideAndSeek.configuration.LocalizationString; @@ -92,4 +95,22 @@ public class Util { for(ItemStack i : player.getInventory().getContents()) if(hi.isSimilar(i)) player.getInventory().remove(i); } + + public static InputStream convertUniqueId(UUID uuid) { + byte[] bytes = new byte[16]; + ByteBuffer.wrap(bytes) + .putLong(uuid.getMostSignificantBits()) + .putLong(uuid.getLeastSignificantBits()); + return new ByteArrayInputStream(bytes); + } + + public static UUID convertBinaryStream(InputStream stream) { + ByteBuffer buffer = ByteBuffer.allocate(16); + try { + buffer.put(ByteStreams.toByteArray(stream)); + buffer.flip(); + return new UUID(buffer.getLong(), buffer.getLong()); + } catch (IOException e) {} + return null; + } } \ No newline at end of file diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml index c5b0b72..c17fafe 100644 --- a/src/main/resources/lang/localization_de-DE.yml +++ b/src/main/resources/lang/localization_de-DE.yml @@ -60,7 +60,8 @@ Localization: BOUNDS_WRONG_WORLD: "Führe diesen Befehl bitte in der Spielwelt aus." BOUNDS: "Grenzen erfolgreich an dieser Position gesetzt. ({AMOUNT}/2)" NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält." - + NO_GAME_INFO: "Der Spieler hat keine Gameplay-Informationen." + INFORMATION_FOR: "Gewinninformationen für {PLAYER}" # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE version: 2 type: "de-DE" diff --git a/src/main/resources/lang/localization_en-US.yml b/src/main/resources/lang/localization_en-US.yml index af5b80c..977f69b 100644 --- a/src/main/resources/lang/localization_en-US.yml +++ b/src/main/resources/lang/localization_en-US.yml @@ -60,6 +60,8 @@ Localization: BOUNDS_WRONG_WORLD: "Please run this command in the game world." BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)." NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0." + NO_GAME_INFO: "Player has no gameplay information." + INFORMATION_FOR: "Win information for {PLAYER}:" # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE version: 2 -- cgit v1.2.3-freya From 7f9def05fb88441520bd95f0d5cf20f7162b72dd Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 27 Dec 2021 13:01:39 -0600 Subject: fix ClassNotFound and add Licence headers --- .../java/net/tylermurphy/hideAndSeek/Main.java | 19 ++++++++++ .../tylermurphy/hideAndSeek/command/SetBounds.java | 19 ++++++++++ .../hideAndSeek/command/SetExitLocation.java | 19 ++++++++++ .../hideAndSeek/command/SetLobbyLocation.java | 19 ++++++++++ .../hideAndSeek/command/SetSpawnLocation.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/command/Setup.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/command/Start.java | 20 ++++++++++ .../net/tylermurphy/hideAndSeek/command/Stop.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/command/Top.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/command/Wins.java | 19 ++++++++++ .../hideAndSeek/configuration/Config.java | 19 ++++++++++ .../hideAndSeek/configuration/ConfigManager.java | 19 ++++++++++ .../hideAndSeek/configuration/Items.java | 19 ++++++++++ .../hideAndSeek/configuration/Localization.java | 19 ++++++++++ .../configuration/LocalizationString.java | 19 ++++++++++ .../tylermurphy/hideAndSeek/database/Database.java | 19 ++++++++++ .../hideAndSeek/database/PlayerInfo.java | 19 ++++++++++ .../hideAndSeek/database/PlayerInfoTable.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/game/Board.java | 19 ++++++++++ .../hideAndSeek/game/CommandHandler.java | 19 ++++++++++ .../hideAndSeek/game/EventListener.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/game/Game.java | 43 +++++++++++++++++----- .../net/tylermurphy/hideAndSeek/util/Packet.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/util/Status.java | 19 ++++++++++ .../tylermurphy/hideAndSeek/util/TabCompleter.java | 19 ++++++++++ .../tylermurphy/hideAndSeek/util/UUIDFetcher.java | 19 ++++++++++ .../net/tylermurphy/hideAndSeek/util/WinType.java | 19 ++++++++++ .../hideAndSeek/world/VoidGenerator.java | 19 ++++++++++ .../tylermurphy/hideAndSeek/world/WorldLoader.java | 19 ++++++++++ src/main/resources/lang/localization_de-DE.yml | 1 + src/main/resources/lang/localization_en-US.yml | 1 + 31 files changed, 568 insertions(+), 10 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java index 12b4f77..3e2daf3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek; import java.io.File; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java index ca21908..d5f8a64 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java index 8938939..6f3364b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java index df5d512..af9c2de 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index eb03625..f68fda5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java index 5cde727..49d1cde 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 4abda2b..5a59650 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -1,4 +1,24 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; + import static net.tylermurphy.hideAndSeek.configuration.Localization.*; import net.tylermurphy.hideAndSeek.game.Board; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java index 0a81793..329048f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java index 8ac71fc..10df4bd 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import net.tylermurphy.hideAndSeek.Main; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java index 20d1e64..304762e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.command; import net.tylermurphy.hideAndSeek.Main; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index b83ee42..6998ffd 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.configuration; import org.bukkit.util.Vector; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index 669f729..c950468 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.configuration; import net.tylermurphy.hideAndSeek.Main; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index 3651a41..26c4991 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.configuration; import org.bukkit.ChatColor; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java index 327af24..dbf7915 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.configuration; import java.io.File; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java index b457622..228bb08 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.configuration; import org.bukkit.entity.Entity; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java index 9d3cc73..5681f33 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.database; import com.google.common.io.ByteStreams; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java index c1e0070..b59f434 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.database; import java.util.UUID; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java index 0dba4b4..f3daa62 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.database; import net.tylermurphy.hideAndSeek.Main; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 44e3f05..9df39be 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.game; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java index 6758908..7ff7c74 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.game; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java index dc79732..4dba35a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.game; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index d04d32a..6ee4cf6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2020-2021. Tyler Murphy + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.game; import static net.tylermurphy.hideAndSeek.configuration.Config.*; @@ -33,7 +52,7 @@ public class Game { public static Taunt taunt; public static Glow glow; - public static WorldBorder worldBorder; + public static Border worldBorder; public static WorldLoader worldLoader; public static int tick = 0; public static int countdownTime = -1; @@ -77,10 +96,16 @@ public class Game { player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false)); player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20); } + if(tauntEnabled) + taunt = new Taunt(); + if (glowEnabled) + glow = new Glow(); + worldBorder = new Border(); worldBorder.resetWorldborder("hideandseek_"+spawnWorld); - for(Player player : Board.getPlayers()){ + if(gameLength > 0) + timeLeft = gameLength; + for(Player player : Board.getPlayers()) Board.createGameBoard(player); - } Board.reloadGameBoards(); status = Status.STARTING; int temp = gameId; @@ -93,12 +118,8 @@ public class Game { sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(1), gameId, 20 * 29); Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, () -> { if(temp != gameId) return; - if(gameLength > 0) timeLeft = gameLength; broadcastMessage(messagePrefix + message("START")); for(Player player : Board.getPlayers()) resetPlayer(player); - if(worldborderEnabled) worldBorder = new WorldBorder(); - if(tauntEnabled) taunt = new Taunt(); - if (glowEnabled) glow = new Glow(); status = Status.PLAYING; }, 20 * 30); } @@ -432,17 +453,19 @@ class Taunt { } -class WorldBorder { +class Border { private int delay; private boolean running; - public WorldBorder() { + public Border() { delay = 60 * worldborderDelay; } void update(){ - if(delay == 0){ + if(delay == 30 && !running){ + broadcastMessage(worldborderPrefix + message("WORLDBORDER_WARN")); + } else if(delay == 0){ if(running){ delay = 60 * worldborderDelay; running = false; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java index 43a358c..9d863f8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.util; import java.lang.reflect.InvocationTargetException; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java index 76c691f..305da9f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.util; public enum Status { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java b/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java index 21fe555..d793d9e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.util; import java.util.ArrayList; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java index 193ec32..c79f335 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.util; import net.tylermurphy.hideAndSeek.Main; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java b/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java index 1a1eb74..f633d1b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.util; public enum WinType { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java index 46636cf..1e75be7 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.world; import java.util.Collections; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java index b744b9d..5d84ceb 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java @@ -1,3 +1,22 @@ +/* + * This file is part of Kenshins Hide and Seek + * + * Copyright (c) 2021 Tyler Murphy. + * + * Kenshins Hide and Seek free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * he Free Software Foundation, either version 3 of the License. + * + * Kenshins Hide and Seek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package net.tylermurphy.hideAndSeek.world; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml index c17fafe..49e5f5e 100644 --- a/src/main/resources/lang/localization_de-DE.yml +++ b/src/main/resources/lang/localization_de-DE.yml @@ -36,6 +36,7 @@ Localization: WORLDBORDER_POSITION: "Spawn muss mindestens 100 Blöcke vom Zentrum der World Border entfernt sein." WORLDBORDER_ENABLE: "Setze World Border zentriert von dieser Position aus. Größe: {AMOUNT}. Verzögerung: {AMOUNT}." WORLDBORDER_DECREASING: "World Norder schrumpoft 100 Blöcke über die nächsten 30 Sekunden!" + WORLDBORDER_WARN: "Die Weltgrenze wird in den nächsten 30er Jahren schrumpfen!" TAUNTED: "$c$oOh nein! Du wurdest geärgert!" TAUNT: "Ein zufälliger Hider wird in den nächsten 30 Sekunden geärgert." TAUNT_ACTIVATE: "Ärgern wurde aktiviert" diff --git a/src/main/resources/lang/localization_en-US.yml b/src/main/resources/lang/localization_en-US.yml index 977f69b..1a2a25a 100644 --- a/src/main/resources/lang/localization_en-US.yml +++ b/src/main/resources/lang/localization_en-US.yml @@ -36,6 +36,7 @@ Localization: WORLDBORDER_POSITION: "Spawn position must be 100 from world border center." WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}." WORLDBORDER_DECREASING: "World border decreasing by 100 blocks over the next 30s." + WORLDBORDER_WARN: "World border will shrink in the next 30s!" TAUNTED: "$c$oOh no! You have been chosen to be taunted." TAUNT: "A random hider will be taunted in the next 30s." TAUNT_ACTIVATE: "Taunt has been activated." -- cgit v1.2.3-freya From 56e6cac28f0ed7bf02b974cca85c88faa78b1479 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 27 Dec 2021 13:14:32 -0600 Subject: 1.3.3 rc1 --- .../java/net/tylermurphy/hideAndSeek/Main.java | 2 +- .../net/tylermurphy/hideAndSeek/command/About.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Help.java | 2 +- .../tylermurphy/hideAndSeek/command/ICommand.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Join.java | 32 ++-------------------- .../net/tylermurphy/hideAndSeek/command/Leave.java | 2 +- .../tylermurphy/hideAndSeek/command/Reload.java | 2 +- .../tylermurphy/hideAndSeek/command/SaveMap.java | 2 +- .../tylermurphy/hideAndSeek/command/SetBorder.java | 2 +- .../tylermurphy/hideAndSeek/command/SetBounds.java | 2 +- .../hideAndSeek/command/SetExitLocation.java | 2 +- .../hideAndSeek/command/SetLobbyLocation.java | 2 +- .../hideAndSeek/command/SetSpawnLocation.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Setup.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Start.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Stop.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Top.java | 2 +- .../net/tylermurphy/hideAndSeek/command/Wins.java | 2 +- .../hideAndSeek/configuration/Config.java | 2 +- .../hideAndSeek/configuration/ConfigManager.java | 2 +- .../hideAndSeek/configuration/Items.java | 2 +- .../hideAndSeek/configuration/Localization.java | 2 +- .../configuration/LocalizationString.java | 2 +- .../tylermurphy/hideAndSeek/database/Database.java | 2 +- .../hideAndSeek/database/PlayerInfo.java | 2 +- .../hideAndSeek/database/PlayerInfoTable.java | 2 +- .../net/tylermurphy/hideAndSeek/game/Board.java | 2 +- .../hideAndSeek/game/CommandHandler.java | 2 +- .../hideAndSeek/game/EventListener.java | 12 +++++--- .../net/tylermurphy/hideAndSeek/game/Game.java | 26 +++++++++++++++++- .../net/tylermurphy/hideAndSeek/util/Packet.java | 2 +- .../net/tylermurphy/hideAndSeek/util/Status.java | 2 +- .../tylermurphy/hideAndSeek/util/TabCompleter.java | 2 +- .../tylermurphy/hideAndSeek/util/UUIDFetcher.java | 2 +- .../net/tylermurphy/hideAndSeek/util/WinType.java | 2 +- .../hideAndSeek/world/VoidGenerator.java | 2 +- .../tylermurphy/hideAndSeek/world/WorldLoader.java | 2 +- src/main/resources/lang/localization_de-DE.yml | 1 + src/main/resources/lang/localization_en-US.yml | 1 + 39 files changed, 71 insertions(+), 69 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java index 3e2daf3..f1b3364 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java index 4882af2..de1062b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java index 379301c..c1934a9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java b/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java index edadca9..6404c22 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java index c7d5fc2..0ca21d1 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,16 +23,10 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*; import net.tylermurphy.hideAndSeek.game.Board; import net.tylermurphy.hideAndSeek.game.Game; -import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.attribute.Attribute; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.Objects; - import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class Join implements ICommand { @@ -52,29 +46,7 @@ public class Join implements ICommand { return; } - join(player); - } - - public static void join(Player player){ - if(Game.status == Status.STANDBY) { - player.getInventory().clear(); - Board.addHider(player); - if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); - else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); - player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ())); - player.setGameMode(GameMode.ADVENTURE); - Board.createLobbyBoard(player); - Board.reloadLobbyBoards(); - } else { - Board.addSpectator(player); - player.sendMessage(messagePrefix + message("GAME_JOIN_SPECTATOR")); - player.setGameMode(GameMode.SPECTATOR); - Board.createGameBoard(player); - player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ())); - } - - player.setFoodLevel(20); - player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getBaseValue()); + Game.join(player); } public String getLabel() { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java index 2954f1d..cc4f0b4 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java index 183377f..fc2592b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java index 5878035..c48e1c6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java index ecbdbef..5f14b20 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java index d5f8a64..9f4101a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java index 6f3364b..7461767 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java index af9c2de..69e5e52 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index f68fda5..7afe861 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java index 49d1cde..74c29bf 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 5a59650..b82e3b5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java index 329048f..b41277b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java index 10df4bd..760bb2c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java index 304762e..dfa5338 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index 6998ffd..524eeac 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index c950468..84ad5b4 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index 26c4991..569cae6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java index dbf7915..d5ae01d 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java index 228bb08..3d8bc0f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java index 5681f33..602c948 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java index b59f434..8464b54 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfo.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java index f3daa62..e859687 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 9df39be..d81e310 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java index 7ff7c74..8df3cf2 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/CommandHandler.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java index 4dba35a..4911d5f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -54,7 +54,7 @@ public class EventListener implements Listener { Game.removeItems(event.getPlayer()); if(Game.isNotSetup()) return; if(autoJoin){ - Join.join(event.getPlayer()); + Game.join(event.getPlayer()); } else if(teleportToExit) { if (event.getPlayer().getWorld().getName().equals("hideandseek_" + spawnWorld) || event.getPlayer().getWorld().getName().equals(lobbyWorld)) { event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ())); @@ -62,8 +62,12 @@ public class EventListener implements Listener { } } else { if (event.getPlayer().getWorld().getName().equals("hideandseek_" + spawnWorld)) { - event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ())); - event.getPlayer().setGameMode(GameMode.ADVENTURE); + if(Game.status != Status.STANDBY){ + Game.join(event.getPlayer()); + } else { + event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ())); + event.getPlayer().setGameMode(GameMode.ADVENTURE); + } } } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index 6ee4cf6..39d6376 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,6 +28,7 @@ import net.tylermurphy.hideAndSeek.util.Status; import net.tylermurphy.hideAndSeek.util.WinType; import net.tylermurphy.hideAndSeek.world.WorldLoader; import org.bukkit.*; +import org.bukkit.attribute.Attribute; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Firework; @@ -219,6 +220,29 @@ public class Game { } } + public static void join(Player player){ + if(Game.status == Status.STANDBY) { + player.getInventory().clear(); + Board.addHider(player); + if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); + else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); + player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ())); + player.setGameMode(GameMode.ADVENTURE); + Board.createLobbyBoard(player); + Board.reloadLobbyBoards(); + } else { + Board.addSpectator(player); + player.sendMessage(messagePrefix + message("GAME_JOIN_SPECTATOR")); + player.setGameMode(GameMode.SPECTATOR); + Board.createGameBoard(player); + player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ())); + player.sendTitle(ChatColor.GRAY + "" + ChatColor.BOLD + "SPECTATING", ChatColor.WHITE + message("SPECTATOR_SUBTITLE").toString(), 10, 70, 20); + } + + player.setFoodLevel(20); + player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getBaseValue()); + } + public static void removeItems(Player player){ for(ItemStack si : Items.SEEKER_ITEMS) for(ItemStack i : player.getInventory().getContents()) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java index 9d863f8..18913da 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Packet.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java index 305da9f..44a3e42 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Status.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java b/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java index d793d9e..4c949e1 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/TabCompleter.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java index c79f335..ef65af3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/UUIDFetcher.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java b/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java index f633d1b..3c555cc 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/WinType.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java index 1e75be7..7f29d6a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java index 5d84ceb..5d6e377 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java @@ -5,7 +5,7 @@ * * Kenshins Hide and Seek free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * he Free Software Foundation, either version 3 of the License. + * he Free Software Foundation version 3. * * Kenshins Hide and Seek is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml index 49e5f5e..b48aa4e 100644 --- a/src/main/resources/lang/localization_de-DE.yml +++ b/src/main/resources/lang/localization_de-DE.yml @@ -58,6 +58,7 @@ Localization: STOP: "Das Spiel wurde gestoppt." HIDERS_SUBTITLE: "Verstecke dich gut vor den Seekern!" SEEKERS_SUBTITLE: "Finde alle Hider!" + SPECTATOR_SUBTITLE: "Du bist mitten im spiel beigetreten." BOUNDS_WRONG_WORLD: "Führe diesen Befehl bitte in der Spielwelt aus." BOUNDS: "Grenzen erfolgreich an dieser Position gesetzt. ({AMOUNT}/2)" NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält." diff --git a/src/main/resources/lang/localization_en-US.yml b/src/main/resources/lang/localization_en-US.yml index 1a2a25a..93cbd4e 100644 --- a/src/main/resources/lang/localization_en-US.yml +++ b/src/main/resources/lang/localization_en-US.yml @@ -58,6 +58,7 @@ Localization: STOP: "Game has been force stopped." HIDERS_SUBTITLE: "Hide away from the seekers" SEEKERS_SUBTITLE: "Eliminate all hiders" + SPECTATOR_SUBTITLE: "You joined mid-game." BOUNDS_WRONG_WORLD: "Please run this command in the game world." BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)." NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0." -- cgit v1.2.3-freya From 3c10cf735d49e62cabef5180248748b06f9de287 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Tue, 28 Dec 2021 11:53:55 -0500 Subject: 1.3.3 rc2 --- pom.xml | 5 +++ .../java/net/tylermurphy/hideAndSeek/Main.java | 7 ++-- .../hideAndSeek/game/EventListener.java | 1 - .../net/tylermurphy/hideAndSeek/game/Game.java | 47 ++++++++++------------ .../hideAndSeek/world/VoidGenerator.java | 12 +++--- src/main/resources/config.yml | 1 - 6 files changed, 38 insertions(+), 35 deletions(-) (limited to 'src/main/resources') diff --git a/pom.xml b/pom.xml index 7c10eb1..7e48a1c 100644 --- a/pom.xml +++ b/pom.xml @@ -44,5 +44,10 @@ sqlite-jdbc 3.36.0.3 + + org.jetbrains + annotations + 23.0.0 + \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/net/tylermurphy/hideAndSeek/Main.java index f1b3364..e486cda 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/Main.java @@ -40,6 +40,7 @@ import net.tylermurphy.hideAndSeek.configuration.Config; import net.tylermurphy.hideAndSeek.configuration.Localization; import net.tylermurphy.hideAndSeek.configuration.Items; import net.tylermurphy.hideAndSeek.game.Board; +import org.jetbrains.annotations.NotNull; public class Main extends JavaPlugin implements Listener { @@ -77,12 +78,12 @@ public class Main extends JavaPlugin implements Listener { UUIDFetcher.cleanup(); } - public boolean onCommand(CommandSender sender, Command cmd,String label, String[] args) { + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) { return CommandHandler.handleCommand(sender, args); } - public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { + public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { return TabCompleter.handleTabComplete(sender, args); } -} +} \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java index 4911d5f..7db663c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java @@ -21,7 +21,6 @@ package net.tylermurphy.hideAndSeek.game; import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import net.tylermurphy.hideAndSeek.command.Join; import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.*; import org.bukkit.attribute.Attribute; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index 39d6376..f8284ca 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -411,7 +411,7 @@ class Taunt { protected void update() { if(delay == 0) { if(running) launchTaunt(); - else if(tauntLast || Board.size() > 1) executeTaunt(); + else if(tauntLast || Board.sizeHider() > 1) executeTaunt(); } else { delay--; delay = Math.max(delay, 0); @@ -419,34 +419,31 @@ class Taunt { } private void executeTaunt() { - Player taunted = null; - int rand = (int) (Math.random()*Board.sizeHider()); - for(Player player : Board.getPlayers()) { - if(Board.isHider(player)) { - rand--; - if(rand==0) { - taunted = player; - break; - } - } - } - if(taunted != null) { - taunted.sendMessage(message("TAUNTED").toString()); - broadcastMessage(tauntPrefix + message("TAUNT")); - tauntPlayer = taunted.getName(); - running = true; - delay = 30; - } else { - this.delay = tauntDelay; + Optional rand = Board.getHiders().stream().skip(new Random().nextInt(Board.size())).findFirst(); + if(!rand.isPresent()){ + Main.plugin.getLogger().warning("Failed to select random seeker."); + return; } + Player taunted = rand.get(); + taunted.sendMessage(message("TAUNTED").toString()); + broadcastMessage(tauntPrefix + message("TAUNT")); + tauntPlayer = taunted.getName(); + running = true; + delay = 30; } private void launchTaunt(){ - Player taunted1 = Board.getPlayer(tauntPlayer); - if(taunted1 != null) { - World world = taunted1.getLocation().getWorld(); - assert world != null; - Firework fw = (Firework) world.spawnEntity(taunted1.getLocation(), EntityType.FIREWORK); + Player taunted = Board.getPlayer(tauntPlayer); + if(taunted != null) { + World world = taunted.getLocation().getWorld(); + if(world == null){ + Main.plugin.getLogger().severe("Game world is null while trying to launch taunt."); + tauntPlayer = ""; + running = false; + delay = tauntDelay; + return; + } + Firework fw = (Firework) world.spawnEntity(taunted.getLocation(), EntityType.FIREWORK); FireworkMeta fwm = fw.getFireworkMeta(); fwm.setPower(4); fwm.addEffect(FireworkEffect.builder() diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java index 7f29d6a..7b12767 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java @@ -26,11 +26,12 @@ import java.util.Random; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; +import org.jetbrains.annotations.NotNull; public class VoidGenerator extends ChunkGenerator{ - public List getDefaultPopulators(World world) { - return Collections.emptyList(); + public @NotNull List getDefaultPopulators(@NotNull World world) { + return Collections.emptyList(); } public boolean shouldGenerateNoise() { @@ -61,10 +62,11 @@ public class VoidGenerator extends ChunkGenerator{ return false; } - public boolean canSpawn(World world, int x, int z) { + public boolean canSpawn(@NotNull World world, int x, int z) { return true; } - public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) { return createChunkData(world); } - + // Backwards compatibility + public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) { return createChunkData(world); } + } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ae130f8..778e3b4 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -90,7 +90,6 @@ lobby: max: 10 enabled: true - # Changes the default plugin language. Currently, Supported localizations are: # en-US (English - United States) # de-DE (German - Germany) -- cgit v1.2.3-freya From 7eb18751260425e13337ffd3ccac0f2c0064ee54 Mon Sep 17 00:00:00 2001 From: HerrMelodious <88331632+HerrMelodious@users.noreply.github.com> Date: Tue, 28 Dec 2021 23:31:57 +0100 Subject: Update localization_de-DE.yml * SETUP_BOUNDS * NO_GAME_INFO * INFORMATION_FOR --- src/main/resources/lang/localization_de-DE.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml index b48aa4e..d2dcc1e 100644 --- a/src/main/resources/lang/localization_de-DE.yml +++ b/src/main/resources/lang/localization_de-DE.yml @@ -47,7 +47,7 @@ Localization: SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit" SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)" SETUP_COMPLETE: "Alles eingerichtet! Hide and Seek ist spielbereit." - SETUP_BOUNDS: "&c&l- &fBitte legen Sie Spielgrenzen in 2 gegenüberliegenden Ecken der Spielkarte fest, /hs setbounds" + SETUP_BOUNDS: "&c&l- &fSpielgrenze in 2 gegenüberliegenden Ecken der Welt festlegen mit /hs setbounds" GAME_SPAWN: "Teleport-Position für Spielbeginn festgelegt" LOBBY_SPAWN: "Teleport-Position für Lobby festgelegt" EXIT_SPAWN: "Teleport-Position für Spielende festgelegt" @@ -62,8 +62,9 @@ Localization: BOUNDS_WRONG_WORLD: "Führe diesen Befehl bitte in der Spielwelt aus." BOUNDS: "Grenzen erfolgreich an dieser Position gesetzt. ({AMOUNT}/2)" NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält." - NO_GAME_INFO: "Der Spieler hat keine Gameplay-Informationen." - INFORMATION_FOR: "Gewinninformationen für {PLAYER}" + NO_GAME_INFO: "Keine Informationen zum Gameplay für diesen Spieler vorhanden." + INFORMATION_FOR: "Gewinninformationen für {PLAYER}:" + # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE version: 2 type: "de-DE" -- cgit v1.2.3-freya