diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-08-25 00:23:03 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-08-25 00:23:03 -0600 |
commit | 90bf30acfe869e17cf4209465f67cd70919c63b0 (patch) | |
tree | 099300dd7eaee5b30c8c0c7bee1ff3843150345e | |
parent | 9764af18a7bd1e9c9564993bccf7826e565ec7c7 (diff) | |
download | resurrection-90bf30acfe869e17cf4209465f67cd70919c63b0.tar resurrection-90bf30acfe869e17cf4209465f67cd70919c63b0.tar.gz resurrection-90bf30acfe869e17cf4209465f67cd70919c63b0.tar.bz2 |
did some cleanup for transtioning out of beta
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1598152 -> 1600412 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/Resurrection.java | 6 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/commands/CommandAbout.java | 34 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/commands/CommandBug.java | 2 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/commands/CommandHowLong.java | 10 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/commands/CommandResurrect.java | 14 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/commands/CommandSource.java | 32 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerListener.java | 9 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/plugin.yml | 10 |
10 files changed, 79 insertions, 40 deletions
@@ -1,3 +1,5 @@ .idea/ out/production/ Resurrection.iml +data/'resurrection bukkit.png' + diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex 9b23d4b..951e16e 100644 --- a/out/artifacts/Resurrection_jar/Resurrection.jar +++ b/out/artifacts/Resurrection_jar/Resurrection.jar diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index 48ef593..e8aed53 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -1,9 +1,6 @@ package net.brysonsteck.Resurrection; -import net.brysonsteck.Resurrection.commands.CommandAbout; -import net.brysonsteck.Resurrection.commands.CommandBug; -import net.brysonsteck.Resurrection.commands.CommandHowLong; -import net.brysonsteck.Resurrection.commands.CommandResurrect; +import net.brysonsteck.Resurrection.commands.*; import net.brysonsteck.Resurrection.player.PlayerListener; import net.brysonsteck.Resurrection.player.TimeCheck; import net.brysonsteck.Resurrection.startup.CheckForUpdate; @@ -105,6 +102,7 @@ public class Resurrection extends JavaPlugin implements Listener { this.getCommand("bug").setExecutor(new CommandBug()); this.getCommand("resurrect").setExecutor(new CommandResurrect()); this.getCommand("howlong").setExecutor(new CommandHowLong()); + this.getCommand("source").setExecutor(new CommandSource()); System.out.println("[Resurrection] ---------------------------------------------------------"); System.out.println("[Resurrection] Successfully Started!"); diff --git a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java index a474f6c..47d45c8 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java @@ -17,29 +17,33 @@ public class CommandAbout implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { - String aboutMessage = ChatColor.GREEN + "" + ChatColor.BOLD + "Resurrection\n\n" + ChatColor.RESET + - "Resurrection is a Spigot Minecraft plugin that forces players to wait 24 hours before respawning.\n" + - "The current version of this plugin is " + currentVersion + ".\n\n" + - "This plugin is licensed under the GNU Affero General Public License v3.0. Read more here: " + - "For more information on this plugin or to download it for yourself, visit the GitHub repository at https://github.com/brysonsteck/resurrection" + - "\u00a9 2021 Bryson Steck."; + if (commandSender instanceof Player) { Player p = (Player) commandSender; - p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Resurrection" + ChatColor.RESET); - p.sendMessage(""); - p.sendMessage(ChatColor.YELLOW + "Resurrection is a Spigot Minecraft plugin that forces players to wait 24 hours before respawning."); + 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."); p.sendMessage(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection."); - p.sendMessage(""); if (outdated) { - p.sendMessage(ChatColor.RED + "A newer version of this plugin is available. Please notify a server admin to update this plugin for new features and/or stability improvements."); - p.sendMessage(""); + p.sendMessage(ChatColor.RED + "HOWEVER, A newer version of this plugin is available. Please notify a server admin to update this plugin for new features and/or stability improvements."); } + p.sendMessage("---"); + p.sendMessage(ChatColor.YELLOW + "This plugin is licensed under the GNU Affero General Public License v3.0. For more info, run " + ChatColor.AQUA + "/source"); + p.sendMessage(ChatColor.YELLOW + "For more info on this plugin or to download it, visit the GitHub repository at https://github.com/brysonsteck/resurrection"); p.sendMessage(ChatColor.YELLOW + "\u00a9 2021 Bryson Steck"); - p.sendMessage(ChatColor.YELLOW + "This plugin is licensed under the GNU Affero General Public License v3.0. Read more here: https://www.gnu.org/licenses/agpl-3.0.en.html"); - p.sendMessage(ChatColor.YELLOW + "For more information on this plugin or to download it for yourself, visit the GitHub repository at https://github.com/brysonsteck/resurrection"); } else { - System.out.println(aboutMessage); + 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."); + System.out.println("[Resurrection] This server is running version " + currentVersion + " of Resurrection."); + if (outdated) { + System.out.println("[Resurrection] HOWEVER, a newer version of Resurrection is available. Please check the updater on startup for more information."); + } + System.out.println("[Resurrection]"); + System.out.println("[Resurrection] This plugin is licensed under the GNU Affero General Public License v3.0. For more info, run /source"); + System.out.println("[Resurrection] Since you're the admin, you probably know where to download it lmao. Here's the link anyway: https://github.com/brysonsteck/resurrection"); + System.out.println("[Resurrection] \u00a9 2021 Bryson Steck"); + } return true; } diff --git a/src/net/brysonsteck/Resurrection/commands/CommandBug.java b/src/net/brysonsteck/Resurrection/commands/CommandBug.java index 2c6b2f4..f6607c3 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandBug.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandBug.java @@ -21,7 +21,7 @@ public class CommandBug implements CommandExecutor { commandSender.sendMessage(""); commandSender.sendMessage(ChatColor.YELLOW + "Okay, fine. Maybe I'll tell you how to fix the problem. Hehe."); commandSender.sendMessage(ChatColor.YELLOW + "You can either create an issue on GitHub here: " + ChatColor.BLUE + "https://github.com/brysonsteck/resurrection/issues"); - commandSender.sendMessage(ChatColor.YELLOW + "OR you can fill out this Google Form if you don't know how to use GitHub: " + ChatColor.GREEN + "https://forms.gle/3gLmhMXowNyqKUGdA"); + commandSender.sendMessage(ChatColor.YELLOW + "OR you can fill out this Google Form if you don't know how to use GitHub: " + ChatColor.BLUE + "https://forms.gle/3gLmhMXowNyqKUGdA"); commandSender.sendMessage(ChatColor.YELLOW + "Please prepare to explain how the bug occurred regardless of how you report the bug to me."); } }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 60); diff --git a/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java b/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java index 012d23e..9569c27 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java @@ -48,22 +48,22 @@ public class CommandHowLong implements CommandExecutor { TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime); if (self) { - commandSender.sendMessage("You will respawn in " + timeCheck.formatTime('f')); + commandSender.sendMessage(ChatColor.YELLOW + "You will respawn in " + timeCheck.formatTime('f')); } else { - commandSender.sendMessage(p.getDisplayName() + " will respawn in " + timeCheck.formatTime('f')); + commandSender.sendMessage(ChatColor.YELLOW + p.getDisplayName() + " will respawn in " + timeCheck.formatTime('f')); } return true; } else { if (self) { - commandSender.sendMessage("You aren't dead, dummy."); + commandSender.sendMessage(ChatColor.RED + "ERROR: You aren't dead, dummy."); } else { - commandSender.sendMessage("ERROR: " + p.getDisplayName() + " is not dead!"); + commandSender.sendMessage(ChatColor.RED + "ERROR: " + p.getDisplayName() + " is not dead!"); } return false; } } } - commandSender.sendMessage("ERROR: An error has occurred while trying to get time information. This is a bug in the program and not your fault."); + commandSender.sendMessage(ChatColor.RED + "ERROR: An error has occurred while trying to get time information. This is a bug in the program and not your fault."); return false; } } else { diff --git a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java index b573349..45ed156 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java @@ -21,7 +21,7 @@ public class CommandResurrect implements CommandExecutor { if (valid) { Player resurrectPlayer = Bukkit.getPlayer(strings[0]); if (resurrectPlayer == null) { - p.sendMessage(ChatColor.RED + "That player does not exist! Failed to resurrect."); + p.sendMessage(ChatColor.RED + "ERROR: That player is not online/doesn't exist! Failed to resurrect."); return false; } if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) { @@ -38,19 +38,18 @@ public class CommandResurrect implements CommandExecutor { } return true; } else { - p.sendMessage(ChatColor.RED + strings[0] + " is not dead! Failed to resurrect."); + p.sendMessage(ChatColor.RED + "ERROR: " + strings[0] + " is not dead! Failed to resurrect."); return false; } } else { - System.out.println(ChatColor.RED + "Too few arguments!"); - System.out.println(ChatColor.RED + "Usage: /resurrect PLAYER"); + System.out.println(ChatColor.RED + "ERROR: Too few arguments!"); return false; } } else { if (valid) { Player resurrectPlayer = Bukkit.getPlayer(strings[0]); if (resurrectPlayer == null) { - System.out.println("That player does not exist! Failed to resurrect."); + System.out.println("[Resurrection] That player is not online/doesn't exist! Failed to resurrect."); return false; } if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) { @@ -67,12 +66,11 @@ public class CommandResurrect implements CommandExecutor { } return true; } else { - System.out.println(strings[0] + " is not dead! Failed to resurrect."); + System.out.println("[Resurrection] " + strings[0] + " is not dead! Failed to resurrect."); return false; } } else { - System.out.println("Too few arguments!"); - System.out.println("Usage: /resurrect PLAYER"); + System.out.println("[Resurrection] ERROR: Too few arguments!"); return false; } } diff --git a/src/net/brysonsteck/Resurrection/commands/CommandSource.java b/src/net/brysonsteck/Resurrection/commands/CommandSource.java new file mode 100644 index 0000000..c36fbf2 --- /dev/null +++ b/src/net/brysonsteck/Resurrection/commands/CommandSource.java @@ -0,0 +1,32 @@ +package net.brysonsteck.Resurrection.commands; + +import net.brysonsteck.Resurrection.Resurrection; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; + +public class CommandSource implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + if (commandSender instanceof Player) { + commandSender.sendMessage(ChatColor.AQUA + "Resurrection is FREE AND OPEN SOURCE under the"); + commandSender.sendMessage(ChatColor.AQUA + "GNU Affero General Public License v3.0 via GitHub."); + commandSender.sendMessage(ChatColor.AQUA + "You can view the repository at https://github.com/brysonsteck/resurrection"); + commandSender.sendMessage(ChatColor.AQUA + "and the license at https://github.com/brysonsteck/resurrection/blob/master/LICENSE"); + + return true; + } else { + System.out.println("[Resurrection] Resurrection is FREE AND OPEN SOURCE under the"); + System.out.println("[Resurrection] GNU Affero General Public License v3.0 via GitHub."); + System.out.println("[Resurrection] You can view the repository at https://github.com/brysonsteck/resurrection"); + System.out.println("[Resurrection] and the license at https://github.com/brysonsteck/resurrection/blob/master/LICENSE"); + + return true; + } + } +} diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java index 8a6a78f..9648f69 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java @@ -70,8 +70,8 @@ public class PlayerListener implements Listener { } if (resumeDeath && !timerRunning) { // spawn = p.getLocation(); - p.sendMessage(ChatColor.RED + "You are still dead. To check how long you have left before you are resurrected, " + - "run \"howlong\" in chat."); + p.sendMessage(ChatColor.RED + "You are still dead. To check how long you have left before you are resurrected, "); + p.sendMessage(ChatColor.RED + "run the \"/howlong\" command in chat."); new BukkitRunnable() { @Override public void run() { @@ -111,14 +111,15 @@ public class PlayerListener implements Listener { @EventHandler public void onDeath(PlayerDeathEvent e) { - System.out.println("Resurrection: A player has died!"); + System.out.println("[Resurrection] A player has died!"); Player p = e.getEntity(); stillDead = true; TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time"))); long resurrectionTime = System.currentTimeMillis() + Long.parseLong(parseSettings.getSetting("resurrection_time")); - p.sendMessage("You have died!! You will be able to respawn in the next " + timeCheck.formatTime('h')); + e.setDeathMessage(e.getDeathMessage() + ". They will respawn in the next " + timeCheck.formatTime('f')); +// p.sendMessage("You have died!! You will be able to respawn in the next " + timeCheck.formatTime('h')); timerRunning = true; // save death state diff --git a/src/net/brysonsteck/Resurrection/plugin.yml b/src/net/brysonsteck/Resurrection/plugin.yml index 1d5aa86..189a9bc 100644 --- a/src/net/brysonsteck/Resurrection/plugin.yml +++ b/src/net/brysonsteck/Resurrection/plugin.yml @@ -1,7 +1,7 @@ main: net.brysonsteck.Resurrection.Resurrection name: Resurrection author: 'Bryson Steck' -version: '0.2.1 beta' +version: '1.0' commands: about: description: Displays information about Resurrection. @@ -18,5 +18,9 @@ commands: usage: /resurrect PLAYER_NAME bug: - description: Displays contact info if you encounter a bug. - usage: /bug
\ No newline at end of file + description: Displays contact info if you encounter a bug using Resurrection. + usage: /bug + + source: + description: Displays info about the source code of Resurrection. + usage: /source
\ No newline at end of file |