Compare commits

...

10 commits

11 changed files with 178 additions and 116 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1 @@
blank_issues_enabled: false

View file

@ -1,10 +1,14 @@
--- ---
name: Provide other feedback name: Provide other feedback
about: Tell me something that isn't releated to bugs or feature requests. about: Tell me something that isn't related to bugs or feature requests.
title: '' title: ''
labels: feedback labels: feedback
assignees: '' assignees: ''
--- ---
**What does your feedback concern?**
This can be about the plugin itself, coding style, documentation, outreach, basically anything!
**What feedback do you have for me?**
Write away!

4
.gitignore vendored
View file

@ -5,4 +5,6 @@ data/resurrection bukkit.png
lib/ lib/
.gradle/ .gradle/
.vscode/ .vscode/
*.jar *.jar
/builds
convert-1.8.md

View file

@ -1,5 +1,5 @@
# Resurrection # Resurrection
![](https://brysonsteck.net/resurrection-sc.png) ![](https://brysonsteck.xyz/files/resurrection.png)
Resurrection is a Spigot/Bukkit Minecraft Server plugin that forces players to wait a certain amount of time before rejoining the world. This allows for tactical planning for games such as faction survival and other PvP gamemodes as it can severely penalize an entire team if care is not taken. Resurrection is a Spigot/Bukkit Minecraft Server plugin that forces players to wait a certain amount of time before rejoining the world. This allows for tactical planning for games such as faction survival and other PvP gamemodes as it can severely penalize an entire team if care is not taken.
@ -9,11 +9,11 @@ Resurrection is intended to make players wait long amounts of time between death
Resurrection is only confirmed to run on vanilla Spigot or Bukkit servers, meaning you built the server yourself using `BuildTools` with no extra settings, or downloaded it from official sources such as their website. Resurrection is **NOT GUARANTEED** to run on **ANY** fork of Spigot/Bukkit servers, such as Tuinity or Paper. Issues reported involving these forks may not be provided a solution unless proven that the issue still happens on vanilla versions. Resurrection is only confirmed to run on vanilla Spigot or Bukkit servers, meaning you built the server yourself using `BuildTools` with no extra settings, or downloaded it from official sources such as their website. Resurrection is **NOT GUARANTEED** to run on **ANY** fork of Spigot/Bukkit servers, such as Tuinity or Paper. Issues reported involving these forks may not be provided a solution unless proven that the issue still happens on vanilla versions.
Tested Minecraft Versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18 Tested Minecraft Versions: 1.8<sup>*</sup>, 1.9, 1.10, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18
Native Version: 1.16 Native Version: 1.16
You can keep track of compatibility with other versions by viewing my [TODO list.](TODO.md) <sup>*</sup>For Minecraft Servers version 1.8, you must download a special build of Resurrection in order for the plugin to work properly. These files are in the [releases](https://github.com/brysonsteck/resurrection/releases) as `Resurrection_mc1.8.jar` (for versions of Resurrection > 1.3).
## Commands ## Commands
@ -21,6 +21,8 @@ You can keep track of compatibility with other versions by viewing my [TODO list
* Displays information about the plugin, including links to download, and also warns the command-runner if the plugin is outdated. * Displays information about the plugin, including links to download, and also warns the command-runner if the plugin is outdated.
* `/bug` * `/bug`
* Displays contact information in case a bug occurs, such as links to the GitHub issues page and the Google Form. * Displays contact information in case a bug occurs, such as links to the GitHub issues page and the Google Form.
* `/dead`
* Displays all the players currently awaiting resurrection and how long they have left.
* `/howlong [PLAYER]` * `/howlong [PLAYER]`
* Shows the player how long they (or the specified player) have until they are resurrected. * Shows the player how long they (or the specified player) have until they are resurrected.
* This command requires a player to be specified when ran from the console. * This command requires a player to be specified when ran from the console.

View file

@ -2,9 +2,9 @@ The following applies to all files in this directory with the exception of `resu
# Example Files # Example Files
These files are crucial to Resurrection as they contain important timing data and resources for the plugin. This directory contains sample files for you to visualize what files Resurrection writes to the file system and how they work. Resurrection creates these files in the same directory as the Spigot server `plugins` directory when the plugin is enabled for the first time or if the files do not exist.
This directory contains sample files for you to visualize what these files will/may contain. The plugin creates these files in the same directory as the Spigot server `plugins` directory. **The files in this directory are purely for documentation purposes, they are not compiled into the final jars since Resurrection creates these files programmatically.**
Avoid touching these files while the plugin is enabled and avoid deleting or moving the files at any time after it's creation to prevent breaking the plugin. Avoid touching these files while the plugin is enabled and avoid deleting or moving the files at any time after it's creation to prevent breaking the plugin.

View file

@ -33,6 +33,7 @@ public class Resurrection extends JavaPlugin implements Listener {
PluginDescriptionFile pluginInfo = getDescription(); PluginDescriptionFile pluginInfo = getDescription();
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
boolean stop = false;
if (pluginInfo.getVersion().contains("beta")) { if (pluginInfo.getVersion().contains("beta")) {
// beta message // beta message
log.warning("---------------------------------------------------------"); log.warning("---------------------------------------------------------");
@ -41,85 +42,105 @@ public class Resurrection extends JavaPlugin implements Listener {
log.warning(""); log.warning("");
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."); 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.");
log.warning("---------------------------------------------------------"); log.warning("---------------------------------------------------------");
} else { } else if (Bukkit.getVersion().contains("1.8")) {
log.info("---------------------------------------------------------"); if (!pluginInfo.getDescription().toLowerCase().contains("minecraft 1.8")) {
log.severe("---------------------------------------------------------");
} log.severe("ERROR!");
log.severe("This version of Resurrection is not compatible with Minecraft 1.8 due to specific API calls that were changed in subsequent releases of the game. In order to use Resurrection with Minecraft 1.8, you must download the specific Jar titled \"Resurrection_1.8.jar\" listed in the latest release of Resurrection found at https://github.com/brysonsteck/resurrection/releases.");
// check for updates log.severe("Resurrection will now disable to prevent crashing.");
log.info("Checking for updates..."); log.severe("---------------------------------------------------------");
CheckForUpdate check = new CheckForUpdate(); stop = true;
boolean outdated = false;
if (check.isSuccess()) {
String newestVersion = check.getVersion();
String newestVersionURL = check.getVersionURL();
if (pluginInfo.getVersion().equals(newestVersion)) {
log.info(newestVersion + " is the latest version of Resurrection.");
} else {
log.info("A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
log.info("You can download the latest release on GitHub here \\/");
log.info(newestVersionURL);
outdated = true;
}
}
log.info("---------------------------------------------------------");
log.info("Locating player data and settings files...");
// check if playerData.resurrection exists
File playerFile = new File("plugins/playerData.resurrection");
File settingsFile = new File("plugins/settings.resurrection");
boolean fileFail = false;
if (!playerFile.exists()) {
log.info("Player data file does not exist. Creating now in the \"plugins\" directory...");
try {
playerFile.createNewFile();
log.info("Player data file created successfully.");
} catch (IOException e) {
log.severe("An error has occurred creating the player data file!");
e.printStackTrace();
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; } else {
log.info("---------------------------------------------------------");
} }
} else { } else {
log.info("The player data file has been found!"); log.info("---------------------------------------------------------");
}
if (!settingsFile.exists()) {
log.info("Settings file does not exist. Creating now in the \"plugins\" directory...");
new ParseSettings();
log.info("Settings file created successfully.");
} else {
log.info("The settings file has also been found!");
} }
ParseSettings parseSettings = new ParseSettings(); if (!stop) {
// check for updates
log.info("Checking for updates...");
CheckForUpdate check = new CheckForUpdate();
boolean outdated = false;
if (check.isSuccess()) {
String newestVersion = check.getVersion();
String newestVersionURL = check.getVersionURL();
String message = check.getMessage();
if (pluginInfo.getVersion().equals(newestVersion)) {
log.info(newestVersion + " is the latest version of Resurrection.");
} else {
log.info("A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
log.info("You can download the latest release on GitHub here \\/");
log.info(newestVersionURL);
outdated = true;
}
if (!message.equals("\"\"")) {
log.info("---------------------------------------------------------");
log.warning("A message from the developer has been sent from the update server: " + message);
}
log.info("---------------------------------------------------------");
if (parseSettings.isSettingsComplete() && !fileFail) {
if (Boolean.parseBoolean(parseSettings.getSetting("debug"))) {
log.warning("[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.");
log.warning("---------------------------------------------------------");
} }
log.info("Essential files found and valid. Registering listeners and adding commands..."); log.info("---------------------------------------------------------");
// register listener
this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this);
// register commands log.info("Locating player data and settings files...");
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated)); // check if playerData.resurrection exists
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug"))); File playerFile = new File("plugins/playerData.resurrection");
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug"))); File settingsFile = new File("plugins/settings.resurrection");
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug"))); boolean fileFail = false;
this.getCommand("dead").setExecutor(new CommandDead(parseSettings.getSetting("debug"))); if (!playerFile.exists()) {
log.info("Player data file does not exist. Creating now in the \"plugins\" directory...");
try {
playerFile.createNewFile();
log.info("Player data file created successfully.");
} catch (IOException e) {
log.severe("An error has occurred creating the player data file!");
e.printStackTrace();
log.severe("This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
Bukkit.getPluginManager().disablePlugin(this);
fileFail = true;
}
} else {
log.info("The player data file has been found!");
}
if (!settingsFile.exists()) {
log.info("Settings file does not exist. Creating now in the \"plugins\" directory...");
new ParseSettings();
log.info("Settings file created successfully.");
} else {
log.info("The settings file has also been found!");
}
ParseSettings parseSettings = new ParseSettings();
log.info("---------------------------------------------------------"); log.info("---------------------------------------------------------");
log.info("Successfully Started!");
log.info("---------------------------------------------------------"); if (parseSettings.isSettingsComplete() && !fileFail) {
if (Boolean.parseBoolean(parseSettings.getSetting("debug"))) {
log.warning("[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.");
log.warning("---------------------------------------------------------");
}
log.info("Essential files found and valid. Registering listeners and adding commands...");
// register listener
this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this);
// register commands
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug")));
this.getCommand("dead").setExecutor(new CommandDead(parseSettings.getSetting("debug")));
log.info("---------------------------------------------------------");
log.info("Successfully Started!");
log.info("---------------------------------------------------------");
}
} }
} }

View file

@ -25,7 +25,7 @@ public class CommandDead implements CommandExecutor {
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(); 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 `/dead` command was ran by " + commandSender.getName());
} }
PlayerData playerData = new PlayerData(); PlayerData playerData = new PlayerData();

View file

@ -64,7 +64,7 @@ public class CommandResurrect implements CommandExecutor {
// for versions > 1.8 // for versions > 1.8
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
// for version 1.8 // for version 1.8
//player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1, 0); // player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1, 0);
} }
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!"); Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!");
removeDeath(resurrectPlayer); removeDeath(resurrectPlayer);
@ -114,7 +114,7 @@ public class CommandResurrect implements CommandExecutor {
// for versions > 1.8 // for versions > 1.8
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
// for version 1.8 // for version 1.8
//player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1, 0); // player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1, 0);
} }
Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!"); Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!");
removeDeath(resurrectPlayer); removeDeath(resurrectPlayer);

View file

@ -3,6 +3,8 @@ package net.brysonsteck.Resurrection.player;
import net.brysonsteck.Resurrection.startup.ParseSettings; import net.brysonsteck.Resurrection.startup.ParseSettings;
import net.brysonsteck.Resurrection.Resurrection; import net.brysonsteck.Resurrection.Resurrection;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.*; import org.bukkit.*;
@ -25,6 +27,7 @@ public class PlayerListener implements Listener {
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
Location spawn = world.getSpawnLocation(); Location spawn = world.getSpawnLocation();
//Hashtable<String, Location> playerSpawns = new Hashtable<>(); //Hashtable<String, Location> playerSpawns = new Hashtable<>();
Map<String, Location> playerSpawns = new HashMap<>();
ParseSettings parseSettings; ParseSettings parseSettings;
boolean DEBUG; boolean DEBUG;
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger(); Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
@ -110,7 +113,8 @@ public class PlayerListener implements Listener {
PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 999999999, 10, false); PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 999999999, 10, false);
blindness.apply(p); blindness.apply(p);
slowness.apply(p); slowness.apply(p);
p.teleport(spawn); // p.teleport(spawn);
playerSpawns.put(p.getDisplayName(), p.getLocation());
} }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1); }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
timeToResurrection = timeToResurrection - System.currentTimeMillis(); timeToResurrection = timeToResurrection - System.currentTimeMillis();
@ -122,11 +126,17 @@ public class PlayerListener implements Listener {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
playerData.readData();
String rawData = playerData.getRawData(); String rawData = playerData.getRawData();
int index = 0; int index = 0;
boolean alreadyAlive = false;
for (String players : rawPlayers) { for (String players : rawPlayers) {
if (players.startsWith(p.getDisplayName())) { if (players.startsWith(p.getDisplayName())) {
String[] playerSplit = players.split(","); String[] playerSplit = players.split(",");
if (playerSplit[1] == "false") {
alreadyAlive = true;
break;
}
playerSplit[1] = "false"; playerSplit[1] = "false";
playerSplit[2] = "0"; playerSplit[2] = "0";
@ -137,21 +147,23 @@ public class PlayerListener implements Listener {
} }
index++; index++;
} }
stillDead = false; if (!alreadyAlive) {
for (PotionEffect effect : p.getActivePotionEffects()) stillDead = false;
p.removePotionEffect(effect.getType()); for (PotionEffect effect : p.getActivePotionEffects())
p.setGameMode(GameMode.SURVIVAL); p.removePotionEffect(effect.getType());
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!"); p.setGameMode(GameMode.SURVIVAL);
if (p.getBedSpawnLocation() != null) { Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
p.teleport(p.getBedSpawnLocation()); if (p.getBedSpawnLocation() != null) {
} else { p.teleport(p.getBedSpawnLocation());
p.teleport(spawn); // } else {
} // p.teleport(spawn);
for(Player p : Bukkit.getOnlinePlayers()){ }
// for versions > 1.8 for(Player p : Bukkit.getOnlinePlayers()){
p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); // for versions > 1.8
// for version 1.8 p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
//p.playSound(p.getLocation(), Sound.WITHER_DEATH, 1, 0); // for version 1.8
// p.playSound(p.getLocation(), Sound.WITHER_DEATH, 1, 0);
}
} }
} }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection); }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
@ -216,11 +228,19 @@ public class PlayerListener implements Listener {
@Override @Override
public void run() { public void run() {
// save death to false // save death to false
String rawData = playerData.getRawData(); PlayerData playerData2 = new PlayerData();
playerData2.readData();
String rawData = playerData2.getRawData();
int index = 0; int index = 0;
boolean alreadyAlive = false;
for (String players : rawPlayers) { for (String players : rawPlayers) {
if (players.startsWith(p.getDisplayName())) { if (players.startsWith(p.getDisplayName())) {
String[] playerSplit = players.split(","); String[] playerSplit = players.split(",");
log.info(playerSplit[1]);
if (playerSplit[1] == "false") {
alreadyAlive = true;
break;
}
playerSplit[1] = "false"; playerSplit[1] = "false";
playerSplit[2] = "0"; playerSplit[2] = "0";
@ -231,21 +251,23 @@ public class PlayerListener implements Listener {
} }
index++; index++;
} }
stillDead = false; if (!alreadyAlive) {
for (PotionEffect effect : p.getActivePotionEffects()) stillDead = false;
p.removePotionEffect(effect.getType()); for (PotionEffect effect : p.getActivePotionEffects())
p.setGameMode(GameMode.SURVIVAL); p.removePotionEffect(effect.getType());
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!"); p.setGameMode(GameMode.SURVIVAL);
if (p.getBedSpawnLocation() != null) { Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
p.teleport(p.getBedSpawnLocation()); if (p.getBedSpawnLocation() != null) {
} else { p.teleport(p.getBedSpawnLocation());
p.teleport(spawn); // } else {
} // p.teleport(spawn);
for(Player p : Bukkit.getOnlinePlayers()){ }
// for versions > 1.8 for(Player p : Bukkit.getOnlinePlayers()){
p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0); // for versions > 1.8
// for version 1.8 p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
//p.playSound(p.getLocation(), Sound.WITHER_DEATH, 1, 0); // for version 1.8
// p.playSound(p.getLocation(), Sound.WITHER_DEATH, 1, 0);
}
} }
} }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection); }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
@ -263,6 +285,7 @@ public class PlayerListener implements Listener {
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " has respawned before their resurrection time"); Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " has respawned before their resurrection time");
} }
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time"))); TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
//playerSpawns.put(p.getDisplayName(), p.getLocation()); //playerSpawns.put(p.getDisplayName(), p.getLocation());
p.setGameMode(GameMode.SPECTATOR); p.setGameMode(GameMode.SPECTATOR);
@ -281,6 +304,8 @@ public class PlayerListener implements Listener {
// invisibility.apply(p); // invisibility.apply(p);
blindness.apply(p); blindness.apply(p);
slowness.apply(p); slowness.apply(p);
// put location in map
playerSpawns.put(p.getDisplayName(), p.getLocation());
} }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1); }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
} }
@ -289,11 +314,12 @@ public class PlayerListener implements Listener {
@EventHandler @EventHandler
public void onPlayerMove(PlayerMoveEvent e) { public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (p.getGameMode() == GameMode.SPECTATOR) { if (p.getGameMode() == GameMode.SPECTATOR && stillDead) {
if (DEBUG) { if (DEBUG) {
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " attempted to move while in dead state, teleporting to spawn until their resurrection time"); Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " attempted to move while in dead state, teleporting to spawn until their resurrection time");
} }
p.teleport(spawn); //p.teleport(spawn);
p.teleport(playerSpawns.get(p.getDisplayName()));
} }
} }
} }

View file

@ -18,6 +18,7 @@ public class CheckForUpdate {
boolean success; boolean success;
String version; String version;
String versionURL; String versionURL;
String message;
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger(); Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
public CheckForUpdate() { public CheckForUpdate() {
@ -30,6 +31,7 @@ public class CheckForUpdate {
version = softwareObj.get("current-release").toString(); version = softwareObj.get("current-release").toString();
version = version.replace("\"", ""); version = version.replace("\"", "");
versionURL = softwareObj.get("github-release").toString(); versionURL = softwareObj.get("github-release").toString();
message = softwareObj.get("message").toString();
success = true; success = true;
} catch (IOException e) { } catch (IOException e) {
log.warning("An error has occurred while attempting to check for updates."); log.warning("An error has occurred while attempting to check for updates.");
@ -38,7 +40,7 @@ public class CheckForUpdate {
} }
public String urlReader() throws IOException { public String urlReader() throws IOException {
URL website = new URL("https://brysonsteck.net/updates.json"); URL website = new URL("https://brysonsteck.xyz/updates");
URLConnection connection = website.openConnection(); URLConnection connection = website.openConnection();
BufferedReader in = new BufferedReader( BufferedReader in = new BufferedReader(
new InputStreamReader( new InputStreamReader(
@ -64,4 +66,8 @@ public class CheckForUpdate {
public String getVersion() { public String getVersion() {
return version; return version;
} }
public String getMessage() {
return message;
}
} }

View file

@ -1,8 +1,8 @@
main: net.brysonsteck.Resurrection.Resurrection main: net.brysonsteck.Resurrection.Resurrection
name: Resurrection name: Resurrection
author: 'Bryson Steck' author: 'Bryson Steck'
version: '1.3' version: '1.3.2'
website: https://brysonsteck.net/resurrection.html website: https://brysonsteck.xyz/projects/Resurrection
description: Makes players wait large amounts of time before respawning! description: Makes players wait large amounts of time before respawning!
database: false database: false
api-version: 1.13 api-version: 1.13
@ -33,4 +33,4 @@ commands:
dead: dead:
description: Displays all players who are awaiting resurrection. description: Displays all players who are awaiting resurrection.
usage: /dead usage: /dead