Dieser Commit ist enthalten in:
Ursprung
bcdad382c7
Commit
31e0a0172f
@ -159,7 +159,7 @@ public class Trace { // TODO: Add UUID for file saving and so on!
|
|||||||
private void render(List<TNTPoint> records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) {
|
private void render(List<TNTPoint> records, REntityServer entityServer, PlayerTraceShowData playerTraceShowData) {
|
||||||
if (records.isEmpty()) return;
|
if (records.isEmpty()) return;
|
||||||
|
|
||||||
List<TNTPoint> workingRecords = records;
|
List<TNTPoint> workingRecords = new ArrayList<>(records);
|
||||||
Set<ViewFlag> flagList = playerTraceShowData.getEffectiveViewFlags();
|
Set<ViewFlag> flagList = playerTraceShowData.getEffectiveViewFlags();
|
||||||
|
|
||||||
//Apply filters
|
//Apply filters
|
||||||
|
@ -194,6 +194,10 @@ public class TraceManager implements Listener {
|
|||||||
|
|
||||||
public boolean follow(Player follower, Player following) {
|
public boolean follow(Player follower, Player following) {
|
||||||
if (followerMap.containsKey(follower)) return false;
|
if (followerMap.containsKey(follower)) return false;
|
||||||
|
if (followerMap.entrySet().stream().anyMatch(playerSetEntry -> playerSetEntry.getValue().contains(follower))) {
|
||||||
|
unfollow(follower);
|
||||||
|
}
|
||||||
|
|
||||||
followerMap.computeIfAbsent(following, ignored -> new HashSet<>()).add(follower);
|
followerMap.computeIfAbsent(following, ignored -> new HashSet<>()).add(follower);
|
||||||
|
|
||||||
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
||||||
@ -215,13 +219,21 @@ public class TraceManager implements Listener {
|
|||||||
public void unfollow(Player follower) {
|
public void unfollow(Player follower) {
|
||||||
if (followerMap.containsKey(follower)) return;
|
if (followerMap.containsKey(follower)) return;
|
||||||
List<Player> toRemove = new ArrayList<>();
|
List<Player> toRemove = new ArrayList<>();
|
||||||
|
Set<Player> toHide = new HashSet<>();
|
||||||
followerMap.forEach((player, players) -> {
|
followerMap.forEach((player, players) -> {
|
||||||
players.remove(player);
|
if (players.remove(follower)) toHide.add(follower);
|
||||||
if (players.isEmpty()) toRemove.add(player);
|
if (players.isEmpty()) toRemove.add(player);
|
||||||
});
|
});
|
||||||
toRemove.forEach(followerMap::remove);
|
toRemove.forEach(followerMap::remove);
|
||||||
|
|
||||||
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
|
||||||
|
toHide.forEach(player -> {
|
||||||
|
if (!playerPlayerTraceShowDataMap.containsKey(player)) return;
|
||||||
|
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
|
||||||
|
trace.hide(follower);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower);
|
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(follower);
|
||||||
if (playerTraceShowData == null) return;
|
if (playerTraceShowData == null) return;
|
||||||
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
|
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
|
||||||
|
@ -19,18 +19,24 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tracer.rendering;
|
package de.steamwar.bausystem.features.tracer.rendering;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.techhider.BlockIds;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TraceEntity extends RFallingBlockEntity {
|
public class TraceEntity extends REntity {
|
||||||
|
|
||||||
|
private static final Reflection.MethodInvoker addEntityMethod = Reflection.getMethod(REntityServer.class, "addEntity", REntity.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The records represented by this REntity
|
* The records represented by this REntity
|
||||||
@ -39,9 +45,10 @@ public class TraceEntity extends RFallingBlockEntity {
|
|||||||
private final List<TNTPoint> records;
|
private final List<TNTPoint> records;
|
||||||
|
|
||||||
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records) {
|
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records) {
|
||||||
super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT);
|
super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0));
|
||||||
setNoGravity(true);
|
setNoGravity(true);
|
||||||
this.records = records;
|
this.records = records;
|
||||||
|
addEntityMethod.invoke(server, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printIntoChat(Player player) {
|
public void printIntoChat(Player player) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren