HullHider v2 #408
@ -56,7 +56,10 @@ public class EnternCountdown extends Countdown {
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR);
|
||||
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunkPos, false));
|
||||
fightPlayer.ifPlayer(player -> {
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
FightSystem.getTechHider().reloadChunks(player, chunkPos, false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -275,7 +275,7 @@ public class FightTeam {
|
||||
BountifulWrapper.impl.setAttackSpeed(player);
|
||||
player.setFoodLevel(20);
|
||||
player.getInventory().clear();
|
||||
FightSystem.getHullHider().removePlayer(this, player);
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
|
||||
if(FightState.Spectate.contains(FightState.getFightState())) {
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
@ -319,7 +319,7 @@ public class FightTeam {
|
||||
player.getInventory().clear();
|
||||
|
||||
if(player.isOnline()){
|
||||
FightSystem.getHullHider().addPlayer(this, player);
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
FightSystem.getTechHider().reloadChunks(player, chunksToReload, true);
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode))
|
||||
|
@ -89,8 +89,8 @@ public class Hull {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void addPlayer(Player player, boolean activeHiding) {
|
||||
if(players.add(player) && activeHiding) {
|
||||
public void addPlayer(Player player) {
|
||||
if(players.add(player)) {
|
||||
for(Entity entity : entities)
|
||||
player.hideEntity(FightSystem.getPlugin(), entity); //TODO 1.15-
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@ -62,7 +63,7 @@ public class HullHider implements Listener {
|
||||
new StateDependent(ENABLED, FightState.Schem) {
|
||||
@Override
|
||||
public void enable() {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> addPlayer(player, true));
|
||||
Bukkit.getOnlinePlayers().forEach(player -> updatePlayer(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,23 +82,9 @@ public class HullHider implements Listener {
|
||||
}
|
||||
|
||||
|
||||
public void addPlayer(FightTeam team, Player player) {
|
||||
if(!ENABLED)
|
||||
return;
|
||||
|
||||
hulls.get(team).addPlayer(player, true);
|
||||
}
|
||||
|
||||
public void removePlayer(FightTeam team, Player player) {
|
||||
if(!ENABLED)
|
||||
return;
|
||||
|
||||
hulls.get(team).removePlayer(player, true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
addPlayer(e.getPlayer(), false);
|
||||
updatePlayer(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -105,13 +92,18 @@ public class HullHider implements Listener {
|
||||
removePlayer(e.getPlayer(), false);
|
||||
}
|
||||
|
||||
private void addPlayer(Player player, boolean activeHiding) {
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
for(Map.Entry<FightTeam, Hull> hull : hulls.entrySet()) {
|
||||
if(hull.getKey() == team)
|
||||
continue;
|
||||
public void updatePlayer(Player player) {
|
||||
if(!ENABLED)
|
||||
return;
|
||||
|
||||
hull.getValue().addPlayer(player, activeHiding);
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
FightPlayer fp = Fight.getFightPlayer(player);
|
||||
for(Map.Entry<FightTeam, Hull> hull : hulls.entrySet()) {
|
||||
if(hull.getKey() == team || (fp != null && fp.canEntern())) {
|
||||
hull.getValue().removePlayer(player, true);
|
||||
} else {
|
||||
hull.getValue().addPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren