mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 03:34:42 +02:00
Fixes
Fixes #556 Fixes #540 Fixed plot analysis being slow Fixed auto updating
This commit is contained in:
@ -121,7 +121,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
THIS = this;
|
||||
PS.instance = new PS(this);
|
||||
PS.instance = new PS(this, "Bukkit");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,6 +105,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -877,11 +878,20 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFade(final BlockFadeEvent e) {
|
||||
final Block b = e.getBlock();
|
||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||
if (PS.get().isPlotWorld(loc.getWorld())) {
|
||||
if (MainUtil.isPlotRoad(loc)) {
|
||||
e.setCancelled(true);
|
||||
String world = b.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(world);
|
||||
if (plotworld == null) {
|
||||
return;
|
||||
}
|
||||
PlotManager manager = PS.get().getPlotManager(world);
|
||||
PlotId id = manager.getPlotId(plotworld, b.getX(), b.getY(), b.getZ());
|
||||
if (id == null) {
|
||||
if (plotworld.TYPE == 2) {
|
||||
if (ClusterManager.getClusterAbs(BukkitUtil.getLocation(b.getLocation())) != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,9 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
public void onPlotEnter(final PlayerEnterPlotEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
final Plot plot = event.getPlot();
|
||||
if (FlagManager.getPlotFlag(plot, "greeting") != null) {
|
||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "greeting").getValueString()));
|
||||
Flag greeting = FlagManager.getPlotFlag(plot, "greeting");
|
||||
if (greeting != null) {
|
||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + greeting.getValueString()));
|
||||
}
|
||||
Flag feed = FlagManager.getPlotFlag(plot, "feed");
|
||||
if (feed != null) {
|
||||
@ -222,8 +223,9 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
if (!plot.hasOwner()) {
|
||||
return;
|
||||
}
|
||||
if (FlagManager.getPlotFlag(plot, "farewell") != null) {
|
||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "farewell").getValueString()));
|
||||
Flag farewell = FlagManager.getPlotFlag(plot, "farewell");
|
||||
if (farewell != null) {
|
||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + farewell.getValueString()));
|
||||
}
|
||||
final PlotPlayer pl = BukkitUtil.getPlayer(leaver);
|
||||
String name = leaver.getName();
|
||||
|
@ -28,12 +28,13 @@ public class WEManager {
|
||||
HashSet<RegionWrapper> regions = new HashSet<>();
|
||||
UUID uuid = player.getUUID();
|
||||
for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) {
|
||||
if (Settings.DONE_RESTRICTS_BUILDING && plot.isBasePlot() && FlagManager.getPlotFlag(plot, "done") == null) {
|
||||
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
|
||||
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
|
||||
regions.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()));
|
||||
}
|
||||
if (!plot.isBasePlot() || Settings.DONE_RESTRICTS_BUILDING && FlagManager.getPlotFlag(plot, "done") != null) {
|
||||
continue;
|
||||
}
|
||||
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
|
||||
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
|
||||
regions.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()));
|
||||
}
|
||||
}
|
||||
return regions;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.plotsquared.bukkit.object;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -68,26 +69,45 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String perm) {
|
||||
public boolean hasPermission(final String node) {
|
||||
if (Settings.PERMISSION_CACHING) {
|
||||
if (this.noPerm.contains(perm)) {
|
||||
if (this.noPerm.contains(node)) {
|
||||
return false;
|
||||
}
|
||||
if (this.hasPerm.contains(perm)) {
|
||||
if (this.hasPerm.contains(node)) {
|
||||
return true;
|
||||
}
|
||||
final boolean result = this.player.hasPermission(perm);
|
||||
if (!result) {
|
||||
this.noPerm.add(perm);
|
||||
return false;
|
||||
}
|
||||
this.hasPerm.add(perm);
|
||||
return true;
|
||||
}
|
||||
if (offline && EconHandler.manager != null) {
|
||||
return EconHandler.manager.hasPermission(getName(), perm);
|
||||
return EconHandler.manager.hasPermission(getName(), node);
|
||||
}
|
||||
return this.player.hasPermission(perm);
|
||||
boolean value = this.player.hasPermission(node);
|
||||
if (!value) {
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(node);
|
||||
if (perm == null) {
|
||||
perm = new Permission(node, PermissionDefault.FALSE);
|
||||
Map<String, Boolean> children = perm.getChildren();
|
||||
|
||||
final String[] nodes = node.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
children.put(n + C.PERMISSION_STAR.s(), true);
|
||||
}
|
||||
Bukkit.getServer().getPluginManager().addPermission(perm);
|
||||
Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
|
||||
value = this.player.hasPermission(node);
|
||||
}
|
||||
}
|
||||
if (Settings.PERMISSION_CACHING) {
|
||||
if (value) {
|
||||
this.hasPerm.add(node);
|
||||
}
|
||||
else {
|
||||
this.noPerm.add(node);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
@ -34,7 +35,6 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
@Override
|
||||
public void analyzePlot(final Plot plot, final RunnableVal<PlotAnalysis> whenDone) {
|
||||
// int diff, int variety, int verticies, int rotation, int height_sd
|
||||
|
||||
/*
|
||||
* diff: compare to base by looping through all blocks
|
||||
* variety: add to hashset for each plotblock
|
||||
@ -46,208 +46,213 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
* - recheck each block
|
||||
*
|
||||
*/
|
||||
final World world = Bukkit.getWorld(plot.world);
|
||||
final ChunkGenerator gen = world.getGenerator();
|
||||
if (gen == null) {
|
||||
return;
|
||||
}
|
||||
final BiomeGrid base = new BiomeGrid() { @Override public void setBiome(int a, int b, Biome c) {} @Override public Biome getBiome(int a, int b) {return null;}};
|
||||
Location bot = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||
Location top = MainUtil.getPlotTopLoc(plot.world, plot.id);
|
||||
final int bx = bot.getX();
|
||||
final int bz = bot.getZ();
|
||||
final int tx = top.getX();
|
||||
final int tz = top.getZ();
|
||||
final int cbx = bx >> 4;
|
||||
final int cbz = bz >> 4;
|
||||
final int ctx = tx >> 4;
|
||||
final int ctz = tz >> 4;
|
||||
final Random r = new Random();
|
||||
MainUtil.initCache();
|
||||
final int width = tx - bx + 1;
|
||||
final int length = tz - bz + 1;
|
||||
|
||||
System.gc();
|
||||
System.gc();
|
||||
final short[][][] oldblocks = new short[256][width][length];
|
||||
final short[][][] newblocks = new short[256][width][length];
|
||||
|
||||
final List<ChunkLoc> chunks = new ArrayList<>();
|
||||
final List<ChunkLoc> processed_chunks = new ArrayList<>();
|
||||
|
||||
for (int X = cbx; X <= ctx; X++) {
|
||||
for (int Z = cbz; Z <= ctz; Z++) {
|
||||
// Chunk chunk = world.getChunkAt(X, Z);
|
||||
chunks.add(new ChunkLoc(X, Z));
|
||||
}
|
||||
}
|
||||
final Runnable run = new Runnable() {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (ChunkLoc chunk : processed_chunks) {
|
||||
short[][] result = gen.generateExtBlockSections(world, r, chunk.x, chunk.z, base);
|
||||
int X = chunk.x;
|
||||
int Z = chunk.z;
|
||||
int xb = ((X) << 4) - bx;
|
||||
int zb = ((Z) << 4) - bz;
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
if (result[i] == null) {
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
int x = MainUtil.x_loc[i][j] + xb;
|
||||
if (x < 0 || x >= width) continue;
|
||||
int z = MainUtil.z_loc[i][j] + zb;
|
||||
if (z < 0 || z >= length) continue;
|
||||
int y = MainUtil.y_loc[i][j];
|
||||
oldblocks[y][x][z] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < result[i].length; j++) {
|
||||
int x = MainUtil.x_loc[i][j] + xb;
|
||||
if (x < 0 || x >= width) continue;
|
||||
int z = MainUtil.z_loc[i][j] + zb;
|
||||
if (z < 0 || z >= length) continue;
|
||||
int y = MainUtil.y_loc[i][j];
|
||||
oldblocks[y][x][z] = result[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
int size = width * length;
|
||||
int[] changes = new int[size];
|
||||
int[] faces = new int[size];
|
||||
int[] data = new int[size];
|
||||
int[] air = new int[size];
|
||||
int[] variety = new int[size];
|
||||
|
||||
int i = 0;
|
||||
for (int x = 0; x < width;x++) {
|
||||
for (int z = 0; z < length;z++) {
|
||||
HashSet<Short> types = new HashSet<>();
|
||||
for (int y = 0; y < 256; y++) {
|
||||
short old = oldblocks[y][x][z];
|
||||
short now = newblocks[y][x][z];
|
||||
if (old != now) {
|
||||
changes[i]++;
|
||||
}
|
||||
if (now == 0) {
|
||||
air[i]++;
|
||||
}
|
||||
else {
|
||||
// check verticies
|
||||
// modifications_adjacent
|
||||
if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 && y < 255) {
|
||||
if (newblocks[y - 1][x][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x - 1][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x][z - 1] == 0) faces[i]++;
|
||||
if (newblocks[y + 1][x][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x + 1][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x][z + 1] == 0) faces[i]++;
|
||||
}
|
||||
|
||||
Material material = Material.getMaterial(now);
|
||||
Class<? extends MaterialData> md = material.getData();
|
||||
if (md.equals(Directional.class)) {
|
||||
data[i] += 8;
|
||||
}
|
||||
else if (!md.equals(MaterialData.class)) {
|
||||
data[i]++;
|
||||
}
|
||||
types.add(now);
|
||||
}
|
||||
}
|
||||
variety[i] = types.size();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// analyze plot
|
||||
// put in analysis obj
|
||||
|
||||
// run whenDone
|
||||
PlotAnalysis analysis = new PlotAnalysis();
|
||||
analysis.changes = (int) (MathMan.getMean(changes) * 100);
|
||||
analysis.faces = (int) (MathMan.getMean(faces) * 100);
|
||||
analysis.data = (int) (MathMan.getMean(data) * 100);
|
||||
analysis.air = (int) (MathMan.getMean(air) * 100);
|
||||
analysis.variety = (int) (MathMan.getMean(variety) * 100);
|
||||
|
||||
analysis.changes_sd = (int) (MathMan.getSD(changes, analysis.changes));
|
||||
analysis.faces_sd = (int) (MathMan.getSD(faces, analysis.faces));
|
||||
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data));
|
||||
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air));
|
||||
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety));
|
||||
|
||||
List<Integer> result = new ArrayList<>();
|
||||
result.add(analysis.changes);
|
||||
result.add(analysis.faces);
|
||||
result.add(analysis.data);
|
||||
result.add(analysis.air);
|
||||
result.add(analysis.variety);
|
||||
|
||||
result.add(analysis.changes_sd);
|
||||
result.add(analysis.faces_sd);
|
||||
result.add(analysis.data_sd);
|
||||
result.add(analysis.air_sd);
|
||||
result.add(analysis.variety_sd);
|
||||
Flag flag = new Flag(FlagManager.getFlag("analysis"), result);
|
||||
FlagManager.addPlotFlag(plot, flag);
|
||||
System.gc();
|
||||
System.gc();
|
||||
whenDone.value = analysis;
|
||||
whenDone.run();
|
||||
}
|
||||
};
|
||||
System.gc();
|
||||
MainUtil.initCache();
|
||||
TaskManager.index.incrementAndGet();
|
||||
final Integer currentIndex = TaskManager.index.get();
|
||||
final Integer task = TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int index = chunks.size() - 1;
|
||||
if (index == -1) {
|
||||
PS.get().TASK.cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.runTaskAsync(run);
|
||||
final World world = Bukkit.getWorld(plot.world);
|
||||
final ChunkGenerator gen = world.getGenerator();
|
||||
if (gen == null) {
|
||||
return;
|
||||
}
|
||||
ChunkLoc chunk = chunks.remove(0);
|
||||
world.loadChunk(chunk.x, chunk.z);
|
||||
processed_chunks.add(chunk);
|
||||
int X = chunk.x;
|
||||
int Z = chunk.z;
|
||||
int minX;
|
||||
int minZ;
|
||||
int maxX;
|
||||
int maxZ;
|
||||
if (X == cbx) minX = bx & 0x0f;
|
||||
else minX = 0;
|
||||
if (Z == cbz) minZ = bz & 0x0f;
|
||||
else minZ = 0;
|
||||
if (X == ctx) maxX = tx & 0x0f;
|
||||
else maxX = 16;
|
||||
if (Z == ctz) maxZ = tz & 0x0f;
|
||||
else maxZ = 16;
|
||||
|
||||
int cbx = X << 4;
|
||||
int cbz = Z << 4;
|
||||
|
||||
int xb = (cbx) - bx;
|
||||
int zb = (cbz) - bz;
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
int xx = cbx + cbz;
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
int zz = cbz + z;
|
||||
for (int y = 0; y < 256; y++) {
|
||||
Block block = world.getBlockAt(xx, y, zz);
|
||||
int xr = xb + x;
|
||||
int zr = zb + z;
|
||||
newblocks[y][xr][zr] = (short) block.getTypeId();
|
||||
}
|
||||
final BiomeGrid base = new BiomeGrid() { @Override public void setBiome(int a, int b, Biome c) {} @Override public Biome getBiome(int a, int b) {return null;}};
|
||||
final Location bot = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||
final Location top = MainUtil.getPlotTopLoc(plot.world, plot.id);
|
||||
final int bx = bot.getX();
|
||||
final int bz = bot.getZ();
|
||||
final int tx = top.getX();
|
||||
final int tz = top.getZ();
|
||||
final int cbx = bx >> 4;
|
||||
final int cbz = bz >> 4;
|
||||
final int ctx = tx >> 4;
|
||||
final int ctz = tz >> 4;
|
||||
final Random r = new Random();
|
||||
MainUtil.initCache();
|
||||
final int width = tx - bx + 1;
|
||||
final int length = tz - bz + 1;
|
||||
|
||||
System.gc();
|
||||
System.gc();
|
||||
final short[][][] oldblocks = new short[256][width][length];
|
||||
final short[][][] newblocks = new short[256][width][length];
|
||||
|
||||
final Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ChunkManager.chunkTask(bot, top, new RunnableVal<int[]>() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge]
|
||||
int X = value[0];
|
||||
int Z = value[1];
|
||||
short[][] result = gen.generateExtBlockSections(world, r, X, Z, base);
|
||||
int xb = ((X) << 4) - bx;
|
||||
int zb = ((Z) << 4) - bz;
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
if (result[i] == null) {
|
||||
for (int j = 0; j < 4096; j++) {
|
||||
int x = MainUtil.x_loc[i][j] + xb;
|
||||
if (x < 0 || x >= width) continue;
|
||||
int z = MainUtil.z_loc[i][j] + zb;
|
||||
if (z < 0 || z >= length) continue;
|
||||
int y = MainUtil.y_loc[i][j];
|
||||
oldblocks[y][x][z] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < result[i].length; j++) {
|
||||
int x = MainUtil.x_loc[i][j] + xb;
|
||||
if (x < 0 || x >= width) continue;
|
||||
int z = MainUtil.z_loc[i][j] + zb;
|
||||
if (z < 0 || z >= length) continue;
|
||||
int y = MainUtil.y_loc[i][j];
|
||||
oldblocks[y][x][z] = result[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int size = width * length;
|
||||
int[] changes = new int[size];
|
||||
int[] faces = new int[size];
|
||||
int[] data = new int[size];
|
||||
int[] air = new int[size];
|
||||
int[] variety = new int[size];
|
||||
int i = 0;
|
||||
for (int x = 0; x < width;x++) {
|
||||
for (int z = 0; z < length;z++) {
|
||||
HashSet<Short> types = new HashSet<>();
|
||||
for (int y = 0; y < 256; y++) {
|
||||
short old = oldblocks[y][x][z];
|
||||
short now = newblocks[y][x][z];
|
||||
if (old != now) {
|
||||
changes[i]++;
|
||||
}
|
||||
if (now == 0) {
|
||||
air[i]++;
|
||||
}
|
||||
else {
|
||||
// check verticies
|
||||
// modifications_adjacent
|
||||
if (x > 0 && z > 0 && y > 0 && x < width - 1 && z < length - 1 && y < 255) {
|
||||
if (newblocks[y - 1][x][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x - 1][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x][z - 1] == 0) faces[i]++;
|
||||
if (newblocks[y + 1][x][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x + 1][z] == 0) faces[i]++;
|
||||
if (newblocks[y][x][z + 1] == 0) faces[i]++;
|
||||
}
|
||||
|
||||
Material material = Material.getMaterial(now);
|
||||
Class<? extends MaterialData> md = material.getData();
|
||||
if (md.equals(Directional.class)) {
|
||||
data[i] += 8;
|
||||
}
|
||||
else if (!md.equals(MaterialData.class)) {
|
||||
data[i]++;
|
||||
}
|
||||
types.add(now);
|
||||
}
|
||||
}
|
||||
variety[i] = types.size();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// analyze plot
|
||||
// put in analysis obj
|
||||
|
||||
// run whenDone
|
||||
PlotAnalysis analysis = new PlotAnalysis();
|
||||
analysis.changes = (int) (MathMan.getMean(changes) * 100);
|
||||
analysis.faces = (int) (MathMan.getMean(faces) * 100);
|
||||
analysis.data = (int) (MathMan.getMean(data) * 100);
|
||||
analysis.air = (int) (MathMan.getMean(air) * 100);
|
||||
analysis.variety = (int) (MathMan.getMean(variety) * 100);
|
||||
|
||||
analysis.changes_sd = (int) (MathMan.getSD(changes, analysis.changes));
|
||||
analysis.faces_sd = (int) (MathMan.getSD(faces, analysis.faces));
|
||||
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data));
|
||||
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air));
|
||||
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety));
|
||||
|
||||
List<Integer> result = new ArrayList<>();
|
||||
result.add(analysis.changes);
|
||||
result.add(analysis.faces);
|
||||
result.add(analysis.data);
|
||||
result.add(analysis.air);
|
||||
result.add(analysis.variety);
|
||||
|
||||
result.add(analysis.changes_sd);
|
||||
result.add(analysis.faces_sd);
|
||||
result.add(analysis.data_sd);
|
||||
result.add(analysis.air_sd);
|
||||
result.add(analysis.variety_sd);
|
||||
Flag flag = new Flag(FlagManager.getFlag("analysis"), result);
|
||||
FlagManager.addPlotFlag(plot, flag);
|
||||
System.gc();
|
||||
System.gc();
|
||||
whenDone.value = analysis;
|
||||
whenDone.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
world.unloadChunkRequest(chunk.x, chunk.z, true);
|
||||
};
|
||||
System.gc();
|
||||
MainUtil.initCache();
|
||||
ChunkManager.chunkTask(bot, top, new RunnableVal<int[]>() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int X = value[0];
|
||||
int Z = value[1];
|
||||
world.loadChunk(X, Z);
|
||||
int minX;
|
||||
int minZ;
|
||||
int maxX;
|
||||
int maxZ;
|
||||
if (X == cbx) minX = bx & 15;
|
||||
else minX = 0;
|
||||
if (Z == cbz) minZ = bz & 15;
|
||||
else minZ = 0;
|
||||
if (X == ctx) maxX = tx & 15;
|
||||
else maxX = 16;
|
||||
if (Z == ctz) maxZ = tz & 15;
|
||||
else maxZ = 16;
|
||||
|
||||
int cbx = X << 4;
|
||||
int cbz = Z << 4;
|
||||
|
||||
int xb = (cbx) - bx;
|
||||
int zb = (cbz) - bz;
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
int xx = cbx + x;
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
int zz = cbz + z;
|
||||
for (int y = 0; y < 256; y++) {
|
||||
Block block = world.getBlockAt(xx, y, zz);
|
||||
int xr = xb + x;
|
||||
int zr = zb + z;
|
||||
newblocks[y][xr][zr] = (short) block.getTypeId();
|
||||
}
|
||||
}
|
||||
}
|
||||
world.unloadChunkRequest(X, Z, true);
|
||||
}
|
||||
}, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TaskManager.runTaskAsync(run);
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
}, 1);
|
||||
TaskManager.tasks.put(currentIndex, task);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -229,7 +229,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
server = game.getServer();
|
||||
//
|
||||
|
||||
PS.instance = new PS(this);
|
||||
PS.instance = new PS(this, "Sponge");
|
||||
|
||||
// TODO Until P^2 has json chat stuff for sponge, disable this
|
||||
Settings.FANCY_CHAT = false;
|
||||
|
@ -2,13 +2,8 @@ package com.plotsquared.sponge.object;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.api.data.key.Keys;
|
||||
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
|
||||
import org.spongepowered.api.data.manipulator.mutable.entity.GameModeData;
|
||||
import org.spongepowered.api.data.value.mutable.Value;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameModes;
|
||||
@ -96,7 +91,11 @@ public class SpongePlayer extends PlotPlayer {
|
||||
this.hasPerm.add(perm);
|
||||
return true;
|
||||
}
|
||||
return this.player.hasPermission(perm);
|
||||
boolean value = this.player.hasPermission(perm);
|
||||
|
||||
// TODO check children
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user