refactor: Deprecate IMP initializors in favor of builders

This commit is contained in:
NotMyFault
2021-12-22 20:58:23 +01:00
parent 34f971c729
commit 7da921e075
129 changed files with 750 additions and 677 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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
}

View File

@ -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);

View File

@ -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) {

View File

@ -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));

View File

@ -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(),

View File

@ -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) {