trying syncdelaytask
This commit is contained in:
parent
f84afebf12
commit
2d9d34f8a5
4 changed files with 17 additions and 12 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,6 @@
|
||||||
package net.brysonsteck.Resurrection;
|
package net.brysonsteck.Resurrection;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -10,8 +11,10 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
|
||||||
|
public class PlayerListener extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(PlayerDeathEvent e) {
|
public void onDeath(PlayerDeathEvent e) {
|
||||||
|
@ -31,18 +34,20 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||||
Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
p.setGameMode(GameMode.ADVENTURE);
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(Resurrection.class), new Runnable()
|
||||||
} catch (InterruptedException interruptedException) {
|
{
|
||||||
interruptedException.printStackTrace();
|
public void run()
|
||||||
}
|
{
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false));
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false));
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false));
|
||||||
p.setNoDamageTicks(1728000);
|
p.setNoDamageTicks(1728000);
|
||||||
}
|
}
|
||||||
|
}, (1));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent e) {
|
public void onPlayerMove(PlayerMoveEvent e) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Resurrection extends JavaPlugin {
|
public class Resurrection extends JavaPlugin {
|
||||||
// public Plugin plugin = getPlugin(Resurrection.class);
|
public Plugin plugin = getPlugin(Resurrection.class);
|
||||||
|
|
||||||
//spigot things
|
//spigot things
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue