replaced thread with runnable
This commit is contained in:
parent
bbac7e1509
commit
9342bf9c0a
6 changed files with 13 additions and 12 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
package net.brysonsteck.Resurrection.player;
|
package net.brysonsteck.Resurrection.player;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.Resurrection;
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -34,15 +35,15 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
p.sendMessage("You have died!! You will be able to respawn in the next 24 hours.");
|
p.sendMessage("You have died!! You will be able to respawn in the next 24 hours.");
|
||||||
|
|
||||||
new Thread (() -> {
|
new BukkitRunnable() {
|
||||||
try {
|
@Override
|
||||||
Thread.sleep(5000);
|
public void run() {
|
||||||
} catch (InterruptedException interruptedException) {
|
for (PotionEffect effect : p.getActivePotionEffects())
|
||||||
interruptedException.printStackTrace();
|
p.removePotionEffect(effect.getType());
|
||||||
p.sendMessage("[Resurrection] An error has occurred! Please contact the admin. (Failed to make the thread sleep!)");
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
Bukkit.broadcastMessage(p.getDisplayName() + " has been resurrected manually by an admin!");
|
||||||
}
|
}
|
||||||
ResurrectPlayer resurrectPlayer = new ResurrectPlayer(p);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 200);
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.bukkit.potion.PotionEffect;
|
||||||
public class ResurrectPlayer {
|
public class ResurrectPlayer {
|
||||||
|
|
||||||
public ResurrectPlayer(Player p) {
|
public ResurrectPlayer(Player p) {
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
|
||||||
Bukkit.broadcastMessage(p.getDisplayName() + " has resurrected!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue