aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-08-19 23:40:31 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-08-19 23:40:31 -0600
commite2eac7a28e0a10f473ba8e756b0e4858e46e27fd (patch)
tree432dbcaf13e3fe547a2dc670e3c18239dbcf05e0
parent0962e07574556494e31011f1532edf864dfd02b2 (diff)
downloadresurrection-e2eac7a28e0a10f473ba8e756b0e4858e46e27fd.tar
resurrection-e2eac7a28e0a10f473ba8e756b0e4858e46e27fd.tar.gz
resurrection-e2eac7a28e0a10f473ba8e756b0e4858e46e27fd.tar.bz2
trying to find why settings wont apply
-rw-r--r--TODO.md31
-rw-r--r--out/artifacts/Resurrection_jar/Resurrection.jarbin1598088 -> 1598168 bytes
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java1
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java25
4 files changed, 30 insertions, 27 deletions
diff --git a/TODO.md b/TODO.md
index 8e217d5..d97b79b 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,20 +1,15 @@
# TODO List
-### Done!
-* get the player death event working
-* figure out how to convert milliseconds to an actual date and time for the end user
-* figure out commands and how to use them
- * `about`
-
-### For first release
-
-* figure out how to get the player.data file to add a user when one joins the server for the first time
-* figure out commands and how to use them
- * `about`
- * `resurrect PLAYER` (resurrects a player now if needed)
-
-### For later releases
-
-* add ability to change time with new commands
- * `change-time MILLISECONDS` (0 for default 1 day wait time)
-* figure out how to get a version updater working using the web server (using JSON hopefully)
+### Find compatibility with other versions
+
+* 1.8
+* 1.9
+* 1.10
+* 1.11
+* 1.12
+* 1.13
+* 1.14
+* 1.15
+* 1.16
+ * Works, native version
+* 1.17
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar
index d9fee40..9dfdeb8 100644
--- a/out/artifacts/Resurrection_jar/Resurrection.jar
+++ b/out/artifacts/Resurrection_jar/Resurrection.jar
Binary files differ
diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java
index f481572..0003f1e 100644
--- a/src/net/brysonsteck/Resurrection/Resurrection.java
+++ b/src/net/brysonsteck/Resurrection/Resurrection.java
@@ -151,6 +151,7 @@ public class Resurrection extends JavaPlugin implements Listener {
// TimeCheck timeCheck = new TimeCheck((System.currentTimeMillis() + 86212345) - System.currentTimeMillis());
// System.out.println(timeCheck.formatTime());
+ System.out.println(System.currentTimeMillis());
}
}
diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
index 09ff124..8a6a78f 100644
--- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
@@ -41,13 +41,13 @@ public class PlayerListener implements Listener {
int index = 0;
boolean found = false;
boolean resumeDeath = false;
- long resurrectTime = 0;
+ long timeToResurrection = 0;
for (String players : rawPlayers) {
if (players.startsWith(p.getDisplayName())) {
found = true;
String[] playerSplit = players.split(",");
boolean dead = Boolean.parseBoolean(playerSplit[1]);
- resurrectTime = Long.parseLong(playerSplit[2]);
+ timeToResurrection = Long.parseLong(playerSplit[2]);
if (!dead) {
for (PotionEffect effect : p.getActivePotionEffects())
@@ -83,11 +83,11 @@ public class PlayerListener implements Listener {
p.teleport(spawn);
}
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
- resurrectTime = resurrectTime - System.currentTimeMillis();
+ timeToResurrection = timeToResurrection - System.currentTimeMillis();
// to seconds
- resurrectTime = resurrectTime / 1000;
+ timeToResurrection = timeToResurrection / 1000;
// to ticks
- resurrectTime = resurrectTime * 20;
+ timeToResurrection = timeToResurrection * 20;
new BukkitRunnable() {
@Override
@@ -104,7 +104,7 @@ public class PlayerListener implements Listener {
p.teleport(p.getBedSpawnLocation());
}
}
- }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), resurrectTime);
+ }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
}
}
@@ -116,7 +116,7 @@ public class PlayerListener implements Listener {
stillDead = true;
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
- long resurrectionTime = System.currentTimeMillis() + 86400000;
+ long resurrectionTime = System.currentTimeMillis() + Long.parseLong(parseSettings.getSetting("resurrection_time"));
p.sendMessage("You have died!! You will be able to respawn in the next " + timeCheck.formatTime('h'));
timerRunning = true;
@@ -142,6 +142,12 @@ public class PlayerListener implements Listener {
index++;
}
+ long timeToResurrection = Long.parseLong(parseSettings.getSetting("resurrection_time"));
+ // to seconds
+ timeToResurrection = timeToResurrection / 1000;
+ // to ticks
+ timeToResurrection = timeToResurrection * 20;
+
new BukkitRunnable() {
// save death information to player file
@@ -175,17 +181,18 @@ public class PlayerListener implements Listener {
p.teleport(p.getBedSpawnLocation());
}
}
- }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1728000);
+ }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
}
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
if (stillDead) {
final Player p = e.getPlayer();
+ TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
playerSpawns.put(p.getDisplayName(), p.getLocation());
p.setGameMode(GameMode.SPECTATOR);
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "YOU HAVE DIED!!");
- p.sendMessage(ChatColor.RED + "You will be able to respawn in the next 24 hours.");
+ p.sendMessage(ChatColor.RED + "You will be able to respawn in the next " + timeCheck.formatTime('f'));
new BukkitRunnable() {
@Override
public void run() {