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 @Override
public void run() { public void run() {
physicsFreeze = false; physicsFreeze = false;
itemFreeze = false;
physicsLimit = Settings.TICK_LIMITER.PHYSICS; physicsLimit = Settings.TICK_LIMITER.PHYSICS;
itemLimit = Settings.TICK_LIMITER.PHYSICS; itemLimit = Settings.TICK_LIMITER.ITEMS;
} }
}, 1); }, 1);
} }
@ -27,6 +28,7 @@ public class ChunkListener implements Listener {
private int physicsLimit = Integer.MAX_VALUE; private int physicsLimit = Integer.MAX_VALUE;
private int itemLimit = Integer.MAX_VALUE; private int itemLimit = Integer.MAX_VALUE;
public static boolean physicsFreeze = false; public static boolean physicsFreeze = false;
public static boolean itemFreeze = false;
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPhysics(BlockPhysicsEvent event) { public void onPhysics(BlockPhysicsEvent event) {
@ -42,7 +44,7 @@ public class ChunkListener implements Listener {
if (physicsFreeze) { if (physicsFreeze) {
event.setCancelled(true); event.setCancelled(true);
} else if (itemLimit-- < 0) { } 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 { try {
CharFaweChunk bc = (CharFaweChunk) pc; CharFaweChunk bc = (CharFaweChunk) pc;
Chunk chunk = (Chunk) bc.getChunk(); Chunk chunk = (Chunk) bc.getChunk();
boolean async = Fawe.get().getMainThread() != Thread.currentThread();
if (!chunk.isLoaded()) { if (!chunk.isLoaded()) {
if (Fawe.get().getMainThread() != Thread.currentThread()) { if (async) {
return false; return false;
} }
chunk.load(false); chunk.load(false);
} }
net.minecraft.server.v1_10_R1.Chunk c = ((CraftChunk) chunk).getHandle(); net.minecraft.server.v1_10_R1.Chunk c = ((CraftChunk) chunk).getHandle();
c.e(false);
final boolean flag = chunk.getWorld().getEnvironment() == Environment.NORMAL; final boolean flag = chunk.getWorld().getEnvironment() == Environment.NORMAL;
ChunkSection[] sections = c.getSections(); ChunkSection[] sections = c.getSections();
if (mode == RelightMode.ALL) { if (mode == RelightMode.ALL) {
@ -271,6 +273,7 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
continue; continue;
} }
pos.c(X + x, y, Z + z); pos.c(X + x, y, Z + z);
if (async && !chunk.isLoaded()) return false;
w.w(pos); w.w(pos);
} }
continue; continue;
@ -311,6 +314,7 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
continue; continue;
} }
pos.c(X + x, y, Z + z); pos.c(X + x, y, Z + z);
if (async && !chunk.isLoaded()) return false;
w.w(pos); w.w(pos);
} }
} }

View File

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

View File

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

View File

@ -63,12 +63,14 @@ public class PlotSquaredFeature extends FaweMaskManager {
@Override @Override
public FaweMask getMask(FawePlayer fp) { public FaweMask getMask(FawePlayer fp) {
final PlotPlayer pp = PlotPlayer.wrap((Player) fp.parent); 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) { 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; return null;
} }
final HashSet<com.boydti.fawe.object.RegionWrapper> faweRegions = new HashSet<>(); final HashSet<com.boydti.fawe.object.RegionWrapper> faweRegions = new HashSet<>();