mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
refactor: Deprecate IMP
initializors in favor of builders
This commit is contained in:
@ -101,17 +101,17 @@ public class Fawe {
|
||||
this.setupConfigs();
|
||||
TaskManager.IMP = this.implementation.getTaskManager();
|
||||
|
||||
TaskManager.IMP.async(() -> {
|
||||
TaskManager.taskManager().async(() -> {
|
||||
MainUtil.deleteOlder(
|
||||
MainUtil.getFile(this.implementation
|
||||
.getDirectory(), Settings.IMP.PATHS.HISTORY),
|
||||
TimeUnit.DAYS.toMillis(Settings.IMP.HISTORY.DELETE_AFTER_DAYS),
|
||||
.getDirectory(), Settings.settings().PATHS.HISTORY),
|
||||
TimeUnit.DAYS.toMillis(Settings.settings().HISTORY.DELETE_AFTER_DAYS),
|
||||
false
|
||||
);
|
||||
MainUtil.deleteOlder(
|
||||
MainUtil.getFile(this.implementation
|
||||
.getDirectory(), Settings.IMP.PATHS.CLIPBOARD),
|
||||
TimeUnit.DAYS.toMillis(Settings.IMP.CLIPBOARD.DELETE_AFTER_DAYS),
|
||||
.getDirectory(), Settings.settings().PATHS.CLIPBOARD),
|
||||
TimeUnit.DAYS.toMillis(Settings.settings().CLIPBOARD.DELETE_AFTER_DAYS),
|
||||
false
|
||||
);
|
||||
});
|
||||
@ -123,28 +123,49 @@ public class Fawe {
|
||||
this.timer = new FaweTimer();
|
||||
|
||||
// Delayed worldedit setup
|
||||
TaskManager.IMP.later(() -> {
|
||||
TaskManager.taskManager().later(() -> {
|
||||
try {
|
||||
WEManager.IMP.addManagers(Fawe.this.implementation.getMaskManagers());
|
||||
WEManager.weManager().addManagers(Fawe.this.implementation.getMaskManagers());
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}, 0);
|
||||
|
||||
TaskManager.IMP.repeat(timer, 1);
|
||||
TaskManager.taskManager().repeat(timer, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the implementation specific class.
|
||||
* @deprecated use {@link #platform()}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
public static <T extends IFawe> T imp() {
|
||||
return instance != null ? (T) instance.implementation : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the implementation specific class.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends IFawe> T platform() {
|
||||
return instance != null ? (T) instance.implementation : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the implementation independent class.
|
||||
* @ use {@link #instance()}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
public static Fawe get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the implementation independent class.
|
||||
*/
|
||||
public static Fawe get() {
|
||||
public static Fawe instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -225,8 +246,8 @@ public class Fawe {
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
if (imp().getPreloader(false) != null) {
|
||||
imp().getPreloader(false).cancel();
|
||||
if (platform().getPreloader(false) != null) {
|
||||
platform().getPreloader(false).cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +317,7 @@ public class Fawe {
|
||||
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
||||
// Setting up config.yml
|
||||
File file = new File(this.implementation.getDirectory(), "config.yml");
|
||||
Settings.IMP.PLATFORM = implementation.getPlatform().replace("\"", "");
|
||||
Settings.settings().PLATFORM = implementation.getPlatform().replace("\"", "");
|
||||
try (InputStream stream = getClass().getResourceAsStream("/fawe.properties");
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
|
||||
String versionString = br.readLine();
|
||||
@ -304,17 +325,17 @@ public class Fawe {
|
||||
String dateString = br.readLine();
|
||||
br.close();
|
||||
this.version = FaweVersion.tryParse(versionString, commitString, dateString);
|
||||
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toString();
|
||||
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build;
|
||||
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit/commit/" + Integer.toHexString(version.hash);
|
||||
Settings.settings().DATE = new Date(100 + version.year, version.month, version.day).toString();
|
||||
Settings.settings().BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build;
|
||||
Settings.settings().COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit/commit/" + Integer.toHexString(version.hash);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
try {
|
||||
Settings.IMP.reload(file);
|
||||
Settings.settings().reload(file);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error("Failed to load config.", e);
|
||||
}
|
||||
Settings.IMP.QUEUE.TARGET_SIZE = Math.max(Settings.IMP.QUEUE.TARGET_SIZE, Settings.IMP.QUEUE.PARALLEL_THREADS);
|
||||
Settings.settings().QUEUE.TARGET_SIZE = Math.max(Settings.settings().QUEUE.TARGET_SIZE, Settings.settings().QUEUE.PARALLEL_THREADS);
|
||||
try {
|
||||
byte[] in = new byte[0];
|
||||
byte[] compressed = LZ4Factory.fastestJavaInstance().fastCompressor().compress(in);
|
||||
@ -332,14 +353,14 @@ public class Fawe {
|
||||
assert (Zstd.decompress(ob, compressed) == 0);
|
||||
LOGGER.info("ZSTD Compression Binding loaded successfully");
|
||||
} catch (Throwable e) {
|
||||
if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) {
|
||||
Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL);
|
||||
Settings.IMP.HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.HISTORY.COMPRESSION_LEVEL);
|
||||
if (Settings.settings().CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.settings().HISTORY.COMPRESSION_LEVEL > 6) {
|
||||
Settings.settings().CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.settings().CLIPBOARD.COMPRESSION_LEVEL);
|
||||
Settings.settings().HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.settings().HISTORY.COMPRESSION_LEVEL);
|
||||
LOGGER.error("ZSTD Compression Binding Not Found.\n"
|
||||
+ "FAWE will still work but compression won't work as well.", e);
|
||||
}
|
||||
}
|
||||
Settings.IMP.save(file);
|
||||
Settings.settings().save(file);
|
||||
}
|
||||
|
||||
public WorldEdit getWorldEdit() {
|
||||
@ -347,7 +368,7 @@ public class Fawe {
|
||||
}
|
||||
|
||||
private void setupMemoryListener() {
|
||||
if (Settings.IMP.MAX_MEMORY_PERCENT < 1 || Settings.IMP.MAX_MEMORY_PERCENT > 99) {
|
||||
if (Settings.settings().MAX_MEMORY_PERCENT < 1 || Settings.settings().MAX_MEMORY_PERCENT > 99) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@ -371,7 +392,7 @@ public class Fawe {
|
||||
if (max < 0) {
|
||||
continue;
|
||||
}
|
||||
final long alert = (max * Settings.IMP.MAX_MEMORY_PERCENT) / 100;
|
||||
final long alert = (max * Settings.settings().MAX_MEMORY_PERCENT) / 100;
|
||||
mp.setUsageThreshold(alert);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class FaweAPI {
|
||||
* @return TaskManager
|
||||
*/
|
||||
public static TaskManager getTaskManager() {
|
||||
return TaskManager.IMP;
|
||||
return TaskManager.taskManager();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +81,7 @@ public class FaweAPI {
|
||||
* @return the queue extent
|
||||
*/
|
||||
public static IQueueExtent<IQueueChunk> createQueue(World world, boolean autoQueue) {
|
||||
IQueueExtent<IQueueChunk> queue = Fawe.get().getQueueHandler().getQueue(world);
|
||||
IQueueExtent<IQueueChunk> queue = Fawe.instance().getQueueHandler().getQueue(world);
|
||||
if (!autoQueue) {
|
||||
queue.disableQueue();
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class FaweAPI {
|
||||
* @return Set of FaweMaskManager
|
||||
*/
|
||||
public static Set<FaweMaskManager> getMaskManagers() {
|
||||
return new HashSet<>(WEManager.IMP.getManagers());
|
||||
return new HashSet<>(WEManager.weManager().getManagers());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +143,7 @@ public class FaweAPI {
|
||||
* Get a player's allowed WorldEdit region(s).
|
||||
*/
|
||||
public static Region[] getRegions(Player player) {
|
||||
return WEManager.IMP.getMask(player);
|
||||
return WEManager.weManager().getMask(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +155,7 @@ public class FaweAPI {
|
||||
* @return array of allowed regions if whitelist, else of disallowed regions.
|
||||
*/
|
||||
public static Region[] getRegions(Player player, FaweMaskManager.MaskType type, boolean isWhiteList) {
|
||||
return WEManager.IMP.getMask(player, type, isWhiteList);
|
||||
return WEManager.weManager().getMask(player, type, isWhiteList);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,13 +170,13 @@ public class FaweAPI {
|
||||
*/
|
||||
public static void cancelEdit(AbstractDelegateExtent extent, Component reason) {
|
||||
try {
|
||||
WEManager.IMP.cancelEdit(extent, new FaweException(reason));
|
||||
WEManager.weManager().cancelEdit(extent, new FaweException(reason));
|
||||
} catch (WorldEditException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMaskManager(FaweMaskManager maskMan) {
|
||||
WEManager.IMP.addManager(maskMan);
|
||||
WEManager.weManager().addManager(maskMan);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,7 +186,7 @@ public class FaweAPI {
|
||||
if (!file.exists() || file.isDirectory()) {
|
||||
throw new IllegalArgumentException("Not a file!");
|
||||
}
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (Settings.settings().HISTORY.USE_DISK) {
|
||||
throw new IllegalArgumentException("History on disk not enabled!");
|
||||
}
|
||||
if (!file.getName().toLowerCase(Locale.ROOT).endsWith(".bd")) {
|
||||
@ -224,11 +224,10 @@ public class FaweAPI {
|
||||
*/
|
||||
public static List<DiskStorageHistory> getBDFiles(Location origin, UUID user, int radius, long timediff, boolean shallow) {
|
||||
Extent extent = origin.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
if (!(extent instanceof World world)) {
|
||||
throw new IllegalArgumentException("Origin is not a valid world");
|
||||
}
|
||||
World world = (World) extent;
|
||||
File history = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world.getName());
|
||||
File history = MainUtil.getFile(Fawe.platform().getDirectory(), Settings.settings().PATHS.HISTORY + File.separator + world.getName());
|
||||
if (!history.exists()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -352,12 +351,12 @@ public class FaweAPI {
|
||||
World unwrapped = WorldWrapper.unwrap(world);
|
||||
if (unwrapped instanceof IQueueExtent) {
|
||||
queue = (IQueueExtent) unwrapped;
|
||||
} else if (Settings.IMP.QUEUE.PARALLEL_THREADS > 1) {
|
||||
} else if (Settings.settings().QUEUE.PARALLEL_THREADS > 1) {
|
||||
ParallelQueueExtent parallel =
|
||||
new ParallelQueueExtent(Fawe.get().getQueueHandler(), world, true);
|
||||
new ParallelQueueExtent(Fawe.instance().getQueueHandler(), world, true);
|
||||
queue = parallel.getExtent();
|
||||
} else {
|
||||
queue = Fawe.get().getQueueHandler().getQueue(world);
|
||||
queue = Fawe.instance().getQueueHandler().getQueue(world);
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +371,7 @@ public class FaweAPI {
|
||||
}
|
||||
}
|
||||
if (mode != RelightMode.NONE) {
|
||||
if (Settings.IMP.LIGHTING.REMOVE_FIRST) {
|
||||
if (Settings.settings().LIGHTING.REMOVE_FIRST) {
|
||||
relighter.removeAndRelight(true);
|
||||
} else {
|
||||
relighter.fixSkyLighting();
|
||||
|
@ -59,7 +59,15 @@ import java.util.function.Supplier;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public enum FaweCache implements Trimable {
|
||||
IMP; // singleton
|
||||
/**
|
||||
* @deprecated Use {@link #INSTANCE} to get an instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
IMP,
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
INSTANCE;// singleton
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@ -301,7 +309,7 @@ public enum FaweCache implements Trimable {
|
||||
|
||||
// BlockStates
|
||||
int bitsPerEntry = MathMan.log2nlz(num_palette - 1);
|
||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
if (Settings.settings().PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
||||
} else {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 1); // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
@ -387,7 +395,7 @@ public enum FaweCache implements Trimable {
|
||||
|
||||
// BlockStates
|
||||
int bitsPerEntry = MathMan.log2nlz(num_palette - 1);
|
||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
if (Settings.settings().PROTOCOL_SUPPORT_FIX || num_palette != 1) {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
||||
} else {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 1); // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
@ -568,7 +576,7 @@ public enum FaweCache implements Trimable {
|
||||
Thread stuff
|
||||
*/
|
||||
public ThreadPoolExecutor newBlockingExecutor() {
|
||||
int nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS;
|
||||
int nThreads = Settings.settings().QUEUE.PARALLEL_THREADS;
|
||||
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads, true);
|
||||
return new ThreadPoolExecutor(nThreads, nThreads,
|
||||
0L, TimeUnit.MILLISECONDS, queue,
|
||||
@ -609,7 +617,7 @@ public enum FaweCache implements Trimable {
|
||||
lastException = hash;
|
||||
LOGGER.catching(throwable);
|
||||
count = 0;
|
||||
} else if (count < Settings.IMP.QUEUE.PARALLEL_THREADS) {
|
||||
} else if (count < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||
LOGGER.warn(throwable.getMessage());
|
||||
count++;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ public class AnvilCommands {
|
||||
// });
|
||||
// if (useData) {
|
||||
// for (long[] c : map) {
|
||||
// BaseBlock block = FaweCache.IMP.CACHE_BLOCK[(int) c[0]];
|
||||
// BaseBlock block = FaweCache.INSTANCE.CACHE_BLOCK[(int) c[0]];
|
||||
// String name = BlockType.fromID(block.getId()).getName();
|
||||
// String str = String.format("%-7s (%.3f%%) %s #%d:%d",
|
||||
// String.valueOf(c[1]),
|
||||
|
@ -147,7 +147,7 @@
|
||||
// CFISettings settings = getSettings(player).remove();
|
||||
// generator.setPacketViewer(player);
|
||||
// settings.setGenerator(generator).bind();
|
||||
// generator.setImageViewer(Fawe.imp().getImageViewer(player));
|
||||
// generator.setImageViewer(Fawe.platform().getImageViewer(player));
|
||||
// generator.update();
|
||||
// mainMenu(player);
|
||||
// }
|
||||
@ -226,7 +226,7 @@
|
||||
// World world = FaweAPI.getWorld(folder.getName());
|
||||
// if (world != null) {
|
||||
// if (player.getWorld() != world) {
|
||||
// TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
// TaskManager.taskManager().sync(new RunnableVal<Object>() {
|
||||
// @Override
|
||||
// public void run(Object value) {
|
||||
// Location spawn = new Location(world, world.getSpawnPosition().toVector3());
|
||||
@ -425,7 +425,7 @@
|
||||
// switch (argOpt.toLowerCase(Locale.ROOT)) {
|
||||
// case "true":
|
||||
// case "*": {
|
||||
// generator.setTextureUtil(Fawe.get().getTextureUtil());
|
||||
// generator.setTextureUtil(Fawe.instance().getTextureUtil());
|
||||
// return;
|
||||
// }
|
||||
// case "#clipboard": {
|
||||
@ -453,7 +453,7 @@
|
||||
// parserContext.setExtent(extent);
|
||||
// Request.request().setExtent(extent);
|
||||
// Mask mask = worldEdit.getMaskFactory().parseFromInput(argOpt, parserContext);
|
||||
// TextureUtil tu = Fawe.get().getTextureUtil();
|
||||
// TextureUtil tu = Fawe.instance().getTextureUtil();
|
||||
// for (int typeId : tu.getValidBlockIds()) {
|
||||
// BlockType type = BlockTypes.get(typeId);
|
||||
// extent.init(0, 0, 0, type.getDefaultState().toBaseBlock());
|
||||
@ -464,7 +464,7 @@
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// generator.setTextureUtil(new FilteredTextureUtil(Fawe.get().getTextureUtil(), blocks));
|
||||
// generator.setTextureUtil(new FilteredTextureUtil(Fawe.instance().getTextureUtil(), blocks));
|
||||
// coloring(player);
|
||||
// }
|
||||
//
|
||||
@ -493,9 +493,9 @@
|
||||
// public void complexity(Player player, int min, int max) throws FileNotFoundException {
|
||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
// if (min == 0 && max == 100) {
|
||||
// gen.setTextureUtil(Fawe.get().getTextureUtil());
|
||||
// gen.setTextureUtil(Fawe.instance().getTextureUtil());
|
||||
// } else {
|
||||
// gen.setTextureUtil(new CleanTextureUtil(Fawe.get().getTextureUtil(), min, max));
|
||||
// gen.setTextureUtil(new CleanTextureUtil(Fawe.instance().getTextureUtil(), min, max));
|
||||
// }
|
||||
// coloring(player);
|
||||
// }
|
||||
@ -1201,7 +1201,7 @@
|
||||
// whiteOnly = true;
|
||||
// maskArg = null;
|
||||
// imageMaskArg = null;
|
||||
// generator.setTextureUtil(Fawe.get().getTextureUtil());
|
||||
// generator.setTextureUtil(Fawe.instance().getTextureUtil());
|
||||
// }
|
||||
//
|
||||
// public void resetComponent() {
|
||||
|
@ -95,7 +95,7 @@ public class ListFilters {
|
||||
}
|
||||
String firstArg = finalArg.substring(0, finalArg.length() - File.separator.length());
|
||||
if (firstArg.length() > 3 && firstArg.length() <= 16) {
|
||||
UUID fromName = Fawe.imp().getUUID(finalArg);
|
||||
UUID fromName = Fawe.platform().getUUID(finalArg);
|
||||
if (fromName != null) {
|
||||
newRoot = new File(root, finalArg);
|
||||
if (newRoot.exists()) {
|
||||
|
@ -45,7 +45,7 @@
|
||||
// PlotPlayer player = PlotPlayer.get(actor.getName());
|
||||
//
|
||||
// actor.print("Claiming world");
|
||||
// Plot plot = TaskManager.IMP.sync(new RunnableVal<Plot>() {
|
||||
// Plot plot = TaskManager.taskManager().sync(new RunnableVal<Plot>() {
|
||||
// @Override
|
||||
// public void run(Plot o) {
|
||||
// int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount()
|
||||
@ -73,7 +73,7 @@
|
||||
// File folder = CFICommands.getFolder(plot.getWorldName());
|
||||
// Boolean result = createTask.apply(folder);
|
||||
// if (result == Boolean.TRUE) {
|
||||
// TaskManager.IMP.sync(() -> plot.teleportPlayer(player));
|
||||
// TaskManager.taskManager().sync(() -> plot.teleportPlayer(player));
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
|
@ -90,7 +90,7 @@ public class BrushSettings {
|
||||
// }
|
||||
// if (settings.containsKey(SettingType.TRANSFORM.name())) {
|
||||
// String transformArgs = (String) settings.get(SettingType.TRANSFORM.name());
|
||||
// ResettableExtent extent = Fawe.get().getTransformParser().parseFromInput(transformArgs, parserContext);
|
||||
// ResettableExtent extent = Fawe.instance().getTransformParser().parseFromInput(transformArgs, parserContext);
|
||||
// bs.setTransform(extent);
|
||||
// bs.constructor.put(SettingType.TRANSFORM, transformArgs);
|
||||
// }
|
||||
|
@ -68,7 +68,7 @@ public class InspectBrush extends BrushTool {
|
||||
player.print(Caption.of("fawe.error.no-perm", "worldedit.tool.inspect"));
|
||||
return false;
|
||||
}
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (!Settings.settings().HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of(
|
||||
"fawe.error.setting.disable",
|
||||
"history.use-database (Import with /history import )"
|
||||
@ -95,7 +95,7 @@ public class InspectBrush extends BrushTool {
|
||||
int from = change.from;
|
||||
int to = change.to;
|
||||
UUID uuid = edit.getUUID();
|
||||
String name = Fawe.imp().getName(uuid);
|
||||
String name = Fawe.platform().getName(uuid);
|
||||
int index = edit.getIndex();
|
||||
long age = System.currentTimeMillis() - edit.getBDFile().lastModified();
|
||||
String ageFormatted = MainUtil.secToTime(age / 1000);
|
||||
|
@ -19,12 +19,16 @@ import java.util.stream.Stream;
|
||||
|
||||
public class Settings extends Config {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #settings()} instead to get an instance.
|
||||
*/
|
||||
@Ignore
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
public static final Settings IMP = new Settings();
|
||||
|
||||
@Ignore
|
||||
static Settings INSTANCE = new Settings();
|
||||
@Ignore
|
||||
public boolean PROTOCOL_SUPPORT_FIX = false;
|
||||
|
||||
@Comment("These first 6 aren't configurable") // This is a comment
|
||||
@Final // Indicates that this value isn't configurable
|
||||
public String ISSUES = "https://github.com/IntellectualSites/FastAsyncWorldEdit/issues";
|
||||
@ -38,7 +42,6 @@ public class Settings extends Config {
|
||||
public String COMMIT; // These values are set from FAWE before loading
|
||||
@Final
|
||||
public String PLATFORM; // These values are set from FAWE before loading
|
||||
|
||||
@Comment({
|
||||
"Set true to enable WorldEdit restrictions per region (e.g. PlotSquared or WorldGuard).",
|
||||
"To be allowed to WorldEdit in a region, users need the appropriate",
|
||||
@ -51,7 +54,6 @@ public class Settings extends Config {
|
||||
" - Disable with 100 or -1."
|
||||
})
|
||||
public int MAX_MEMORY_PERCENT = 95;
|
||||
|
||||
@Create
|
||||
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
|
||||
@Create
|
||||
@ -77,16 +79,178 @@ public class Settings extends Config {
|
||||
@Create
|
||||
public ConfigBlock<LIMITS> LIMITS;
|
||||
|
||||
private Settings() {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of Settings.
|
||||
*
|
||||
* @return an instance of Settings
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public static Settings settings() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void reload(File file) {
|
||||
load(file);
|
||||
save(file);
|
||||
}
|
||||
|
||||
public FaweLimit getLimit(Actor actor) {
|
||||
FaweLimit limit;
|
||||
if (actor.hasPermission("fawe.limit.*") || actor.hasPermission("fawe.bypass")) {
|
||||
limit = FaweLimit.MAX.copy();
|
||||
} else {
|
||||
limit = new FaweLimit();
|
||||
}
|
||||
ArrayList<String> keys = new ArrayList<>(LIMITS.getSections());
|
||||
if (keys.remove("default")) {
|
||||
keys.add("default");
|
||||
}
|
||||
|
||||
boolean limitFound = false;
|
||||
for (String key : keys) {
|
||||
if (actor.hasPermission("fawe.limit." + key) || !limitFound && key.equals("default")) {
|
||||
limitFound = true;
|
||||
LIMITS newLimit = LIMITS.get(key);
|
||||
limit.MAX_ACTIONS = Math.max(
|
||||
limit.MAX_ACTIONS,
|
||||
newLimit.MAX_ACTIONS != -1 ? newLimit.MAX_ACTIONS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_CHANGES = Math.max(
|
||||
limit.MAX_CHANGES,
|
||||
newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Long.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BLOCKSTATES = Math.max(
|
||||
limit.MAX_BLOCKSTATES,
|
||||
newLimit.MAX_BLOCKSTATES != -1 ? newLimit.MAX_BLOCKSTATES : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_CHECKS = Math.max(
|
||||
limit.MAX_CHECKS,
|
||||
newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Long.MAX_VALUE
|
||||
);
|
||||
limit.MAX_ENTITIES = Math.max(
|
||||
limit.MAX_ENTITIES,
|
||||
newLimit.MAX_ENTITIES != -1 ? newLimit.MAX_ENTITIES : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE);
|
||||
limit.MAX_ITERATIONS = Math.max(
|
||||
limit.MAX_ITERATIONS,
|
||||
newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_HISTORY = Math.max(
|
||||
limit.MAX_HISTORY,
|
||||
newLimit.MAX_HISTORY_MB != -1 ? newLimit.MAX_HISTORY_MB : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_EXPRESSION_MS = Math.max(
|
||||
limit.MAX_EXPRESSION_MS,
|
||||
newLimit.MAX_EXPRESSION_MS != -1 ? newLimit.MAX_EXPRESSION_MS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.INVENTORY_MODE = Math.min(limit.INVENTORY_MODE, newLimit.INVENTORY_MODE);
|
||||
limit.SPEED_REDUCTION = Math.min(limit.SPEED_REDUCTION, newLimit.SPEED_REDUCTION);
|
||||
limit.FAST_PLACEMENT |= newLimit.FAST_PLACEMENT;
|
||||
limit.CONFIRM_LARGE &= newLimit.CONFIRM_LARGE;
|
||||
limit.RESTRICT_HISTORY_TO_REGIONS &= newLimit.RESTRICT_HISTORY_TO_REGIONS;
|
||||
if (limit.STRIP_NBT == null) {
|
||||
limit.STRIP_NBT = newLimit.STRIP_NBT.isEmpty() ? Collections.emptySet() : new HashSet<>(newLimit.STRIP_NBT);
|
||||
} else if (limit.STRIP_NBT.isEmpty() || newLimit.STRIP_NBT.isEmpty()) {
|
||||
limit.STRIP_NBT = Collections.emptySet();
|
||||
} else {
|
||||
limit.STRIP_NBT = new HashSet<>(limit.STRIP_NBT);
|
||||
limit.STRIP_NBT.retainAll(newLimit.STRIP_NBT);
|
||||
if (limit.STRIP_NBT.isEmpty()) {
|
||||
limit.STRIP_NBT = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
limit.UNIVERSAL_DISALLOWED_BLOCKS &= newLimit.UNIVERSAL_DISALLOWED_BLOCKS;
|
||||
|
||||
if (limit.DISALLOWED_BLOCKS == null) {
|
||||
limit.DISALLOWED_BLOCKS = newLimit.DISALLOWED_BLOCKS.isEmpty() ? Collections.emptySet() : new HashSet<>(
|
||||
newLimit.DISALLOWED_BLOCKS);
|
||||
} else if (limit.DISALLOWED_BLOCKS.isEmpty() || newLimit.DISALLOWED_BLOCKS.isEmpty()) {
|
||||
limit.DISALLOWED_BLOCKS = Collections.emptySet();
|
||||
} else {
|
||||
limit.DISALLOWED_BLOCKS = new HashSet<>(limit.DISALLOWED_BLOCKS);
|
||||
limit.DISALLOWED_BLOCKS.retainAll(newLimit.DISALLOWED_BLOCKS
|
||||
.stream()
|
||||
.map(s -> s.contains(":") ? s.toLowerCase(Locale.ROOT) : ("minecraft:" + s).toLowerCase(Locale.ROOT))
|
||||
.collect(Collectors.toSet()));
|
||||
if (limit.DISALLOWED_BLOCKS.isEmpty()) {
|
||||
limit.DISALLOWED_BLOCKS = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
if (limit.REMAP_PROPERTIES == null) {
|
||||
limit.REMAP_PROPERTIES = newLimit.REMAP_PROPERTIES.isEmpty() ? Collections.emptySet() :
|
||||
newLimit.REMAP_PROPERTIES.stream().flatMap(s -> {
|
||||
String propertyStr = s.substring(0, s.indexOf('['));
|
||||
List<Property<?>> properties =
|
||||
BlockTypesCache.getAllProperties().get(propertyStr.toLowerCase(Locale.ROOT));
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
String[] mappings = s.substring(s.indexOf('[') + 1, s.indexOf(']')).split(",");
|
||||
Set<PropertyRemap<?>> remaps = new HashSet<>();
|
||||
for (Property<?> property : properties) {
|
||||
for (String mapping : mappings) {
|
||||
try {
|
||||
String[] fromTo = mapping.split(":");
|
||||
remaps.add(property.getRemap(
|
||||
property.getValueFor(fromTo[0]),
|
||||
property.getValueFor(fromTo[1])
|
||||
));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// This property is unlikely to be the one being targeted.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return remaps.stream();
|
||||
}).collect(Collectors.toSet());
|
||||
} else if (limit.REMAP_PROPERTIES.isEmpty() || newLimit.REMAP_PROPERTIES.isEmpty()) {
|
||||
limit.REMAP_PROPERTIES = Collections.emptySet();
|
||||
} else {
|
||||
limit.REMAP_PROPERTIES = new HashSet<>(limit.REMAP_PROPERTIES);
|
||||
limit.REMAP_PROPERTIES.retainAll(newLimit.REMAP_PROPERTIES.stream().flatMap(s -> {
|
||||
String propertyStr = s.substring(0, s.indexOf('['));
|
||||
List<Property<?>> properties =
|
||||
BlockTypesCache.getAllProperties().get(propertyStr.toLowerCase(Locale.ROOT));
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
String[] mappings = s.substring(s.indexOf('[') + 1, s.indexOf(']')).split(",");
|
||||
Set<PropertyRemap<?>> remaps = new HashSet<>();
|
||||
for (Property<?> property : properties) {
|
||||
for (String mapping : mappings) {
|
||||
try {
|
||||
String[] fromTo = mapping.split(":");
|
||||
remaps.add(property.getRemap(
|
||||
property.getValueFor(fromTo[0]),
|
||||
property.getValueFor(fromTo[1])
|
||||
));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// This property is unlikely to be the one being targeted.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return remaps.stream();
|
||||
}).collect(Collectors.toSet()));
|
||||
if (limit.REMAP_PROPERTIES.isEmpty()) {
|
||||
limit.REMAP_PROPERTIES = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
@Comment("Enable or disable core components")
|
||||
public static final class ENABLED_COMPONENTS {
|
||||
|
||||
public boolean COMMANDS = true;
|
||||
@Comment({
|
||||
"Disable the FAWE-PlotSquared hook to take over most intense P2 queueing",
|
||||
"Specific aspects can be turned on and off further below",
|
||||
"Only disables/enables the hook with v4. For v6, see PlotSquared settings.yml"
|
||||
})
|
||||
public boolean PLOTSQUARED_V4_HOOK = true;
|
||||
@Comment({"Show additional information in console. It helps us at IntellectualSites to find out more about an issue.",
|
||||
"Leave it off if you don't need it, it can spam your console."})
|
||||
public boolean DEBUG = false;
|
||||
@ -341,12 +505,12 @@ public class Settings extends Config {
|
||||
@Comment("This relates to how FAWE places chunks")
|
||||
public static class QUEUE {
|
||||
|
||||
@Create
|
||||
public static PROGRESS PROGRESS;
|
||||
@Comment({
|
||||
"This should equal the number of processors you have",
|
||||
})
|
||||
public int PARALLEL_THREADS = Math.max(1, Runtime.getRuntime().availableProcessors());
|
||||
@Create
|
||||
public static PROGRESS PROGRESS;
|
||||
@Comment({
|
||||
"When doing edits that effect more than this many chunks:",
|
||||
" - FAWE will start placing before all calculations are finished",
|
||||
@ -575,158 +739,4 @@ public class Settings extends Config {
|
||||
|
||||
}
|
||||
|
||||
public void reload(File file) {
|
||||
load(file);
|
||||
save(file);
|
||||
}
|
||||
|
||||
public FaweLimit getLimit(Actor actor) {
|
||||
FaweLimit limit;
|
||||
if (actor.hasPermission("fawe.limit.*") || actor.hasPermission("fawe.bypass")) {
|
||||
limit = FaweLimit.MAX.copy();
|
||||
} else {
|
||||
limit = new FaweLimit();
|
||||
}
|
||||
ArrayList<String> keys = new ArrayList<>(LIMITS.getSections());
|
||||
if (keys.remove("default")) {
|
||||
keys.add("default");
|
||||
}
|
||||
|
||||
boolean limitFound = false;
|
||||
for (String key : keys) {
|
||||
if (actor.hasPermission("fawe.limit." + key) || !limitFound && key.equals("default")) {
|
||||
limitFound = true;
|
||||
LIMITS newLimit = LIMITS.get(key);
|
||||
limit.MAX_ACTIONS = Math.max(
|
||||
limit.MAX_ACTIONS,
|
||||
newLimit.MAX_ACTIONS != -1 ? newLimit.MAX_ACTIONS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_CHANGES = Math.max(
|
||||
limit.MAX_CHANGES,
|
||||
newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Long.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BLOCKSTATES = Math.max(
|
||||
limit.MAX_BLOCKSTATES,
|
||||
newLimit.MAX_BLOCKSTATES != -1 ? newLimit.MAX_BLOCKSTATES : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_CHECKS = Math.max(
|
||||
limit.MAX_CHECKS,
|
||||
newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Long.MAX_VALUE
|
||||
);
|
||||
limit.MAX_ENTITIES = Math.max(
|
||||
limit.MAX_ENTITIES,
|
||||
newLimit.MAX_ENTITIES != -1 ? newLimit.MAX_ENTITIES : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE);
|
||||
limit.MAX_ITERATIONS = Math.max(
|
||||
limit.MAX_ITERATIONS,
|
||||
newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_HISTORY = Math.max(
|
||||
limit.MAX_HISTORY,
|
||||
newLimit.MAX_HISTORY_MB != -1 ? newLimit.MAX_HISTORY_MB : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_EXPRESSION_MS = Math.max(
|
||||
limit.MAX_EXPRESSION_MS,
|
||||
newLimit.MAX_EXPRESSION_MS != -1 ? newLimit.MAX_EXPRESSION_MS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.INVENTORY_MODE = Math.min(limit.INVENTORY_MODE, newLimit.INVENTORY_MODE);
|
||||
limit.SPEED_REDUCTION = Math.min(limit.SPEED_REDUCTION, newLimit.SPEED_REDUCTION);
|
||||
limit.FAST_PLACEMENT |= newLimit.FAST_PLACEMENT;
|
||||
limit.CONFIRM_LARGE &= newLimit.CONFIRM_LARGE;
|
||||
limit.RESTRICT_HISTORY_TO_REGIONS &= newLimit.RESTRICT_HISTORY_TO_REGIONS;
|
||||
if (limit.STRIP_NBT == null) {
|
||||
limit.STRIP_NBT = newLimit.STRIP_NBT.isEmpty() ? Collections.emptySet() : new HashSet<>(newLimit.STRIP_NBT);
|
||||
} else if (limit.STRIP_NBT.isEmpty() || newLimit.STRIP_NBT.isEmpty()) {
|
||||
limit.STRIP_NBT = Collections.emptySet();
|
||||
} else {
|
||||
limit.STRIP_NBT = new HashSet<>(limit.STRIP_NBT);
|
||||
limit.STRIP_NBT.retainAll(newLimit.STRIP_NBT);
|
||||
if (limit.STRIP_NBT.isEmpty()) {
|
||||
limit.STRIP_NBT = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
limit.UNIVERSAL_DISALLOWED_BLOCKS &= newLimit.UNIVERSAL_DISALLOWED_BLOCKS;
|
||||
|
||||
if (limit.DISALLOWED_BLOCKS == null) {
|
||||
limit.DISALLOWED_BLOCKS = newLimit.DISALLOWED_BLOCKS.isEmpty() ? Collections.emptySet() : new HashSet<>(
|
||||
newLimit.DISALLOWED_BLOCKS);
|
||||
} else if (limit.DISALLOWED_BLOCKS.isEmpty() || newLimit.DISALLOWED_BLOCKS.isEmpty()) {
|
||||
limit.DISALLOWED_BLOCKS = Collections.emptySet();
|
||||
} else {
|
||||
limit.DISALLOWED_BLOCKS = new HashSet<>(limit.DISALLOWED_BLOCKS);
|
||||
limit.DISALLOWED_BLOCKS.retainAll(newLimit.DISALLOWED_BLOCKS
|
||||
.stream()
|
||||
.map(s -> s.contains(":") ? s.toLowerCase(Locale.ROOT) : ("minecraft:" + s).toLowerCase(Locale.ROOT))
|
||||
.collect(Collectors.toSet()));
|
||||
if (limit.DISALLOWED_BLOCKS.isEmpty()) {
|
||||
limit.DISALLOWED_BLOCKS = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
if (limit.REMAP_PROPERTIES == null) {
|
||||
limit.REMAP_PROPERTIES = newLimit.REMAP_PROPERTIES.isEmpty() ? Collections.emptySet() :
|
||||
newLimit.REMAP_PROPERTIES.stream().flatMap(s -> {
|
||||
String propertyStr = s.substring(0, s.indexOf('['));
|
||||
List<Property<?>> properties =
|
||||
BlockTypesCache.getAllProperties().get(propertyStr.toLowerCase(Locale.ROOT));
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
String[] mappings = s.substring(s.indexOf('[') + 1, s.indexOf(']')).split(",");
|
||||
Set<PropertyRemap<?>> remaps = new HashSet<>();
|
||||
for (Property<?> property : properties) {
|
||||
for (String mapping : mappings) {
|
||||
try {
|
||||
String[] fromTo = mapping.split(":");
|
||||
remaps.add(property.getRemap(
|
||||
property.getValueFor(fromTo[0]),
|
||||
property.getValueFor(fromTo[1])
|
||||
));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// This property is unlikely to be the one being targeted.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return remaps.stream();
|
||||
}).collect(Collectors.toSet());
|
||||
} else if (limit.REMAP_PROPERTIES.isEmpty() || newLimit.REMAP_PROPERTIES.isEmpty()) {
|
||||
limit.REMAP_PROPERTIES = Collections.emptySet();
|
||||
} else {
|
||||
limit.REMAP_PROPERTIES = new HashSet<>(limit.REMAP_PROPERTIES);
|
||||
limit.REMAP_PROPERTIES.retainAll(newLimit.REMAP_PROPERTIES.stream().flatMap(s -> {
|
||||
String propertyStr = s.substring(0, s.indexOf('['));
|
||||
List<Property<?>> properties =
|
||||
BlockTypesCache.getAllProperties().get(propertyStr.toLowerCase(Locale.ROOT));
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
String[] mappings = s.substring(s.indexOf('[') + 1, s.indexOf(']')).split(",");
|
||||
Set<PropertyRemap<?>> remaps = new HashSet<>();
|
||||
for (Property<?> property : properties) {
|
||||
for (String mapping : mappings) {
|
||||
try {
|
||||
String[] fromTo = mapping.split(":");
|
||||
remaps.add(property.getRemap(
|
||||
property.getValueFor(fromTo[0]),
|
||||
property.getValueFor(fromTo[1])
|
||||
));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// This property is unlikely to be the one being targeted.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return remaps.stream();
|
||||
}).collect(Collectors.toSet()));
|
||||
if (limit.REMAP_PROPERTIES.isEmpty()) {
|
||||
limit.REMAP_PROPERTIES = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,14 +44,14 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
this.prefix = "";
|
||||
this.world = world;
|
||||
this.dbLocation = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + "summary.db"
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getName() + File.separator + "summary.db"
|
||||
);
|
||||
connection = openConnection();
|
||||
|
||||
try {
|
||||
init().get();
|
||||
purge((int) TimeUnit.DAYS.toSeconds(Settings.IMP.HISTORY.DELETE_AFTER_DAYS));
|
||||
purge((int) TimeUnit.DAYS.toSeconds(Settings.settings().HISTORY.DELETE_AFTER_DAYS));
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -284,8 +284,8 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
if (checkConnection()) {
|
||||
return connection;
|
||||
}
|
||||
if (!Fawe.imp().getDirectory().exists()) {
|
||||
Fawe.imp().getDirectory().mkdirs();
|
||||
if (!Fawe.platform().getDirectory().exists()) {
|
||||
Fawe.platform().getDirectory().mkdirs();
|
||||
}
|
||||
if (!dbLocation.exists()) {
|
||||
try {
|
||||
|
@ -27,7 +27,7 @@ public class LazyBaseEntity extends BaseEntity {
|
||||
if (Fawe.isMainThread()) {
|
||||
setNbtData(tmp.get());
|
||||
} else {
|
||||
setNbtData(TaskManager.IMP.sync(tmp));
|
||||
setNbtData(TaskManager.taskManager().sync(tmp));
|
||||
}
|
||||
}
|
||||
return super.getNbtData();
|
||||
|
@ -166,7 +166,7 @@ public class ConsumeBindings extends Bindings {
|
||||
if (argument.length() > 16) {
|
||||
uuid = UUID.fromString(argument);
|
||||
} else {
|
||||
uuid = Fawe.imp().getUUID(argument);
|
||||
uuid = Fawe.platform().getUUID(argument);
|
||||
}
|
||||
if (uuid == null) {
|
||||
throw new InputParseException(Caption.of("fawe.error.player.not.found", TextComponent.of(argument)));
|
||||
|
@ -75,7 +75,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
throws WorldEditException {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +86,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -97,7 +97,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -108,7 +108,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
if (!contains(x, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -119,7 +119,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
@ -130,7 +130,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
@ -142,7 +142,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
this.actor.print(Caption.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
}
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.LOW_MEMORY);
|
||||
WEManager.weManager().cancelEdit(this, FaweCache.LOW_MEMORY);
|
||||
}
|
||||
return super.getExtent();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
if (!limit.MAX_ENTITIES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_ENTITIES);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.MAX_ENTITIES);
|
||||
return null;
|
||||
}
|
||||
return super.createEntity(location, entity);
|
||||
@ -46,7 +46,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
} else {
|
||||
return extent.getBlock(x, y, z);
|
||||
@ -56,7 +56,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 pos) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
} else {
|
||||
return extent.getFullBlock(pos);
|
||||
@ -80,18 +80,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
|
||||
if (hasNbt) {
|
||||
if (!limit.MAX_BLOCKSTATES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_TILES);
|
||||
WEManager.weManager().cancelEdit(this, FaweCache.MAX_TILES);
|
||||
return false;
|
||||
} else {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
WEManager.weManager().cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return extent.setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
WEManager.weManager().cancelEdit(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
} else {
|
||||
return extent.setBlock(x, y, z, block);
|
||||
@ -101,7 +101,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHANGES);
|
||||
WEManager.weManager().cancelEditSafe(this, FaweCache.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return super.setBiome(position, biome);
|
||||
|
@ -72,8 +72,8 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
||||
this(
|
||||
region.getDimensions(),
|
||||
MainUtil.getFile(
|
||||
Fawe.get() != null ? Fawe.imp().getDirectory() : new File("."),
|
||||
Settings.IMP.PATHS.CLIPBOARD + File.separator + uuid + ".bd"
|
||||
Fawe.instance() != null ? Fawe.platform().getDirectory() : new File("."),
|
||||
Settings.settings().PATHS.CLIPBOARD + File.separator + uuid + ".bd"
|
||||
)
|
||||
);
|
||||
setOffset(region.getMinimumPoint());
|
||||
@ -84,8 +84,8 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
||||
this(
|
||||
dimensions,
|
||||
MainUtil.getFile(
|
||||
Fawe.imp() != null ? Fawe.imp().getDirectory() : new File("."),
|
||||
Settings.IMP.PATHS.CLIPBOARD + File.separator + UUID.randomUUID() + ".bd"
|
||||
Fawe.platform() != null ? Fawe.platform().getDirectory() : new File("."),
|
||||
Settings.settings().PATHS.CLIPBOARD + File.separator + UUID.randomUUID() + ".bd"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
private final int compressionLevel;
|
||||
|
||||
public MemoryOptimizedClipboard(Region region) {
|
||||
this(region, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL);
|
||||
this(region, Settings.settings().CLIPBOARD.COMPRESSION_LEVEL);
|
||||
}
|
||||
|
||||
public MemoryOptimizedClipboard(Region region, int compressionLevel) {
|
||||
|
@ -39,12 +39,12 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard {
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Extent extent, final Region region) {
|
||||
Fawe.get().getQueueHandler().unCache();
|
||||
Fawe.instance().getQueueHandler().unCache();
|
||||
return of(() -> extent, region);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Extent extent, final Region region, boolean copyEntities, boolean copyBiomes) {
|
||||
Fawe.get().getQueueHandler().unCache();
|
||||
Fawe.instance().getQueueHandler().unCache();
|
||||
return of(() -> extent, region, copyEntities, copyBiomes);
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
// tiles
|
||||
if (tiles != null && !tiles.isEmpty()) {
|
||||
for (Map<String, Object> tileRaw : tiles) {
|
||||
CompoundTag tile = FaweCache.IMP.asTag(tileRaw);
|
||||
CompoundTag tile = FaweCache.INSTANCE.asTag(tileRaw);
|
||||
|
||||
int[] pos = tile.getIntArray("Pos");
|
||||
int x;
|
||||
@ -372,7 +372,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
// entities
|
||||
if (entities != null && !entities.isEmpty()) {
|
||||
for (Map<String, Object> entRaw : entities) {
|
||||
Map<String, Tag> value = new HashMap<>(FaweCache.IMP.asTag(entRaw).getValue());
|
||||
Map<String, Tag> value = new HashMap<>(FaweCache.INSTANCE.asTag(entRaw).getValue());
|
||||
StringTag id = (StringTag) value.get("Id");
|
||||
if (id == null) {
|
||||
id = (StringTag) value.get("id");
|
||||
|
@ -123,7 +123,7 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
out1.writeNamedTag("WEOffsetX", offset.getBlockX());
|
||||
out1.writeNamedTag("WEOffsetY", offset.getBlockY());
|
||||
out1.writeNamedTag("WEOffsetZ", offset.getBlockZ());
|
||||
out1.writeNamedTag("FAWEVersion", Fawe.get().getVersion().build);
|
||||
out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build);
|
||||
});
|
||||
|
||||
ByteArrayOutputStream blocksCompressed = new ByteArrayOutputStream();
|
||||
|
@ -165,7 +165,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
if (width > WARN_SIZE || height > WARN_SIZE || length > WARN_SIZE) {
|
||||
LOGGER.info("A structure longer than 32 is unsupported by minecraft (but probably still works)");
|
||||
}
|
||||
Map<String, Object> structure = FaweCache.IMP.asMap("version", 1, "author", owner);
|
||||
Map<String, Object> structure = FaweCache.INSTANCE.asMap("version", 1, "author", owner);
|
||||
// ignored: version / owner
|
||||
Int2ObjectArrayMap<Integer> indexes = new Int2ObjectArrayMap<>();
|
||||
// Size
|
||||
@ -217,10 +217,10 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
point.getY() - min.getY(), point.getZ() - min.getZ()
|
||||
);
|
||||
if (!block.hasNbtData()) {
|
||||
blocks.add(FaweCache.IMP.asMap("state", index, "pos", pos));
|
||||
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
||||
} else {
|
||||
blocks.add(
|
||||
FaweCache.IMP.asMap("state", index, "pos", pos, "nbt", block.getNbtData()));
|
||||
FaweCache.INSTANCE.asMap("state", index, "pos", pos, "nbt", block.getNbtData()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,14 +240,14 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
// Replace rotation data
|
||||
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
||||
nbtMap.put("id", new StringTag(state.getType().getId()));
|
||||
Map<String, Object> entityMap = FaweCache.IMP.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
entities.add(entityMap);
|
||||
}
|
||||
}
|
||||
if (!entities.isEmpty()) {
|
||||
structure.put("entities", entities);
|
||||
}
|
||||
out.writeNamedTag("", FaweCache.IMP.asTag(structure));
|
||||
out.writeNamedTag("", FaweCache.INSTANCE.asTag(structure));
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class PNGWriter implements ClipboardWriter {
|
||||
|
||||
public PNGWriter(OutputStream out) throws IOException {
|
||||
this.out = ImageIO.createImageOutputStream(out);
|
||||
this.tu = Fawe.get().getCachedTextureUtil(false, 0, 100);
|
||||
this.tu = Fawe.instance().getCachedTextureUtil(false, 0, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +203,7 @@
|
||||
// */
|
||||
// private void clean() {
|
||||
// if (chunks.size() > 225) {
|
||||
// TaskManager.IMP.sync(() -> {
|
||||
// TaskManager.taskManager().sync(() -> {
|
||||
// if (chunks.size() > 225) {
|
||||
// synchronized (SchemVis.this) {
|
||||
// Location pos = player.toWorldEditPlayer().getLocation();
|
||||
@ -233,7 +233,7 @@
|
||||
// * @param chunkZ
|
||||
// */
|
||||
// private void send(IQueueExtent packetQueue, int chunkX, int chunkZ) {
|
||||
// TaskManager.IMP.getPublicForkJoinPool().submit(() -> {
|
||||
// TaskManager.taskManager().getPublicForkJoinPool().submit(() -> {
|
||||
// try {
|
||||
// int OX = chunkOffset.getBlockX();
|
||||
// int OZ = chunkOffset.getBlockZ();
|
||||
|
@ -71,7 +71,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
maxLayer = this.get.getMaxSectionPosition();
|
||||
this.layer = layer;
|
||||
if (!iget.hasSection(layer)) {
|
||||
getArr = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
getArr = FaweCache.INSTANCE.EMPTY_CHAR_4096;
|
||||
} else {
|
||||
getArr = iget.load(layer);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder im
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(AbstractChangeSet changeSet) {
|
||||
if (Settings.IMP.HISTORY.SEND_BEFORE_HISTORY) {
|
||||
if (Settings.settings().HISTORY.SEND_BEFORE_HISTORY) {
|
||||
return this.addPostProcessor(changeSet);
|
||||
} else {
|
||||
return this.addProcessor(changeSet);
|
||||
|
@ -34,7 +34,7 @@ public class MultiBatchProcessor implements IBatchProcessor {
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final LoadingCache<Class<?>, Map<Long, Filter>> classToThreadIdToFilter =
|
||||
FaweCache.IMP.createCache((Supplier<Map<Long, Filter>>) ConcurrentHashMap::new);
|
||||
FaweCache.INSTANCE.createCache((Supplier<Map<Long, Filter>>) ConcurrentHashMap::new);
|
||||
// Array for lazy avoidance of concurrent modification exceptions and needless overcomplication of code (synchronisation is
|
||||
// not very important)
|
||||
private boolean[] faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length];
|
||||
@ -157,7 +157,7 @@ public class MultiBatchProcessor implements IBatchProcessor {
|
||||
lastException = hash;
|
||||
exceptionCount = 0;
|
||||
LOGGER.catching(e);
|
||||
} else if (exceptionCount < Settings.IMP.QUEUE.PARALLEL_THREADS) {
|
||||
} else if (exceptionCount < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||
exceptionCount++;
|
||||
LOGGER.warn(message);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class HeightmapProcessor implements IBatchProcessor {
|
||||
continue;
|
||||
}
|
||||
char[] setSection = hasSectionSet ? set.loadIfPresent(layer) : null;
|
||||
if (setSection == null || Arrays.equals(setSection, FaweCache.IMP.EMPTY_CHAR_4096) ||
|
||||
if (setSection == null || Arrays.equals(setSection, FaweCache.INSTANCE.EMPTY_CHAR_4096) ||
|
||||
Arrays.equals(setSection, AIR_LAYER)) {
|
||||
hasSectionSet = false;
|
||||
}
|
||||
@ -86,7 +86,7 @@ public class HeightmapProcessor implements IBatchProcessor {
|
||||
} else if (getSection == null) {
|
||||
getSection = get.load(layer);
|
||||
// skip empty layer
|
||||
if (Arrays.equals(getSection, FaweCache.IMP.EMPTY_CHAR_4096)
|
||||
if (Arrays.equals(getSection, FaweCache.INSTANCE.EMPTY_CHAR_4096)
|
||||
|| Arrays.equals(getSection, AIR_LAYER)) {
|
||||
hasSectionGet = false;
|
||||
if (!hasSectionSet) {
|
||||
|
@ -77,7 +77,7 @@ public class NMSRelighter implements Relighter {
|
||||
this.concurrentLightQueue = new ConcurrentHashMap<>(12);
|
||||
this.maxY = queue.getMaxY();
|
||||
this.minY = queue.getMinY();
|
||||
this.relightMode = relightMode != null ? relightMode : RelightMode.valueOf(Settings.IMP.LIGHTING.MODE);
|
||||
this.relightMode = relightMode != null ? relightMode : RelightMode.valueOf(Settings.settings().LIGHTING.MODE);
|
||||
this.lightingLock = new ReentrantLock();
|
||||
}
|
||||
|
||||
@ -911,11 +911,11 @@ public class NMSRelighter implements Relighter {
|
||||
chunk.setBitMask(bitMask);
|
||||
iter.remove();
|
||||
}
|
||||
if (Settings.IMP.LIGHTING.ASYNC) {
|
||||
if (Settings.settings().LIGHTING.ASYNC) {
|
||||
queue.flush();
|
||||
finished.set(true);
|
||||
} else {
|
||||
TaskManager.IMP.sync(new RunnableVal<>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
queue.flush();
|
||||
@ -943,16 +943,16 @@ public class NMSRelighter implements Relighter {
|
||||
ChunkHolder<?> chunk = (ChunkHolder<?>) queue.getOrCreateChunk(x, z);
|
||||
chunk.setBitMask(bitMask);
|
||||
chunk.flushLightToGet();
|
||||
Fawe.imp().getPlatformAdapter().sendChunk(chunk.getOrCreateGet(), bitMask, true);
|
||||
Fawe.platform().getPlatformAdapter().sendChunk(chunk.getOrCreateGet(), bitMask, true);
|
||||
iter.remove();
|
||||
}
|
||||
finished.set(true);
|
||||
}
|
||||
};
|
||||
if (Settings.IMP.LIGHTING.ASYNC) {
|
||||
if (Settings.settings().LIGHTING.ASYNC) {
|
||||
runnable.run();
|
||||
} else {
|
||||
TaskManager.IMP.sync(runnable);
|
||||
TaskManager.taskManager().sync(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ public class RelightProcessor implements IBatchProcessor {
|
||||
|
||||
@Override
|
||||
public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
|
||||
if (Settings.IMP.LIGHTING.MODE == 2) {
|
||||
if (Settings.settings().LIGHTING.MODE == 2) {
|
||||
relighter.addChunk(chunk.getX(), chunk.getZ(), null, chunk.getBitMask());
|
||||
} else if (Settings.IMP.LIGHTING.MODE == 1) {
|
||||
} else if (Settings.settings().LIGHTING.MODE == 1) {
|
||||
byte[] fix = new byte[get.getSectionCount()];
|
||||
boolean relight = false;
|
||||
for (int i = get.getMaxSectionPosition(); i >= get.getMinSectionPosition(); i--) {
|
||||
|
@ -32,7 +32,7 @@ public class BufferedPattern extends AbstractPattern implements ResettablePatter
|
||||
}
|
||||
actionTime = tmp;
|
||||
this.pattern = parent;
|
||||
this.timer = Fawe.get().getTimer();
|
||||
this.timer = Fawe.instance().getTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,8 +75,8 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
|
||||
private void init(UUID uuid, String worldName) {
|
||||
final File folder = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + worldName + File.separator + uuid
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + worldName + File.separator + uuid
|
||||
);
|
||||
|
||||
final int max = NEXT_INDEX.computeIfAbsent(worldName, _worldName -> new ConcurrentHashMap<>())
|
||||
@ -111,8 +111,8 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
this.uuid = uuid;
|
||||
this.index = i;
|
||||
File folder = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + getWorld().getName() + File.separator + uuid
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + getWorld().getName() + File.separator + uuid
|
||||
);
|
||||
initFiles(folder);
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
@Override
|
||||
public void delete() {
|
||||
deleteFiles();
|
||||
if (Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (Settings.settings().HISTORY.USE_DATABASE) {
|
||||
RollbackDatabase db = DBHandler.IMP.getDatabase(getWorld());
|
||||
db.delete(uuid, index);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
}
|
||||
synchronized (this) {
|
||||
setOrigin(x, z);
|
||||
idsStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
idsStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
idsStreamZip = getCompressedOS(idsStream);
|
||||
writeHeader(idsStreamZip, x, y, z);
|
||||
return idsStreamZip;
|
||||
@ -170,7 +170,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
return biomeStreamZip;
|
||||
}
|
||||
synchronized (this) {
|
||||
biomeStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
biomeStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
biomeStreamZip = getCompressedOS(biomeStream);
|
||||
return biomeStreamZip;
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
if (entCStreamZip != null) {
|
||||
return entCStreamZip;
|
||||
}
|
||||
entCStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
entCStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
return entCStreamZip = new NBTOutputStream(getCompressedOS(entCStream));
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
if (entRStreamZip != null) {
|
||||
return entRStreamZip;
|
||||
}
|
||||
entRStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
entRStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
return entRStreamZip = new NBTOutputStream(getCompressedOS(entRStream));
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
if (tileCStreamZip != null) {
|
||||
return tileCStreamZip;
|
||||
}
|
||||
tileCStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
tileCStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
return tileCStreamZip = new NBTOutputStream(getCompressedOS(tileCStream));
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
if (tileRStreamZip != null) {
|
||||
return tileRStreamZip;
|
||||
}
|
||||
tileRStream = new FastByteArrayOutputStream(Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
tileRStream = new FastByteArrayOutputStream(Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
return tileRStreamZip = new NBTOutputStream(getCompressedOS(tileRStream));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
return;
|
||||
}
|
||||
waitingAsync.incrementAndGet();
|
||||
TaskManager.IMP.async(() -> {
|
||||
TaskManager.taskManager().async(() -> {
|
||||
waitingAsync.decrementAndGet();
|
||||
synchronized (waitingAsync) {
|
||||
waitingAsync.notifyAll();
|
||||
@ -168,7 +168,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
char[] blocksGet;
|
||||
char[] tmp = get.load(layer);
|
||||
if (tmp == null) {
|
||||
blocksGet = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
blocksGet = FaweCache.INSTANCE.EMPTY_CHAR_4096;
|
||||
} else {
|
||||
System.arraycopy(tmp, 0, (blocksGet = new char[4096]), 0, 4096);
|
||||
}
|
||||
@ -379,7 +379,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
wrappedTask.run();
|
||||
return Futures.immediateCancelledFuture();
|
||||
} else {
|
||||
return Fawe.get().getQueueHandler().submit(wrappedTask);
|
||||
return Fawe.instance().getQueueHandler().submit(wrappedTask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
|
||||
protected FaweStreamPositionDelegate posDel;
|
||||
|
||||
public FaweStreamChangeSet(World world) {
|
||||
this(world, Settings.IMP.HISTORY.COMPRESSION_LEVEL, Settings.IMP.HISTORY.STORE_REDO, Settings.IMP.HISTORY.SMALL_EDITS);
|
||||
this(world, Settings.settings().HISTORY.COMPRESSION_LEVEL, Settings.settings().HISTORY.STORE_REDO, Settings.settings().HISTORY.SMALL_EDITS);
|
||||
}
|
||||
|
||||
public FaweStreamChangeSet(World world, int compression, boolean storeRedo, boolean smallLoc) {
|
||||
@ -764,7 +764,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
|
||||
}
|
||||
try (FaweInputStream fis = getBlockIS()) {
|
||||
if (!shallow) {
|
||||
int amount = (Settings.IMP.HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
||||
int amount = (Settings.settings().HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
||||
MutableFullBlockChange change = new MutableFullBlockChange(null, 0, false);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = posDel.readX(fis) + ox;
|
||||
|
@ -14,7 +14,7 @@ public class MutableBlockVector3 extends BlockVector3 {
|
||||
}
|
||||
|
||||
public static MutableBlockVector3 get(int x, int y, int z) {
|
||||
return FaweCache.IMP.MUTABLE_BLOCKVECTOR3.get().setComponents(x, y, z);
|
||||
return FaweCache.INSTANCE.MUTABLE_BLOCKVECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public MutableBlockVector3() {
|
||||
|
@ -27,11 +27,11 @@ public class MutableVector3 extends Vector3 {
|
||||
}
|
||||
|
||||
public static MutableVector3 get(int x, int y, int z) {
|
||||
return FaweCache.IMP.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
return FaweCache.INSTANCE.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public static MutableVector3 get(double x, double y, double z) {
|
||||
return FaweCache.IMP.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
return FaweCache.INSTANCE.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,9 +129,9 @@ public interface IBlocks extends Trimable {
|
||||
sectionWriter.writeShort(nonEmpty); // non empty
|
||||
FaweCache.Palette palette;
|
||||
if (stretched) {
|
||||
palette = FaweCache.IMP.toPalette(0, ids);
|
||||
palette = FaweCache.INSTANCE.toPalette(0, ids);
|
||||
} else {
|
||||
palette = FaweCache.IMP.toPaletteUnstretched(0, ids);
|
||||
palette = FaweCache.INSTANCE.toPaletteUnstretched(0, ids);
|
||||
}
|
||||
|
||||
sectionWriter.writeByte(palette.bitsPerEntry); // bits per block
|
||||
|
@ -45,7 +45,7 @@ public class Flood {
|
||||
}
|
||||
|
||||
public synchronized void run(World world) {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
QueueHandler queueHandler = Fawe.instance().getQueueHandler();
|
||||
IQueueExtent<IQueueChunk> fq = queueHandler.getQueue(world);
|
||||
while (!chunkQueues.isEmpty()) {
|
||||
long firstKey = chunkQueues.firstLongKey();
|
||||
|
@ -99,7 +99,7 @@ public class ParallelQueueExtent extends PassthroughExtent {
|
||||
final Iterator<BlockVector2> chunksIter = chunks.iterator();
|
||||
|
||||
// Get a pool, to operate on the chunks in parallel
|
||||
final int size = Math.min(chunks.size(), Settings.IMP.QUEUE.PARALLEL_THREADS);
|
||||
final int size = Math.min(chunks.size(), Settings.settings().QUEUE.PARALLEL_THREADS);
|
||||
if (size <= 1 && chunksIter.hasNext()) {
|
||||
BlockVector2 pos = chunksIter.next();
|
||||
getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full);
|
||||
@ -147,7 +147,7 @@ public class ParallelQueueExtent extends PassthroughExtent {
|
||||
lastException = hash;
|
||||
exceptionCount = 0;
|
||||
LOGGER.catching(e);
|
||||
} else if (exceptionCount < Settings.IMP.QUEUE.PARALLEL_THREADS) {
|
||||
} else if (exceptionCount < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||
exceptionCount++;
|
||||
LOGGER.warn(message);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
|
||||
private final ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool();
|
||||
private final ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool();
|
||||
private final ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor();
|
||||
private final ThreadPoolExecutor blockingExecutor = FaweCache.INSTANCE.newBlockingExecutor();
|
||||
private final ConcurrentLinkedQueue<FutureTask> syncTasks = new ConcurrentLinkedQueue<>();
|
||||
private final ConcurrentLinkedQueue<FutureTask> syncWhenFree = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@ -56,7 +56,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
private double targetTPS = 18;
|
||||
|
||||
public QueueHandler() {
|
||||
TaskManager.IMP.repeat(this, 1);
|
||||
TaskManager.taskManager().repeat(this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,14 +87,14 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
|
||||
private long getAllocate() {
|
||||
long now = System.currentTimeMillis();
|
||||
targetTPS = 18 - Math.max(Settings.IMP.QUEUE.EXTRA_TIME_MS * 0.05, 0);
|
||||
targetTPS = 18 - Math.max(Settings.settings().QUEUE.EXTRA_TIME_MS * 0.05, 0);
|
||||
long diff = 50 + this.last - (this.last = now);
|
||||
long absDiff = Math.abs(diff);
|
||||
if (diff == 0) {
|
||||
allocate = Math.min(50, allocate + 1);
|
||||
} else if (diff < 0) {
|
||||
allocate = Math.max(5, allocate + diff);
|
||||
} else if (!Fawe.get().getTimer().isAbove(targetTPS)) {
|
||||
} else if (!Fawe.instance().getTimer().isAbove(targetTPS)) {
|
||||
allocate = Math.max(5, allocate - 1);
|
||||
}
|
||||
return allocate - absDiff;
|
||||
|
@ -250,7 +250,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
}
|
||||
}
|
||||
|
||||
return (V) Fawe.get().getQueueHandler().submit(chunk);
|
||||
return (V) Fawe.instance().getQueueHandler().submit(chunk);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -266,7 +266,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
if (aggressive) {
|
||||
pollSubmissions(0, aggressive);
|
||||
} else {
|
||||
pollSubmissions(Settings.IMP.QUEUE.PARALLEL_THREADS, aggressive);
|
||||
pollSubmissions(Settings.settings().QUEUE.PARALLEL_THREADS, aggressive);
|
||||
}
|
||||
}
|
||||
synchronized (this) {
|
||||
@ -312,8 +312,8 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
// If queueing is enabled AND either of the following
|
||||
// - memory is low & queue size > num threads + 8
|
||||
// - queue size > target size and primary queue has less than num threads submissions
|
||||
if (enabledQueue && ((lowMem && size > Settings.IMP.QUEUE.PARALLEL_THREADS + 8) || (size > Settings.IMP.QUEUE.TARGET_SIZE && Fawe
|
||||
.get()
|
||||
if (enabledQueue && ((lowMem && size > Settings.settings().QUEUE.PARALLEL_THREADS + 8) || (size > Settings.settings().QUEUE.TARGET_SIZE && Fawe
|
||||
.instance()
|
||||
.getQueueHandler()
|
||||
.isUnderutilized()))) {
|
||||
chunk = chunks.removeFirst();
|
||||
@ -321,9 +321,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
if (future != null && !future.isDone()) {
|
||||
final int targetSize;
|
||||
if (lowMem) {
|
||||
targetSize = Settings.IMP.QUEUE.PARALLEL_THREADS + 8;
|
||||
targetSize = Settings.settings().QUEUE.PARALLEL_THREADS + 8;
|
||||
} else {
|
||||
targetSize = Settings.IMP.QUEUE.TARGET_SIZE;
|
||||
targetSize = Settings.settings().QUEUE.TARGET_SIZE;
|
||||
}
|
||||
pollSubmissions(targetSize, lowMem);
|
||||
submissions.add(future);
|
||||
@ -361,10 +361,10 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
* @param region region of chunks
|
||||
*/
|
||||
public void preload(Region region) {
|
||||
if (Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
if (Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
int loadCount = 0;
|
||||
for (BlockVector2 from : region.getChunks()) {
|
||||
if (loadCount >= Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT) {
|
||||
if (loadCount >= Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT) {
|
||||
break;
|
||||
}
|
||||
loadCount++;
|
||||
@ -409,7 +409,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
lastException = hash;
|
||||
exceptionCount = 0;
|
||||
LOGGER.catching(e);
|
||||
} else if (exceptionCount < Settings.IMP.QUEUE.PARALLEL_THREADS) {
|
||||
} else if (exceptionCount < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||
exceptionCount++;
|
||||
LOGGER.warn(message);
|
||||
}
|
||||
@ -449,7 +449,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
lastException = hash;
|
||||
exceptionCount = 0;
|
||||
LOGGER.catching(e);
|
||||
} else if (exceptionCount < Settings.IMP.QUEUE.PARALLEL_THREADS) {
|
||||
} else if (exceptionCount < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||
exceptionCount++;
|
||||
LOGGER.warn(message);
|
||||
}
|
||||
@ -464,7 +464,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
for (IQueueChunk chunk : chunks.values()) {
|
||||
final Future future = submitUnchecked(chunk);
|
||||
if (future != null && !future.isDone()) {
|
||||
pollSubmissions(Settings.IMP.QUEUE.PARALLEL_THREADS, true);
|
||||
pollSubmissions(Settings.settings().QUEUE.PARALLEL_THREADS, true);
|
||||
submissions.add(future);
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class BitSetBlocks implements IChunkSet {
|
||||
@Override
|
||||
public char[] load(int layer) {
|
||||
layer -= minSectionPosition;
|
||||
char[] arr = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
|
||||
char[] arr = FaweCache.INSTANCE.SECTION_BITS_TO_CHAR.get();
|
||||
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
||||
if (nullRowY instanceof MemBlockSet.RowY) {
|
||||
char value = blockState.getOrdinalChar();
|
||||
|
@ -201,7 +201,7 @@ public abstract class CharBlocks implements IBlocks {
|
||||
set(layer, index, value);
|
||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||
LOGGER.error("Tried setting block at coordinates (" + x + "," + y + "," + z + ")");
|
||||
assert Fawe.imp() != null;
|
||||
assert Fawe.platform() != null;
|
||||
LOGGER.error("Layer variable was = {}", layer, exception);
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ import java.util.stream.IntStream;
|
||||
|
||||
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||
|
||||
private static final Pool<CharSetBlocks> POOL = FaweCache.IMP.registerPool(
|
||||
private static final Pool<CharSetBlocks> POOL = FaweCache.INSTANCE.registerPool(
|
||||
CharSetBlocks.class,
|
||||
CharSetBlocks::new,
|
||||
Settings.IMP.QUEUE.POOL
|
||||
Settings.settings().QUEUE.POOL
|
||||
);
|
||||
|
||||
public static CharSetBlocks newInstance() {
|
||||
|
@ -124,7 +124,7 @@ public final class NullChunkGet implements IChunkGet {
|
||||
|
||||
@Nonnull
|
||||
public char[] load(int layer) {
|
||||
return FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
return FaweCache.INSTANCE.EMPTY_CHAR_4096;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -32,10 +32,10 @@ import java.util.concurrent.Future;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||
|
||||
private static final Pool<ChunkHolder> POOL = FaweCache.IMP.registerPool(
|
||||
private static final Pool<ChunkHolder> POOL = FaweCache.INSTANCE.registerPool(
|
||||
ChunkHolder.class,
|
||||
ChunkHolder::new,
|
||||
Settings.IMP.QUEUE.POOL
|
||||
Settings.settings().QUEUE.POOL
|
||||
);
|
||||
|
||||
public static ChunkHolder newInstance() {
|
||||
|
@ -64,8 +64,8 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
||||
synchronized (this) {
|
||||
if (sectionBytes == null) {
|
||||
IBlocks tmpChunk = getChunk();
|
||||
byte[] buf = FaweCache.IMP.BYTE_BUFFER_8192.get();
|
||||
sectionBytes = tmpChunk.toByteArray(buf, tmpChunk.getBitMask(), this.full, Fawe.imp().isChunksStretched());
|
||||
byte[] buf = FaweCache.INSTANCE.BYTE_BUFFER_8192.get();
|
||||
sectionBytes = tmpChunk.toByteArray(buf, tmpChunk.getBitMask(), this.full, Fawe.platform().isChunksStretched());
|
||||
}
|
||||
tmp = sectionBytes;
|
||||
}
|
||||
@ -85,14 +85,14 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
||||
@Override
|
||||
@Deprecated
|
||||
public byte[] get() {
|
||||
return apply(FaweCache.IMP.BYTE_BUFFER_8192.get());
|
||||
return apply(FaweCache.INSTANCE.BYTE_BUFFER_8192.get());
|
||||
}
|
||||
|
||||
public CompoundTag getHeightMap() {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("MOTION_BLOCKING", new long[36]);
|
||||
// TODO
|
||||
return FaweCache.IMP.asTag(map);
|
||||
return FaweCache.INSTANCE.asTag(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public class AsyncPreloader implements Preloader, Runnable {
|
||||
|
||||
public AsyncPreloader() {
|
||||
this.update = new ConcurrentHashMap<>();
|
||||
TaskManager.IMP.laterAsync(this, 1);
|
||||
TaskManager.taskManager().laterAsync(this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,7 +77,7 @@ public class AsyncPreloader implements Preloader, Runnable {
|
||||
existing.setKey(world);
|
||||
existing.setValue(ImmutableSet.copyOf(Iterables.limit(
|
||||
region.getChunks(),
|
||||
Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT
|
||||
Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT
|
||||
)));
|
||||
}
|
||||
synchronized (update) {
|
||||
@ -89,12 +89,12 @@ public class AsyncPreloader implements Preloader, Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FaweTimer timer = Fawe.get().getTimer();
|
||||
FaweTimer timer = Fawe.instance().getTimer();
|
||||
if (cancelled.get()) {
|
||||
return;
|
||||
}
|
||||
if (update.isEmpty()) {
|
||||
TaskManager.IMP.laterAsync(this, 1);
|
||||
TaskManager.taskManager().laterAsync(this, 1);
|
||||
return;
|
||||
}
|
||||
Iterator<Map.Entry<UUID, MutablePair<World, Set<BlockVector2>>>> plrIter = update.entrySet().iterator();
|
||||
@ -118,7 +118,7 @@ public class AsyncPreloader implements Preloader, Runnable {
|
||||
if (cancelled.get()) {
|
||||
return;
|
||||
}
|
||||
TaskManager.IMP.laterAsync(this, 20);
|
||||
TaskManager.taskManager().laterAsync(this, 20);
|
||||
}
|
||||
|
||||
private void queueLoad(World world, BlockVector2 chunk) {
|
||||
|
@ -29,7 +29,7 @@ public abstract class FaweMaskManager {
|
||||
public abstract FaweMask getMask(final Player player, MaskType type, boolean isWhitelist);
|
||||
|
||||
public boolean isExclusive() {
|
||||
return Settings.IMP.REGION_RESTRICTIONS_OPTIONS.EXCLUSIVE_MANAGERS.contains(this.key);
|
||||
return Settings.settings().REGION_RESTRICTIONS_OPTIONS.EXCLUSIVE_MANAGERS.contains(this.key);
|
||||
}
|
||||
|
||||
public enum MaskType {
|
||||
@ -39,7 +39,7 @@ public abstract class FaweMaskManager {
|
||||
public static MaskType getDefaultMaskType() {
|
||||
try {
|
||||
return MaskType
|
||||
.valueOf(Settings.IMP.REGION_RESTRICTIONS_OPTIONS.MODE.toUpperCase(Locale.ROOT));
|
||||
.valueOf(Settings.settings().REGION_RESTRICTIONS_OPTIONS.MODE.toUpperCase(Locale.ROOT));
|
||||
} catch (Exception ignored) {
|
||||
return MEMBER;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class MainUtil {
|
||||
|
||||
public static long getTotalSize(Path path) {
|
||||
final AtomicLong size = new AtomicLong(0);
|
||||
traverse(path, new RunnableVal2<Path, BasicFileAttributes>() {
|
||||
traverse(path, new RunnableVal2<>() {
|
||||
@Override
|
||||
public void run(Path path, BasicFileAttributes attrs) {
|
||||
size.addAndGet(attrs.size());
|
||||
@ -126,7 +126,7 @@ public class MainUtil {
|
||||
|
||||
public static void traverse(Path path, final BiConsumer<Path, BasicFileAttributes> onEach) {
|
||||
try {
|
||||
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
|
||||
Files.walkFileTree(path, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult
|
||||
visitFile(Path file, BasicFileAttributes attrs) {
|
||||
@ -231,20 +231,19 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static long getSize(ChangeSet changeSet) {
|
||||
if (changeSet instanceof FaweStreamChangeSet) {
|
||||
FaweStreamChangeSet fscs = (FaweStreamChangeSet) changeSet;
|
||||
if (changeSet instanceof FaweStreamChangeSet fscs) {
|
||||
return fscs.getSizeOnDisk() + fscs.getSizeInMemory();
|
||||
// } else if (changeSet instanceof CPUOptimizedChangeSet) {
|
||||
// return changeSet.size() + 32;
|
||||
} else if (changeSet != null) {
|
||||
return changeSet.size() * 128;
|
||||
return changeSet.size() * 128L;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static FaweOutputStream getCompressedOS(OutputStream os, int amount) throws IOException {
|
||||
return getCompressedOS(os, amount, Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
return getCompressedOS(os, amount, Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
}
|
||||
|
||||
private static final LZ4Factory FACTORY = LZ4Factory.fastestInstance();
|
||||
@ -350,7 +349,7 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static FaweInputStream getCompressedIS(InputStream is) throws IOException {
|
||||
return getCompressedIS(is, Settings.IMP.HISTORY.BUFFER_SIZE);
|
||||
return getCompressedIS(is, Settings.settings().HISTORY.BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public static FaweInputStream getCompressedIS(InputStream is, int buffer) throws IOException {
|
||||
@ -381,7 +380,7 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static URL upload(UUID uuid, String file, String extension, @Nonnull final RunnableVal<OutputStream> writeTask) {
|
||||
return upload(Settings.IMP.WEB.URL, uuid != null, uuid != null ? uuid.toString() : null, file, extension, writeTask);
|
||||
return upload(Settings.settings().WEB.URL, uuid != null, uuid != null ? uuid.toString() : null, file, extension, writeTask);
|
||||
}
|
||||
|
||||
public static URL upload(
|
||||
@ -413,16 +412,15 @@ public class MainUtil {
|
||||
StandardCharsets.UTF_8
|
||||
), true)) {
|
||||
String crlf = "\r\n";
|
||||
writer.append("--" + boundary).append(crlf);
|
||||
writer.append("--").append(boundary).append(crlf);
|
||||
writer.append("Content-Disposition: form-data; name=\"param\"").append(crlf);
|
||||
writer.append("Content-Type: text/plain; charset=" + StandardCharsets.UTF_8.displayName()).append(crlf);
|
||||
writer.append("Content-Type: text/plain; charset=").append(StandardCharsets.UTF_8.displayName()).append(crlf);
|
||||
String param = "value";
|
||||
writer.append(crlf).append(param).append(crlf).flush();
|
||||
writer.append("--" + boundary).append(crlf);
|
||||
writer
|
||||
.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"" + filename + '"')
|
||||
writer.append("--").append(boundary).append(crlf);
|
||||
writer.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"").append(filename).append(String.valueOf('"'))
|
||||
.append(crlf);
|
||||
writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename)).append(crlf);
|
||||
writer.append("Content-Type: ").append(URLConnection.guessContentTypeFromName(filename)).append(crlf);
|
||||
writer.append("Content-Transfer-Encoding: binary").append(crlf);
|
||||
writer.append(crlf).flush();
|
||||
OutputStream nonClosable = new AbstractDelegateOutputStream(new BufferedOutputStream(output)) {
|
||||
@ -434,7 +432,7 @@ public class MainUtil {
|
||||
writeTask.run();
|
||||
nonClosable.flush();
|
||||
writer.append(crlf).flush();
|
||||
writer.append("--" + boundary + "--").append(crlf).flush();
|
||||
writer.append("--").append(boundary).append("--").append(crlf).flush();
|
||||
}
|
||||
int responseCode = ((HttpURLConnection) con).getResponseCode();
|
||||
String content;
|
||||
@ -524,7 +522,7 @@ public class MainUtil {
|
||||
try {
|
||||
return getJarFile(Fawe.class);
|
||||
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
|
||||
return new File(Fawe.imp().getDirectory().getParentFile(), "FastAsyncWorldEdit.jar");
|
||||
return new File(Fawe.platform().getDirectory().getParentFile(), "FastAsyncWorldEdit.jar");
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,7 +596,7 @@ public class MainUtil {
|
||||
public static File copyFile(File jar, String resource, File output, String fileName) {
|
||||
try {
|
||||
if (output == null) {
|
||||
output = Fawe.imp().getDirectory();
|
||||
output = Fawe.platform().getDirectory();
|
||||
}
|
||||
if (!output.exists()) {
|
||||
output.mkdirs();
|
||||
@ -663,21 +661,19 @@ public class MainUtil {
|
||||
continue;
|
||||
}
|
||||
switch (c) {
|
||||
case '-':
|
||||
val = -val;
|
||||
break;
|
||||
case '.':
|
||||
case '-' -> val = -val;
|
||||
case '.' -> {
|
||||
res[index--] = val;
|
||||
if (index == -1) {
|
||||
return res;
|
||||
}
|
||||
val = 0;
|
||||
numIndex = 1;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
val = val + (c - 48) * numIndex;
|
||||
numIndex *= 10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
res[index] = val;
|
||||
@ -802,30 +798,30 @@ public class MainUtil {
|
||||
int years = (int) (time / 33868800);
|
||||
int time1 = years * 33868800;
|
||||
time -= time1;
|
||||
toreturn.append(years + "y ");
|
||||
toreturn.append(years).append("y ");
|
||||
}
|
||||
if (time >= 604800) {
|
||||
int weeks = (int) (time / 604800);
|
||||
time -= weeks * 604800;
|
||||
toreturn.append(weeks + "w ");
|
||||
time -= weeks * 604800L;
|
||||
toreturn.append(weeks).append("w ");
|
||||
}
|
||||
if (time >= 86400) {
|
||||
int days = (int) (time / 86400);
|
||||
time -= days * 86400;
|
||||
toreturn.append(days + "d ");
|
||||
time -= days * 86400L;
|
||||
toreturn.append(days).append("d ");
|
||||
}
|
||||
if (time >= 3600) {
|
||||
int hours = (int) (time / 3600);
|
||||
time -= hours * 3600;
|
||||
toreturn.append(hours + "h ");
|
||||
time -= hours * 3600L;
|
||||
toreturn.append(hours).append("h ");
|
||||
}
|
||||
if (time >= 60) {
|
||||
int minutes = (int) (time / 60);
|
||||
time -= minutes * 60;
|
||||
toreturn.append(minutes + "m ");
|
||||
time -= minutes * 60L;
|
||||
toreturn.append(minutes).append("m ");
|
||||
}
|
||||
if (toreturn.equals("") || time > 0) {
|
||||
toreturn.append((time) + "s ");
|
||||
toreturn.append(time).append("s ");
|
||||
}
|
||||
return toreturn.toString().trim();
|
||||
}
|
||||
@ -849,23 +845,23 @@ public class MainUtil {
|
||||
case "wks":
|
||||
case "w":
|
||||
|
||||
time += 604800 * nums;
|
||||
time += 604800L * nums;
|
||||
case "days":
|
||||
case "day":
|
||||
case "d":
|
||||
time += 86400 * nums;
|
||||
time += 86400L * nums;
|
||||
case "hour":
|
||||
case "hr":
|
||||
case "hrs":
|
||||
case "hours":
|
||||
case "h":
|
||||
time += 3600 * nums;
|
||||
time += 3600L * nums;
|
||||
case "minutes":
|
||||
case "minute":
|
||||
case "mins":
|
||||
case "min":
|
||||
case "m":
|
||||
time += 60 * nums;
|
||||
time += 60L * nums;
|
||||
case "seconds":
|
||||
case "second":
|
||||
case "secs":
|
||||
|
@ -44,7 +44,7 @@ public class MemUtil {
|
||||
}
|
||||
final long heapFreeSize = Runtime.getRuntime().freeMemory();
|
||||
final int size = (int) ((heapFreeSize * 100) / heapMaxSize);
|
||||
if (size > (100 - Settings.IMP.MAX_MEMORY_PERCENT)) {
|
||||
if (size > (100 - Settings.settings().MAX_MEMORY_PERCENT)) {
|
||||
memoryPlentifulTask();
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
@ -21,10 +21,31 @@ public abstract class TaskManager {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #taskManager()} to get an instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
public static TaskManager IMP;
|
||||
|
||||
static TaskManager INSTANCE;
|
||||
private final ForkJoinPool pool = new ForkJoinPool();
|
||||
|
||||
protected TaskManager() {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of the TaskManager.
|
||||
*
|
||||
* @return an instance of the TaskManager
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public static TaskManager taskManager() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Fawe.platform().getTaskManager();
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a repeating task on the main thread.
|
||||
*
|
||||
@ -68,8 +89,8 @@ public abstract class TaskManager {
|
||||
/**
|
||||
* Run a bunch of tasks in parallel using the shared thread pool.
|
||||
*/
|
||||
public void parallel(Collection<Runnable> runnables) {
|
||||
for (Runnable run : runnables) {
|
||||
public void parallel(Collection<Runnable> runables) {
|
||||
for (Runnable run : runables) {
|
||||
pool.submit(run);
|
||||
}
|
||||
pool.awaitQuiescence(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
|
||||
@ -87,7 +108,7 @@ public abstract class TaskManager {
|
||||
return;
|
||||
}
|
||||
if (numThreads == null) {
|
||||
numThreads = Settings.IMP.QUEUE.PARALLEL_THREADS;
|
||||
numThreads = Settings.settings().QUEUE.PARALLEL_THREADS;
|
||||
}
|
||||
if (numThreads <= 1) {
|
||||
for (Runnable run : runnables) {
|
||||
@ -135,7 +156,7 @@ public abstract class TaskManager {
|
||||
* Disable async catching for a specific task.
|
||||
*/
|
||||
public void runUnsafe(Runnable run) {
|
||||
QueueHandler queue = Fawe.get().getQueueHandler();
|
||||
QueueHandler queue = Fawe.instance().getQueueHandler();
|
||||
queue.startSet(true);
|
||||
try {
|
||||
run.run();
|
||||
@ -256,7 +277,7 @@ public abstract class TaskManager {
|
||||
synchronized (running) {
|
||||
while (running.get()) {
|
||||
running.wait(timeout);
|
||||
if (running.get() && System.currentTimeMillis() - start > Settings.IMP.QUEUE.DISCARD_AFTER_MS) {
|
||||
if (running.get() && System.currentTimeMillis() - start > Settings.settings().QUEUE.DISCARD_AFTER_MS) {
|
||||
new RuntimeException("FAWE is taking a long time to execute a task (might just be a symptom): ").printStackTrace();
|
||||
LOGGER.info("For full debug information use: /fawe threads");
|
||||
}
|
||||
@ -278,7 +299,7 @@ public abstract class TaskManager {
|
||||
if (Fawe.isMainThread()) {
|
||||
run.run();
|
||||
} else {
|
||||
Fawe.get().getQueueHandler().sync(run);
|
||||
Fawe.instance().getQueueHandler().sync(run);
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,7 +314,7 @@ public abstract class TaskManager {
|
||||
return function.value;
|
||||
}
|
||||
try {
|
||||
return Fawe.get().getQueueHandler().sync((Supplier<T>) function).get();
|
||||
return Fawe.instance().getQueueHandler().sync((Supplier<T>) function).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -309,7 +330,7 @@ public abstract class TaskManager {
|
||||
return supplier.get();
|
||||
}
|
||||
try {
|
||||
return Fawe.get().getQueueHandler().sync(supplier).get();
|
||||
return Fawe.instance().getQueueHandler().sync(supplier).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -334,7 +355,7 @@ public abstract class TaskManager {
|
||||
return function.get();
|
||||
}
|
||||
try {
|
||||
return Fawe.get().getQueueHandler().sync(function).get();
|
||||
return Fawe.instance().getQueueHandler().sync(function).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ public class TextureUtil implements TextureHolder {
|
||||
* Do not use. Use {@link Fawe#getTextureUtil()}
|
||||
*/
|
||||
public TextureUtil() throws FileNotFoundException {
|
||||
this(MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TEXTURES));
|
||||
this(MainUtil.getFile(Fawe.platform().getDirectory(), Settings.settings().PATHS.TEXTURES));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -351,12 +351,12 @@ public class TextureUtil implements TextureHolder {
|
||||
if (!folder.exists()) {
|
||||
try {
|
||||
LOGGER.info("Downloading asset jar from Mojang, please wait...");
|
||||
new File(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/").mkdirs();
|
||||
new File(Fawe.platform().getDirectory() + "/" + Settings.settings().PATHS.TEXTURES + "/").mkdirs();
|
||||
try (BufferedInputStream in = new BufferedInputStream(
|
||||
new URL("https://launcher.mojang.com/v1/objects/7e46fb47609401970e2818989fa584fd467cd036/client.jar")
|
||||
.openStream());
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(
|
||||
Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/1.18.1.jar")) {
|
||||
Fawe.platform().getDirectory() + "/" + Settings.settings().PATHS.TEXTURES + "/1.18.1.jar")) {
|
||||
byte[] dataBuffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
||||
@ -395,7 +395,7 @@ public class TextureUtil implements TextureHolder {
|
||||
}
|
||||
|
||||
public static TextureUtil fromBlocks(Set<BlockType> blocks) throws FileNotFoundException {
|
||||
return new FilteredTextureUtil(Fawe.get().getTextureUtil(), blocks);
|
||||
return new FilteredTextureUtil(Fawe.instance().getTextureUtil(), blocks);
|
||||
}
|
||||
|
||||
public static TextureUtil fromMask(Mask mask) throws FileNotFoundException {
|
||||
@ -404,7 +404,7 @@ public class TextureUtil implements TextureHolder {
|
||||
SingleFilterBlock extent = new SingleFilterBlock();
|
||||
new MaskTraverser(mask).reset(extent);
|
||||
|
||||
TextureUtil tu = Fawe.get().getTextureUtil();
|
||||
TextureUtil tu = Fawe.instance().getTextureUtil();
|
||||
for (int typeId : tu.getValidBlockIds()) {
|
||||
BlockType block = BlockTypes.get(typeId);
|
||||
extent.init(0, 0, 0, block.getDefaultState().toBaseBlock());
|
||||
@ -807,13 +807,13 @@ public class TextureUtil implements TextureHolder {
|
||||
// Get all the jar files
|
||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
|
||||
if (files.length == 0) {
|
||||
new File(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/")
|
||||
new File(Fawe.platform().getDirectory() + "/" + Settings.settings().PATHS.TEXTURES + "/")
|
||||
.mkdirs();
|
||||
try (BufferedInputStream in = new BufferedInputStream(
|
||||
new URL("https://launcher.mojang.com/v1/objects/7e46fb47609401970e2818989fa584fd467cd036/client.jar")
|
||||
.openStream());
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(
|
||||
Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/1.18.1.jar")) {
|
||||
Fawe.platform().getDirectory() + "/" + Settings.settings().PATHS.TEXTURES + "/1.18.1.jar")) {
|
||||
byte[] dataBuffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
||||
|
@ -27,14 +27,14 @@ public class UpdateNotification {
|
||||
* Check whether a new build with a higher build number than the current build is available.
|
||||
*/
|
||||
public static void doUpdateCheck() {
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) {
|
||||
if (Settings.settings().ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) {
|
||||
try {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document doc = db.parse(new URL("https://ci.athion.net/job/FastAsyncWorldEdit/api/xml/").openStream());
|
||||
faweVersion = doc.getElementsByTagName("lastSuccessfulBuild").item(0).getFirstChild().getTextContent();
|
||||
FaweVersion faweVersion = Fawe.get().getVersion();
|
||||
FaweVersion faweVersion = Fawe.instance().getVersion();
|
||||
if (faweVersion.build == 0) {
|
||||
LOGGER.warn("You are using a snapshot or a custom version of FAWE. This is not an official build distributed " +
|
||||
"via https://www.spigotmc.org/resources/13932/");
|
||||
@ -66,9 +66,9 @@ public class UpdateNotification {
|
||||
* @param actor The player to notify.
|
||||
*/
|
||||
public static void doUpdateNotification(Actor actor) {
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) {
|
||||
if (Settings.settings().ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) {
|
||||
if (actor.hasPermission("fawe.admin") && UpdateNotification.hasUpdate) {
|
||||
FaweVersion faweVersion = Fawe.get().getVersion();
|
||||
FaweVersion faweVersion = Fawe.instance().getVersion();
|
||||
int versionDifference = Integer.parseInt(UpdateNotification.faweVersion) - faweVersion.build;
|
||||
actor.print(Caption.of(
|
||||
"fawe.info.update-available",
|
||||
|
@ -26,10 +26,28 @@ import java.util.Set;
|
||||
|
||||
public class WEManager {
|
||||
|
||||
public static final WEManager IMP = new WEManager();
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static WEManager INSTANCE;
|
||||
/**
|
||||
* @deprecated Use {@link #weManager()} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "2.0.0")
|
||||
private final WEManager IMP = new WEManager();
|
||||
private final ArrayDeque<FaweMaskManager> managers = new ArrayDeque<>();
|
||||
|
||||
private WEManager() {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the WEManager.
|
||||
*
|
||||
* @return an instance of the WEManager
|
||||
*/
|
||||
public static WEManager weManager() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public ArrayDeque<FaweMaskManager> getManagers() {
|
||||
return managers;
|
||||
}
|
||||
@ -81,7 +99,7 @@ public class WEManager {
|
||||
* @return array of allowed regions if whitelist, else of disallowed regions.
|
||||
*/
|
||||
public Region[] getMask(Player player, FaweMaskManager.MaskType type, final boolean isWhitelist) {
|
||||
if (!Settings.IMP.REGION_RESTRICTIONS || player.hasPermission("fawe.bypass") || player.hasPermission("fawe.bypass.regions")) {
|
||||
if (!Settings.settings().REGION_RESTRICTIONS || player.hasPermission("fawe.bypass") || player.hasPermission("fawe.bypass.regions")) {
|
||||
return new Region[]{RegionWrapper.GLOBAL()};
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
|
@ -22,7 +22,7 @@ import java.util.Set;
|
||||
public final class MemBlockSet extends BlockSet {
|
||||
|
||||
public static final int BITS_PER_WORD = 6;
|
||||
public static final int WORDS = FaweCache.IMP.BLOCKS_PER_LAYER >> BITS_PER_WORD;
|
||||
public static final int WORDS = FaweCache.INSTANCE.BLOCKS_PER_LAYER >> BITS_PER_WORD;
|
||||
public static final IRow NULL_ROW_X = new NullRowX();
|
||||
public static final IRow NULL_ROW_Z = new NullRowZ();
|
||||
public static final IRow NULL_ROW_Y = new NullRowY();
|
||||
|
@ -212,8 +212,8 @@ public class ImageUtil {
|
||||
if (arg.startsWith("file:/")) {
|
||||
arg = arg.replaceFirst("file:/+", "");
|
||||
File file = MainUtil.getFile(MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HEIGHTMAP
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HEIGHTMAP
|
||||
), arg);
|
||||
return MainUtil.readImage(file);
|
||||
}
|
||||
@ -234,8 +234,8 @@ public class ImageUtil {
|
||||
if (arg.startsWith("file:/")) {
|
||||
arg = arg.replaceFirst("file:/+", "");
|
||||
File file = MainUtil.getFile(MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HEIGHTMAP
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HEIGHTMAP
|
||||
), arg);
|
||||
if (!file.exists()) {
|
||||
throw new InputParseException(Caption.of(
|
||||
|
@ -17,8 +17,8 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
|
||||
|
||||
private final Player player;
|
||||
private final long start;
|
||||
private int delay = Settings.IMP.QUEUE.PROGRESS.DELAY;
|
||||
private int interval = Settings.IMP.QUEUE.PROGRESS.INTERVAL;
|
||||
private int delay = Settings.settings().QUEUE.PROGRESS.DELAY;
|
||||
private int interval = Settings.settings().QUEUE.PROGRESS.INTERVAL;
|
||||
|
||||
public DefaultProgressTracker(Player player) {
|
||||
this.start = System.currentTimeMillis();
|
||||
@ -92,14 +92,14 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
|
||||
}
|
||||
|
||||
private void done() {
|
||||
TaskManager.IMP.task(this::doneTask);
|
||||
TaskManager.taskManager().task(this::doneTask);
|
||||
}
|
||||
|
||||
private long lastTick = 0;
|
||||
|
||||
private void send() {
|
||||
// Run on main thread
|
||||
TaskManager.IMP.task(this::sendTask);
|
||||
TaskManager.taskManager().task(this::sendTask);
|
||||
}
|
||||
|
||||
public void doneTask() {
|
||||
|
@ -59,7 +59,7 @@ public class AsyncNotifyQueue implements Closeable {
|
||||
}
|
||||
return null;
|
||||
};
|
||||
self[0] = Fawe.get().getQueueHandler().async(wrapped);
|
||||
self[0] = Fawe.instance().getQueueHandler().async(wrapped);
|
||||
return self[0];
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public abstract class SingleThreadIntervalQueue<T> {
|
||||
this.task = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long allowedTick = Fawe.get().getTimer().getTick() - 1;
|
||||
long allowedTick = Fawe.instance().getTimer().getTick() - 1;
|
||||
Iterator<Map.Entry<T, Long>> iter = objMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<T, Long> entry = iter.next();
|
||||
@ -32,7 +32,7 @@ public abstract class SingleThreadIntervalQueue<T> {
|
||||
}
|
||||
synchronized (objMap) {
|
||||
if (!objMap.isEmpty()) {
|
||||
TaskManager.IMP.laterAsync(this, interval);
|
||||
TaskManager.taskManager().laterAsync(this, interval);
|
||||
} else {
|
||||
queued.set(false);
|
||||
}
|
||||
@ -51,10 +51,10 @@ public abstract class SingleThreadIntervalQueue<T> {
|
||||
|
||||
public void queue(T obj) {
|
||||
synchronized (objMap) {
|
||||
objMap.put(obj, Fawe.get().getTimer().getTick());
|
||||
objMap.put(obj, Fawe.instance().getTimer().getTick());
|
||||
if (!queued.get()) {
|
||||
queued.set(true);
|
||||
TaskManager.IMP.laterAsync(task, 3);
|
||||
TaskManager.taskManager().laterAsync(task, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public interface SimpleWorld extends World {
|
||||
|
||||
@Override
|
||||
default boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) {
|
||||
Fawe.get().getQueueHandler().sync((Supplier<Boolean>) () -> playEffect(
|
||||
Fawe.instance().getQueueHandler().sync((Supplier<Boolean>) () -> playEffect(
|
||||
position,
|
||||
2001,
|
||||
blockType.getLegacyCombinedId() >> 4
|
||||
|
@ -38,7 +38,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public void findFreePosition(Location searchPos) {
|
||||
TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
getBasePlayer().findFreePosition(searchPos);
|
||||
@ -48,7 +48,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public void setOnGround(Location searchPos) {
|
||||
TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
getBasePlayer().setOnGround(searchPos);
|
||||
@ -58,7 +58,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public void findFreePosition() {
|
||||
TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
getBasePlayer().findFreePosition();
|
||||
@ -68,12 +68,12 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public boolean ascendLevel() {
|
||||
return TaskManager.IMP.sync(() -> getBasePlayer().ascendLevel());
|
||||
return TaskManager.taskManager().sync(() -> getBasePlayer().ascendLevel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean descendLevel() {
|
||||
return TaskManager.IMP.sync(() -> getBasePlayer().descendLevel());
|
||||
return TaskManager.taskManager().sync(() -> getBasePlayer().descendLevel());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -155,7 +155,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
unwrap(getBasePlayer())).build();
|
||||
edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS);
|
||||
edit.flushQueue();
|
||||
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
|
||||
LocalSession session = Fawe.instance().getWorldEdit().getSessionManager().get(this);
|
||||
if (session != null) {
|
||||
session.remember(edit, true, getBasePlayer().getLimit().MAX_HISTORY);
|
||||
}
|
||||
@ -173,12 +173,12 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
Fawe.get().getQueueHandler().sync(() -> super.setPosition(pos, pitch, yaw));
|
||||
Fawe.instance().getQueueHandler().sync(() -> super.setPosition(pos, pitch, yaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockTrace(int range, boolean useLastBlock) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
return TaskManager.taskManager().sync(() -> {
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock();
|
||||
});
|
||||
@ -186,7 +186,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public Location getBlockTraceFace(int range, boolean useLastBlock) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
return TaskManager.taskManager().sync(() -> {
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace();
|
||||
});
|
||||
@ -194,7 +194,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public Location getSolidBlockTrace(int range) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
return TaskManager.taskManager().sync(() -> {
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return tb.getSolidTargetBlock();
|
||||
});
|
||||
@ -207,7 +207,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public boolean passThroughForwardWall(int range) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
return TaskManager.taskManager().sync(() -> {
|
||||
int searchDist = 0;
|
||||
TargetBlock hitBlox = new TargetBlock(AsyncPlayer.this, range, 0.2);
|
||||
Extent world = getLocation().getExtent();
|
||||
|
@ -238,7 +238,7 @@ public class WorldWrapper extends AbstractWorld {
|
||||
|
||||
@Override
|
||||
public void simulateBlockMine(BlockVector3 pt) {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
parent.simulateBlockMine(pt);
|
||||
@ -249,7 +249,7 @@ public class WorldWrapper extends AbstractWorld {
|
||||
//FAWE start
|
||||
@Override
|
||||
public Collection<BaseItemStack> getBlockDrops(final BlockVector3 position) {
|
||||
return TaskManager.IMP.sync(() -> parent.getBlockDrops(position));
|
||||
return TaskManager.taskManager().sync(() -> parent.getBlockDrops(position));
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
@ -266,7 +266,7 @@ public class WorldWrapper extends AbstractWorld {
|
||||
@Override
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws
|
||||
MaxChangedBlocksException {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
return TaskManager.taskManager().sync(() -> {
|
||||
try {
|
||||
return parent.generateTree(type, editSession, position);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -307,12 +307,12 @@ public class WorldWrapper extends AbstractWorld {
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return TaskManager.IMP.sync(() -> parent.getEntities(region));
|
||||
return TaskManager.taskManager().sync(() -> parent.getEntities(region));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return TaskManager.IMP.sync(parent::getEntities);
|
||||
return TaskManager.taskManager().sync(parent::getEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1289,7 +1289,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
// Don't relight twice!
|
||||
if (!relighter.isFinished() && relighter.getLock().tryLock()) {
|
||||
try {
|
||||
if (Settings.IMP.LIGHTING.REMOVE_FIRST) {
|
||||
if (Settings.settings().LIGHTING.REMOVE_FIRST) {
|
||||
relighter.removeAndRelight(true);
|
||||
} else {
|
||||
relighter.fixLightingSafe(true);
|
||||
@ -1305,14 +1305,14 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
// Cancel any preloader associated with the actor if present
|
||||
if (getActor() instanceof Player) {
|
||||
Preloader preloader = Fawe.imp().getPreloader(false);
|
||||
Preloader preloader = Fawe.platform().getPreloader(false);
|
||||
if (preloader != null) {
|
||||
preloader.cancel(getActor());
|
||||
}
|
||||
}
|
||||
// Enqueue it
|
||||
if (getChangeSet() != null) {
|
||||
if (Settings.IMP.HISTORY.COMBINE_STAGES) {
|
||||
if (Settings.settings().HISTORY.COMBINE_STAGES) {
|
||||
((AbstractChangeSet) getChangeSet()).closeAsync();
|
||||
} else {
|
||||
try {
|
||||
@ -3649,7 +3649,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
if (containsAny) {
|
||||
changes++;
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
regenerateChunk(cx, cz, biome, seed);
|
||||
|
@ -303,7 +303,7 @@ public final class EditSessionBuilder {
|
||||
*/
|
||||
public EditSessionBuilder changeSet(boolean disk, @Nullable UUID uuid) {
|
||||
if (disk) {
|
||||
if (Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (Settings.settings().HISTORY.USE_DATABASE) {
|
||||
this.changeSet = new RollbackOptimizedHistory(world, uuid);
|
||||
} else {
|
||||
this.changeSet = new DiskStorageHistory(world, uuid);
|
||||
@ -437,7 +437,7 @@ public final class EditSessionBuilder {
|
||||
}
|
||||
if (fastMode == null) {
|
||||
if (actor == null) {
|
||||
fastMode = !Settings.IMP.HISTORY.ENABLE_FOR_CONSOLE;
|
||||
fastMode = !Settings.settings().HISTORY.ENABLE_FOR_CONSOLE;
|
||||
} else {
|
||||
fastMode = actor.getSession().hasFastMode();
|
||||
}
|
||||
@ -466,12 +466,12 @@ public final class EditSessionBuilder {
|
||||
wnaMode = false;
|
||||
if (unwrapped instanceof IQueueExtent) {
|
||||
extent = queue = (IQueueExtent) unwrapped;
|
||||
} else if (Settings.IMP.QUEUE.PARALLEL_THREADS > 1 && !Fawe.isMainThread()) {
|
||||
ParallelQueueExtent parallel = new ParallelQueueExtent(Fawe.get().getQueueHandler(), world, fastMode);
|
||||
} else if (Settings.settings().QUEUE.PARALLEL_THREADS > 1 && !Fawe.isMainThread()) {
|
||||
ParallelQueueExtent parallel = new ParallelQueueExtent(Fawe.instance().getQueueHandler(), world, fastMode);
|
||||
queue = parallel.getExtent();
|
||||
extent = parallel;
|
||||
} else {
|
||||
extent = queue = Fawe.get().getQueueHandler().getQueue(world);
|
||||
extent = queue = Fawe.instance().getQueueHandler().getQueue(world);
|
||||
}
|
||||
} else {
|
||||
wnaMode = true;
|
||||
@ -480,7 +480,7 @@ public final class EditSessionBuilder {
|
||||
if (combineStages == null) {
|
||||
combineStages =
|
||||
// If it's enabled in the settings
|
||||
Settings.IMP.HISTORY.COMBINE_STAGES
|
||||
Settings.settings().HISTORY.COMBINE_STAGES
|
||||
// If fast placement is disabled, it's slower to perform a copy on each chunk
|
||||
&& this.limit.FAST_PLACEMENT
|
||||
// If the edit uses items from the inventory we can't use a delayed task
|
||||
@ -490,17 +490,17 @@ public final class EditSessionBuilder {
|
||||
this.bypassHistory = this.extent = wrapExtent(bypassAll, eventBus, event, EditSession.Stage.BEFORE_REORDER);
|
||||
if (!this.fastMode || changeSet != null) {
|
||||
if (changeSet == null) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (Settings.settings().HISTORY.USE_DISK) {
|
||||
UUID uuid = actor == null ? Identifiable.CONSOLE : actor.getUniqueId();
|
||||
if (Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (Settings.settings().HISTORY.USE_DATABASE) {
|
||||
changeSet = new RollbackOptimizedHistory(world, uuid);
|
||||
} else {
|
||||
changeSet = new DiskStorageHistory(world, uuid);
|
||||
}
|
||||
// } else if (combineStages && Settings.IMP.HISTORY.COMPRESSION_LEVEL == 0) {
|
||||
// } else if (combineStages && Settings.settings().HISTORY.COMPRESSION_LEVEL == 0) {
|
||||
// changeSet = new CPUOptimizedChangeSet(world);
|
||||
} else {
|
||||
if (combineStages && Settings.IMP.HISTORY.COMPRESSION_LEVEL == 0) {
|
||||
if (combineStages && Settings.settings().HISTORY.COMPRESSION_LEVEL == 0) {
|
||||
//TODO add CPUOptimizedChangeSet
|
||||
}
|
||||
changeSet = new MemoryOptimizedHistory(world);
|
||||
@ -528,7 +528,7 @@ public final class EditSessionBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allowedRegions == null && Settings.IMP.REGION_RESTRICTIONS) {
|
||||
if (allowedRegions == null && Settings.settings().REGION_RESTRICTIONS) {
|
||||
if (actor != null && !actor.hasPermission("fawe.bypass") && !actor.hasPermission("fawe.bypass.regions")) {
|
||||
if (actor instanceof Player) {
|
||||
Player player = (Player) actor;
|
||||
@ -536,7 +536,7 @@ public final class EditSessionBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (disallowedRegions == null && Settings.IMP.REGION_RESTRICTIONS && Settings.IMP.REGION_RESTRICTIONS_OPTIONS.ALLOW_BLACKLISTS) {
|
||||
if (disallowedRegions == null && Settings.settings().REGION_RESTRICTIONS && Settings.settings().REGION_RESTRICTIONS_OPTIONS.ALLOW_BLACKLISTS) {
|
||||
if (actor != null && !actor.hasPermission("fawe.bypass") && !actor.hasPermission("fawe.bypass.regions")) {
|
||||
if (actor instanceof Player) {
|
||||
Player player = (Player) actor;
|
||||
@ -562,7 +562,7 @@ public final class EditSessionBuilder {
|
||||
}
|
||||
// There's no need to do lighting (and it'll also just be a pain to implement) if we're not placing chunks
|
||||
if (placeChunks) {
|
||||
if (((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.IMP.LIGHTING.MODE > 0))) {
|
||||
if (((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.settings().LIGHTING.MODE > 0))) {
|
||||
relighter = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getRelighterFactory().createRelighter(relightMode, world, queue);
|
||||
@ -704,13 +704,13 @@ public final class EditSessionBuilder {
|
||||
}
|
||||
if (toReturn != extent) {
|
||||
String className = toReturn.getClass().getName().toLowerCase(Locale.ROOT);
|
||||
for (String allowed : Settings.IMP.EXTENT.ALLOWED_PLUGINS) {
|
||||
for (String allowed : Settings.settings().EXTENT.ALLOWED_PLUGINS) {
|
||||
if (className.contains(allowed.toLowerCase(Locale.ROOT))) {
|
||||
this.wrapped = true;
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
if (Settings.IMP.EXTENT.DEBUG) {
|
||||
if (Settings.settings().EXTENT.DEBUG) {
|
||||
if (event.getActor() != null) {
|
||||
event.getActor().printDebug(TextComponent.of("Potentially unsafe extent blocked: " + toReturn
|
||||
.getClass()
|
||||
|
@ -225,7 +225,7 @@ public class LocalSession implements TextureHolder {
|
||||
if (world == null || uuid == null) {
|
||||
return false;
|
||||
}
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (Settings.settings().HISTORY.USE_DISK) {
|
||||
MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
world = WorldWrapper.unwrap(world);
|
||||
@ -248,8 +248,8 @@ public class LocalSession implements TextureHolder {
|
||||
private boolean loadHistoryChangeSets(UUID uuid, World world) {
|
||||
SparseBitSet set = new SparseBitSet();
|
||||
final File folder = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid
|
||||
);
|
||||
if (folder.isDirectory()) {
|
||||
folder.listFiles(pathname -> {
|
||||
@ -282,12 +282,12 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
|
||||
private void loadHistoryNegativeIndex(UUID uuid, World world) {
|
||||
if (!Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (!Settings.settings().HISTORY.USE_DISK) {
|
||||
return;
|
||||
}
|
||||
File file = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index"
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index"
|
||||
);
|
||||
if (file.exists()) {
|
||||
try (FaweInputStream is = new FaweInputStream(new FileInputStream(file))) {
|
||||
@ -301,12 +301,12 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
|
||||
private void saveHistoryNegativeIndex(UUID uuid, World world) {
|
||||
if (world == null || !Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (world == null || !Settings.settings().HISTORY.USE_DISK) {
|
||||
return;
|
||||
}
|
||||
File file = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index"
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index"
|
||||
);
|
||||
if (getHistoryNegativeIndex() != 0) {
|
||||
try {
|
||||
@ -450,8 +450,8 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
if (o instanceof Integer) {
|
||||
File folder = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HISTORY + File.separator + currentWorld.getName() + File.separator + uuid
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + currentWorld.getName() + File.separator + uuid
|
||||
);
|
||||
File specific = new File(folder, o.toString());
|
||||
if (specific.isDirectory()) {
|
||||
@ -467,7 +467,7 @@ public class LocalSession implements TextureHolder {
|
||||
public void remember(Identifiable player, World world, ChangeSet changeSet, FaweLimit limit) {
|
||||
historyWriteLock.lock();
|
||||
try {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (Settings.settings().HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
if (changeSet.size() == 0) {
|
||||
@ -500,7 +500,7 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
if (limit != null) {
|
||||
int limitMb = limit.MAX_HISTORY;
|
||||
while (((!Settings.IMP.HISTORY.USE_DISK && history.size() > MAX_HISTORY_SIZE) || (historySize >> 20) > limitMb) && history
|
||||
while (((!Settings.settings().HISTORY.USE_DISK && history.size() > MAX_HISTORY_SIZE) || (historySize >> 20) > limitMb) && history
|
||||
.size() > 1) {
|
||||
ChangeSet item = (ChangeSet) history.remove(0);
|
||||
item.delete();
|
||||
@ -516,7 +516,7 @@ public class LocalSession implements TextureHolder {
|
||||
public void remember(EditSession editSession, boolean append, int limitMb) {
|
||||
historyWriteLock.lock();
|
||||
try {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
if (Settings.settings().HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
// It should have already been flushed, but just in case!
|
||||
@ -564,7 +564,7 @@ public class LocalSession implements TextureHolder {
|
||||
} else {
|
||||
history.add(0, changeSet);
|
||||
}
|
||||
while (((!Settings.IMP.HISTORY.USE_DISK && history.size() > MAX_HISTORY_SIZE) || (historySize >> 20) > limitMb) && history
|
||||
while (((!Settings.settings().HISTORY.USE_DISK && history.size() > MAX_HISTORY_SIZE) || (historySize >> 20) > limitMb) && history
|
||||
.size() > 1) {
|
||||
ChangeSet item = (ChangeSet) history.remove(0);
|
||||
item.delete();
|
||||
@ -1146,7 +1146,7 @@ public class LocalSession implements TextureHolder {
|
||||
@Nullable
|
||||
public Tool getTool(Player player) {
|
||||
loadDefaults(player, false);
|
||||
if (!Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && tools.isEmpty()) {
|
||||
if (!Settings.settings().EXPERIMENTAL.PERSISTENT_BRUSHES && tools.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
@ -1157,7 +1157,7 @@ public class LocalSession implements TextureHolder {
|
||||
|
||||
public Tool getTool(BaseItem item, Player player) {
|
||||
loadDefaults(player, false);
|
||||
if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) {
|
||||
if (Settings.settings().EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) {
|
||||
BrushTool tool = BrushCache.getTool(player, this, item);
|
||||
if (tool != null) {
|
||||
return tool;
|
||||
@ -1303,7 +1303,7 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
|
||||
Tool previous;
|
||||
if (player != null && (tool instanceof BrushTool || tool == null) && Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) {
|
||||
if (player != null && (tool instanceof BrushTool || tool == null) && Settings.settings().EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) {
|
||||
previous = BrushCache.getCachedTool(item);
|
||||
BrushCache.setTool(item, (BrushTool) tool);
|
||||
if (tool != null) {
|
||||
@ -1782,7 +1782,7 @@ public class LocalSession implements TextureHolder {
|
||||
TextureUtil tmp = texture;
|
||||
if (tmp == null) {
|
||||
synchronized (this) {
|
||||
tmp = Fawe.get().getCachedTextureUtil(true, 0, 100);
|
||||
tmp = Fawe.instance().getCachedTextureUtil(true, 0, 100);
|
||||
this.texture = tmp;
|
||||
}
|
||||
}
|
||||
|
@ -860,8 +860,8 @@ public class BrushCommands {
|
||||
}
|
||||
String filenamePng = filename.endsWith(".png") ? filename : filename + ".png";
|
||||
File file = new File(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HEIGHTMAP + File.separator + filenamePng
|
||||
);
|
||||
if (file.exists()) {
|
||||
return new FileInputStream(file);
|
||||
@ -936,7 +936,7 @@ public class BrushCommands {
|
||||
if (tool != null) {
|
||||
root |= name.startsWith("../");
|
||||
name = FileSystems.getDefault().getPath(name).getFileName().toString();
|
||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
File folder = MainUtil.getFile(Fawe.platform().getDirectory(), "brushes");
|
||||
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
|
||||
File file;
|
||||
if (root && player.hasPermission("worldedit.brush.save.other")) {
|
||||
@ -971,7 +971,7 @@ public class BrushCommands {
|
||||
public void loadBrush(Player player, LocalSession session, @Arg(desc = "String name") String name)
|
||||
throws WorldEditException, IOException {
|
||||
name = FileSystems.getDefault().getPath(name).getFileName().toString();
|
||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
File folder = MainUtil.getFile(Fawe.platform().getDirectory(), "brushes");
|
||||
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
|
||||
File file = new File(folder, player.getUniqueId() + File.separator + name);
|
||||
if (!file.exists()) {
|
||||
@ -1006,7 +1006,7 @@ public class BrushCommands {
|
||||
int page
|
||||
) throws WorldEditException {
|
||||
String baseCmd = "/brush loadbrush";
|
||||
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
File dir = MainUtil.getFile(Fawe.platform().getDirectory(), "brushes");
|
||||
// TODO NOT IMPLEMENTED
|
||||
// UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
|
||||
}
|
||||
@ -1310,7 +1310,7 @@ public class BrushCommands {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
//FAWE start
|
||||
FaweLimit limit = Settings.IMP.getLimit(player);
|
||||
FaweLimit limit = Settings.settings().getLimit(player);
|
||||
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
|
||||
//FAWE end
|
||||
|
||||
@ -1345,7 +1345,7 @@ public class BrushCommands {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
//FAWE start
|
||||
FaweLimit limit = Settings.IMP.getLimit(player);
|
||||
FaweLimit limit = Settings.settings().getLimit(player);
|
||||
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
|
||||
//FAWE end
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class ClipboardCommands {
|
||||
url = null;
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.WEB.URL.isEmpty()) {
|
||||
if (Settings.settings().WEB.URL.isEmpty()) {
|
||||
actor.print(Caption.of("fawe.error.setting.disable", "web.url"));
|
||||
return;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ public class GeneralCommands {
|
||||
String arg = arguments.get(0);
|
||||
String argLower = arg.toLowerCase(Locale.ROOT);
|
||||
|
||||
TextureUtil util = Fawe.get().getTextureUtil();
|
||||
TextureUtil util = Fawe.instance().getTextureUtil();
|
||||
int randomIndex = 1;
|
||||
boolean checkRandomization = true;
|
||||
if (arguments.size() >= 2 && MathMan.isInteger(arguments.get(0)) && MathMan.isInteger(arguments.get(1))) {
|
||||
@ -500,7 +500,7 @@ public class GeneralCommands {
|
||||
Clipboard clipboard = session.getClipboard().getClipboard();
|
||||
util = TextureUtil.fromClipboard(clipboard);
|
||||
} else if (argLower.equals("*") || argLower.equals("true")) {
|
||||
util = Fawe.get().getTextureUtil();
|
||||
util = Fawe.instance().getTextureUtil();
|
||||
} else {
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(actor);
|
||||
|
@ -582,7 +582,7 @@ public class GenerationCommands {
|
||||
@Arg(desc = "TODO", def = "100") int threshold,
|
||||
@Arg(desc = "BlockVector2", def = "") BlockVector2 dimensions
|
||||
) throws WorldEditException, IOException {
|
||||
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
|
||||
TextureUtil tu = Fawe.instance().getCachedTextureUtil(randomize, 0, threshold);
|
||||
URL url = new URL(imageURL);
|
||||
if (!url.getHost().equalsIgnoreCase("i.imgur.com")) {
|
||||
throw new IOException("Only i.imgur.com links are allowed!");
|
||||
|
@ -114,7 +114,7 @@ public class HistorySubCommands {
|
||||
@Switch(name = 'f', desc = "Restore instead of rollback")
|
||||
boolean restore
|
||||
) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (!Settings.settings().HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable", "history.use-database (Import with /history import )"));
|
||||
return;
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class HistorySubCommands {
|
||||
@CommandPermissions("fawe.rollback.import")
|
||||
@Confirm
|
||||
public synchronized void importdb(Actor actor) throws WorldEditException {
|
||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY);
|
||||
File folder = MainUtil.getFile(Fawe.platform().getDirectory(), Settings.settings().PATHS.HISTORY);
|
||||
if (folder.exists()) {
|
||||
for (File worldFolder : Objects.requireNonNull(folder.listFiles())) {
|
||||
if (worldFolder != null && worldFolder.isDirectory()) {
|
||||
@ -238,7 +238,7 @@ public class HistorySubCommands {
|
||||
}
|
||||
Location origin = player.getLocation();
|
||||
|
||||
String name = Fawe.imp().getName(edit.getUUID());
|
||||
String name = Fawe.platform().getName(edit.getUUID());
|
||||
String cmd = edit.getCommand();
|
||||
BlockVector3 pos1 = edit.getMinimumPoint();
|
||||
BlockVector3 pos2 = edit.getMaximumPoint();
|
||||
@ -319,7 +319,7 @@ public class HistorySubCommands {
|
||||
|
||||
UUID uuid = rollback.getUUID();
|
||||
int index = rollback.getIndex();
|
||||
String name = Fawe.imp().getName(rollback.getUUID());
|
||||
String name = Fawe.platform().getName(rollback.getUUID());
|
||||
|
||||
String cmd = rollback.getCommand();
|
||||
BlockVector3 pos1 = rollback.getMinimumPoint();
|
||||
@ -382,7 +382,7 @@ public class HistorySubCommands {
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
|
||||
Integer page
|
||||
) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
if (!Settings.settings().HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable", "history.use-database (Import with //history import )"));
|
||||
return;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class SchematicCommands {
|
||||
} else {
|
||||
final LocalConfiguration config = this.worldEdit.getConfiguration();
|
||||
File working = this.worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File root = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
File root = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
uri = new File(root, fileName).toURI();
|
||||
}
|
||||
|
||||
@ -238,13 +238,13 @@ public class SchematicCommands {
|
||||
IOException {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
File dir = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
File destDir = new File(dir, directory);
|
||||
if (!MainUtil.isInSubDirectory(working, destDir)) {
|
||||
actor.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir))));
|
||||
return;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !actor.hasPermission(
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !actor.hasPermission(
|
||||
"worldedit.schematic.move.other")) {
|
||||
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other"));
|
||||
return;
|
||||
@ -265,7 +265,7 @@ public class SchematicCommands {
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile));
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(
|
||||
dir,
|
||||
destFile
|
||||
) || !MainUtil.isInSubDirectory(dir, source)) && !actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
@ -333,7 +333,7 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
UUID uuid = UUID.fromString(filename.substring(4));
|
||||
URL webUrl = new URL(Settings.IMP.WEB.URL);
|
||||
URL webUrl = new URL(Settings.settings().WEB.URL);
|
||||
format = ClipboardFormats.findByAlias(formatName);
|
||||
URL url = new URL(webUrl, "uploads/" + uuid + "." + format.getPrimaryFileExtension());
|
||||
ReadableByteChannel byteChannel = Channels.newChannel(url.openStream());
|
||||
@ -341,7 +341,7 @@ public class SchematicCommands {
|
||||
uri = url.toURI();
|
||||
} else {
|
||||
File saveDir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(saveDir, actor.getUniqueId().toString()) : saveDir;
|
||||
File dir = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS ? new File(saveDir, actor.getUniqueId().toString()) : saveDir;
|
||||
File file;
|
||||
if (filename.startsWith("#")) {
|
||||
format = ClipboardFormats.findByAlias(formatName);
|
||||
@ -357,7 +357,7 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !actor.hasPermission("worldedit.schematic.load.other") && Pattern
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && !actor.hasPermission("worldedit.schematic.load.other") && Pattern
|
||||
.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
|
||||
.matcher(filename)
|
||||
.find()) {
|
||||
@ -446,7 +446,7 @@ public class SchematicCommands {
|
||||
File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
|
||||
//FAWE start
|
||||
if (!global && Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
|
||||
if (!global && Settings.settings().PATHS.PER_PLAYER_SCHEMATICS) {
|
||||
dir = new File(dir, actor.getUniqueId().toString());
|
||||
}
|
||||
|
||||
@ -580,7 +580,7 @@ public class SchematicCommands {
|
||||
final boolean hasShow = false;
|
||||
|
||||
//If player forgot -p argument
|
||||
boolean playerFolder = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
||||
boolean playerFolder = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS;
|
||||
UUID uuid = playerFolder ? actor.getUniqueId() : null;
|
||||
List<File> files = UtilityCommands.getFiles(dir, actor, args, formatName, playerFolder, oldFirst, newFirst);
|
||||
List<Map.Entry<URI, String>> entries = UtilityCommands.filesToEntry(dir, files, uuid);
|
||||
@ -670,14 +670,14 @@ public class SchematicCommands {
|
||||
|
||||
String headerBytesElem = String.format("%.1fkb", totalBytes / 1000.0);
|
||||
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT > -1) {
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT > -1) {
|
||||
headerBytesElem += String.format(
|
||||
" / %dkb",
|
||||
Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT
|
||||
Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS) {
|
||||
String fullHeader = "| My Schematics: " + headerBytesElem + " |";
|
||||
PaginationBox paginationBox = PaginationBox.fromComponents(fullHeader, pageCommand, components);
|
||||
actor.print(paginationBox.create(page));
|
||||
@ -704,7 +704,7 @@ public class SchematicCommands {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
//FAWE start
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
File dir = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
List<File> files = new ArrayList<>();
|
||||
|
||||
if (filename.equalsIgnoreCase("*")) {
|
||||
@ -723,7 +723,7 @@ public class SchematicCommands {
|
||||
actor.print(Caption.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission(
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission(
|
||||
"worldedit.schematic.delete.other")) {
|
||||
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.delete.other"));
|
||||
continue;
|
||||
@ -806,8 +806,8 @@ public class SchematicCommands {
|
||||
Clipboard target;
|
||||
|
||||
//FAWE start
|
||||
boolean checkFilesize = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||
&& Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT > -1;
|
||||
boolean checkFilesize = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS
|
||||
&& Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT > -1;
|
||||
|
||||
double directorysizeKb = 0;
|
||||
String curFilepath = file.getAbsolutePath();
|
||||
@ -838,7 +838,7 @@ public class SchematicCommands {
|
||||
}
|
||||
|
||||
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT > -1) {
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT > -1) {
|
||||
|
||||
if (numFiles == -1) {
|
||||
numFiles = 0;
|
||||
@ -851,7 +851,7 @@ public class SchematicCommands {
|
||||
}
|
||||
}
|
||||
}
|
||||
int limit = Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT;
|
||||
int limit = Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT;
|
||||
|
||||
if (numFiles >= limit) {
|
||||
TextComponent noSlotsErr = TextComponent.of( //TODO - to be moved into captions/translatablecomponents
|
||||
@ -902,7 +902,7 @@ public class SchematicCommands {
|
||||
if (checkFilesize) {
|
||||
|
||||
double curKb = filesizeKb + directorysizeKb;
|
||||
int allocatedKb = Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT;
|
||||
int allocatedKb = Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_SIZE_LIMIT;
|
||||
|
||||
if (overwrite) {
|
||||
curKb -= oldKbOverwritten;
|
||||
@ -937,11 +937,11 @@ public class SchematicCommands {
|
||||
actor.print(kbRemainingNotif);
|
||||
}
|
||||
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT > -1) {
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS && Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT > -1) {
|
||||
|
||||
TextComponent slotsRemainingNotif = TextComponent.of(
|
||||
//TODO - to be moved into captions/translatablecomponents
|
||||
"You have " + (Settings.IMP.EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT - numFiles)
|
||||
"You have " + (Settings.settings().EXPERIMENTAL.PER_PLAYER_FILE_NUM_LIMIT - numFiles)
|
||||
+ " schematic file slots left.",
|
||||
TextColor.GRAY
|
||||
);
|
||||
|
@ -135,9 +135,9 @@ public class UtilityCommands {
|
||||
@Arg(name = "max", desc = "int", def = "200") int max
|
||||
) throws IOException {
|
||||
actor.print(TextComponent.of("Please wait while we generate the minified heightmaps."));
|
||||
File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);
|
||||
File srcFolder = MainUtil.getFile(Fawe.platform().getDirectory(), Settings.settings().PATHS.HEIGHTMAP);
|
||||
|
||||
File webSrc = new File(Fawe.imp().getDirectory(), "web" + File.separator + "heightmap");
|
||||
File webSrc = new File(Fawe.platform().getDirectory(), "web" + File.separator + "heightmap");
|
||||
File minImages = new File(webSrc, "images" + File.separator + "min");
|
||||
File maxImages = new File(webSrc, "images" + File.separator + "max");
|
||||
final int sub = srcFolder.getAbsolutePath().length();
|
||||
@ -698,7 +698,7 @@ public class UtilityCommands {
|
||||
|
||||
//FAWE start - run this sync
|
||||
int finalRadius = radius;
|
||||
int killed = TaskManager.IMP.sync(() -> killMatchingEntities(finalRadius, actor, flags::createFunction));
|
||||
int killed = TaskManager.taskManager().sync(() -> killMatchingEntities(finalRadius, actor, flags::createFunction));
|
||||
//FAWE end
|
||||
|
||||
actor.print(Caption.of(
|
||||
@ -730,7 +730,7 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
//FAWE start - run this sync
|
||||
int removed = TaskManager.IMP.sync(() -> killMatchingEntities(radius, actor, remover::createFunction));
|
||||
int removed = TaskManager.taskManager().sync(() -> killMatchingEntities(radius, actor, remover::createFunction));
|
||||
//FAWE end
|
||||
actor.print(Caption.of("worldedit.remove.removed", TextComponent.of(removed)));
|
||||
return removed;
|
||||
@ -953,7 +953,7 @@ public class UtilityCommands {
|
||||
String dirFilter = File.separator;
|
||||
|
||||
boolean listMine = false;
|
||||
boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
||||
boolean listGlobal = !Settings.settings().PATHS.PER_PLAYER_SCHEMATICS;
|
||||
if (len > 0) {
|
||||
for (String arg : args) {
|
||||
switch (arg.toLowerCase(Locale.ROOT)) {
|
||||
@ -982,7 +982,7 @@ public class UtilityCommands {
|
||||
if (!exists) {
|
||||
arg = arg.substring(0, arg.length() - File.separator.length());
|
||||
if (arg.length() > 3 && arg.length() <= 16) {
|
||||
UUID fromName = Fawe.imp().getUUID(arg);
|
||||
UUID fromName = Fawe.platform().getUUID(arg);
|
||||
if (fromName != null) {
|
||||
newDirFilter = dirFilter + fromName + File.separator;
|
||||
listGlobal = true;
|
||||
@ -1103,7 +1103,7 @@ public class UtilityCommands {
|
||||
if (newList.isEmpty()) {
|
||||
String checkName = filter.replace("\\", "/").split("/")[0];
|
||||
if (checkName.length() > 3 && checkName.length() <= 16) {
|
||||
UUID fromName = Fawe.imp().getUUID(checkName);
|
||||
UUID fromName = Fawe.platform().getUUID(checkName);
|
||||
if (fromName != null) {
|
||||
lowerFilter = filter.replaceFirst(checkName, fromName.toString()).toLowerCase(Locale.ROOT);
|
||||
for (int i = 0; i < normalizedNames.length; i++) {
|
||||
|
@ -81,7 +81,7 @@ public class WorldEditCommands {
|
||||
@CommandPermissions(queued = false)
|
||||
public void version(Actor actor) {
|
||||
//FAWE start - use own, minimized message that doesn't print "Platforms" and "Capabilities"
|
||||
FaweVersion fVer = Fawe.get().getVersion();
|
||||
FaweVersion fVer = Fawe.instance().getVersion();
|
||||
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
|
||||
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr));
|
||||
actor.print(TextComponent.of("Authors: Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault"));
|
||||
@ -105,7 +105,7 @@ public class WorldEditCommands {
|
||||
.queryCapability(Capability.CONFIGURATION)
|
||||
.getConfiguration()));
|
||||
//FAWE start
|
||||
Fawe.get().setupConfigs();
|
||||
Fawe.instance().setupConfigs();
|
||||
//FAWE end
|
||||
actor.print(Caption.of("worldedit.reload.config"));
|
||||
}
|
||||
@ -120,9 +120,9 @@ public class WorldEditCommands {
|
||||
String dest;
|
||||
try {
|
||||
final File logFile = new File("logs/latest.log");
|
||||
final File config = new File(Fawe.imp().getDirectory(), "config.yml");
|
||||
final File worldeditConfig = new File(Fawe.imp().getDirectory(), "worldedit-config.yml");
|
||||
dest = IncendoPaster.debugPaste(logFile, Fawe.imp().getDebugInfo(), config, worldeditConfig);
|
||||
final File config = new File(Fawe.platform().getDirectory(), "config.yml");
|
||||
final File worldeditConfig = new File(Fawe.platform().getDirectory(), "worldedit-config.yml");
|
||||
dest = IncendoPaster.debugPaste(logFile, Fawe.platform().getDebugInfo(), config, worldeditConfig);
|
||||
} catch (IOException e) {
|
||||
actor.printInfo(TextComponent.of(e.getMessage()));
|
||||
return;
|
||||
|
@ -56,7 +56,7 @@ public enum SelectionWand implements DoubleActionBlockTool {
|
||||
|
||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
//FAWE start
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
if (Settings.settings().EXPERIMENTAL.OTHER) {
|
||||
LOGGER.info("actSecondary Hit and about to explain with explainPrimarySelection");
|
||||
}
|
||||
//FAWE end
|
||||
@ -79,7 +79,7 @@ public enum SelectionWand implements DoubleActionBlockTool {
|
||||
|
||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
//FAWE start
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
if (Settings.settings().EXPERIMENTAL.OTHER) {
|
||||
LOGGER.info("actPrimary Hit and about to explain with explainSecondarySelection");
|
||||
}
|
||||
//FAWE end
|
||||
|
@ -148,7 +148,7 @@ public class EntityRemover {
|
||||
if (registryType != null) {
|
||||
if (type.matches(registryType)) {
|
||||
//FAWE start - Calling this async violates thread safety
|
||||
TaskManager.IMP.sync(entity::remove);
|
||||
TaskManager.taskManager().sync(entity::remove);
|
||||
//FAWE end
|
||||
return true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ConfirmHandler implements CommandCallListener {
|
||||
}
|
||||
Actor actor = actorOpt.get();
|
||||
// don't check confirmation if actor doesn't need to confirm
|
||||
if (!Settings.IMP.getLimit(actor).CONFIRM_LARGE) {
|
||||
if (!Settings.settings().getLimit(actor).CONFIRM_LARGE) {
|
||||
return;
|
||||
}
|
||||
if (!confirmAnnotation.value().passes(actor, parameters, 1)) {
|
||||
|
@ -32,7 +32,7 @@ public @interface Preload {
|
||||
@Override
|
||||
public void preload(Actor actor, InjectedValueAccess context) {
|
||||
World world = context.injectedValue(Key.of(EditSession.class)).get().getWorld();
|
||||
Preloader preloader = Fawe.imp().getPreloader(true);
|
||||
Preloader preloader = Fawe.platform().getPreloader(true);
|
||||
if (preloader != null) {
|
||||
preloader.update(actor, world);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class PreloadHandler implements CommandCallListener {
|
||||
}
|
||||
Actor actor = actorOpt.get();
|
||||
// Don't attempt to preload if effectively disabled
|
||||
if (Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT <= 1) {
|
||||
if (Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT <= 1) {
|
||||
return;
|
||||
}
|
||||
preloadAnnotation.value().preload(actor, parameters);
|
||||
|
@ -425,7 +425,7 @@ public interface Player extends Entity, Actor {
|
||||
default void unregister() {
|
||||
cancel(true);
|
||||
LocalSession session = getSession();
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK && Settings.IMP.CLIPBOARD.DELETE_ON_LOGOUT) {
|
||||
if (Settings.settings().CLIPBOARD.USE_DISK && Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT) {
|
||||
ClipboardHolder holder = session.getExistingClipboard();
|
||||
if (holder != null) {
|
||||
for (Clipboard clipboard : holder.getClipboards()) {
|
||||
@ -441,10 +441,10 @@ public interface Player extends Entity, Actor {
|
||||
doc.getFile().delete();
|
||||
}
|
||||
}
|
||||
} else if (Settings.IMP.CLIPBOARD.DELETE_ON_LOGOUT || Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
} else if (Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT || Settings.settings().CLIPBOARD.USE_DISK) {
|
||||
session.setClipboard(null);
|
||||
}
|
||||
if (Settings.IMP.HISTORY.DELETE_ON_LOGOUT) {
|
||||
if (Settings.settings().HISTORY.DELETE_ON_LOGOUT) {
|
||||
session.clearHistory();
|
||||
}
|
||||
}
|
||||
@ -456,8 +456,8 @@ public interface Player extends Entity, Actor {
|
||||
*/
|
||||
default void loadClipboardFromDisk() {
|
||||
File file = MainUtil.getFile(
|
||||
Fawe.imp().getDirectory(),
|
||||
Settings.IMP.PATHS.CLIPBOARD + File.separator + getUniqueId() + ".bd"
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.CLIPBOARD + File.separator + getUniqueId() + ".bd"
|
||||
);
|
||||
try {
|
||||
if (file.exists() && file.length() > 5) {
|
||||
|
@ -110,7 +110,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
|
||||
if (async) {
|
||||
asyncNotifyQueue.run(wrapped);
|
||||
} else {
|
||||
TaskManager.IMP.taskNow(wrapped, false);
|
||||
TaskManager.taskManager().taskNow(wrapped, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public Region[] getAllowedRegions(FaweMaskManager.MaskType type) {
|
||||
return WEManager.IMP.getMask(this, type, true);
|
||||
return WEManager.weManager().getMask(this, type, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -501,7 +501,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public Region[] getDisallowedRegions(FaweMaskManager.MaskType type) {
|
||||
return WEManager.IMP.getMask(this, type, false);
|
||||
return WEManager.weManager().getMask(this, type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -677,7 +677,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
if (async) {
|
||||
asyncNotifyQueue.run(wrapped);
|
||||
} else {
|
||||
TaskManager.IMP.taskNow(wrapped, false);
|
||||
TaskManager.taskManager().taskNow(wrapped, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -220,13 +220,13 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
|
||||
default boolean checkAction() {
|
||||
long time = getMeta("faweActionTick", Long.MIN_VALUE);
|
||||
long tick = Fawe.get().getTimer().getTick();
|
||||
long tick = Fawe.instance().getTimer().getTick();
|
||||
setMeta("faweActionTick", tick);
|
||||
return tick > time;
|
||||
}
|
||||
|
||||
default FaweLimit getLimit() {
|
||||
return Settings.IMP.getLimit(this);
|
||||
return Settings.settings().getLimit(this);
|
||||
}
|
||||
|
||||
default boolean runAsyncIfFree(Runnable r) {
|
||||
|
@ -434,7 +434,7 @@ public final class PlatformCommandManager {
|
||||
|
||||
public void registerAllCommands() {
|
||||
//FAWE start
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
||||
if (Settings.settings().ENABLED_COMPONENTS.COMMANDS) {
|
||||
// TODO: Ping @MattBDev to reimplement (or remove) 2020-02-04
|
||||
// registerSubCommands(
|
||||
// "patterns",
|
||||
@ -674,7 +674,7 @@ public final class PlatformCommandManager {
|
||||
|
||||
Actor actor = event.getActor();
|
||||
String args = event.getArguments();
|
||||
TaskManager.IMP.taskNow(() -> {
|
||||
TaskManager.taskManager().taskNow(() -> {
|
||||
if (!Fawe.isMainThread()) {
|
||||
Thread.currentThread().setName("FAWE Thread for player: " + actor.getName());
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class AbstractDelegateExtent implements Extent {
|
||||
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
if (Settings.settings().EXPERIMENTAL.OTHER) {
|
||||
LOGGER.info("addProcessor Info: \t " + processor.getClass().getName());
|
||||
LOGGER.info("The following is not an error or a crash:");
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
@ -262,7 +262,7 @@ public class AbstractDelegateExtent implements Extent {
|
||||
|
||||
@Override
|
||||
public Extent addPostProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
if (Settings.settings().EXPERIMENTAL.OTHER) {
|
||||
LOGGER.info("addPostProcessor Info: \t " + processor.getClass().getName());
|
||||
LOGGER.info("The following is not an error or a crash:");
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
|
@ -870,7 +870,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
}
|
||||
|
||||
default Extent enableHistory(AbstractChangeSet changeSet) {
|
||||
if (Settings.IMP.HISTORY.SEND_BEFORE_HISTORY) {
|
||||
if (Settings.settings().HISTORY.SEND_BEFORE_HISTORY) {
|
||||
return addPostProcessor(changeSet);
|
||||
} else {
|
||||
return addProcessor(changeSet);
|
||||
|
@ -62,7 +62,7 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
|
||||
checkNotNull(mask);
|
||||
this.mask = mask;
|
||||
//FAWE start
|
||||
this.threadIdToFilter = FaweCache.IMP.createCache(() -> new CharFilterBlock(getExtent()));
|
||||
this.threadIdToFilter = FaweCache.INSTANCE.createCache(() -> new CharFilterBlock(getExtent()));
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
|
@ -86,9 +86,9 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable, Fl
|
||||
}
|
||||
|
||||
static Clipboard create(Region region, UUID uuid) {
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
if (Settings.settings().CLIPBOARD.USE_DISK) {
|
||||
return new DiskOptimizedClipboard(region, uuid);
|
||||
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
|
||||
} else if (Settings.settings().CLIPBOARD.COMPRESSION_LEVEL == 0) {
|
||||
return new CPUOptimizedClipboard(region);
|
||||
} else {
|
||||
return new MemoryOptimizedClipboard(region);
|
||||
|
@ -187,21 +187,21 @@ public class ClipboardFormats {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
URL base = new URL(Settings.IMP.WEB.URL);
|
||||
URL base = new URL(Settings.settings().WEB.URL);
|
||||
input = new URL(base, "uploads/" + input.substring(4) + "."
|
||||
+ format.getPrimaryFileExtension()).toString();
|
||||
}
|
||||
if (input.startsWith("http")) {
|
||||
return null;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS
|
||||
&& Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find()
|
||||
&& !player.hasPermission("worldedit.schematic.load.other")) {
|
||||
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
||||
return null;
|
||||
}
|
||||
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||
File dir = Settings.settings().PATHS.PER_PLAYER_SCHEMATICS
|
||||
? new File(working, player.getUniqueId().toString()) : working;
|
||||
File f;
|
||||
if (input.startsWith("#")) {
|
||||
@ -219,7 +219,7 @@ public class ClipboardFormats {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||
if (Settings.settings().PATHS.PER_PLAYER_SCHEMATICS
|
||||
&& Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find()
|
||||
&& !player.hasPermission("worldedit.schematic.load.other")) {
|
||||
if (message) {
|
||||
|
@ -120,7 +120,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
|
||||
metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
|
||||
metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
|
||||
metadata.put("FAWEVersion", new IntTag(Fawe.get().getVersion().build));
|
||||
metadata.put("FAWEVersion", new IntTag(Fawe.instance().getVersion().build));
|
||||
|
||||
schematic.put("Metadata", new CompoundTag(metadata));
|
||||
|
||||
|
@ -438,7 +438,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
if (directions != null) {
|
||||
int oldIndex = property.getIndex(state.getInternalId());
|
||||
if (oldIndex >= directions.length) {
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.DEBUG) {
|
||||
if (Settings.settings().ENABLED_COMPONENTS.DEBUG) {
|
||||
LOGGER.warn(String.format(
|
||||
"Index outside direction array length found for block:{%s} property:{%s}",
|
||||
state.getBlockType().getId(),
|
||||
|
@ -99,7 +99,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
|
||||
Collection<BaseItemStack> drops = world.getBlockDrops(location);
|
||||
boolean canSet = super.setBlock(location, block);
|
||||
if (canSet) {
|
||||
TaskManager.IMP.sync(new RunnableVal<>() {
|
||||
TaskManager.taskManager().sync(new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
for (BaseItemStack stack : drops) {
|
||||
|
@ -290,13 +290,13 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
BlockVectorSet chunkLoadSet = new BlockVectorSet();
|
||||
for (currentDepth = 0; !queue.isEmpty() && currentDepth <= maxDepth; currentDepth++) {
|
||||
int loadCount = 0;
|
||||
if (singleQueue != null && Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
if (singleQueue != null && Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
int cx = Integer.MIN_VALUE;
|
||||
int cz = Integer.MIN_VALUE;
|
||||
outer:
|
||||
for (BlockVector3 from : queue) {
|
||||
for (BlockVector3 direction : dirs) {
|
||||
if (loadCount > Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT) {
|
||||
if (loadCount > Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT) {
|
||||
break outer;
|
||||
}
|
||||
int x = from.getBlockX() + direction.getBlockX();
|
||||
|
@ -93,7 +93,7 @@ public class RegionVisitor implements Operation {
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
//FAWE start > allow chunk preloading
|
||||
if (singleQueue != null && Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
if (singleQueue != null && Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT > 1) {
|
||||
/*
|
||||
* The following is done to reduce iteration cost
|
||||
* - Preload chunks just in time
|
||||
@ -107,7 +107,7 @@ public class RegionVisitor implements Operation {
|
||||
int lastTrailChunkZ = Integer.MIN_VALUE;
|
||||
int lastLeadChunkX = Integer.MIN_VALUE;
|
||||
int lastLeadChunkZ = Integer.MIN_VALUE;
|
||||
int loadingTarget = Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT;
|
||||
int loadingTarget = Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT;
|
||||
while (trailIter.hasNext()) {
|
||||
BlockVector3 pt = trailIter.next();
|
||||
apply(pt);
|
||||
|
@ -467,7 +467,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
@Override
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
//FAWE start
|
||||
if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9) {
|
||||
if (Settings.settings().HISTORY.COMPRESSION_LEVEL >= 9) {
|
||||
return iterator_old();
|
||||
}
|
||||
//FAWE end
|
||||
|
@ -430,7 +430,7 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
||||
int by = layer << 4;
|
||||
int ty = by + 15;
|
||||
if (containsEntireCuboid(bx, tx, by, ty, bz, tz)) {
|
||||
set.setBlocks(layer, FaweCache.IMP.EMPTY_CHAR_4096);
|
||||
set.setBlocks(layer, FaweCache.INSTANCE.EMPTY_CHAR_4096);
|
||||
processExtra = true;
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user