trying to find why settings wont apply
This commit is contained in:
parent
0962e07574
commit
e2eac7a28e
4 changed files with 29 additions and 26 deletions
29
TODO.md
29
TODO.md
|
@ -1,20 +1,15 @@
|
||||||
# TODO List
|
# TODO List
|
||||||
|
|
||||||
### Done!
|
### Find compatibility with other versions
|
||||||
* 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
|
* 1.8
|
||||||
|
* 1.9
|
||||||
* figure out how to get the player.data file to add a user when one joins the server for the first time
|
* 1.10
|
||||||
* figure out commands and how to use them
|
* 1.11
|
||||||
* `about`
|
* 1.12
|
||||||
* `resurrect PLAYER` (resurrects a player now if needed)
|
* 1.13
|
||||||
|
* 1.14
|
||||||
### For later releases
|
* 1.15
|
||||||
|
* 1.16
|
||||||
* add ability to change time with new commands
|
* Works, native version
|
||||||
* `change-time MILLISECONDS` (0 for default 1 day wait time)
|
* 1.17
|
||||||
* figure out how to get a version updater working using the web server (using JSON hopefully)
|
|
||||||
|
|
Binary file not shown.
|
@ -151,6 +151,7 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
// TimeCheck timeCheck = new TimeCheck((System.currentTimeMillis() + 86212345) - System.currentTimeMillis());
|
// TimeCheck timeCheck = new TimeCheck((System.currentTimeMillis() + 86212345) - System.currentTimeMillis());
|
||||||
// System.out.println(timeCheck.formatTime());
|
// System.out.println(timeCheck.formatTime());
|
||||||
|
System.out.println(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,13 @@ public class PlayerListener implements Listener {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
boolean resumeDeath = false;
|
boolean resumeDeath = false;
|
||||||
long resurrectTime = 0;
|
long timeToResurrection = 0;
|
||||||
for (String players : rawPlayers) {
|
for (String players : rawPlayers) {
|
||||||
if (players.startsWith(p.getDisplayName())) {
|
if (players.startsWith(p.getDisplayName())) {
|
||||||
found = true;
|
found = true;
|
||||||
String[] playerSplit = players.split(",");
|
String[] playerSplit = players.split(",");
|
||||||
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
||||||
resurrectTime = Long.parseLong(playerSplit[2]);
|
timeToResurrection = Long.parseLong(playerSplit[2]);
|
||||||
|
|
||||||
if (!dead) {
|
if (!dead) {
|
||||||
for (PotionEffect effect : p.getActivePotionEffects())
|
for (PotionEffect effect : p.getActivePotionEffects())
|
||||||
|
@ -83,11 +83,11 @@ public class PlayerListener implements Listener {
|
||||||
p.teleport(spawn);
|
p.teleport(spawn);
|
||||||
}
|
}
|
||||||
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
|
||||||
resurrectTime = resurrectTime - System.currentTimeMillis();
|
timeToResurrection = timeToResurrection - System.currentTimeMillis();
|
||||||
// to seconds
|
// to seconds
|
||||||
resurrectTime = resurrectTime / 1000;
|
timeToResurrection = timeToResurrection / 1000;
|
||||||
// to ticks
|
// to ticks
|
||||||
resurrectTime = resurrectTime * 20;
|
timeToResurrection = timeToResurrection * 20;
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,7 +104,7 @@ public class PlayerListener implements Listener {
|
||||||
p.teleport(p.getBedSpawnLocation());
|
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;
|
stillDead = true;
|
||||||
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
|
TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time")));
|
||||||
|
|
||||||
long resurrectionTime = System.currentTimeMillis() + 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'));
|
p.sendMessage("You have died!! You will be able to respawn in the next " + timeCheck.formatTime('h'));
|
||||||
timerRunning = true;
|
timerRunning = true;
|
||||||
|
@ -142,6 +142,12 @@ public class PlayerListener implements Listener {
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long timeToResurrection = Long.parseLong(parseSettings.getSetting("resurrection_time"));
|
||||||
|
// to seconds
|
||||||
|
timeToResurrection = timeToResurrection / 1000;
|
||||||
|
// to ticks
|
||||||
|
timeToResurrection = timeToResurrection * 20;
|
||||||
|
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
// save death information to player file
|
// save death information to player file
|
||||||
|
@ -175,17 +181,18 @@ public class PlayerListener implements Listener {
|
||||||
p.teleport(p.getBedSpawnLocation());
|
p.teleport(p.getBedSpawnLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1728000);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||||
if (stillDead) {
|
if (stillDead) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
|
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);
|
||||||
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "YOU HAVE DIED!!");
|
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() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue