diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-07-04 21:56:15 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-07-04 21:56:15 -0600 |
commit | 27c90aaed911ba382542cd761c8b01e24b042000 (patch) | |
tree | ddfaac129bce057815ce0834c1613d33d65ac72b /src | |
parent | 6c39053bdf64ac130daee2bf3b44ce1c025b4dbd (diff) | |
download | resurrection-27c90aaed911ba382542cd761c8b01e24b042000.tar resurrection-27c90aaed911ba382542cd761c8b01e24b042000.tar.gz resurrection-27c90aaed911ba382542cd761c8b01e24b042000.tar.bz2 |
code cleanup
Diffstat (limited to 'src')
4 files changed, 12 insertions, 17 deletions
diff --git a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java index 1bf27fb..a474f6c 100644 --- a/src/net/brysonsteck/Resurrection/commands/CommandAbout.java +++ b/src/net/brysonsteck/Resurrection/commands/CommandAbout.java @@ -1,6 +1,5 @@ package net.brysonsteck.Resurrection.commands; -import net.brysonsteck.Resurrection.startup.CheckForUpdate; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/net/brysonsteck/Resurrection/player/PlayerData.java b/src/net/brysonsteck/Resurrection/player/PlayerData.java index 512c94f..582d940 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerData.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerData.java @@ -1,10 +1,7 @@ package net.brysonsteck.Resurrection.player; -import net.brysonsteck.Resurrection.Resurrection; -import org.bukkit.plugin.java.JavaPlugin; import java.io.*; -import java.util.Arrays; import java.util.Hashtable; public class PlayerData { @@ -26,10 +23,9 @@ public class PlayerData { try { rawData = ""; BufferedReader reader = new BufferedReader(new FileReader("plugins/playerData.resurrection")); - String line = ""; + String line; String[] playerData; while (true) { - playerData = new String[3]; line = reader.readLine(); if (line == null) { break; @@ -46,9 +42,9 @@ public class PlayerData { } } - public Hashtable<String, Hashtable<String, String>> getPlayers() { - return playerData; - } +// public Hashtable<String, Hashtable<String, String>> getPlayers() { +// return playerData; +// } public String getRawData() { return rawData; diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java index 0badf52..93d9f32 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java @@ -59,6 +59,8 @@ public class PlayerListener implements Listener { } if (resumeDeath && !timerRunning) { spawn = p.getLocation(); + p.sendMessage(ChatColor.RED + "You are still dead. To check how long you have left before you are resurrected, " + + "run \"howlong\" in chat."); new BukkitRunnable() { @Override public void run() { @@ -71,7 +73,9 @@ public class PlayerListener implements Listener { } }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1); resurrectTime = resurrectTime - System.currentTimeMillis(); + // to seconds resurrectTime = resurrectTime / 1000; + // to ticks resurrectTime = resurrectTime * 20; new BukkitRunnable() { @@ -102,7 +106,7 @@ public class PlayerListener implements Listener { // // String deathFormatted = death.formatTime(); // String resurrectFormatted = resurrect.formatTime(); - long timeOfDeath = System.currentTimeMillis(); +// long timeOfDeath = System.currentTimeMillis(); long resurrectionTime = System.currentTimeMillis() + 86400000; p.sendMessage("You have died!! You will be able to respawn in the next 24 hours."); @@ -114,10 +118,8 @@ public class PlayerListener implements Listener { String rawData = playerData.getRawData(); String[] rawPlayers = rawData.split(";"); int index = 0; - boolean found = false; for (String players : rawPlayers) { if (players.startsWith(p.getDisplayName())) { - found = true; String[] playerSplit = players.split(","); playerSplit[1] = "true"; playerSplit[2] = String.valueOf(resurrectionTime); @@ -169,7 +171,8 @@ public class PlayerListener implements Listener { if (stillDead) { final Player p = e.getPlayer(); p.setGameMode(GameMode.SPECTATOR); - p.sendTitle("You have died!", "You must wait 24 hours before you can respawn."); + p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "YOU HAVE DIED!!"); + p.sendMessage(ChatColor.RED + "You will be able to respawn in the next 24 hours."); new BukkitRunnable() { @Override public void run() { diff --git a/src/net/brysonsteck/Resurrection/player/TimeCheck.java b/src/net/brysonsteck/Resurrection/player/TimeCheck.java index dc989ea..a12bb16 100644 --- a/src/net/brysonsteck/Resurrection/player/TimeCheck.java +++ b/src/net/brysonsteck/Resurrection/player/TimeCheck.java @@ -10,13 +10,10 @@ public class TimeCheck { } public String formatTime() { - long hours = TimeUnit.MILLISECONDS.toHours(millis); - - String formattedTime = String.format("%d hrs, %d min, %d sec", + return String.format("%d hrs, %d min, %d sec", TimeUnit.MILLISECONDS.toHours(millis), TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); - return formattedTime; } } |