aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/brysonsteck/Resurrection/PlayerListener.java27
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java2
2 files changed, 17 insertions, 12 deletions
diff --git a/src/net/brysonsteck/Resurrection/PlayerListener.java b/src/net/brysonsteck/Resurrection/PlayerListener.java
index 039f723..f87f257 100644
--- a/src/net/brysonsteck/Resurrection/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/PlayerListener.java
@@ -1,5 +1,6 @@
package net.brysonsteck.Resurrection;
+import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -10,8 +11,10 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
+import org.bukkit.plugin.java.JavaPlugin;
-public class PlayerListener implements Listener {
+
+public class PlayerListener extends JavaPlugin implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
@@ -31,17 +34,19 @@ public class PlayerListener implements Listener {
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
- Player p = e.getPlayer();
+ final Player p = e.getPlayer();
p.setGameMode(GameMode.ADVENTURE);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException interruptedException) {
- interruptedException.printStackTrace();
- }
- p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false));
- p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false));
- p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false));
- p.setNoDamageTicks(1728000);
+
+ Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(Resurrection.class), new Runnable()
+ {
+ public void run()
+ {
+ p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false));
+ p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false));
+ p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false));
+ p.setNoDamageTicks(1728000);
+ }
+ }, (1));
}
@EventHandler
diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java
index 33c5b99..23c0c4a 100644
--- a/src/net/brysonsteck/Resurrection/Resurrection.java
+++ b/src/net/brysonsteck/Resurrection/Resurrection.java
@@ -9,7 +9,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class Resurrection extends JavaPlugin {
-// public Plugin plugin = getPlugin(Resurrection.class);
+ public Plugin plugin = getPlugin(Resurrection.class);
//spigot things
@Override