mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-15 01:08:35 +00:00
freebuild region restrictions
This commit is contained in:
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user