SteamWar/BauSystem2.0
Archiviert
12
0

Fix bundle counting entity twice
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-04-18 17:54:20 +02:00
Ursprung 5af9cfcaad
Commit 67a34ee5ca
4 geänderte Dateien mit 12 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -483,8 +483,8 @@ TRACE_IDLE_SINGLE=§esingle
TRACE_IDLE_AUTO_IGNITE=§eauto TRACE_IDLE_AUTO_IGNITE=§eauto
TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_START = §aTNT-Tracer started
TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_STOP = §cTNT-Tracer stopped
TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted
TRACE_MESSAGE_DELETE_SPECIFIC=§cTrace TNT-positions deleted TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted
TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_SHOW = §aAll TNT-positions shown
TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden
TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0}

Datei anzeigen

@ -462,7 +462,7 @@ TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelösch
TRACE_MESSAGE_START = §aTNT-Tracer gestartet TRACE_MESSAGE_START = §aTNT-Tracer gestartet
TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet
TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt
TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht
TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt
TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet
TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen

Datei anzeigen

@ -154,6 +154,12 @@ public class Trace {
} else { } else {
entityServer = new REntityServer(); entityServer = new REntityServer();
entityServer.addPlayer(player); entityServer.addPlayer(player);
entityServer.setCallback((p, rEntity, entityAction) -> {
if (entityAction != REntityServer.EntityAction.INTERACT) return;
if (rEntity instanceof TraceEntity) {
((TraceEntity) rEntity).printIntoChat(p);
}
});
entityServerMap.put(player, entityServer); entityServerMap.put(player, entityServer);
} }
render(getRecords(), entityServer, playerTraceShowData); render(getRecords(), entityServer, playerTraceShowData);
@ -190,22 +196,13 @@ public class Trace {
List<TraceEntity> entities = new LinkedList<>(); List<TraceEntity> entities = new LinkedList<>();
for (List<TNTPoint> bundle : bundles) { for (List<TNTPoint> bundle : bundles) {
entities.add( entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle));
new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle));
} }
// Apply modifiers // Apply modifiers
for (ViewFlag flag : flagList) { for (ViewFlag flag : flagList) {
flag.modify(entityServer, entities); flag.modify(entityServer, entities);
} }
entityServer.setCallback((player, rEntity, entityAction) -> {
for (TraceEntity entity : entities) {
if (rEntity.equals(entity)) {
entity.printIntoChat(player);
return;
}
}
});
} }
/** /**
@ -224,12 +221,6 @@ public class Trace {
recordsLoop: recordsLoop:
for (TNTPoint record : records) { for (TNTPoint record : records) {
if (bundles.isEmpty()) {
List<TNTPoint> firstBundle = new ArrayList<>();
firstBundle.add(record);
bundles.add(firstBundle);
}
for (int i = bundles.size() - 1; i >= 0; i--) { for (int i = bundles.size() - 1; i >= 0; i--) {
List<TNTPoint> bundle = bundles.get(i); List<TNTPoint> bundle = bundles.get(i);

Datei anzeigen

@ -133,13 +133,13 @@ public class TraceCommand extends SWCommand {
@Register(value = "clear") @Register(value = "clear")
public void clear(@Validator Player player) { public void clear(@Validator Player player) {
TraceManager.instance.clear(Region.getRegion(player.getLocation())); TraceManager.instance.clear(Region.getRegion(player.getLocation()));
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player);
} }
@Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE")
public void delete(@Validator Player player, Trace trace) { public void delete(@Validator Player player, Trace trace) {
TraceManager.instance.remove(trace); TraceManager.instance.remove(trace);
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player);
} }
@Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE") @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE")