now testing full day resurrection
This commit is contained in:
parent
9342bf9c0a
commit
a49057361f
12 changed files with 29 additions and 56 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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) { }
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
@ -36,14 +34,15 @@ public class PlayerListener implements Listener {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue