trying threads
This commit is contained in:
parent
357ef1da6c
commit
22410ae7b9
5 changed files with 23 additions and 9 deletions
Binary file not shown.
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;
|
||||
|
@ -11,6 +12,8 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
|
@ -31,16 +34,22 @@ public class PlayerListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
final Player p = e.getPlayer();
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException interruptedException) {
|
||||
interruptedException.printStackTrace();
|
||||
}
|
||||
PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false);
|
||||
PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false);
|
||||
PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false);
|
||||
invisibility.apply(p);
|
||||
blindness.apply(p);
|
||||
slowness.apply(p);
|
||||
}).start();
|
||||
|
||||
PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false);
|
||||
PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false);
|
||||
PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false);
|
||||
invisibility.apply(p);
|
||||
blindness.apply(p);
|
||||
slowness.apply(p);
|
||||
p.setNoDamageTicks(1728000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -4,11 +4,15 @@ import net.brysonsteck.Resurrection.commands.CommandAbout;
|
|||
import net.brysonsteck.Resurrection.commands.CommandResurrect;
|
||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.w3c.dom.stylesheets.LinkStyle;
|
||||
|
||||
public class Resurrection extends JavaPlugin {
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class Resurrection extends JavaPlugin implements Listener {
|
||||
// public Plugin plugin = getPlugin(Resurrection.class);
|
||||
|
||||
//spigot things
|
||||
|
@ -21,6 +25,7 @@ public class Resurrection extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
super.onEnable();
|
||||
PluginDescriptionFile pluginInfo = getDescription();
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
|
||||
// check for updates
|
||||
System.out.println("[Resurrection] Checking for updates...");
|
||||
|
|
Loading…
Add table
Reference in a new issue