did some cleanup for transtioning out of beta
This commit is contained in:
parent
9764af18a7
commit
90bf30acfe
10 changed files with 79 additions and 40 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
.idea/
|
.idea/
|
||||||
out/production/
|
out/production/
|
||||||
Resurrection.iml
|
Resurrection.iml
|
||||||
|
data/'resurrection bukkit.png'
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,9 +1,6 @@
|
||||||
package net.brysonsteck.Resurrection;
|
package net.brysonsteck.Resurrection;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.commands.CommandAbout;
|
import net.brysonsteck.Resurrection.commands.*;
|
||||||
import net.brysonsteck.Resurrection.commands.CommandBug;
|
|
||||||
import net.brysonsteck.Resurrection.commands.CommandHowLong;
|
|
||||||
import net.brysonsteck.Resurrection.commands.CommandResurrect;
|
|
||||||
import net.brysonsteck.Resurrection.player.PlayerListener;
|
import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
import net.brysonsteck.Resurrection.player.TimeCheck;
|
import net.brysonsteck.Resurrection.player.TimeCheck;
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
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("bug").setExecutor(new CommandBug());
|
||||||
this.getCommand("resurrect").setExecutor(new CommandResurrect());
|
this.getCommand("resurrect").setExecutor(new CommandResurrect());
|
||||||
this.getCommand("howlong").setExecutor(new CommandHowLong());
|
this.getCommand("howlong").setExecutor(new CommandHowLong());
|
||||||
|
this.getCommand("source").setExecutor(new CommandSource());
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
System.out.println("[Resurrection] ---------------------------------------------------------");
|
||||||
System.out.println("[Resurrection] Successfully Started!");
|
System.out.println("[Resurrection] Successfully Started!");
|
||||||
|
|
|
@ -17,29 +17,33 @@ public class CommandAbout implements CommandExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
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) {
|
if (commandSender instanceof Player) {
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Resurrection" + ChatColor.RESET);
|
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 a certain amount of time before respawning.");
|
||||||
p.sendMessage(ChatColor.YELLOW + "Resurrection is a Spigot Minecraft plugin that forces players to wait 24 hours before respawning.");
|
|
||||||
p.sendMessage(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection.");
|
p.sendMessage(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection.");
|
||||||
p.sendMessage("");
|
|
||||||
if (outdated) {
|
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(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("---");
|
||||||
|
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 + "\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 {
|
} 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class CommandBug implements CommandExecutor {
|
||||||
commandSender.sendMessage("");
|
commandSender.sendMessage("");
|
||||||
commandSender.sendMessage(ChatColor.YELLOW + "Okay, fine. Maybe I'll tell you how to fix the problem. Hehe.");
|
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 + "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.");
|
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);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 60);
|
||||||
|
|
|
@ -48,22 +48,22 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
||||||
if (self) {
|
if (self) {
|
||||||
commandSender.sendMessage("You will respawn in " + timeCheck.formatTime('f'));
|
commandSender.sendMessage(ChatColor.YELLOW + "You will respawn in " + timeCheck.formatTime('f'));
|
||||||
} else {
|
} 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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (self) {
|
if (self) {
|
||||||
commandSender.sendMessage("You aren't dead, dummy.");
|
commandSender.sendMessage(ChatColor.RED + "ERROR: You aren't dead, dummy.");
|
||||||
} else {
|
} else {
|
||||||
commandSender.sendMessage("ERROR: " + p.getDisplayName() + " is not dead!");
|
commandSender.sendMessage(ChatColor.RED + "ERROR: " + p.getDisplayName() + " is not dead!");
|
||||||
}
|
}
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
||||||
if (resurrectPlayer == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) {
|
if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
@ -38,19 +38,18 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println(ChatColor.RED + "Too few arguments!");
|
System.out.println(ChatColor.RED + "ERROR: Too few arguments!");
|
||||||
System.out.println(ChatColor.RED + "Usage: /resurrect PLAYER");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
||||||
if (resurrectPlayer == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) {
|
if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
@ -67,12 +66,11 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Too few arguments!");
|
System.out.println("[Resurrection] ERROR: Too few arguments!");
|
||||||
System.out.println("Usage: /resurrect PLAYER");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
src/net/brysonsteck/Resurrection/commands/CommandSource.java
Normal file
32
src/net/brysonsteck/Resurrection/commands/CommandSource.java
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,8 +70,8 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
if (resumeDeath && !timerRunning) {
|
if (resumeDeath && !timerRunning) {
|
||||||
// spawn = p.getLocation();
|
// spawn = p.getLocation();
|
||||||
p.sendMessage(ChatColor.RED + "You are still dead. To check how long you have left before you are resurrected, " +
|
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 + "run the \"/howlong\" command in chat.");
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -111,14 +111,15 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(PlayerDeathEvent e) {
|
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();
|
Player p = e.getEntity();
|
||||||
stillDead = true;
|
stillDead = true;
|
||||||
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
|
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
|
||||||
|
|
||||||
long resurrectionTime = System.currentTimeMillis() + 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;
|
timerRunning = true;
|
||||||
|
|
||||||
// save death state
|
// save death state
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
main: net.brysonsteck.Resurrection.Resurrection
|
main: net.brysonsteck.Resurrection.Resurrection
|
||||||
name: Resurrection
|
name: Resurrection
|
||||||
author: 'Bryson Steck'
|
author: 'Bryson Steck'
|
||||||
version: '0.2.1 beta'
|
version: '1.0'
|
||||||
commands:
|
commands:
|
||||||
about:
|
about:
|
||||||
description: Displays information about Resurrection.
|
description: Displays information about Resurrection.
|
||||||
|
@ -18,5 +18,9 @@ commands:
|
||||||
usage: /resurrect PLAYER_NAME
|
usage: /resurrect PLAYER_NAME
|
||||||
|
|
||||||
bug:
|
bug:
|
||||||
description: Displays contact info if you encounter a bug.
|
description: Displays contact info if you encounter a bug using Resurrection.
|
||||||
usage: /bug
|
usage: /bug
|
||||||
|
|
||||||
|
source:
|
||||||
|
description: Displays info about the source code of Resurrection.
|
||||||
|
usage: /source
|
Loading…
Add table
Reference in a new issue