Fix chunk listener items and tweak p2 mask.

This commit is contained in:
Jesse Boyd 2016-06-24 15:38:30 +10:00
parent cf397524ff
commit 2c0a47c60f
5 changed files with 18 additions and 10 deletions

View File

@ -18,8 +18,9 @@ public class ChunkListener implements Listener {
@Override
public void run() {
physicsFreeze = false;
itemFreeze = false;
physicsLimit = Settings.TICK_LIMITER.PHYSICS;
itemLimit = Settings.TICK_LIMITER.PHYSICS;
itemLimit = Settings.TICK_LIMITER.ITEMS;
}
}, 1);
}
@ -27,6 +28,7 @@ public class ChunkListener implements Listener {
private int physicsLimit = Integer.MAX_VALUE;
private int itemLimit = Integer.MAX_VALUE;
public static boolean physicsFreeze = false;
public static boolean itemFreeze = false;
@EventHandler(priority = EventPriority.LOWEST)
public void onPhysics(BlockPhysicsEvent event) {
@ -42,7 +44,7 @@ public class ChunkListener implements Listener {
if (physicsFreeze) {
event.setCancelled(true);
} else if (itemLimit-- < 0) {
physicsFreeze = true;
event.setCancelled(true);
}
}
}

View File

@ -193,13 +193,15 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
try {
CharFaweChunk bc = (CharFaweChunk) pc;
Chunk chunk = (Chunk) bc.getChunk();
boolean async = Fawe.get().getMainThread() != Thread.currentThread();
if (!chunk.isLoaded()) {
if (Fawe.get().getMainThread() != Thread.currentThread()) {
if (async) {
return false;
}
chunk.load(false);
}
net.minecraft.server.v1_10_R1.Chunk c = ((CraftChunk) chunk).getHandle();
c.e(false);
final boolean flag = chunk.getWorld().getEnvironment() == Environment.NORMAL;
ChunkSection[] sections = c.getSections();
if (mode == RelightMode.ALL) {
@ -271,6 +273,7 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
continue;
}
pos.c(X + x, y, Z + z);
if (async && !chunk.isLoaded()) return false;
w.w(pos);
}
continue;
@ -311,6 +314,7 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
continue;
}
pos.c(X + x, y, Z + z);
if (async && !chunk.isLoaded()) return false;
w.w(pos);
}
}

View File

@ -2,8 +2,8 @@ package com.boydti.fawe.example;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import java.util.Collection;

View File

@ -40,7 +40,7 @@ public class CommandBrush implements Brush {
if (face == null) {
position = position.add(0, 1, 1);
} else {
position = face;
position = face.getFaceVector();
}
FawePlayer<Object> fp = FawePlayer.wrap(player);
fp.deleteMeta("fawe_action");

View File

@ -63,12 +63,14 @@ public class PlotSquaredFeature extends FaweMaskManager {
@Override
public FaweMask getMask(FawePlayer fp) {
final PlotPlayer pp = PlotPlayer.wrap((Player) fp.parent);
final HashSet<RegionWrapper> regions = WEManager.getMask(pp);
final HashSet<RegionWrapper> regions;
Plot plot = pp.getCurrentPlot();
if (plot != null && (plot.isOwner(pp.getUUID()) || plot.getTrusted().contains(pp.getUUID()) || (plot.getMembers().contains(pp.getUUID()) && pp.hasPermission("fawe.plotsquared.member")))) {
regions = plot.getRegions();
} else {
regions = WEManager.getMask(pp);
}
if (regions.size() == 0) {
Plot plot = pp.getCurrentPlot();
if (plot != null && plot.isOwner(pp.getUUID())) {
System.out.println("INVALID MASK? " + WEManager.getMask(pp) + " | " + plot + " | " + pp.getName());
}
return null;
}
final HashSet<com.boydti.fawe.object.RegionWrapper> faweRegions = new HashSet<>();