Dieser Commit ist enthalten in:
Ursprung
d81fb4e020
Commit
d0a08bc331
@ -217,7 +217,7 @@ public class Trace {
|
||||
List<TraceEntity> entities = new LinkedList<>();
|
||||
|
||||
for (List<TNTPoint> bundle : bundles) {
|
||||
entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle));
|
||||
entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle, this));
|
||||
}
|
||||
|
||||
// Apply modifiers
|
||||
|
@ -149,7 +149,7 @@ public class TraceCommand extends SWCommand {
|
||||
@Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE")
|
||||
public void isolate(@Validator Player player, Trace trace, @ErrorMessage("TRACE_RECORD_ID_INVALID") TNTPoint... records) {
|
||||
TraceManager.instance.isolate(player, records);
|
||||
// TODO: Add Message!
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_ISOLATE", player);
|
||||
}
|
||||
|
||||
@Register(value = "share", description = "TRACE_COMMAND_HELP_SHARE")
|
||||
|
@ -97,6 +97,18 @@ public class TraceManager implements Listener {
|
||||
return nextOpenId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the given trace
|
||||
*
|
||||
* @param trace
|
||||
*/
|
||||
public int getId(Trace trace) {
|
||||
for (Map.Entry<Integer, Trace> entry : traces.entrySet()) {
|
||||
if (entry.getValue() == trace) return entry.getKey();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders only the given records to the specified trace
|
||||
*
|
||||
|
@ -22,6 +22,8 @@ package de.steamwar.bausystem.features.tracer.rendering;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||
import de.steamwar.bausystem.features.tracer.Trace;
|
||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
@ -49,13 +51,19 @@ public class TraceEntity extends REntity {
|
||||
@Getter
|
||||
private final List<TNTPoint> records;
|
||||
|
||||
/**
|
||||
* A string of all unique tnt records
|
||||
*/
|
||||
private final String uniqueTntIdsString;
|
||||
|
||||
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records) {
|
||||
private final Trace trace;
|
||||
|
||||
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records, Trace trace) {
|
||||
super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0));
|
||||
setNoGravity(true);
|
||||
this.records = records;
|
||||
uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" "));
|
||||
this.trace = trace;
|
||||
addEntityMethod.invoke(server, this);
|
||||
}
|
||||
|
||||
@ -75,7 +83,7 @@ public class TraceEntity extends REntity {
|
||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, representative.getVelocity().getX() + "");
|
||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, representative.getVelocity().getY() + "");
|
||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + "");
|
||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + uniqueTntIdsString));
|
||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + TraceManager.instance.getId(trace) + " " + uniqueTntIdsString));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren