fixed all System.out calls, added command
This commit is contained in:
parent
8dcde3ca41
commit
7ab8389f0f
12 changed files with 228 additions and 163 deletions
3
TODO.md
3
TODO.md
|
@ -3,9 +3,10 @@
|
||||||
### Find compatibility with other versions
|
### Find compatibility with other versions
|
||||||
|
|
||||||
* 1.8
|
* 1.8
|
||||||
* Enables but crashes when trying to play ender dragon noise upon resurrection (ender dragon introduced in 1.9)
|
* Enables but crashes when trying to play ender dragon noise upon resurrection (ender dragon introduced in 1.9, wither noise instead? `Caused by: java.lang.NoSuchFieldError: ENTITY_ENDER_DRAGON_GROWL`)
|
||||||
* 1.9
|
* 1.9
|
||||||
* Doesn't enable, "compiled by more recent version of java"
|
* Doesn't enable, "compiled by more recent version of java"
|
||||||
|
* THIS SHOULD BE FIXED AFTER MOVING TO VSCODE (using java 8)
|
||||||
* 1.10
|
* 1.10
|
||||||
* same as 1.9
|
* same as 1.9
|
||||||
* 1.11
|
* 1.11
|
||||||
|
|
|
@ -5,13 +5,13 @@ import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class Resurrection extends JavaPlugin implements Listener {
|
public class Resurrection extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
|
@ -19,180 +19,111 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
System.out.println("[Resurrection] Resurrection has completed shutdown.");
|
Logger log = this.getLogger();
|
||||||
|
log.info("Resurrection has completed shutdown.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
Logger log = this.getLogger();
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
|
|
||||||
System.out.println("[Resurrection] Resurrection is starting!");
|
log.info("Resurrection is starting!");
|
||||||
PluginDescriptionFile pluginInfo = getDescription();
|
PluginDescriptionFile pluginInfo = getDescription();
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
|
|
||||||
if (pluginInfo.getVersion().contains("beta")) {
|
if (pluginInfo.getVersion().contains("beta")) {
|
||||||
// beta message
|
// beta message
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.warning("---------------------------------------------------------");
|
||||||
System.out.println("[Resurrection] WARNING!!!!");
|
log.warning("WARNING!!!!");
|
||||||
System.out.println("[Resurrection] You are running a beta version of Resurrection!");
|
log.warning("You are running a beta version of Resurrection!");
|
||||||
System.out.println("[Resurrection] ");
|
log.warning("");
|
||||||
System.out.println("[Resurrection] This means that this plugin is early in development and");
|
log.warning("This means that this plugin is early in development and not completely finished, and as a result you may experience unexpected doodads. Make sure that the plugin is up-to-date for more features and bug fixes. The plugin will now check for updates.");
|
||||||
System.out.println("[Resurrection] not completely finished, and as a result you may");
|
log.warning("---------------------------------------------------------");
|
||||||
System.out.println("[Resurrection] experience unexpected doodads. Make sure that the plugin");
|
|
||||||
System.out.println("[Resurrection] is up-to-date for more features and bug fixes. The plugin");
|
|
||||||
System.out.println("[Resurrection] will now check for updates.");
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for updates
|
// check for updates
|
||||||
System.out.println("[Resurrection] Checking for updates...");
|
log.info("Checking for updates...");
|
||||||
CheckForUpdate check = new CheckForUpdate();
|
CheckForUpdate check = new CheckForUpdate();
|
||||||
boolean outdated = false;
|
boolean outdated = false;
|
||||||
if (check.isSuccess()) {
|
if (check.isSuccess()) {
|
||||||
String newestVersion = check.getVersion();
|
String newestVersion = check.getVersion();
|
||||||
String newestVersionURL = check.getVersionURL();
|
String newestVersionURL = check.getVersionURL();
|
||||||
if (pluginInfo.getVersion().equals(newestVersion)) {
|
if (pluginInfo.getVersion().equals(newestVersion)) {
|
||||||
System.out.println("[Resurrection] " + newestVersion + " is the latest version of Resurrection.");
|
log.info(newestVersion + " is the latest version of Resurrection.");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
|
log.info("A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
|
||||||
System.out.println("[Resurrection] You can download the latest release on GitHub here \\/");
|
log.info("You can download the latest release on GitHub here \\/");
|
||||||
System.out.println("[Resurrection] " + newestVersionURL);
|
log.info(newestVersionURL);
|
||||||
outdated = true;
|
outdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
|
|
||||||
System.out.println("[Resurrection] Locating player data and settings files...");
|
log.info("Locating player data and settings files...");
|
||||||
// check if playerData.resurrection exists
|
// check if playerData.resurrection exists
|
||||||
File playerFile = new File("plugins/playerData.resurrection");
|
File playerFile = new File("plugins/playerData.resurrection");
|
||||||
File settingsFile = new File("plugins/settings.resurrection");
|
File settingsFile = new File("plugins/settings.resurrection");
|
||||||
|
|
||||||
boolean fileFail = false;
|
boolean fileFail = false;
|
||||||
if (!playerFile.exists()) {
|
if (!playerFile.exists()) {
|
||||||
System.out.println("[Resurrection] Player data file does not exist. Creating now in the \"plugins\" directory...");
|
log.info("Player data file does not exist. Creating now in the \"plugins\" directory...");
|
||||||
try {
|
try {
|
||||||
playerFile.createNewFile();
|
playerFile.createNewFile();
|
||||||
System.out.println("[Resurrection] Player data file created successfully.");
|
log.info("Player data file created successfully.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[Resurrection] An error has occurred creating the player data file!");
|
log.severe("An error has occurred creating the player data file!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
|
log.severe("This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
fileFail = true;
|
fileFail = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] The player data file has been found!");
|
log.info("The player data file has been found!");
|
||||||
}
|
}
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
System.out.println("[Resurrection] Settings file does not exist. Creating now in the \"plugins\" directory...");
|
log.info("Settings file does not exist. Creating now in the \"plugins\" directory...");
|
||||||
new ParseSettings();
|
new ParseSettings();
|
||||||
System.out.println("[Resurrection] Settings file created successfully.");
|
log.info("Settings file created successfully.");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] The settings file has also been found!");
|
log.info("The settings file has also been found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseSettings parseSettings = new ParseSettings();
|
ParseSettings parseSettings = new ParseSettings();
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
|
|
||||||
if (parseSettings.isSettingsComplete() && !fileFail) {
|
if (parseSettings.isSettingsComplete() && !fileFail) {
|
||||||
boolean DEBUG = false;
|
|
||||||
if (Boolean.parseBoolean(parseSettings.getSetting("debug"))) {
|
if (Boolean.parseBoolean(parseSettings.getSetting("debug"))) {
|
||||||
DEBUG = true;
|
log.warning("[Res. DEBUG]: DEBUG MODE ENABLED!");
|
||||||
System.out.println("[Res. DEBUG]: ***** DEBUG MODE ENABLED *****");
|
log.warning("[Res. DEBUG]: Resurrection's debug mode has been enabled in the settings file. All debug messages after this disclaimer will be broadcasted (sent to everyone) prefaced with the tag \"[Res. DEBUG]\" and sent in bold yellow text. Several messages may be sent at a time. Therefore, debug mode should be disabled for anything other than, well, debugging.");
|
||||||
System.out.println("[Res. DEBUG]: Resurrection's debug mode has been enabled in the settings file.");
|
log.warning("---------------------------------------------------------");
|
||||||
System.out.println("[Res. DEBUG]: All debug messages after this disclaimer will be broadcasted (sent to everyone) prefaced with the tag \"[Res. DEBUG]\" and sent in bold yellow text.");
|
|
||||||
System.out.println("[Res. DEBUG]: Several messages may be sent at a time. Therefore, debug mode should be disabled for anything other than, well, debugging.");
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[Resurrection] Essential files found and valid. Registering listeners and adding commands...");
|
log.info("Essential files found and valid. Registering listeners and adding commands...");
|
||||||
// register listener
|
// register listener
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this);
|
||||||
if (DEBUG) {
|
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player listener registered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// register commands
|
// register commands
|
||||||
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
|
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
|
||||||
if (DEBUG) {
|
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: `/about` registered.");
|
|
||||||
}
|
|
||||||
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
|
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
|
||||||
if (DEBUG) {
|
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: `/bug` registered.");
|
|
||||||
}
|
|
||||||
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
|
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
|
||||||
if (DEBUG) {
|
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: `/resurrect` registered.");
|
|
||||||
}
|
|
||||||
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
|
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
|
||||||
if (DEBUG) {
|
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: `/howlong` registered.");
|
|
||||||
}
|
|
||||||
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug")));
|
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug")));
|
||||||
if (DEBUG) {
|
this.getCommand("dead").setExecutor(new CommandDead(parseSettings.getSetting("debug")));
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: `/source` registered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
System.out.println("[Resurrection] Successfully Started!");
|
log.info("Successfully Started!");
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
log.info("---------------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {}
|
||||||
|
|
||||||
// String test = "fals";
|
|
||||||
//
|
|
||||||
// if (!test.toLowerCase().contains("true") && !test.toLowerCase().contains("false")) {
|
|
||||||
// System.out.println("fail");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// DO THIS
|
|
||||||
// PlayerData playerData = new PlayerData();
|
|
||||||
// System.out.println("--- Reading Player data file ---");
|
|
||||||
// playerData.readData();
|
|
||||||
// System.out.println(playerData.getPlayers());
|
|
||||||
// System.out.println(playerData.getRawData());
|
|
||||||
// System.out.println("--- Oh look! A new player joined. Adding them. ---");
|
|
||||||
// String rawData = playerData.getRawData();
|
|
||||||
// rawData = rawData + ";bryzinga,false,0";
|
|
||||||
// playerData.saveData(rawData);
|
|
||||||
// System.out.println(playerData.getPlayers());
|
|
||||||
// System.out.println(playerData.getRawData());
|
|
||||||
// System.out.println("--- A player has died! Update the data file! ---");
|
|
||||||
// rawData = playerData.getRawData();
|
|
||||||
// String[] rawPlayers = rawData.split(";");
|
|
||||||
// String[] rawSinglePlayer = new String[3];
|
|
||||||
// int index = 0;
|
|
||||||
// for (String players : rawPlayers) {
|
|
||||||
// if (players.startsWith("bryzinga")) {
|
|
||||||
// String[] playerSplit = players.split(",");
|
|
||||||
// playerSplit[1] = "true";
|
|
||||||
// playerSplit[2] = "12345";
|
|
||||||
//
|
|
||||||
// rawPlayers[index] = String.join(",", playerSplit);
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// index++;
|
|
||||||
// }
|
|
||||||
// rawData = String.join(";", rawPlayers);
|
|
||||||
// playerData.saveData(rawData);
|
|
||||||
// System.out.println(rawData);
|
|
||||||
// String[] array = ";bryzinga,false,0".split(";");
|
|
||||||
// System.out.println(array.length);
|
|
||||||
|
|
||||||
// TimeCheck timeCheck = new TimeCheck((System.currentTimeMillis() + 86212345) - System.currentTimeMillis());
|
|
||||||
// System.out.println(timeCheck.formatTime());
|
|
||||||
// System.out.println(System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
|
||||||
public class CommandAbout implements CommandExecutor {
|
public class CommandAbout implements CommandExecutor {
|
||||||
boolean DEBUG;
|
boolean DEBUG;
|
||||||
|
@ -20,6 +25,7 @@ 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) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/about` command was ran by " + commandSender.getName());
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/about` command was ran by " + commandSender.getName());
|
||||||
}
|
}
|
||||||
|
@ -28,13 +34,15 @@ public class CommandAbout implements CommandExecutor {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is a player.");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is a player.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String outdatedText = "";
|
||||||
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(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 a certain amount of time before respawning.");
|
||||||
p.sendMessage(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection.");
|
|
||||||
if (outdated) {
|
if (outdated) {
|
||||||
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.");
|
outdatedText = " 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(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection." + ChatColor.RED + outdatedText);
|
||||||
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 + "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 " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection");
|
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");
|
||||||
|
@ -43,18 +51,17 @@ public class CommandAbout implements CommandExecutor {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console.");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console.");
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection] --- Resurrection ---");
|
String outdatedText = "";
|
||||||
System.out.println("[Resurrection]");
|
log.info("--- Resurrection ---");
|
||||||
System.out.println("[Resurrection] Resurrection is a Spigot Minecraft plugin that forces players to wait a certain amount of time before respawning.");
|
log.info("");
|
||||||
System.out.println("[Resurrection] This server is running version " + currentVersion + " of Resurrection.");
|
log.info("Resurrection is a Spigot Minecraft plugin that forces players to wait a certain amount of time before respawning.");
|
||||||
if (outdated) {
|
if (outdated) {
|
||||||
System.out.println("[Resurrection] HOWEVER, a newer version of Resurrection is available. Please check the updater on startup for more information.");
|
outdatedText = " HOWEVER, a newer version of Resurrection is available. Please check the updater on startup for more information.";
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection]");
|
log.info("This server is running version " + currentVersion + " of Resurrection." + outdatedText);
|
||||||
System.out.println("[Resurrection] This plugin is licensed under the GNU Affero General Public License v3.0. For more info, run /source");
|
log.info("");
|
||||||
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");
|
log.info("This plugin is licensed under the GNU Affero General Public License v3.0. For more info, run \"/source\". 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] Copyright 2021 Bryson Steck");
|
log.info("Copyright 2021 Bryson Steck");
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.Resurrection;
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -19,6 +22,7 @@ public class CommandBug 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) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/bug` command was ran by " + commandSender.getName());
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/bug` command was ran by " + commandSender.getName());
|
||||||
}
|
}
|
||||||
|
@ -45,15 +49,13 @@ public class CommandBug implements CommandExecutor {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[Resurrection] Did you find a bug? Well that sucks for you.");
|
log.info("Did you find a bug? Well that sucks for you.");
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("[Resurrection] ");
|
log.info("");
|
||||||
System.out.println("[Resurrection] Okay, fine. Maybe I'll tell you how to fix the problem. Hehe.");
|
log.info("Okay, fine. Maybe I'll tell you how to fix the problem. Hehe.");
|
||||||
System.out.println("[Resurrection] You can either create an issue on GitHub here: https://github.com/brysonsteck/resurrection/issues");
|
log.info("You can either create an issue on GitHub here: https://github.com/brysonsteck/resurrection/issues OR you can fill out this Google Form if you don't know how to use GitHub. Please prepare to explain how the bug occurred regardless of how you report the bug to me: https://forms.gle/3gLmhMXowNyqKUGdA ");
|
||||||
System.out.println("[Resurrection] OR you can fill out this Google Form if you don't know how to use GitHub: https://forms.gle/3gLmhMXowNyqKUGdA");
|
|
||||||
System.out.println("[Resurrection] 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);
|
||||||
return true;
|
return true;
|
||||||
|
|
100
src/net/brysonsteck/Resurrection/commands/CommandDead.java
Normal file
100
src/net/brysonsteck/Resurrection/commands/CommandDead.java
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
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 net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
import net.brysonsteck.Resurrection.player.PlayerData;
|
||||||
|
import net.brysonsteck.Resurrection.player.TimeCheck;
|
||||||
|
|
||||||
|
public class CommandDead implements CommandExecutor {
|
||||||
|
boolean DEBUG;
|
||||||
|
|
||||||
|
public CommandDead(String DEBUG) {
|
||||||
|
this.DEBUG = Boolean.parseBoolean(DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
|
if (DEBUG) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/about` command was ran by " + commandSender.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerData playerData = new PlayerData();
|
||||||
|
playerData.readData();
|
||||||
|
String rawData = playerData.getRawData();
|
||||||
|
String[] rawPlayers = rawData.split(";");
|
||||||
|
int amountDead = 0;
|
||||||
|
for (String players : rawPlayers) {
|
||||||
|
String[] playerSplit = players.split(",");
|
||||||
|
if (playerSplit.length == 3) {
|
||||||
|
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
||||||
|
if (dead) {
|
||||||
|
amountDead++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] responses = new String[amountDead];
|
||||||
|
int index = 0;
|
||||||
|
for (String players : rawPlayers) {
|
||||||
|
String[] playerSplit = players.split(",");
|
||||||
|
if (playerSplit.length == 3) {
|
||||||
|
String playerName = playerSplit[0];
|
||||||
|
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
||||||
|
long timeToResurrection = Long.parseLong(playerSplit[2]);
|
||||||
|
|
||||||
|
if (dead) {
|
||||||
|
TimeCheck timeCheck = new TimeCheck(timeToResurrection - System.currentTimeMillis());
|
||||||
|
if (System.currentTimeMillis() > timeToResurrection) {
|
||||||
|
responses[index] = playerName + " will resurrect when they rejoin.";
|
||||||
|
} else {
|
||||||
|
responses[index] = playerName + " will resurrect in " + timeCheck.formatTime('f');
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandSender instanceof Player) {
|
||||||
|
Player p = (Player) commandSender;
|
||||||
|
if (amountDead == 0) {
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "There are currently no players awaiting resurrection.");
|
||||||
|
} else if (amountDead == 1) {
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "There is currently 1 player awaiting resurrection:");
|
||||||
|
} else if (amountDead >= 2) {
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "There are currently " + amountDead + " players awaiting resurrection:");
|
||||||
|
}
|
||||||
|
if (amountDead > 0) {
|
||||||
|
for (String response : responses) {
|
||||||
|
p.sendMessage(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (amountDead == 0) {
|
||||||
|
log.info("There are currently no players awaiting resurrection.");
|
||||||
|
} else if (amountDead == 1) {
|
||||||
|
log.info("There is currently 1 player awaiting resurrection:");
|
||||||
|
} else if (amountDead >= 2) {
|
||||||
|
log.info("There are currently " + amountDead + " players awaiting resurrection:");
|
||||||
|
}
|
||||||
|
if (amountDead > 0) {
|
||||||
|
for (String response : responses) {
|
||||||
|
log.info(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerData;
|
import net.brysonsteck.Resurrection.player.PlayerData;
|
||||||
import net.brysonsteck.Resurrection.player.TimeCheck;
|
import net.brysonsteck.Resurrection.player.TimeCheck;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class CommandHowLong implements CommandExecutor {
|
public class CommandHowLong implements CommandExecutor {
|
||||||
boolean DEBUG;
|
boolean DEBUG;
|
||||||
|
@ -18,6 +23,7 @@ public class CommandHowLong 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) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/howlong` command was ran by " + commandSender.getName());
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/howlong` command was ran by " + commandSender.getName());
|
||||||
}
|
}
|
||||||
|
@ -103,7 +109,7 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
|
|
||||||
if (strings.length == 0) {
|
if (strings.length == 0) {
|
||||||
System.out.println("[Resurrection] ERROR: The /howlong command requires the name of a player when ran through the console.");
|
log.warning("ERROR: The /howlong command requires the name of a player when ran through the console.");
|
||||||
return false;
|
return false;
|
||||||
} else if (strings.length == 1) {
|
} else if (strings.length == 1) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -117,7 +123,7 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
Player p = Bukkit.getPlayer(strings[0]);
|
Player p = Bukkit.getPlayer(strings[0]);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
System.out.println("[Resurrection] ERROR: That player is not online/doesn't exist!");
|
log.warning("ERROR: That player is not online/doesn't exist!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,16 +147,15 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
||||||
|
|
||||||
System.out.println("[Resurrection] " + p.getDisplayName() + " will respawn in " + timeCheck.formatTime('f'));
|
log.info(p.getDisplayName() + " will respawn in " + timeCheck.formatTime('f'));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] ERROR: " + p.getDisplayName() + " is not dead!");
|
log.warning("ERROR: " + p.getDisplayName() + " is not dead!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection] 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerData;
|
import net.brysonsteck.Resurrection.player.PlayerData;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
@ -9,6 +13,7 @@ import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
public class CommandResurrect implements CommandExecutor {
|
public class CommandResurrect implements CommandExecutor {
|
||||||
|
@ -20,6 +25,7 @@ public class CommandResurrect 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) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `resurrect` command was ran by " + commandSender.getName());
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `resurrect` command was ran by " + commandSender.getName());
|
||||||
}
|
}
|
||||||
|
@ -72,7 +78,7 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println(ChatColor.RED + "ERROR: Too few arguments!");
|
p.sendMessage(ChatColor.RED + "ERROR: Too few arguments!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +93,7 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
|
|
||||||
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
|
||||||
if (resurrectPlayer == null) {
|
if (resurrectPlayer == null) {
|
||||||
System.out.println("[Resurrection] ERROR: That player is not online/doesn't exist! Failed to resurrect.");
|
log.warning("ERROR: That player is not online/doesn't exist! Failed to resurrect.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -115,11 +121,11 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] ERROR: " + strings[0] + " is not dead! Failed to resurrect.");
|
log.warning("ERROR: " + strings[0] + " is not dead! Failed to resurrect.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] ERROR: Too few arguments!");
|
log.warning("ERROR: Too few arguments!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
|
||||||
|
|
||||||
public class CommandSource implements CommandExecutor {
|
public class CommandSource implements CommandExecutor {
|
||||||
|
@ -17,6 +22,7 @@ public class CommandSource 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) {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/source` command was ran by " + commandSender.getName());
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/source` command was ran by " + commandSender.getName());
|
||||||
}
|
}
|
||||||
|
@ -25,21 +31,14 @@ public class CommandSource implements CommandExecutor {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is a player");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is a player");
|
||||||
}
|
}
|
||||||
commandSender.sendMessage(ChatColor.YELLOW + "Resurrection is FREE AND OPEN SOURCE under the");
|
commandSender.sendMessage(ChatColor.YELLOW + "Resurrection is FREE AND OPEN SOURCE under the GNU Affero General Public License v3.0 via GitHub. You can view the repository at " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection" + ChatColor.YELLOW + " and the license at " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection/blob/master/LICENSE");
|
||||||
commandSender.sendMessage(ChatColor.YELLOW + "GNU Affero General Public License v3.0 via GitHub.");
|
|
||||||
commandSender.sendMessage(ChatColor.YELLOW + "You can view the repository at " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection");
|
|
||||||
commandSender.sendMessage(ChatColor.YELLOW + "and the license at " + ChatColor.AQUA + "https://github.com/brysonsteck/resurrection/blob/master/LICENSE");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: CommandSender is console");
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection] Resurrection is FREE AND OPEN SOURCE under the");
|
log.info("Resurrection is FREE AND OPEN SOURCE under the GNU Affero General Public License v3.0 via GitHub. You can view the repository at https://github.com/brysonsteck/resurrection and the license at https://github.com/brysonsteck/resurrection/blob/master/LICENSE");
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,14 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class PlayerData {
|
public class PlayerData {
|
||||||
Hashtable<String, Hashtable<String, String>> playerData = new Hashtable<>();
|
Hashtable<String, Hashtable<String, String>> playerData = new Hashtable<>();
|
||||||
String rawData;
|
String rawData;
|
||||||
boolean DEBUG = Boolean.parseBoolean(new ParseSettings()
|
boolean DEBUG = Boolean.parseBoolean(new ParseSettings()
|
||||||
.getSetting("debug"));
|
.getSetting("debug"));
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
|
|
||||||
public void saveData(String write) {
|
public void saveData(String write) {
|
||||||
try {
|
try {
|
||||||
|
@ -28,10 +30,10 @@ public class PlayerData {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Error occurred while trying to save player data, avoid shutting down the server");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Error occurred while trying to save player data, avoid shutting down the server");
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection] There was an issue saving the player data file.");
|
log.warning("There was an issue saving the player data file.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("[Resurrection] Resurrection will continue to run despite this error, but avoid shutting down the server until a successful save occurs.");
|
log.warning("Resurrection will continue to run despite this error, but avoid shutting down the server until a successful save occurs.");
|
||||||
System.out.println("[Resurrection] In the mean time, check to make sure the playerData file exists and you have permissions to write to it.");
|
log.warning("In the mean time, check to make sure the playerData file exists and you have permissions to write to it.");
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player data saved successfully, rereading data to ensure Resurrection is up to date");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player data saved successfully, rereading data to ensure Resurrection is up to date");
|
||||||
|
@ -70,9 +72,9 @@ public class PlayerData {
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Error occurred while trying to read player data. Resurrection is shutting down");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Error occurred while trying to read player data. Resurrection is shutting down");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[Resurrection] There was an issue reading the player data file.");
|
log.severe("There was an issue reading the player data file.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file could not be read, the plugin will now stop.");
|
log.severe("This file is crucial to Resurrection. Since the file could not be read, the plugin will now stop.");
|
||||||
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|
|
@ -4,15 +4,21 @@ import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
public class CheckForUpdate {
|
public class CheckForUpdate {
|
||||||
boolean success;
|
boolean success;
|
||||||
String version;
|
String version;
|
||||||
String versionURL;
|
String versionURL;
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
|
|
||||||
public CheckForUpdate() {
|
public CheckForUpdate() {
|
||||||
try {
|
try {
|
||||||
|
@ -26,7 +32,7 @@ public class CheckForUpdate {
|
||||||
versionURL = softwareObj.get("github-release").toString();
|
versionURL = softwareObj.get("github-release").toString();
|
||||||
success = true;
|
success = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[Resurrection] An error has occurred while attempting to check for updates.");
|
log.warning("An error has occurred while attempting to check for updates.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ParseSettings {
|
public class ParseSettings {
|
||||||
Hashtable<String, String> settings = new Hashtable<>();
|
Hashtable<String, String> settings = new Hashtable<>();
|
||||||
|
@ -15,6 +16,7 @@ public class ParseSettings {
|
||||||
boolean valuesComplete;
|
boolean valuesComplete;
|
||||||
|
|
||||||
public ParseSettings() {
|
public ParseSettings() {
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
try {
|
try {
|
||||||
File settingsFile = new File("plugins/settings.resurrection");
|
File settingsFile = new File("plugins/settings.resurrection");
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
|
@ -43,25 +45,25 @@ public class ParseSettings {
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
if (!verifySettings()) {
|
if (!verifySettings()) {
|
||||||
System.out.println("[Resurrection] There is a syntax issue inside the Settings file:");
|
log.severe("There is a syntax issue inside the Settings file:");
|
||||||
if (!settingsComplete) {
|
if (!settingsComplete) {
|
||||||
System.out.println("[Resurrection] The setting \"" + failedSetting + "\" is not present in the settings file.\n" +
|
log.severe(" The setting \"" + failedSetting + "\" is not present in the settings file.");
|
||||||
"[Resurrection] Please double check the settings file to make sure the setting exists and a valid corresponding value is set.\n" +
|
log.severe(" Please double check the settings file to make sure the setting exists and a valid corresponding value is set.");
|
||||||
"[Resurrection] Example: \"resurrection_time=86400000\"\n" +
|
log.severe(" Example: \"resurrection_time=86400000\"");
|
||||||
"[Resurrection] Example: \"debug=false\"");
|
log.severe(" Example: \"debug=false\"");
|
||||||
} else if (!valuesComplete) {
|
} else if (!valuesComplete) {
|
||||||
System.out.println("[Resurrection] The setting \"" + failedSetting + "\" contains an invalid or empty value.\n" +
|
log.severe("The setting \"" + failedSetting + "\" contains an invalid or empty value.");
|
||||||
"[Resurrection] Please double check the settings file to make sure that a valid value is set for this setting.\n" +
|
log.severe(" Please double check the settings file to make sure that a valid value is set for this setting.");
|
||||||
"[Resurrection] Example: \"resurrection_time=86400000\"\n" +
|
log.severe(" Example: \"resurrection_time=86400000\"");
|
||||||
"[Resurrection] Example: \"debug=false\"");
|
log.severe(" Example: \"debug=false\"");
|
||||||
}
|
}
|
||||||
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file is not complete, the plugin will now stop.");
|
log.severe("This file is crucial to Resurrection. Since the file is not complete, the plugin will now stop.");
|
||||||
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("[Resurrection] There was an issue reading the Settings file:");
|
log.severe("There was an issue reading the Settings file:");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file is not complete, the plugin will now stop.");
|
log.severe("This file is crucial to Resurrection. Since the file is not complete, the plugin will now stop.");
|
||||||
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
Bukkit.getPluginManager().disablePlugin(JavaPlugin.getProvidingPlugin(Resurrection.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,3 +30,7 @@ commands:
|
||||||
source:
|
source:
|
||||||
description: Displays info about the source code of Resurrection.
|
description: Displays info about the source code of Resurrection.
|
||||||
usage: /source
|
usage: /source
|
||||||
|
|
||||||
|
dead:
|
||||||
|
description: Displays all players who are awaiting resurrection.
|
||||||
|
usage: /dead
|
Loading…
Add table
Reference in a new issue