finishing the appearance of being dead
This commit is contained in:
parent
65033eee49
commit
0f89320996
5 changed files with 4 additions and 8 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -17,7 +17,7 @@ public class PlayerListener implements Listener {
|
||||||
public void onDeath(PlayerDeathEvent e) {
|
public void onDeath(PlayerDeathEvent e) {
|
||||||
System.out.println("Resurrection: A player has died!");
|
System.out.println("Resurrection: A player has died!");
|
||||||
Player p = e.getEntity();
|
Player p = e.getEntity();
|
||||||
p.setGameMode(GameMode.ADVENTURE);
|
p.setGameMode(GameMode.SPECTATOR);
|
||||||
Long timeOfDeath = System.currentTimeMillis();
|
Long timeOfDeath = System.currentTimeMillis();
|
||||||
Long resurrectionTime = timeOfDeath + 86400000;
|
Long resurrectionTime = timeOfDeath + 86400000;
|
||||||
|
|
||||||
|
@ -27,25 +27,21 @@ public class PlayerListener implements Listener {
|
||||||
String deathFormatted = death.formatTime();
|
String deathFormatted = death.formatTime();
|
||||||
String resurrectFormatted = resurrect.formatTime();
|
String resurrectFormatted = resurrect.formatTime();
|
||||||
|
|
||||||
|
p.sendMessage("You have died!! You will be able to respawn in the next " + resurrectFormatted);
|
||||||
p.sendMessage("You have died! You will be able to respawn in 24 hours.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
public void onPlayerRespawn(PlayerRespawnEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
p.sendMessage("You have respawned");
|
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 86400, 255));
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,500000, 500));
|
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500000, 500));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent e) {
|
public void onPlayerMove(PlayerMoveEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
Location location = p.getLocation();
|
Location location = p.getLocation();
|
||||||
if (p.getGameMode() == GameMode.SPECTATOR) {
|
if (p.getGameMode() == GameMode.SPECTATOR && p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
|
||||||
p.teleport(location);
|
p.teleport(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue