no pvp damage event fix
This commit is contained in:
parent
90b4375853
commit
0416f4bfd2
4 changed files with 18 additions and 6 deletions
|
@ -20,6 +20,7 @@
|
|||
package net.tylermurphy.hideAndSeek.game;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -271,9 +272,9 @@ public class Board {
|
|||
}
|
||||
|
||||
private static String getTeam(Player player) {
|
||||
if(isHider(player)) return ChatColor.GOLD + "HIDER";
|
||||
else if(isSeeker(player)) return ChatColor.RED + "SEEKER";
|
||||
else if(isSpectator(player)) return ChatColor.GRAY + "SPECTATOR";
|
||||
if(isHider(player)) return message("HIDER_TEAM_NAME").toString();
|
||||
else if(isSeeker(player)) return message("SEEKER_TEAM_NAME").toString();
|
||||
else if(isSpectator(player)) return message("SPECTATOR_TEAM_NAME").toString();
|
||||
else return ChatColor.WHITE + "UNKNOWN";
|
||||
}
|
||||
|
||||
|
|
|
@ -189,9 +189,18 @@ public class EventListener implements Listener {
|
|||
}
|
||||
if(event.isCancelled()) return;
|
||||
if (player.getHealth() - event.getFinalDamage() < 0.5 || !pvpEnabled) {
|
||||
if(!pvpEnabled && !Board.isSeeker(player)){
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
if (event instanceof EntityDamageByEntityEvent && !pvpEnabled) {
|
||||
Entity damager = ((EntityDamageByEntityEvent) event).getDamager();
|
||||
if (damager instanceof Player) {
|
||||
Player atacker = (Player) damager;
|
||||
if(!Board.isSeeker(atacker)){
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (spawnPosition == null) return;
|
||||
event.setCancelled(true);
|
||||
|
|
|
@ -58,6 +58,7 @@ Localization:
|
|||
STOP: "Das Spiel wurde gestoppt."
|
||||
HIDER_TEAM_NAME: "&6&lHIDER"
|
||||
SEEKER_TEAM_NAME: "&c&lSEEKER"
|
||||
SPECTATOR_TEAM_NAME: "&8&lSPECTATOR"
|
||||
HIDERS_SUBTITLE: "Verstecke dich gut vor den Seekern!"
|
||||
SEEKERS_SUBTITLE: "Finde alle Hider!"
|
||||
SPECTATOR_SUBTITLE: "Du bist mitten im spiel beigetreten."
|
||||
|
|
|
@ -59,6 +59,7 @@ Localization:
|
|||
STOP: "Game has been force stopped."
|
||||
HIDER_TEAM_NAME: "&6&lHIDER"
|
||||
SEEKER_TEAM_NAME: "&c&lSEEKER"
|
||||
SPECTATOR_TEAM_NAME: "&8&lSPECTATOR"
|
||||
HIDERS_SUBTITLE: "Hide away from the seekers"
|
||||
SEEKERS_SUBTITLE: "Eliminate all hiders"
|
||||
SPECTATOR_SUBTITLE: "You joined mid-game."
|
||||
|
|
Loading…
Reference in a new issue