trying spectator mode again
This commit is contained in:
parent
80b00aca96
commit
f46b9daae4
3 changed files with 14 additions and 7 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,21 +1,18 @@
|
|||
package net.brysonsteck.Resurrection;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin() {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
System.out.println("Resurrection: A player has died!");
|
||||
|
@ -38,7 +35,17 @@ public class PlayerListener implements Listener {
|
|||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
p.sendMessage("You have respawned");
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000000, 500));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000000000, 500));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,500000, 500));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500000, 500));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
Location location = p.getLocation();
|
||||
if (p.getGameMode() == GameMode.SPECTATOR) {
|
||||
p.teleport(location);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue