From eec11316107edbd69d97080cebc369e042ce5183 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Mon, 13 Sep 2021 16:02:00 -0600 Subject: testing new debug mode --- out/artifacts/Resurrection_jar/Resurrection.jar | Bin 1600912 -> 1601195 bytes src/net/brysonsteck/Resurrection/Resurrection.java | 2 +- .../Resurrection/commands/CommandAbout.java | 13 ++++++++++++- .../Resurrection/player/PlayerListener.java | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar index 4608bdb..ba333af 100644 Binary files a/out/artifacts/Resurrection_jar/Resurrection.jar and b/out/artifacts/Resurrection_jar/Resurrection.jar differ diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index cd40d02..01af324 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -102,7 +102,7 @@ public class Resurrection extends JavaPlugin implements Listener { if (parseSettings.isSettingsComplete() && !fileFail) { System.out.println("[Resurrection] Registering listeners and adding commands..."); // register listener - this.getServer().getPluginManager().registerEvents(new PlayerListener(), this); + this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this); // register commands this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated)); diff --git a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java index 272b4d0..08f0437 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java @@ -1,5 +1,6 @@ package net.brysonsteck.Resurrection.commands; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -7,19 +8,26 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class CommandAbout implements CommandExecutor { + boolean debug; String currentVersion; boolean outdated; public CommandAbout(String debug, String currentVersion, boolean outdated) { + this.debug = Boolean.parseBoolean(debug); this.currentVersion = currentVersion; this.outdated = outdated; } @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { - + if (debug) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/about` command was ran by " + commandSender.getName()); + } if (commandSender instanceof Player) { + if (debug) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is a player."); + } Player p = (Player) commandSender; p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "--- Resurrection ---" + ChatColor.RESET); p.sendMessage(ChatColor.YELLOW + "Resurrection is a Spigot Minecraft plugin that forces players to wait a certain amount of time before respawning."); @@ -32,6 +40,9 @@ public class CommandAbout implements CommandExecutor { p.sendMessage(ChatColor.YELLOW + "For more info on this plugin or to download it, visit the GitHub repository at " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection"); p.sendMessage(ChatColor.YELLOW + "\u00a9 2021 Bryson Steck"); } else { + if (debug) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console."); + } System.out.println("[Resurrection] --- Resurrection ---"); System.out.println("[Resurrection]"); System.out.println("[Resurrection] Resurrection is a Spigot Minecraft plugin that forces players to wait a certain amount of time before respawning."); diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java index c54fcf0..4705171 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java @@ -26,8 +26,8 @@ public class PlayerListener implements Listener { Hashtable playerSpawns = new Hashtable<>(); ParseSettings parseSettings; - public PlayerListener() { - parseSettings = new ParseSettings(); + public PlayerListener(ParseSettings parseSettings) { + this.parseSettings = parseSettings; } @EventHandler -- cgit v1.2.3