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;
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue