freebuild region restrictions

This commit is contained in:
Jesse Boyd
2018-09-05 05:10:15 +10:00
19 changed files with 230 additions and 63 deletions

View File

@ -586,7 +586,7 @@ public class MainUtil {
long ratio = total / compressedSize;
long saved = total - compressedSize;
if (ratio > 3 && Thread.currentThread() != Fawe.get().getMainThread() && actor != null) {
if (ratio > 3 && !Fawe.isMainThread() && actor != null) {
BBC.COMPRESSED.send(actor, saved, ratio);
}
} catch (Exception e) {

View File

@ -188,7 +188,7 @@ public abstract class TaskManager {
if (r == null) {
return;
}
if (Thread.currentThread() == Fawe.get().getMainThread()) {
if (Fawe.isMainThread()) {
r.run();
} else {
task(r);
@ -336,7 +336,7 @@ public abstract class TaskManager {
* @return
*/
public <T> T syncWhenFree(final RunnableVal<T> function, int timeout) {
if (Fawe.get().getMainThread() == Thread.currentThread()) {
if (Fawe.isMainThread()) {
function.run();
return function.value;
}
@ -389,7 +389,7 @@ public abstract class TaskManager {
}
public <T> T sync(final Supplier<T> function, int timeout) {
if (Fawe.get().getMainThread() == Thread.currentThread()) {
if (Fawe.isMainThread()) {
return function.get();
}
final AtomicBoolean running = new AtomicBoolean(true);

View File

@ -125,16 +125,19 @@ public class WEManager {
}
}
if (!removed) return regions.toArray(new Region[regions.size()]);
masks.clear();
}
}
Set<FaweMask> tmpMasks = new HashSet<>();
for (final FaweMaskManager manager : managers) {
if (player.hasPermission("fawe." + manager.getKey())) {
try {
if (manager.isExclusive() && !masks.isEmpty()) continue;
final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.getDefaultMaskType());
if (mask != null) {
regions.add(mask.getRegion());
masks.add(mask);
if (manager.isExclusive()) break;
}
} catch (Throwable e) {
e.printStackTrace();