aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-06 18:34:30 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-06 18:34:30 -0600
commit2d9d34f8a5d7551b05e8440d46950faa4e7f4abe (patch)
tree641dd3ef89249aa46bfb5196eb44a025d68d07b7 /src/net
parentf84afebf125128be40772884824e43952d1415e6 (diff)
downloadresurrection-2d9d34f8a5d7551b05e8440d46950faa4e7f4abe.tar
resurrection-2d9d34f8a5d7551b05e8440d46950faa4e7f4abe.tar.gz
resurrection-2d9d34f8a5d7551b05e8440d46950faa4e7f4abe.tar.bz2
trying syncdelaytask
Diffstat (limited to 'src/net')
-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