aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-15 20:15:51 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-15 20:15:51 -0600
commita49057361f0e37f90de5f50f7172f04b0a2d389e (patch)
tree65daa65a0be631c708b5f485d0e34b8efd2fb9cb /src
parent9342bf9c0a1ae27fc6d1b4c886caf37e31708508 (diff)
downloadresurrection-a49057361f0e37f90de5f50f7172f04b0a2d389e.tar
resurrection-a49057361f0e37f90de5f50f7172f04b0a2d389e.tar.gz
resurrection-a49057361f0e37f90de5f50f7172f04b0a2d389e.tar.bz2
now testing full day resurrection
Diffstat (limited to 'src')
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java37
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandResurrect.java10
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java20
-rw-r--r--src/net/brysonsteck/Resurrection/player/ResurrectPlayer.java14
-rw-r--r--src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java4
5 files changed, 29 insertions, 56 deletions
diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java
index 7a7e949..f0efc41 100644
--- a/src/net/brysonsteck/Resurrection/Resurrection.java
+++ b/src/net/brysonsteck/Resurrection/Resurrection.java
@@ -9,7 +9,6 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class Resurrection extends JavaPlugin implements Listener {
-// public Plugin plugin = getPlugin(Resurrection.class);
//spigot things
@Override
@@ -20,9 +19,22 @@ public class Resurrection extends JavaPlugin implements Listener {
@Override
public void onEnable() {
super.onEnable();
+ System.out.println("[Resurrection] Resurrection is starting!");
PluginDescriptionFile pluginInfo = getDescription();
getServer().getPluginManager().registerEvents(this, this);
+ // beta message
+ System.out.println("[Resurrection] ---------------------------------------------------------");
+ System.out.println("[Resurrection] WARNING!!!!");
+ System.out.println("[Resurrection] You are running a beta version of Resurrection!");
+ System.out.println("[Resurrection] ");
+ System.out.println("[Resurrection] This means that this plugin is early in development and");
+ System.out.println("[Resurrection] not completely finished, and as a result you may");
+ System.out.println("[Resurrection] experience unexpected doodads. Make sure that the plugin");
+ System.out.println("[Resurrection] is up-to-date for more features and bug fixes. The plugin");
+ System.out.println("[Resurrection] will now check for updates.");
+ System.out.println("[Resurrection] ---------------------------------------------------------");
+
// check for updates
System.out.println("[Resurrection] Checking for updates...");
CheckForUpdate check = new CheckForUpdate();
@@ -40,30 +52,13 @@ public class Resurrection extends JavaPlugin implements Listener {
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
// register commands
+ System.out.println("[Resurrection] Adding commands...");
this.getCommand("about").setExecutor(new CommandAbout());
this.getCommand("resurrect").setExecutor(new CommandResurrect());
- System.out.println("[Resurrection] Successfully Started.");
+ System.out.println("[Resurrection] Successfully Started!");
}
- // end of spigot things
- public static void main(String[] args) {
- CheckForUpdate check = new CheckForUpdate();
-// PlayerData playerData = new PlayerData();
-// playerData.saveData("This is the first line\nthis is the second line");
-// System.out.println(playerData.getPlayers());
-// playerData.readData();
-
-// playerData.saveData("username,false,0");
-// System.out.println("now adding two more lines");
-// playerData.saveData(playerData.getPlayers() + "this is the third line\nthis is the fourth line\nthe thread is now sleeping\nonce more\nand again");
-// System.out.println(playerData.getPlayers());
-// try {
-// Thread.sleep(100000);
-// } catch (InterruptedException e) {
-// e.printStackTrace();
-// }
-
- }
+ public static void main(String[] args) { }
}
diff --git a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java
index a969687..5e902e0 100644
--- a/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java
+++ b/src/net/brysonsteck/Resurrection/commands/CommandResurrect.java
@@ -19,22 +19,22 @@ public class CommandResurrect implements CommandExecutor {
if (valid) {
Player resurrectPlayer = Bukkit.getPlayer(strings[0]);
if (resurrectPlayer == null) {
- p.sendMessage("That player does not exist! Failed to resurrect.");
+ p.sendMessage(ChatColor.RED + "That player does not exist! Failed to resurrect.");
return false;
}
if (resurrectPlayer.getGameMode() == GameMode.SPECTATOR) {
for (PotionEffect effect : resurrectPlayer.getActivePotionEffects())
resurrectPlayer.removePotionEffect(effect.getType());
resurrectPlayer.setGameMode(GameMode.SURVIVAL);
- Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!");
+ Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!");
return true;
} else {
- p.sendMessage(strings[0] + " is not dead! Failed to resurrect.");
+ p.sendMessage(ChatColor.RED + strings[0] + " is not dead! Failed to resurrect.");
return false;
}
} else {
- System.out.println("Too few arguments!");
- System.out.println("Usage: /resurrect PLAYER");
+ System.out.println(ChatColor.RED + "Too few arguments!");
+ System.out.println(ChatColor.RED + "Usage: /resurrect PLAYER");
return false;
}
} else {
diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
index 6bc361f..145d39c 100644
--- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
@@ -24,8 +24,6 @@ public class PlayerListener implements Listener {
public void onDeath(PlayerDeathEvent e) {
System.out.println("Resurrection: A player has died!");
Player p = e.getEntity();
- Long timeOfDeath = System.currentTimeMillis();
- Long resurrectionTime = timeOfDeath + 86400000;
//
// TimeCheck death = new TimeCheck(timeOfDeath);
// TimeCheck resurrect = new TimeCheck((timeOfDeath + 86400000) - timeOfDeath);
@@ -34,16 +32,17 @@ public class PlayerListener implements Listener {
// String resurrectFormatted = resurrect.formatTime();
p.sendMessage("You have died!! You will be able to respawn in the next 24 hours.");
-
+
new BukkitRunnable() {
+ // save death information to player file
@Override
public void run() {
for (PotionEffect effect : p.getActivePotionEffects())
p.removePotionEffect(effect.getType());
p.setGameMode(GameMode.SURVIVAL);
- Bukkit.broadcastMessage(p.getDisplayName() + " has been resurrected manually by an admin!");
+ Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
}
- }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 200);
+ }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1728000);
}
@EventHandler
@@ -54,22 +53,19 @@ public class PlayerListener implements Listener {
new BukkitRunnable() {
@Override
public void run() {
- PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 100, 10, false);
- PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 100, 10, false);
- PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 100, 10, false);
- invisibility.apply(p);
+// PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false);
+ PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false);
+ PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false);
+// invisibility.apply(p);
blindness.apply(p);
slowness.apply(p);
}
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
-
-
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
- Location location = p.getLocation();
if (p.getGameMode() == GameMode.SPECTATOR) {
p.teleport(spawn);
}
diff --git a/src/net/brysonsteck/Resurrection/player/ResurrectPlayer.java b/src/net/brysonsteck/Resurrection/player/ResurrectPlayer.java
deleted file mode 100644
index b9f2348..0000000
--- a/src/net/brysonsteck/Resurrection/player/ResurrectPlayer.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package net.brysonsteck.Resurrection.player;
-
-import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.entity.Player;
-import org.bukkit.potion.PotionEffect;
-
-public class ResurrectPlayer {
-
- public ResurrectPlayer(Player p) {
-
-
- }
-}
diff --git a/src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java b/src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java
index 56893d8..2a46aa5 100644
--- a/src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java
+++ b/src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java
@@ -3,10 +3,8 @@ package net.brysonsteck.Resurrection.startup;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import com.google.gson.stream.JsonReader;
import java.io.*;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
@@ -25,8 +23,6 @@ public class CheckForUpdate {
version = softwareObj.get("current-release").toString();
version = version.replace("\"", "");
versionURL = softwareObj.get("github-release").toString();
-// version = rootobj.get("current-version").getAsString();
-// versionURL = rootobj.get("release-url").getAsString();
} catch (IOException e) {
System.out.println("[Resurrection] An error has occurred while attempting to check for updates.");
e.printStackTrace();