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
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: ''
labels: feedback
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!

2
.gitignore vendored
View file

@ -6,3 +6,5 @@ lib/
.gradle/
.vscode/
*.jar
/builds
convert-1.8.md

View file

@ -1,5 +1,5 @@
# 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.
@ -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.
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
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
@ -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.
* `/bug`
* 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]`
* 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.

View file

@ -2,9 +2,9 @@ The following applies to all files in this directory with the exception of `resu
# 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.

View file

@ -33,6 +33,7 @@ public class Resurrection extends JavaPlugin implements Listener {
PluginDescriptionFile pluginInfo = getDescription();
getServer().getPluginManager().registerEvents(this, this);
boolean stop = false;
if (pluginInfo.getVersion().contains("beta")) {
// beta message
log.warning("---------------------------------------------------------");
@ -41,11 +42,24 @@ public class Resurrection extends JavaPlugin implements Listener {
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("---------------------------------------------------------");
} else if (Bukkit.getVersion().contains("1.8")) {
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.");
log.severe("Resurrection will now disable to prevent crashing.");
log.severe("---------------------------------------------------------");
stop = true;
Bukkit.getPluginManager().disablePlugin(this);
} else {
log.info("---------------------------------------------------------");
}
} else {
log.info("---------------------------------------------------------");
}
if (!stop) {
// check for updates
log.info("Checking for updates...");
CheckForUpdate check = new CheckForUpdate();
@ -53,6 +67,7 @@ public class Resurrection extends JavaPlugin implements Listener {
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 {
@ -61,6 +76,11 @@ public class Resurrection extends JavaPlugin implements Listener {
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("---------------------------------------------------------");
@ -121,6 +141,7 @@ public class Resurrection extends JavaPlugin implements Listener {
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) {
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());
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: The `/dead` command was ran by " + commandSender.getName());
}
PlayerData playerData = new PlayerData();

View file

@ -64,7 +64,7 @@ public class CommandResurrect implements CommandExecutor {
// for versions > 1.8
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
// 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!");
removeDeath(resurrectPlayer);
@ -114,7 +114,7 @@ public class CommandResurrect implements CommandExecutor {
// for versions > 1.8
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
// 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!");
removeDeath(resurrectPlayer);

View file

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

View file

@ -18,6 +18,7 @@ public class CheckForUpdate {
boolean success;
String version;
String versionURL;
String message;
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
public CheckForUpdate() {
@ -30,6 +31,7 @@ public class CheckForUpdate {
version = softwareObj.get("current-release").toString();
version = version.replace("\"", "");
versionURL = softwareObj.get("github-release").toString();
message = softwareObj.get("message").toString();
success = true;
} catch (IOException e) {
log.warning("An error has occurred while attempting to check for updates.");
@ -38,7 +40,7 @@ public class CheckForUpdate {
}
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();
BufferedReader in = new BufferedReader(
new InputStreamReader(
@ -64,4 +66,8 @@ public class CheckForUpdate {
public String getVersion() {
return version;
}
public String getMessage() {
return message;
}
}

View file

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