SteamWar/BauSystem2.0
Archiviert
12
0

REntity #148

Zusammengeführt
YoyoNow hat 19 Commits von REntity nach master 2023-02-24 20:31:33 +01:00 zusammengeführt
5 geänderte Dateien mit 28 neuen und 30 gelöschten Zeilen
Nur Änderungen aus Commit cb474ea75b werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -121,19 +121,4 @@ public class BauSystem extends JavaPlugin implements Listener {
} }
})); }));
} }
private void createLink(String source, String destination) {
try {
Bukkit.getLogger().log(Level.INFO, "Executing: ln -s /home/minecraft/server/Bau15/{0} {1}", new String[]{source, destination});
ProcessBuilder processBuilder = new ProcessBuilder("ln", "-s", "/home/minecraft/server/Bau15/" + source, destination);
processBuilder.directory(world.getWorldFolder());
processBuilder.inheritIO();
Process process = processBuilder.start();
process.waitFor();
} catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
Bukkit.shutdown();
}
}
} }

Datei anzeigen

@ -113,8 +113,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
tntEntityMap.clear(); tntEntityMap.clear();
explodeEntityMap.clear(); explodeEntityMap.clear();
updateEntityMap.clear(); updateEntityMap.clear();
entityServer.close(); if (entityServer != null) {
entityServer = null; entityServer.close();
entityServer = null;
}
} }
private void generatePositions(TNTPosition position, boolean interpolateY, boolean interpolateXZ) { private void generatePositions(TNTPosition position, boolean interpolateY, boolean interpolateXZ) {

Datei anzeigen

@ -29,8 +29,8 @@ public class ShowModeParameter {
private boolean sourceOnly = false; private boolean sourceOnly = false;
private boolean explodeOnly = false; private boolean explodeOnly = false;
private boolean ticks = false; private boolean ticks = false;
private boolean buildDestroyOnly = false;
private boolean count = false; private boolean count = false;
private boolean buildDestroyOnly = false;
public void enableWater() { public void enableWater() {
this.water = true; this.water = true;
@ -56,11 +56,11 @@ public class ShowModeParameter {
this.ticks = true; this.ticks = true;
} }
public void enableBuildDestroyOnly() {
this.buildDestroyOnly = true;
}
public void enableCount() { public void enableCount() {
this.count = true; this.count = true;
} }
public void enableBuildDestroyOnly() {
this.buildDestroyOnly = true;
}
} }

Datei anzeigen

@ -63,7 +63,7 @@ public class TraceShowManager implements Listener {
if (regionalShowModes == null) { if (regionalShowModes == null) {
return; return;
} }
ShowMode<TNTPosition> showMode = regionalShowModes.get(player); ShowMode<TNTPosition> showMode = regionalShowModes.remove(player);
if (showMode == null) { if (showMode == null) {
return; return;
} }
@ -160,13 +160,10 @@ public class TraceShowManager implements Listener {
@EventHandler @EventHandler
public void onLeave(PlayerQuitEvent event) { public void onLeave(PlayerQuitEvent event) {
Region region = Region.getRegion(event.getPlayer().getLocation()); showModes.forEach((region, playerShowModeMap) -> {
if (!region.isGlobal()) { ShowMode<TNTPosition> showMode = playerShowModeMap.remove(event.getPlayer());
Map<Player, ShowMode<TNTPosition>> regionalShowModes = showModes.get(region); if (showMode != null) showMode.hide();
if (regionalShowModes != null) { });
regionalShowModes.remove(event.getPlayer()).hide();
}
}
StoredRecords.cleanup(event.getPlayer()); StoredRecords.cleanup(event.getPlayer());
} }
} }

Datei anzeigen

@ -71,4 +71,18 @@ public class RayTraceUtils {
return entityHitDistanceSquared < blockHitDistance * blockHitDistance ? entities : blocks; return entityHitDistanceSquared < blockHitDistance * blockHitDistance ? entities : blocks;
} }
} }
public static boolean isOccluded(Vector a, Vector n, Vector b) {
// a = Head pos, n = View direction (normalized), b = entity center
// https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation
double abX = b.getX() - a.getX();
double abY = b.getY() - a.getY();
double abZ = b.getZ() - a.getZ();
double lambda = abX * n.getX() + abY * n.getY() + abZ * n.getZ();
double distX = abX - n.getX() * lambda;
double distY = abY - n.getY() * lambda;
double distZ = abZ - n.getZ() * lambda;
return Math.abs(distX) < 0.5 && Math.abs(distY) < 0.5 && Math.abs(distZ) < 0.5;
}
} }