REntity #148
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -113,8 +113,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
|
||||
tntEntityMap.clear();
|
||||
explodeEntityMap.clear();
|
||||
updateEntityMap.clear();
|
||||
entityServer.close();
|
||||
entityServer = null;
|
||||
if (entityServer != null) {
|
||||
entityServer.close();
|
||||
entityServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePositions(TNTPosition position, boolean interpolateY, boolean interpolateXZ) {
|
||||
|
@ -29,8 +29,8 @@ public class ShowModeParameter {
|
||||
private boolean sourceOnly = false;
|
||||
private boolean explodeOnly = false;
|
||||
private boolean ticks = false;
|
||||
private boolean buildDestroyOnly = false;
|
||||
private boolean count = false;
|
||||
private boolean buildDestroyOnly = false;
|
||||
|
||||
public void enableWater() {
|
||||
this.water = true;
|
||||
@ -56,11 +56,11 @@ public class ShowModeParameter {
|
||||
this.ticks = true;
|
||||
}
|
||||
|
||||
public void enableBuildDestroyOnly() {
|
||||
this.buildDestroyOnly = true;
|
||||
}
|
||||
|
||||
public void enableCount() {
|
||||
this.count = true;
|
||||
}
|
||||
|
||||
public void enableBuildDestroyOnly() {
|
||||
this.buildDestroyOnly = true;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class TraceShowManager implements Listener {
|
||||
if (regionalShowModes == null) {
|
||||
return;
|
||||
}
|
||||
ShowMode<TNTPosition> showMode = regionalShowModes.get(player);
|
||||
ShowMode<TNTPosition> showMode = regionalShowModes.remove(player);
|
||||
if (showMode == null) {
|
||||
return;
|
||||
}
|
||||
@ -160,13 +160,10 @@ public class TraceShowManager implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
Region region = Region.getRegion(event.getPlayer().getLocation());
|
||||
if (!region.isGlobal()) {
|
||||
Map<Player, ShowMode<TNTPosition>> regionalShowModes = showModes.get(region);
|
||||
if (regionalShowModes != null) {
|
||||
regionalShowModes.remove(event.getPlayer()).hide();
|
||||
}
|
||||
}
|
||||
showModes.forEach((region, playerShowModeMap) -> {
|
||||
ShowMode<TNTPosition> showMode = playerShowModeMap.remove(event.getPlayer());
|
||||
if (showMode != null) showMode.hide();
|
||||
});
|
||||
StoredRecords.cleanup(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -71,4 +71,18 @@ public class RayTraceUtils {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren