SteamWar/FightSystem
Archiviert
13
1

Add logging to debug team area bugs

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-02-06 22:50:42 +01:00
Ursprung ace26a7750
Commit 470f8613cd
3 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen
FightSystem_Core/src/de/steamwar/fightsystem/listener

Datei anzeigen

@ -39,8 +39,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class ArenaBorder implements Listener { public class ArenaBorder implements Listener {
private final Border spectatorBorder = new Border(Config.PlayerRegion, true, 5, "NO_ARENA_LEAVING"); private final Border spectatorBorder = new Border(Config.PlayerRegion, true, 5, "NO_ARENA_LEAVING", "ArenaBorder.spectatorBorder");
private final Border playerBorder = new Border(Config.PlayerRegion.to2d(), true, 5, "NO_ARENA_LEAVING"); private final Border playerBorder = new Border(Config.PlayerRegion.to2d(), true, 5, "NO_ARENA_LEAVING", "ArenaBorder.playerBorder");
public ArenaBorder() { public ArenaBorder() {
new StateDependentListener(ArenaMode.All, FightState.All, this); new StateDependentListener(ArenaMode.All, FightState.All, this);

Datei anzeigen

@ -36,6 +36,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
public class Border { public class Border {
@ -43,13 +44,15 @@ public class Border {
private final Map<Player, Location> lastLocation = new HashMap<>(); private final Map<Player, Location> lastLocation = new HashMap<>();
private final boolean contain; private final boolean contain;
private final String resetMessage; private final String resetMessage;
private final String name;
private final Region region; private final Region region;
private final int ghostRange; private final int ghostRange;
private final int ghostSize; private final int ghostSize;
public Border(Region region, boolean contain, int ghostRange, String resetMessage) { public Border(Region region, boolean contain, int ghostRange, String resetMessage, String name) {
this.contain = contain; this.contain = contain;
this.resetMessage = resetMessage; this.resetMessage = resetMessage;
this.name = name;
this.region = region; this.region = region;
this.ghostRange = ghostRange; this.ghostRange = ghostRange;
this.ghostSize = 2*ghostRange + 1; this.ghostSize = 2*ghostRange + 1;
@ -63,6 +66,7 @@ public class Border {
ghostBarriers.put(player, new HashSet<>()); ghostBarriers.put(player, new HashSet<>());
lastLocation.put(player, player.getLocation()); lastLocation.put(player, player.getLocation());
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was added to border " + name);
} }
public boolean contains(Player player) { public boolean contains(Player player) {
@ -70,6 +74,7 @@ public class Border {
} }
public void removePlayer(Player player) { public void removePlayer(Player player) {
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was removed from border " + name);
lastLocation.remove(player); lastLocation.remove(player);
Set<Block> blocks = ghostBarriers.remove(player); Set<Block> blocks = ghostBarriers.remove(player);
if(blocks == null || !player.isOnline()) if(blocks == null || !player.isOnline())

Datei anzeigen

@ -52,8 +52,8 @@ public class TeamArea implements Listener {
public TeamArea(FightTeam team) { public TeamArea(FightTeam team) {
this.team = team; this.team = team;
this.spectatorBorder = new Border(team.getExtendRegion(), false, 5, "NO_TEAMAREA"); this.spectatorBorder = new Border(team.getExtendRegion(), false, 5, "NO_TEAMAREA", team.getName() + ".spectatorBorder");
this.bordingBorder = new Border(team.getExtendRegion().to2d(), true, 1, "NO_ENTERN"); this.bordingBorder = new Border(team.getExtendRegion().to2d(), true, 1, "NO_ENTERN", team.getName() + ".boardingBorder");
new StateDependentListener(ArenaMode.AntiTest, FightState.All, this); new StateDependentListener(ArenaMode.AntiTest, FightState.All, this);
new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1); new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1);