aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java6
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandAbout.java34
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandBug.java2
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandHowLong.java10
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandResurrect.java14
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandSource.java32
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java9
-rw-r--r--src/net/brysonsteck/Resurrection/plugin.yml10
8 files changed, 77 insertions, 40 deletions
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