mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 20:43:54 +00:00
Update Upstream
609c7b8 Scrapped Logging Framework 4 Java Closes #997 Closes #998 Closes #999 Closes #1000 Closes #1001 Closes #1002
This commit is contained in:
@ -14,8 +14,8 @@ import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.github.luben.zstd.util.Native;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@ -73,7 +73,7 @@ import javax.management.NotificationEmitter;
|
||||
*/
|
||||
public class Fawe {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Fawe.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static Fawe instance;
|
||||
|
||||
@ -250,7 +250,7 @@ public class Fawe {
|
||||
try {
|
||||
Settings.IMP.reload(file);
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to load config.", e);
|
||||
LOGGER.error("Failed to load config.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,14 +272,14 @@ public class Fawe {
|
||||
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);
|
||||
log.error("ZSTD Compression Binding Not Found.\n"
|
||||
LOGGER.error("ZSTD Compression Binding Not Found.\n"
|
||||
+ "FAWE will still work but compression won't work as well.\n", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
net.jpountz.util.Native.load();
|
||||
} catch (Throwable e) {
|
||||
log.error("LZ4 Compression Binding Not Found.\n"
|
||||
LOGGER.error("LZ4 Compression Binding Not Found.\n"
|
||||
+ "FAWE will still work but compression will be slower.\n", e);
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ public class Fawe {
|
||||
boolean x86OS = System.getProperty("sun.arch.data.model").contains("32");
|
||||
boolean x86JVM = System.getProperty("os.arch").contains("32");
|
||||
if (x86OS != x86JVM) {
|
||||
log.info("You are running 32-bit Java on a 64-bit machine. Please upgrade to 64-bit Java.");
|
||||
LOGGER.info("You are running 32-bit Java on a 64-bit machine. Please upgrade to 64-bit Java.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ public class Fawe {
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
log.error("FAWE encountered an error trying to listen to JVM memory.\n"
|
||||
LOGGER.error("FAWE encountered an error trying to listen to JVM memory.\n"
|
||||
+ "Please change your Java security settings or disable this message by"
|
||||
+ "changing 'max-memory-percent' in the config files to '-1'.");
|
||||
}
|
||||
|
@ -30,10 +30,12 @@ import com.sk89q.jnbt.LongTag;
|
||||
import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector3;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -56,12 +58,13 @@ import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public enum FaweCache implements Trimable {
|
||||
IMP
|
||||
; // singleton
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public final int BLOCKS_PER_LAYER = 4096;
|
||||
public final int CHUNK_LAYERS = 16;
|
||||
public final int WORLD_HEIGHT = CHUNK_LAYERS << 4;
|
||||
@ -503,7 +506,7 @@ public enum FaweCache implements Trimable {
|
||||
} else if (value instanceof Boolean) {
|
||||
return asTag((byte) ((boolean) value ? 1 : 0));
|
||||
}
|
||||
getLogger(FaweCache.class).error("Invalid nbt: {}", value);
|
||||
LOGGER.error("Invalid nbt: {}", value);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.apache.logging.log4j.LogManager.getLogger;
|
||||
|
||||
public interface IBatchProcessor {
|
||||
|
||||
|
@ -3,15 +3,15 @@ package com.boydti.fawe.beta.implementation.blocks;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IBlocks;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.Range;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class CharBlocks implements IBlocks {
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(CharBlocks.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
protected static final Section FULL = new Section() {
|
||||
@Override
|
||||
@ -139,9 +139,9 @@ public abstract class CharBlocks implements IBlocks {
|
||||
try {
|
||||
set(layer, index, value);
|
||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||
logger.error("Tried setting block at coordinates (" + x + "," + y + "," + z + ")");
|
||||
LOGGER.error("Tried setting block at coordinates (" + x + "," + y + "," + z + ")");
|
||||
assert Fawe.imp() != null;
|
||||
logger.error("Layer variable was = {}", layer, exception);
|
||||
LOGGER.error("Layer variable was = {}", layer, exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.collection.BlockVectorSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.BooleanProperty;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
@ -20,8 +21,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
@ -41,7 +41,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class NMSRelighter implements Relighter {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(NMSRelighter.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static final int DISPATCH_SIZE = 64;
|
||||
private static final DirectionalProperty stairDirection;
|
||||
private static final EnumProperty stairHalf;
|
||||
@ -1028,8 +1028,8 @@ public class NMSRelighter implements Relighter {
|
||||
heightMapList.get(HeightMapType.MOTION_BLOCKING)[j] = y + 1;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
log.debug(states.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
LOGGER.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
LOGGER.debug(states.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(", ", "{", "}")));
|
||||
}
|
||||
try {
|
||||
@ -1039,8 +1039,8 @@ public class NMSRelighter implements Relighter {
|
||||
heightMapList.get(HeightMapType.MOTION_BLOCKING_NO_LEAVES)[j] = y + 1;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
log.debug(states.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
LOGGER.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
LOGGER.debug(states.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(", ", "{", "}")));
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -28,8 +26,6 @@ import java.util.function.Supplier;
|
||||
|
||||
public class MultiBatchProcessor implements IBatchProcessor {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MultiBatchProcessor.class);
|
||||
|
||||
private IBatchProcessor[] processors;
|
||||
private final LoadingCache<Class<?>, Map<Long, Filter>> classToThreadIdToFilter =
|
||||
FaweCache.IMP.createCache((Supplier<Map<Long, Filter>>) ConcurrentHashMap::new);
|
||||
|
@ -21,9 +21,9 @@ import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.MemUtil;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@ -38,8 +38,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
|
||||
|
||||
// Don't bother with the full classpath.
|
||||
private static final Logger log = LoggerFactory.getLogger("SingleThreadQueueExtent");
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
// Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
@ -302,10 +301,10 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
future = (Future) future.get();
|
||||
}
|
||||
} catch (FaweException messageOnly) {
|
||||
log.warn(messageOnly.getMessage());
|
||||
LOGGER.warn(messageOnly.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
if (e.getCause() instanceof FaweException) {
|
||||
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
LOGGER.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -321,10 +320,10 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
first = (Future) first.get();
|
||||
}
|
||||
} catch (FaweException messageOnly) {
|
||||
log.warn(messageOnly.getMessage());
|
||||
LOGGER.warn(messageOnly.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
if (e.getCause() instanceof FaweException) {
|
||||
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
LOGGER.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -340,14 +339,14 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
try {
|
||||
next = (Future) next.get();
|
||||
} catch (FaweException messageOnly) {
|
||||
log.warn(messageOnly.getMessage());
|
||||
LOGGER.warn(messageOnly.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
if (e.getCause() instanceof FaweException) {
|
||||
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
LOGGER.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log.error("Please report this error on our issue tracker");
|
||||
LOGGER.error("Please report this error on our issue tracker: https://github.com/IntellectualSites/FastAsyncWorldEdit/issues");
|
||||
e.getCause().printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -3,8 +3,8 @@ package com.boydti.fawe.config;
|
||||
import com.boydti.fawe.configuration.MemorySection;
|
||||
import com.boydti.fawe.configuration.file.YamlConfiguration;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
|
||||
public class Config {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(Config.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public Config() {
|
||||
save(new PrintWriter(new ByteArrayOutputStream(0)), getClass(), this, 0);
|
||||
@ -48,7 +48,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("Failed to get config option: " + key);
|
||||
LOGGER.debug("Failed to get config option: " + key);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("Failed to set config option: " + key + ": " + value + " | " + instance + " | " + root.getSimpleName() + ".yml");
|
||||
LOGGER.debug("Failed to set config option: " + key + ": " + value + " | " + instance + " | " + root.getSimpleName() + ".yml");
|
||||
}
|
||||
|
||||
public boolean load(File file) {
|
||||
@ -333,7 +333,7 @@ public class Config {
|
||||
setAccessible(field);
|
||||
return field;
|
||||
} catch (Throwable ignored) {
|
||||
log.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance.getClass().getSimpleName()));
|
||||
LOGGER.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance.getClass().getSimpleName()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package com.boydti.fawe.configuration.file;
|
||||
import com.boydti.fawe.configuration.Configuration;
|
||||
import com.boydti.fawe.configuration.ConfigurationSection;
|
||||
import com.boydti.fawe.configuration.InvalidConfigurationException;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
@ -16,13 +18,13 @@ import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* An implementation of {@link com.boydti.fawe.configuration.Configuration} which saves all files in Yaml.
|
||||
* Note that this implementation is not synchronized.
|
||||
*/
|
||||
public class YamlConfiguration extends FileConfiguration {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
protected static final String COMMENT_PREFIX = "# ";
|
||||
protected static final String BLANK_CONFIG = "{}\n";
|
||||
private final DumperOptions yamlOptions = new DumperOptions();
|
||||
@ -64,8 +66,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
||||
}
|
||||
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
getLogger(YamlConfiguration.class).error("Could not read: {}\n"
|
||||
+ "Renamed to: {}", file, dest.getName(), ex);
|
||||
LOGGER.error("Could not read {}\n" + "Renamed to {}", file, dest.getAbsolutePath(), ex);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -97,7 +98,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
try {
|
||||
config.load(reader);
|
||||
} catch (final IOException | InvalidConfigurationException ex) {
|
||||
getLogger(YAMLConfiguration.class).error("Cannot load configuration from stream", ex);
|
||||
LOGGER.error("Cannot load configuration from stream", ex);
|
||||
}
|
||||
|
||||
return config;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.boydti.fawe.configuration.serialization;
|
||||
|
||||
import com.boydti.fawe.configuration.Configuration;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -14,6 +15,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class ConfigurationSerialization {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public static final String SERIALIZED_TYPE_KEY = "==";
|
||||
private static final Map<String, Class<? extends ConfigurationSerializable>> aliases =
|
||||
new HashMap<>();
|
||||
@ -196,15 +199,14 @@ public class ConfigurationSerialization {
|
||||
ConfigurationSerializable result = (ConfigurationSerializable) method.invoke(null, args);
|
||||
|
||||
if (result == null) {
|
||||
LoggerFactory.getLogger(ConfigurationSerialization.class).error(
|
||||
"Could not call method '" + method.toString() + "' of " + this.clazz + " for deserialization: method returned null");
|
||||
LOGGER.error("Could not call method '" + method.toString() + "' of " + this.clazz + " for deserialization: method returned null");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
LoggerFactory.getLogger(ConfigurationSerialization.class).error("Could not call method '" + method.toString() + "' of " + this.clazz
|
||||
+ " for deserialization",
|
||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
||||
LOGGER.error("Could not call method '" + method.toString() + "' of " + this.clazz
|
||||
+ " for deserialization",
|
||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -214,9 +216,9 @@ public class ConfigurationSerialization {
|
||||
try {
|
||||
return ctor.newInstance(args);
|
||||
} catch (Throwable ex) {
|
||||
LoggerFactory.getLogger(ConfigurationSerialization.class).error("Could not call constructor '" + ctor.toString() + "' of " + this.clazz
|
||||
+ " for deserialization",
|
||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
||||
LOGGER.error("Could not call constructor '" + ctor.toString() + "' of " + this.clazz
|
||||
+ " for deserialization",
|
||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1,16 +1,15 @@
|
||||
package com.boydti.fawe.database;
|
||||
|
||||
import com.boydti.fawe.config.Config;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class DBHandler {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(Config.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public static final DBHandler IMP = new DBHandler();
|
||||
|
||||
@ -26,7 +25,7 @@ public class DBHandler {
|
||||
databases.put(world, database);
|
||||
return database;
|
||||
} catch (Throwable e) {
|
||||
log.error("No JDBC driver found!", e);
|
||||
LOGGER.error("No JDBC driver found!", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||
import com.boydti.fawe.object.collection.YieldIterable;
|
||||
import com.boydti.fawe.object.task.AsyncNotifyQueue;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -32,7 +32,7 @@ import java.util.stream.IntStream;
|
||||
|
||||
public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RollbackDatabase.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final String prefix;
|
||||
private final File dbLocation;
|
||||
@ -309,7 +309,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
dbLocation.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.debug("Unable to create the database!");
|
||||
LOGGER.error("Unable to create the database!");
|
||||
}
|
||||
}
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
|
@ -17,6 +17,7 @@ import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.NBTConstants;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
@ -30,6 +31,7 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -44,9 +46,10 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class MCAChunk implements IChunk {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public final boolean[] hasSections = new boolean[16];
|
||||
|
||||
public boolean hasBiomes = false;
|
||||
@ -310,7 +313,7 @@ public class MCAChunk implements IChunk {
|
||||
Object value = state.getState(property);
|
||||
String valueStr = value.toString();
|
||||
if (Character.isUpperCase(valueStr.charAt(0))) {
|
||||
getLogger(MCAChunk.class).warn("Invalid uppercase value {}", value);
|
||||
LOGGER.warn("Invalid uppercase value {}", value);
|
||||
valueStr = valueStr.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
out.writeNamedTag(key, valueStr);
|
||||
|
@ -12,11 +12,13 @@ import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@ -38,8 +40,6 @@ import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* Chunk format: http://minecraft.gamepedia.com/Chunk_format#Entity_format
|
||||
* e.g., `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
||||
@ -47,6 +47,8 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
*/
|
||||
public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, IChunkExtent {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static Field fieldBuf2;
|
||||
|
||||
static {
|
||||
@ -294,7 +296,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
if (offset < offsets.length) {
|
||||
offsets[offset] = i;
|
||||
} else {
|
||||
getLogger(MCAFile.class).debug("Ignoring invalid offset " + offset);
|
||||
LOGGER.debug("Ignoring invalid offset " + offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,16 @@ package com.boydti.fawe.jnbt.streamer;
|
||||
|
||||
import com.sk89q.jnbt.NBTConstants;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class StreamDelegate {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final byte[][] ZERO_KEYS = new byte[0][];
|
||||
private static final StreamDelegate[] ZERO_VALUES = new StreamDelegate[0];
|
||||
|
||||
@ -41,7 +44,7 @@ public class StreamDelegate {
|
||||
|
||||
private StreamDelegate add(String name, StreamDelegate scope) {
|
||||
if (valueReader != null) {
|
||||
getLogger(StreamDelegate.class).warn("Scope {} | {} may not run, as the stream is only read once, and a value reader is already set", name, scope);
|
||||
LOGGER.warn("Scope {} | {} may not run, as the stream is only read once, and a value reader is already set", name, scope);
|
||||
}
|
||||
byte[] bytes = name.getBytes(NBTConstants.CHARSET);
|
||||
int maxSize = bytes.length;
|
||||
@ -169,7 +172,7 @@ public class StreamDelegate {
|
||||
|
||||
public StreamDelegate withValue(ValueReader valueReader) {
|
||||
if (keys.length != 0) {
|
||||
getLogger(StreamDelegate.class).warn("Reader {} may not run, as the stream is only read once, and a value reader is already set", valueReader);
|
||||
LOGGER.warn("Reader {} may not run, as the stream is only read once, and a value reader is already set", valueReader);
|
||||
}
|
||||
this.valueReader = valueReader;
|
||||
return this;
|
||||
|
@ -4,17 +4,20 @@ import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class RollbackOptimizedHistory extends DiskStorageHistory {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private long time;
|
||||
|
||||
private int minX;
|
||||
@ -47,7 +50,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
|
||||
this.blockSize = (int) size;
|
||||
this.command = command;
|
||||
this.closed = true;
|
||||
getLogger(RollbackOptimizedHistory.class).debug("Size {}", size);
|
||||
LOGGER.debug("Size: {}", size);
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -24,16 +25,17 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class InspectBrush extends BrushTool {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* Construct the tool.
|
||||
*/
|
||||
@ -64,13 +66,13 @@ public class InspectBrush extends BrushTool {
|
||||
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
|
||||
if (!player.hasPermission("worldedit.tool.inspect")) {
|
||||
player.print(Caption.of("", "worldedit.tool.inspect"));
|
||||
getLogger(InspectBrush.class).debug("No tool control");
|
||||
LOGGER.debug("No tool control");
|
||||
return false;
|
||||
}
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable",
|
||||
"history.use-database (Import with /history import )"));
|
||||
getLogger(InspectBrush.class).debug("No db");
|
||||
LOGGER.debug("No db");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@ -113,7 +115,7 @@ public class InspectBrush extends BrushTool {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Throwable e) {
|
||||
getLogger(InspectBrush.class).error("E throw", e);
|
||||
LOGGER.error("E throw", e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
@ -60,6 +61,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
@ -75,10 +77,10 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
|
||||
private final DifferentialBlockBuffer blocks;
|
||||
@ -2128,7 +2130,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
|
||||
@Override
|
||||
public IChunkGet get(int x, int z) {
|
||||
getLogger(HeightMapMCAGenerator.class).debug("Should not be using buffering with HMMG");
|
||||
LOGGER.debug("Should not be using buffering with HMMG");
|
||||
return new FallbackChunkGet(this, x, z);
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,18 @@ import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.history.UndoContext;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class CFIChange implements Change {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final File file;
|
||||
|
||||
public CFIChange(File file) {
|
||||
@ -25,7 +29,7 @@ public class CFIChange implements Change {
|
||||
if (found != null) {
|
||||
return found.get();
|
||||
}
|
||||
getLogger(CFIChange.class).debug("FAWE does not support: " + context.getExtent() + " for " + getClass() + " (bug Empire92)");
|
||||
LOGGER.debug("FAWE does not support: " + context.getExtent() + " for " + getClass() + " (bug Empire92)");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -10,18 +10,20 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.history.UndoContext;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class MutableEntityChange implements Change {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public CompoundTag tag;
|
||||
public boolean create;
|
||||
|
||||
@ -59,7 +61,7 @@ public class MutableEntityChange implements Change {
|
||||
most = ((LongTag) map.get("PersistentIDMSB")).getValue();
|
||||
least = ((LongTag) map.get("PersistentIDLSB")).getValue();
|
||||
} else {
|
||||
getLogger(MutableEntityChange.class).debug("Skipping entity without uuid.");
|
||||
LOGGER.debug("Skipping entity without uuid.");
|
||||
return;
|
||||
}
|
||||
List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue();
|
||||
@ -74,7 +76,7 @@ public class MutableEntityChange implements Change {
|
||||
Map<String, Tag> map = tag.getValue();
|
||||
Tag posTag = map.get("Pos");
|
||||
if (posTag == null) {
|
||||
getLogger(MutableEntityChange.class).debug("Missing pos tag: " + tag);
|
||||
LOGGER.debug("Missing pos tag: " + tag);
|
||||
return;
|
||||
}
|
||||
List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue();
|
||||
|
@ -38,7 +38,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.apache.logging.log4j.LogManager.getLogger;
|
||||
|
||||
public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -21,8 +22,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Closeable;
|
||||
@ -53,7 +53,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class DiskOptimizedClipboard extends LinearClipboard implements Closeable {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DiskOptimizedClipboard.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final int HEADER_SIZE = 14;
|
||||
|
||||
@ -80,7 +80,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
||||
if (HEADER_SIZE + ((long) getVolume() << 1) >= Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("Dimensions too large for this clipboard format. Use //lazycopy for large selections.");
|
||||
} else if (HEADER_SIZE + ((long) getVolume() << 1) + (long) ((getHeight() >> 2) + 1) * ((getLength() >> 2) + 1) * ((getWidth() >> 2) + 1) >= Integer.MAX_VALUE) {
|
||||
log.error("Dimensions are too large for biomes to be stored in a DiskOptimizedClipboard");
|
||||
LOGGER.error("Dimensions are too large for biomes to be stored in a DiskOptimizedClipboard");
|
||||
canHaveBiomes = false;
|
||||
}
|
||||
nbtMap = new HashMap<>();
|
||||
|
@ -15,6 +15,7 @@ import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -29,6 +30,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.storage.NBTConversions;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -39,9 +41,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final int WARN_SIZE = 32;
|
||||
|
||||
private NBTInputStream inputStream;
|
||||
@ -160,7 +163,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
int height = region.getHeight();
|
||||
int length = region.getLength();
|
||||
if (width > WARN_SIZE || height > WARN_SIZE || length > WARN_SIZE) {
|
||||
getLogger(MinecraftStructure.class).debug("A structure longer than 32 is unsupported by minecraft (but probably still works)");
|
||||
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);
|
||||
// ignored: version / owner
|
||||
|
@ -36,14 +36,14 @@ import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
@ -53,7 +53,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class EditSessionBuilder {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractDelegateExtent.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@NotNull
|
||||
private World world;
|
||||
@ -246,11 +246,11 @@ public class EditSessionBuilder {
|
||||
event.getActor().printDebug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
|
||||
event.getActor().printDebug(" - To hide this message set `debug` to false in the FAWE config.yml");
|
||||
} else {
|
||||
logger.debug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
|
||||
logger.debug(" - For area restrictions, it is recommended to use the FaweAPI");
|
||||
logger.debug(" - For block logging, it is recommended to use BlocksHub");
|
||||
logger.debug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
|
||||
logger.debug(" - To hide this message set `debug` to false in the FAWE config.yml");
|
||||
LOGGER.debug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
|
||||
LOGGER.debug(" - For area restrictions, it is recommended to use the FaweAPI");
|
||||
LOGGER.debug(" - For block logging, it is recommended to use BlocksHub");
|
||||
LOGGER.debug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
|
||||
LOGGER.debug(" - To hide this message set `debug` to false in the FAWE config.yml");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
@ -32,6 +33,7 @@ import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
import net.jpountz.lz4.LZ4InputStream;
|
||||
import net.jpountz.lz4.LZ4Utils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -89,10 +91,10 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class MainUtil {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public static List<String> filter(String prefix, List<String> suggestions) {
|
||||
if (prefix.isEmpty()) {
|
||||
return suggestions;
|
||||
@ -438,7 +440,7 @@ public class MainUtil {
|
||||
content = scanner.next().trim();
|
||||
}
|
||||
if (!content.startsWith("<")) {
|
||||
getLogger(MainUtil.class).debug(content);
|
||||
LOGGER.debug(content);
|
||||
}
|
||||
if (responseCode == 200) {
|
||||
return url;
|
||||
@ -638,7 +640,7 @@ public class MainUtil {
|
||||
return newFile;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
getLogger(MainUtil.class).debug("Could not save " + resource, e);
|
||||
LOGGER.debug("Could not save " + resource, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -880,7 +882,7 @@ public class MainUtil {
|
||||
pool.submit(file::delete);
|
||||
Component msg = TranslatableComponent.of("worldedit.schematic.delete.deleted");
|
||||
if (printDebug) {
|
||||
getLogger(MainUtil.class).debug(msg.toString());
|
||||
LOGGER.debug(msg.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -4,6 +4,8 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -15,10 +17,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public abstract class TaskManager {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public static TaskManager IMP;
|
||||
|
||||
private final ForkJoinPool pool = new ForkJoinPool();
|
||||
@ -257,7 +259,7 @@ public abstract class TaskManager {
|
||||
running.wait(timeout);
|
||||
if (running.get() && System.currentTimeMillis() - start > Settings.IMP.QUEUE.DISCARD_AFTER_MS) {
|
||||
new RuntimeException("FAWE is taking a long time to execute a task (might just be a symptom): ").printStackTrace();
|
||||
getLogger(TaskManager.class).debug("For full debug information use: /fawe threads");
|
||||
LOGGER.info("For full debug information use: /fawe threads");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.PropertiesConfiguration;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
@ -20,8 +21,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArraySet;
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedInputStream;
|
||||
@ -51,12 +51,12 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.apache.logging.log4j.LogManager.getLogger;
|
||||
|
||||
// TODO FIXME
|
||||
public class TextureUtil implements TextureHolder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TextureUtil.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final int[] FACTORS = new int[766];
|
||||
|
||||
@ -355,7 +355,7 @@ public class TextureUtil implements TextureHolder {
|
||||
this.folder = folder;
|
||||
if (!folder.exists()) {
|
||||
try {
|
||||
log.info("Downloading asset jar from Mojang, please wait...");
|
||||
LOGGER.info("Downloading asset jar from Mojang, please wait...");
|
||||
new File(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/").mkdirs();
|
||||
try (BufferedInputStream in = new BufferedInputStream(new URL("https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar").openStream());
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/1.16.5.jar")) {
|
||||
@ -364,14 +364,14 @@ public class TextureUtil implements TextureHolder {
|
||||
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
||||
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
||||
}
|
||||
log.info("Asset jar down has been downloaded successfully.");
|
||||
LOGGER.info("Asset jar down has been downloaded successfully.");
|
||||
} catch (IOException e) {
|
||||
log.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar in it.");
|
||||
log.error("If the file exists, please make sure the server has read access to the directory.");
|
||||
LOGGER.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar in it.");
|
||||
LOGGER.error("If the file exists, please make sure the server has read access to the directory.");
|
||||
}
|
||||
} catch (AccessControlException e) {
|
||||
log.error("Could not download asset jar. It's likely your file permission are setup improperly and do not allow fetching data from the Mojang servers.");
|
||||
log.error("Please create the following folder manually: `FastAsyncWorldEdit/textures` with `.minecraft/versions` jar in it.");
|
||||
LOGGER.error("Could not download asset jar. It's likely your file permission are setup improperly and do not allow fetching data from the Mojang servers.");
|
||||
LOGGER.error("Please create the following folder manually: `FastAsyncWorldEdit/textures` with `.minecraft/versions` jar in it.");
|
||||
|
||||
}
|
||||
}
|
||||
@ -643,8 +643,8 @@ public class TextureUtil implements TextureHolder {
|
||||
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar or mods in it.");
|
||||
log.error("If the file exists, please make sure the server has read access to the directory.");
|
||||
LOGGER.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar or mods in it.");
|
||||
LOGGER.error("If the file exists, please make sure the server has read access to the directory.");
|
||||
}
|
||||
} else {
|
||||
for (File file : files) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -7,8 +10,6 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/** An internal FAWE class not meant for public use. **/
|
||||
public enum ThirdPartyManager {
|
||||
|
||||
@ -22,6 +23,8 @@ public enum ThirdPartyManager {
|
||||
|
||||
;
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public final String url;
|
||||
public final int fileSize;
|
||||
public final String digest;
|
||||
@ -54,12 +57,12 @@ public enum ThirdPartyManager {
|
||||
String jarDigest = Base64.getEncoder().encodeToString(jarDigestBytes);
|
||||
|
||||
if (this.digest.equals(jarDigest)) {
|
||||
getLogger(ThirdPartyManager.class).debug("++++ HASH CHECK ++++");
|
||||
getLogger(ThirdPartyManager.class).debug(this.url);
|
||||
getLogger(ThirdPartyManager.class).debug(this.digest);
|
||||
LOGGER.debug("++++ HASH CHECK ++++");
|
||||
LOGGER.debug(this.url);
|
||||
LOGGER.debug(this.digest);
|
||||
return jarBytes;
|
||||
} else {
|
||||
getLogger(ThirdPartyManager.class).debug(jarDigest + " | " + url);
|
||||
LOGGER.debug(jarDigest + " | " + url);
|
||||
throw new IllegalStateException("The downloaded jar does not match the hash");
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
|
@ -10,12 +10,12 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashSet;
|
||||
@ -24,14 +24,14 @@ import java.util.Set;
|
||||
|
||||
public class WEManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WEManager.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public static final WEManager IMP = new WEManager();
|
||||
|
||||
public final ArrayDeque<FaweMaskManager> managers = new ArrayDeque<>();
|
||||
|
||||
public void cancelEditSafe(AbstractDelegateExtent parent, FaweException reason) throws FaweException {
|
||||
log.warn("CancelEditSafe was hit. Please ignore this message.");
|
||||
LOGGER.warn("CancelEditSafe was hit. Please ignore this message.");
|
||||
Extent currentExtent = parent.getExtent();
|
||||
if (!(currentExtent instanceof NullExtent)) {
|
||||
parent.extent = new NullExtent(parent.extent, reason);
|
||||
@ -123,10 +123,10 @@ public class WEManager {
|
||||
player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey()));
|
||||
}
|
||||
}
|
||||
log.debug("Region info for " + player.getName());
|
||||
log.debug("There are " + backupRegions.size() + " backupRegions being added to Regions. Regions has " + regions.size() + " before backupRegions are added");
|
||||
LOGGER.debug("Region info for " + player.getName());
|
||||
LOGGER.debug("There are " + backupRegions.size() + " backupRegions being added to Regions. Regions has " + regions.size() + " before backupRegions are added");
|
||||
regions.addAll(backupRegions);
|
||||
log.debug("Finished adding regions for " + player.getName());
|
||||
LOGGER.debug("Finished adding regions for " + player.getName());
|
||||
if (!masks.isEmpty()) {
|
||||
player.setMeta("lastMask", masks);
|
||||
} else {
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -64,8 +64,7 @@ import java.util.Set;
|
||||
@Deprecated
|
||||
public abstract class CommandsManager<T> {
|
||||
|
||||
protected static final Logger logger =
|
||||
LoggerFactory.getLogger(CommandsManager.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* Mapping of commands (including aliases) with a description. Root
|
||||
@ -144,7 +143,7 @@ public abstract class CommandsManager<T> {
|
||||
return registerMethods(cls, parent, obj);
|
||||
}
|
||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
logger.error("Failed to register commands", e);
|
||||
LOGGER.error("Failed to register commands", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -525,7 +524,7 @@ public abstract class CommandsManager<T> {
|
||||
try {
|
||||
method.invoke(instance, methodArgs);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
logger.error("Failed to execute command", e);
|
||||
LOGGER.error("Failed to execute command", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
if (e.getCause() instanceof CommandException) {
|
||||
throw (CommandException) e.getCause();
|
||||
|
@ -19,15 +19,15 @@
|
||||
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class SimpleInjector implements Injector {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SimpleInjector.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private Object[] args;
|
||||
private Class<?>[] argClasses;
|
||||
|
||||
@ -46,7 +46,7 @@ public class SimpleInjector implements Injector {
|
||||
ctr.setAccessible(true);
|
||||
return ctr.newInstance(args);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
|
||||
log.error("Error initializing commands class " + clazz, e);
|
||||
LOGGER.error("Error initializing commands class " + clazz, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionTimeoutException;
|
||||
import com.sk89q.worldedit.internal.expression.LocalSlot.Variable;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MathUtils;
|
||||
@ -134,10 +135,9 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -170,7 +170,7 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
@SuppressWarnings({"FieldCanBeLocal"})
|
||||
public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EditSession.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to
|
||||
@ -2555,7 +2555,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
timedOut[0] = timedOut[0] + 1;
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to create shape", e);
|
||||
LOGGER.warn("Failed to create shape", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -3091,7 +3091,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
timedOut.getAndIncrement();
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to create shape", e);
|
||||
LOGGER.warn("Failed to create shape", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.io.file.ArchiveNioSupports;
|
||||
import com.sk89q.worldedit.util.logging.LogFormat;
|
||||
@ -33,8 +34,7 @@ import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||
import com.sk89q.worldedit.world.snapshot.experimental.SnapshotDatabase;
|
||||
import com.sk89q.worldedit.world.snapshot.experimental.fs.FileSystemSnapshotDatabase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -51,7 +51,7 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class LocalConfiguration {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LocalConfiguration.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public boolean profile = false;
|
||||
public boolean traceUnflushedSessions = false;
|
||||
|
@ -46,6 +46,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.SchematicsEventListener;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.invoke.ReturnException;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||
@ -71,8 +72,7 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
import com.sk89q.worldedit.world.registry.BundledItemData;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
@ -109,7 +109,10 @@ import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
|
||||
*/
|
||||
public final class WorldEdit {
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(WorldEdit.class);
|
||||
/**
|
||||
* This is for internal use only.
|
||||
*/
|
||||
public static final Logger logger = LogManagerCompat.getLogger();
|
||||
|
||||
private static final WorldEdit instance = new WorldEdit();
|
||||
private static String version;
|
||||
|
@ -45,6 +45,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
@ -58,14 +59,13 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -102,7 +102,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class SchematicCommands {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SchematicCommands.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
/**
|
||||
@ -304,7 +304,7 @@ public class SchematicCommands {
|
||||
actor.printError("Unknown filename: " + filename);
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
actor.printError("File could not be read or it does not exist: " + e.getMessage());
|
||||
log.warn("Failed to load a saved clipboard", e);
|
||||
LOGGER.warn("Failed to load a saved clipboard", e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
@ -701,7 +701,7 @@ public class SchematicCommands {
|
||||
ClipboardReader reader = closer.register(format.getReader(bis));
|
||||
|
||||
Clipboard clipboard = reader.read();
|
||||
log.info(actor.getName() + " loaded " + file.getCanonicalPath());
|
||||
LOGGER.info(actor.getName() + " loaded " + file.getCanonicalPath());
|
||||
return new ClipboardHolder(clipboard);
|
||||
}
|
||||
}
|
||||
@ -785,7 +785,7 @@ public class SchematicCommands {
|
||||
TextComponent noSlotsErr = TextComponent.of( //TODO - to be moved into captions/translatablecomponents
|
||||
String.format("You have " + numFiles + "/" + limit + " saved schematics. Delete some to save this one!",
|
||||
TextColor.RED));
|
||||
log.info(actor.getName() + " failed to save " + file.getCanonicalPath() + " - too many schematics!");
|
||||
LOGGER.info(actor.getName() + " failed to save " + file.getCanonicalPath() + " - too many schematics!");
|
||||
throw new WorldEditException(noSlotsErr) {
|
||||
};
|
||||
}
|
||||
@ -838,7 +838,7 @@ public class SchematicCommands {
|
||||
"You're about to be at " + String.format("%.1f", curKb) + "kb of schematics. ("
|
||||
+ String.format("%dkb", allocatedKb) + " available) Delete some first to save this one!",
|
||||
TextColor.RED);
|
||||
log.info(actor.getName() + " failed to save " + SCHEMATIC_NAME + " - not enough space!");
|
||||
LOGGER.info(actor.getName() + " failed to save " + SCHEMATIC_NAME + " - not enough space!");
|
||||
throw new WorldEditException(notEnoughKbErr) {
|
||||
};
|
||||
}
|
||||
@ -860,7 +860,7 @@ public class SchematicCommands {
|
||||
+ " schematic file slots left.", TextColor.GRAY);
|
||||
actor.print(slotsRemainingNotif);
|
||||
}
|
||||
log.info(actor.getName() + " saved " + file.getCanonicalPath());
|
||||
LOGGER.info(actor.getName() + " saved " + file.getCanonicalPath());
|
||||
} else {
|
||||
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public enum SelectionWand implements DoubleActionBlockTool {
|
||||
INSTANCE;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SelectionWand.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
@ -43,7 +43,7 @@ public enum SelectionWand implements DoubleActionBlockTool {
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("actSecondary Hit and about to explain with explainPrimarySelection");
|
||||
LOGGER.info("actSecondary Hit and about to explain with explainPrimarySelection");
|
||||
}
|
||||
selector.explainPrimarySelection(player, session, blockPoint);
|
||||
}
|
||||
@ -57,7 +57,7 @@ public enum SelectionWand implements DoubleActionBlockTool {
|
||||
|
||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("actPrimary Hit and about to explain with explainSecondarySelection");
|
||||
LOGGER.info("actPrimary Hit and about to explain with explainSecondarySelection");
|
||||
}
|
||||
selector.explainSecondarySelection(player, session, blockPoint);
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.command.exception.ExceptionConverter;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.task.FutureForwardingTask;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.exception.CommandException;
|
||||
import org.enginehub.piston.exception.CommandExecutionException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
@ -45,7 +45,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class AsyncCommandBuilder<T> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AsyncCommandBuilder.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final Callable<T> callable;
|
||||
private final Actor sender;
|
||||
@ -174,7 +174,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
}
|
||||
} catch (Throwable unknown) {
|
||||
sender.printError(failure.append(TextComponent.of(": Unknown error. Please see console.")));
|
||||
logger.error("Uncaught exception occurred in task: " + description, orig);
|
||||
LOGGER.error("Uncaught exception occurred in task: " + description, orig);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -20,8 +20,6 @@ import org.enginehub.piston.inject.InjectAnnotation;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.inject.MemoizingValueAccess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@ -160,7 +158,6 @@ public @interface Confirm {
|
||||
final MemoizingValueAccess memoizingValueAccess;
|
||||
if (!(context instanceof MemoizingValueAccess)) {
|
||||
if (!context.getClass().getSimpleName().contains("AutoValue_CommandParametersImpl")) {
|
||||
LoggerFactory.getLogger(Confirm.class).warn("InjectedValueAccess " + context.getClass().getName() + " given to Confirm");
|
||||
return true;
|
||||
}
|
||||
memoizingValueAccess = (MemoizingValueAccess) Reflect.injectedValues.get(context);
|
||||
|
@ -121,6 +121,7 @@ import com.sk89q.worldedit.internal.command.ConfirmHandler;
|
||||
import com.sk89q.worldedit.internal.command.MethodInjector;
|
||||
import com.sk89q.worldedit.internal.command.exception.ExceptionConverter;
|
||||
import com.sk89q.worldedit.internal.command.exception.WorldEditExceptionConverter;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.internal.util.Substring;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
@ -133,6 +134,7 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.logging.DynamicStreamHandler;
|
||||
import com.sk89q.worldedit.util.logging.LogFormat;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.converter.ArgumentConverter;
|
||||
@ -155,8 +157,6 @@ import org.enginehub.piston.suggestion.Suggestion;
|
||||
import org.enginehub.piston.util.HelpGenerator;
|
||||
import org.enginehub.piston.util.ValueProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -185,7 +185,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public final class PlatformCommandManager {
|
||||
|
||||
public static final Pattern COMMAND_CLEAN_PATTERN = Pattern.compile("^[/]+");
|
||||
private static final Logger log = LoggerFactory.getLogger(PlatformCommandManager.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static final java.util.logging.Logger COMMAND_LOG =
|
||||
java.util.logging.Logger.getLogger("com.sk89q.worldedit.CommandLog");
|
||||
|
||||
@ -567,7 +567,7 @@ public final class PlatformCommandManager {
|
||||
}
|
||||
|
||||
void registerCommandsWith(Platform platform) {
|
||||
log.info("Registering commands with " + platform.getClass().getCanonicalName());
|
||||
LOGGER.info("Registering commands with " + platform.getClass().getCanonicalName());
|
||||
|
||||
|
||||
LocalConfiguration config = platform.getConfiguration();
|
||||
@ -582,12 +582,12 @@ public final class PlatformCommandManager {
|
||||
File file = new File(config.getWorkingDirectory(), path);
|
||||
COMMAND_LOG.setLevel(Level.ALL);
|
||||
|
||||
log.info("Logging WorldEdit commands to " + file.getAbsolutePath());
|
||||
LOGGER.info("Logging WorldEdit commands to " + file.getAbsolutePath());
|
||||
|
||||
try {
|
||||
dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true));
|
||||
} catch (IOException e) {
|
||||
log.warn("Could not use command log file " + path + ": " + e.getMessage());
|
||||
LOGGER.warn("Could not use command log file " + path + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
dynamicHandler.setFormatter(new LogFormat(config.logFormat));
|
||||
@ -828,7 +828,7 @@ public final class PlatformCommandManager {
|
||||
private void handleUnknownException(Actor actor, Throwable t) {
|
||||
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
|
||||
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
|
||||
log.error("An unexpected error while handling a WorldEdit command", t);
|
||||
LOGGER.error("An unexpected error while handling a WorldEdit command", t);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -848,7 +848,7 @@ public final class PlatformCommandManager {
|
||||
suggestions = commandManager.getSuggestions(access, argStrings);
|
||||
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
|
||||
if (!(t instanceof CommandException)) {
|
||||
log.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t);
|
||||
LOGGER.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t);
|
||||
return;
|
||||
}
|
||||
throw t;
|
||||
|
@ -41,6 +41,7 @@ import com.sk89q.worldedit.event.platform.Interaction;
|
||||
import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -48,8 +49,7 @@ import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -71,7 +71,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class PlatformManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
private final PlatformCommandManager platformCommandManager;
|
||||
@ -104,7 +104,7 @@ public class PlatformManager {
|
||||
public synchronized void register(Platform platform) {
|
||||
checkNotNull(platform);
|
||||
|
||||
logger.info("Got request to register " + platform.getClass() + " with WorldEdit [" + super.toString() + "]");
|
||||
LOGGER.info("Got request to register " + platform.getClass() + " with WorldEdit [" + super.toString() + "]");
|
||||
|
||||
// Just add the platform to the list of platforms: we'll pick favorites
|
||||
// once all the platforms have been loaded
|
||||
@ -113,7 +113,7 @@ public class PlatformManager {
|
||||
// Make sure that versions are in sync
|
||||
if (firstSeenVersion != null) {
|
||||
if (!firstSeenVersion.equals(platform.getVersion())) {
|
||||
logger.warn("Multiple ports of WorldEdit are installed but they report different versions ({} and {}). "
|
||||
LOGGER.warn("Multiple ports of WorldEdit are installed but they report different versions ({} and {}). "
|
||||
+ "If these two versions are truly different, then you may run into unexpected crashes and errors.", firstSeenVersion, platform.getVersion());
|
||||
}
|
||||
} else {
|
||||
@ -135,7 +135,7 @@ public class PlatformManager {
|
||||
boolean removed = platforms.remove(platform);
|
||||
|
||||
if (removed) {
|
||||
logger.info("Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit");
|
||||
LOGGER.info("Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit");
|
||||
|
||||
boolean choosePreferred = false;
|
||||
|
||||
@ -349,7 +349,7 @@ public class PlatformManager {
|
||||
VirtualWorld virtual = session.getVirtualWorld();
|
||||
if (virtual != null) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("virtualWorld was not null in handlePlayerInput()");
|
||||
LOGGER.info("virtualWorld was not null in handlePlayerInput()");
|
||||
}
|
||||
|
||||
virtual.handleBlockInteract(player, vector.toBlockPoint(), event);
|
||||
@ -423,7 +423,7 @@ public class PlatformManager {
|
||||
VirtualWorld virtual = session.getVirtualWorld();
|
||||
if (virtual != null) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("virtualWorld was not null in handlePlayerInput()");
|
||||
LOGGER.info("virtualWorld was not null in handlePlayerInput()");
|
||||
}
|
||||
virtual.handlePlayerInput(player, event);
|
||||
if (event.isCancelled()) {
|
||||
|
@ -2,8 +2,10 @@ package com.sk89q.worldedit.extension.platform.binding;
|
||||
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.converter.ArgumentConverter;
|
||||
import org.enginehub.piston.converter.ConversionResult;
|
||||
@ -20,10 +22,10 @@ import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class Bindings {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public Bindings(WorldEdit worldEdit) {
|
||||
@ -57,7 +59,7 @@ public class Bindings {
|
||||
Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0];
|
||||
key = Key.of(ret, annotation);
|
||||
} else {
|
||||
getLogger(Bindings.class).debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
||||
LOGGER.debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -39,23 +40,22 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.Range;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.apache.logging.log4j.LogManager.getLogger;
|
||||
|
||||
/**
|
||||
* A base class for {@link Extent}s that merely passes extents onto another.
|
||||
*/
|
||||
public class AbstractDelegateExtent implements Extent {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractDelegateExtent.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
//Not safe for public usage
|
||||
public Extent extent;
|
||||
@ -298,11 +298,11 @@ public class AbstractDelegateExtent implements Extent {
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("addProcessor Info: \t " + processor.getClass().getName());
|
||||
logger.info("The following is not an error or a crash:");
|
||||
LOGGER.info("addProcessor Info: \t " + processor.getClass().getName());
|
||||
LOGGER.info("The following is not an error or a crash:");
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
for (StackTraceElement stackTraceElement : stackTrace) {
|
||||
logger.info(stackTraceElement.toString());
|
||||
LOGGER.info(stackTraceElement.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@ -316,11 +316,11 @@ public class AbstractDelegateExtent implements Extent {
|
||||
@Override
|
||||
public Extent addPostProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("addPostProcessor Info: \t " + processor.getClass().getName());
|
||||
logger.info("The following is not an error or a crash:");
|
||||
LOGGER.info("addPostProcessor Info: \t " + processor.getClass().getName());
|
||||
LOGGER.info("The following is not an error or a crash:");
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
for (StackTraceElement stackTraceElement : stackTrace) {
|
||||
logger.info(stackTraceElement.toString());
|
||||
LOGGER.info(stackTraceElement.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.DataFixer;
|
||||
@ -52,8 +53,7 @@ import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -71,7 +71,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class FastSchematicReader extends NBTSchematicReader {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FastSchematicReader.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private final NBTInputStream inputStream;
|
||||
private DataFixer fixer;
|
||||
private int dataVersion = -1;
|
||||
@ -183,7 +183,7 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
try {
|
||||
state = BlockState.get(palettePart);
|
||||
} catch (InputParseException ignored) {
|
||||
log.warn("Invalid BlockState in palette: " + palettePart + ". Block will be replaced with air.");
|
||||
LOGGER.warn("Invalid BlockState in palette: " + palettePart + ". Block will be replaced with air.");
|
||||
state = BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
int index = (int) entry.getValue();
|
||||
@ -395,14 +395,14 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
for (Entity e : clipboard.getEntities()) {
|
||||
clipboard.removeEntity(e);
|
||||
}
|
||||
log.error("Detected schematic entity outside clipboard region. FAWE will not load entities. "
|
||||
LOGGER.error("Detected schematic entity outside clipboard region. FAWE will not load entities. "
|
||||
+ "Please try loading the schematic with the format \"legacyentity\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
clipboard.createEntity(loc.setPosition(loc.subtract(min.toVector3())), state);
|
||||
} else {
|
||||
log.debug("Invalid entity: " + id);
|
||||
LOGGER.debug("Invalid entity: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NoteBlockCompatibili
|
||||
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.Pre13HangingCompatibilityHandler;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.SignCompatibilityHandler;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.SkullBlockCompatibilityHandler;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -52,8 +53,7 @@ import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.storage.NBTConversions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -71,7 +71,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MCEditSchematicReader.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private final NBTInputStream inputStream;
|
||||
private final DataFixer fixer;
|
||||
private static final ImmutableList<NBTCompatibilityHandler> COMPATIBILITY_HANDLERS
|
||||
@ -253,7 +253,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
byte data = blockData[index];
|
||||
int combined = block << 8 | data;
|
||||
if (unknownBlocks.add(combined)) {
|
||||
log.warn("Unknown block when loading schematic: "
|
||||
LOGGER.warn("Unknown block when loading schematic: "
|
||||
+ block + ":" + data + ". This is most likely a bad schematic.");
|
||||
}
|
||||
}
|
||||
@ -289,7 +289,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
BaseEntity state = new BaseEntity(entityType, compound);
|
||||
clipboard.createEntity(location, state);
|
||||
} else {
|
||||
log.warn("Unknown entity when pasting schematic: " + id.toLowerCase(Locale.ROOT));
|
||||
LOGGER.warn("Unknown entity when pasting schematic: " + id.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -52,8 +53,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.storage.NBTConversions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -70,7 +70,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SpongeSchematicReader.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private final NBTInputStream inputStream;
|
||||
private DataFixer fixer = null;
|
||||
private int schematicVersion = -1;
|
||||
@ -102,21 +102,21 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
} else if (schematicVersion == 2) {
|
||||
dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue();
|
||||
if (dataVersion < 0) {
|
||||
log.warn("Schematic has an unknown data version ({}). Data may be incompatible.",
|
||||
LOGGER.warn("Schematic has an unknown data version ({}). Data may be incompatible.",
|
||||
dataVersion);
|
||||
// Do not DFU unknown data
|
||||
dataVersion = liveDataVersion;
|
||||
}
|
||||
if (dataVersion > liveDataVersion) {
|
||||
log.warn("Schematic was made in a newer Minecraft version ({} > {}). Data may be incompatible.",
|
||||
LOGGER.warn("Schematic was made in a newer Minecraft version ({} > {}). Data may be incompatible.",
|
||||
dataVersion, liveDataVersion);
|
||||
} else if (dataVersion < liveDataVersion) {
|
||||
fixer = platform.getDataFixer();
|
||||
if (fixer != null) {
|
||||
log.debug("Schematic was made in an older Minecraft version ({} < {}), will attempt DFU.",
|
||||
LOGGER.debug("Schematic was made in an older Minecraft version ({} < {}), will attempt DFU.",
|
||||
dataVersion, liveDataVersion);
|
||||
} else {
|
||||
log.info("Schematic was made in an older Minecraft version ({} < {}), but DFU is not available. Data may be incompatible.",
|
||||
LOGGER.info("Schematic was made in an older Minecraft version ({} < {}), but DFU is not available. Data may be incompatible.",
|
||||
dataVersion, liveDataVersion);
|
||||
}
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
try {
|
||||
state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState();
|
||||
} catch (InputParseException e) {
|
||||
log.warn("Invalid BlockState in palette: " + palettePart + ". Block will be replaced with air.");
|
||||
LOGGER.warn("Invalid BlockState in palette: " + palettePart + ". Block will be replaced with air.");
|
||||
state = BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
palette.put(id, state);
|
||||
@ -327,7 +327,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
}
|
||||
BiomeType biome = BiomeTypes.get(key);
|
||||
if (biome == null) {
|
||||
log.warn("Unknown biome type :" + key
|
||||
LOGGER.warn("Unknown biome type :" + key
|
||||
+ " in palette. Are you missing a mod or using a schematic made in a newer version of Minecraft?");
|
||||
}
|
||||
Tag idTag = palettePart.getValue();
|
||||
@ -396,7 +396,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
BaseEntity state = new BaseEntity(entityType, entityTag);
|
||||
clipboard.createEntity(location, state);
|
||||
} else {
|
||||
log.warn("Unknown entity when pasting schematic: " + id);
|
||||
LOGGER.warn("Unknown entity when pasting schematic: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
@ -43,6 +44,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -73,7 +75,6 @@ import static com.sk89q.worldedit.util.Direction.UP;
|
||||
import static com.sk89q.worldedit.util.Direction.WEST;
|
||||
import static com.sk89q.worldedit.util.Direction.findClosest;
|
||||
import static com.sk89q.worldedit.util.Direction.values;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* Transforms blocks themselves (but not their position) according to a
|
||||
@ -81,6 +82,8 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
*/
|
||||
public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final Set<PropertyKey> directional = PropertyKeySet.of(
|
||||
PropertyKey.HALF,
|
||||
PropertyKey.ROTATION,
|
||||
@ -174,7 +177,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
case 2:
|
||||
return adapt(combine(EAST, WEST), combine(SOUTH, NORTH));
|
||||
default:
|
||||
getLogger(BlockTransformExtent.class).error("Invalid {} {}", property.getName(), property.getValues());
|
||||
LOGGER.error("Invalid {} {}", property.getName(), property.getValues());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -207,7 +210,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
result.add(notIndex(combine(NORTHEAST, NORTHWEST, SOUTHWEST, SOUTHEAST), property.getIndexFor("inner_left"), property.getIndexFor("inner_right")));
|
||||
continue;
|
||||
default:
|
||||
getLogger(BlockTransformExtent.class).warn("Unknown direction {}", value);
|
||||
LOGGER.warn("Unknown direction {}", value);
|
||||
result.add(0L);
|
||||
}
|
||||
}
|
||||
@ -247,7 +250,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
directions.add(combine(NORTHEAST));
|
||||
break;
|
||||
default:
|
||||
getLogger(BlockTransformExtent.class).warn("Unknown direction {}", value);
|
||||
LOGGER.warn("Unknown direction {}", value);
|
||||
directions.add(0L);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
@ -37,7 +39,6 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* Combines several masks and requires that all masks return true
|
||||
@ -46,6 +47,8 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
*/
|
||||
public class MaskIntersection extends AbstractMask {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
protected final Set<Mask> masks;
|
||||
protected Mask[] masksArray;
|
||||
protected boolean defaultReturn;
|
||||
@ -160,9 +163,9 @@ public class MaskIntersection extends AbstractMask {
|
||||
while (combineMasks(pairingFunction(), failedCombines) && --maxIteration > 0);
|
||||
|
||||
if (maxIteration == 0) {
|
||||
getLogger(MaskIntersection.class).error("Failed optimize MaskIntersection");
|
||||
LOGGER.error("Failed optimize MaskIntersection");
|
||||
for (Mask mask : masks) {
|
||||
getLogger(MaskIntersection.class).error(mask.getClass() + " / " + mask);
|
||||
LOGGER.error(mask.getClass() + " / " + mask);
|
||||
}
|
||||
}
|
||||
// Return result
|
||||
|
@ -20,9 +20,9 @@
|
||||
package com.sk89q.worldedit.internal;
|
||||
|
||||
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
@ -31,7 +31,7 @@ import java.nio.file.Path;
|
||||
|
||||
public class SchematicsEventListener {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SchematicsEventListener.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@Subscribe
|
||||
public void onConfigLoad(ConfigurationLoadEvent event) {
|
||||
|
@ -27,9 +27,9 @@ import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
@ -52,7 +52,7 @@ import java.util.stream.Stream;
|
||||
public final class ChunkDeleter {
|
||||
|
||||
public static final String DELCHUNKS_FILE_NAME = "delete_chunks.json";
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChunkDeleter.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();;
|
||||
|
||||
private static final Comparator<BlockVector2> chunkSorter = Comparator.comparing(
|
||||
pos -> (pos.getBlockX() & 31) + (pos.getBlockZ() & 31) * 32
|
||||
@ -80,13 +80,13 @@ public final class ChunkDeleter {
|
||||
try {
|
||||
chunkDeleter = createFromFile(chunkFile);
|
||||
} catch (JsonSyntaxException | IOException e) {
|
||||
logger.error("Could not parse chunk deletion file. Invalid file?", e);
|
||||
LOGGER.error("Could not parse chunk deletion file. Invalid file?", e);
|
||||
return;
|
||||
}
|
||||
logger.info("Found chunk deletions. Proceeding with deletion...");
|
||||
LOGGER.info("Found chunk deletions. Proceeding with deletion...");
|
||||
long start = System.currentTimeMillis();
|
||||
if (chunkDeleter.runDeleter()) {
|
||||
logger.info("Successfully deleted {} matching chunks (out of {}, taking {} ms).",
|
||||
LOGGER.info("Successfully deleted {} matching chunks (out of {}, taking {} ms).",
|
||||
chunkDeleter.getDeletedChunkCount(), chunkDeleter.getDeletionsRequested(),
|
||||
System.currentTimeMillis() - start);
|
||||
if (deleteOnSuccess) {
|
||||
@ -96,12 +96,12 @@ public final class ChunkDeleter {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
if (!deletedFile) {
|
||||
logger.warn("Chunk deletion file could not be cleaned up. This may have unintended consequences"
|
||||
LOGGER.warn("Chunk deletion file could not be cleaned up. This may have unintended consequences"
|
||||
+ " on next startup, or if /delchunks is used again.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Error occurred while deleting chunks. "
|
||||
LOGGER.error("Error occurred while deleting chunks. "
|
||||
+ "If world errors occur, stop the server and restore the *.bak backup files.");
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@ public final class ChunkDeleter {
|
||||
|
||||
private boolean runBatch(ChunkDeletionInfo.ChunkBatch chunkBatch) {
|
||||
int chunkCount = chunkBatch.getChunkCount();
|
||||
logger.debug("Processing deletion batch with {} chunks.", chunkCount);
|
||||
LOGGER.debug("Processing deletion batch with {} chunks.", chunkCount);
|
||||
final Map<Path, Stream<BlockVector2>> regionToChunkList = groupChunks(chunkBatch);
|
||||
BiPredicate<RegionAccess, BlockVector2> predicate = createPredicates(chunkBatch.deletionPredicates);
|
||||
shouldPreload = chunkBatch.chunks == null;
|
||||
@ -147,7 +147,7 @@ public final class ChunkDeleter {
|
||||
try {
|
||||
backupRegion(regionPath);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Error backing up region file: " + regionPath + ". Aborting the process.", e);
|
||||
LOGGER.warn("Error backing up region file: " + regionPath + ". Aborting the process.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -263,15 +263,15 @@ public final class ChunkDeleter {
|
||||
region.deleteChunk(chunk);
|
||||
totalChunksDeleted++;
|
||||
if (debugRate != 0 && totalChunksDeleted % debugRate == 0) {
|
||||
logger.debug("Deleted {} chunks so far.", totalChunksDeleted);
|
||||
LOGGER.debug("Deleted {} chunks so far.", totalChunksDeleted);
|
||||
}
|
||||
} else {
|
||||
logger.debug("Chunk did not match predicates: " + chunk);
|
||||
LOGGER.debug("Chunk did not match predicates: " + chunk);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
logger.warn("Error deleting chunks from region: " + regionFile + ". Aborting the process.", e);
|
||||
LOGGER.warn("Error deleting chunks from region: " + regionFile + ". Aborting the process.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.internal.util;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LogManagerCompat {
|
||||
|
||||
public static Logger getLogger() {
|
||||
return LogManager.getLogger(getCallerCallerClassName());
|
||||
}
|
||||
|
||||
private static String getCallerCallerClassName() {
|
||||
List<StackTraceElement> lazyStack = Throwables.lazyStackTrace(new Throwable());
|
||||
// 0 - this method
|
||||
// 1 - caller
|
||||
// 2 - caller caller
|
||||
return lazyStack.get(2).getClassName();
|
||||
}
|
||||
|
||||
private LogManagerCompat() {
|
||||
}
|
||||
}
|
@ -21,9 +21,9 @@
|
||||
|
||||
package com.sk89q.worldedit.math.interpolation;
|
||||
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
@ -39,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class ReparametrisingInterpolation implements Interpolation {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ReparametrisingInterpolation.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final Interpolation baseInterpolation;
|
||||
private double totalArcLength;
|
||||
@ -108,7 +108,7 @@ public class ReparametrisingInterpolation implements Interpolation {
|
||||
|
||||
Entry<Double, Double> ceilingEntry = cache.ceilingEntry(arc);
|
||||
if (ceilingEntry == null) {
|
||||
log.warn("Error in arcToParameter: no ceiling entry for " + arc + " found!");
|
||||
LOGGER.warn("Error in arcToParameter: no ceiling entry for " + arc + " found!");
|
||||
return 0;
|
||||
}
|
||||
final double rightArc = ceilingEntry.getKey();
|
||||
|
@ -20,16 +20,12 @@
|
||||
package com.sk89q.worldedit.scripting;
|
||||
|
||||
import org.mozilla.javascript.ClassShutter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Hides Minecraft's obfuscated & de-obfuscated names from scripts.
|
||||
*/
|
||||
class MinecraftHidingClassShutter implements ClassShutter {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MinecraftHidingClassShutter.class);
|
||||
|
||||
@Override
|
||||
public boolean visibleToScripts(String fullClassName) {
|
||||
if (!fullClassName.contains(".")) {
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.worldedit.command.tool.Tool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.session.storage.JsonFileSessionStore;
|
||||
import com.sk89q.worldedit.session.storage.SessionStore;
|
||||
@ -40,8 +41,7 @@ import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -69,7 +69,7 @@ public class SessionManager {
|
||||
private static final int FLUSH_PERIOD = 1000 * 30;
|
||||
private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
|
||||
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5, "WorldEdit Session Saver - %s"));
|
||||
private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static boolean warnedInvalidTool;
|
||||
|
||||
private final Timer timer = new Timer("WorldEdit Session Manager");
|
||||
@ -157,7 +157,7 @@ public class SessionManager {
|
||||
session = store.load(getKey(sessionKey));
|
||||
session.postLoad();
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to load saved session", e);
|
||||
LOGGER.warn("Failed to load saved session", e);
|
||||
session = new LocalSession();
|
||||
}
|
||||
Request.request().setSession(session);
|
||||
@ -252,7 +252,7 @@ public class SessionManager {
|
||||
try {
|
||||
store.save(getKey(key), entry.getValue());
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to write session for UUID " + getKey(key), e);
|
||||
LOGGER.warn("Failed to write session for UUID " + getKey(key), e);
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonIOException;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.gson.GsonUtil;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
@ -47,7 +47,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class JsonFileSessionStore implements SessionStore {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(JsonFileSessionStore.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private final Gson gson;
|
||||
private final File dir;
|
||||
|
||||
@ -61,7 +61,7 @@ public class JsonFileSessionStore implements SessionStore {
|
||||
|
||||
if (!dir.isDirectory()) {
|
||||
if (!dir.mkdirs()) {
|
||||
log.warn("Failed to create directory '" + dir.getPath() + "' for sessions");
|
||||
LOGGER.warn("Failed to create directory '" + dir.getPath() + "' for sessions");
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,9 +90,9 @@ public class JsonFileSessionStore implements SessionStore {
|
||||
BufferedReader br = closer.register(new BufferedReader(fr));
|
||||
LocalSession session = gson.fromJson(br, LocalSession.class);
|
||||
if (session == null) {
|
||||
log.warn("Loaded a null session from {}, creating new session", file);
|
||||
LOGGER.warn("Loaded a null session from {}, creating new session", file);
|
||||
if (!file.delete()) {
|
||||
log.warn("Failed to delete corrupted session {}", file);
|
||||
LOGGER.warn("Failed to delete corrupted session {}", file);
|
||||
}
|
||||
session = new LocalSession();
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class JsonFileSessionStore implements SessionStore {
|
||||
|
||||
if (finalFile.exists()) {
|
||||
if (!finalFile.delete()) {
|
||||
log.warn("Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it");
|
||||
LOGGER.warn("Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it");
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public class JsonFileSessionStore implements SessionStore {
|
||||
}
|
||||
|
||||
if (!tempFile.renameTo(finalFile)) {
|
||||
log.warn("Failed to rename temporary session file to " + finalFile.getPath());
|
||||
LOGGER.warn("Failed to rename temporary session file to " + finalFile.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,10 @@ package com.sk89q.worldedit.util;
|
||||
import com.sk89q.util.StringUtil;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -49,7 +49,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class PropertiesConfiguration extends LocalConfiguration {
|
||||
|
||||
@Unreported private static final Logger log = LoggerFactory.getLogger(PropertiesConfiguration.class);
|
||||
@Unreported private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@Unreported protected Properties properties;
|
||||
@Unreported protected File path;
|
||||
@ -82,7 +82,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
properties.load(stream);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to read configuration", e);
|
||||
LOGGER.warn("Failed to read configuration", e);
|
||||
}
|
||||
|
||||
loadExtra();
|
||||
@ -147,7 +147,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
try (OutputStream output = new FileOutputStream(path)) {
|
||||
properties.store(output, "Don't put comments; they get removed");
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to write configuration", e);
|
||||
LOGGER.warn("Failed to write configuration", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.session.SessionManager;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import org.slf4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
|
@ -22,8 +22,8 @@ package com.sk89q.worldedit.util.eventbus;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
@ -47,7 +47,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public final class EventBus {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(EventBus.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
|
||||
@ -192,7 +192,7 @@ public final class EventBus {
|
||||
try {
|
||||
handler.handleEvent(event);
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.error("Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
LOGGER.error("Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ package com.sk89q.worldedit.util.io;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
@ -35,7 +35,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class Closer implements Closeable {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Closer.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* The suppressor implementation to use for the current Java version.
|
||||
@ -239,7 +239,7 @@ public final class Closer implements Closeable {
|
||||
@Override
|
||||
public void suppress(Object closeable, Throwable thrown, Throwable suppressed) {
|
||||
// log to the same place as Closeables
|
||||
logger.warn("Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
LOGGER.warn("Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,6 @@ public class ArchiveNioSupports {
|
||||
|
||||
static {
|
||||
ImmutableList.Builder<ArchiveNioSupport> builder = ImmutableList.builder();
|
||||
try {
|
||||
builder.add(TrueVfsArchiveNioSupport.getInstance());
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
// No TrueVFS available. That's OK.
|
||||
}
|
||||
SUPPORTS = builder.add(ZipArchiveNioSupport.getInstance())
|
||||
.addAll(ServiceLoader.load(ArchiveNioSupport.class))
|
||||
.build();
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.io.file;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.java.truevfs.access.TArchiveDetector;
|
||||
import net.java.truevfs.access.TFileSystem;
|
||||
import net.java.truevfs.access.TPath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public final class TrueVfsArchiveNioSupport implements ArchiveNioSupport {
|
||||
|
||||
private static final TrueVfsArchiveNioSupport INSTANCE = new TrueVfsArchiveNioSupport();
|
||||
|
||||
public static TrueVfsArchiveNioSupport getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static final Set<String> ALLOWED_EXTENSIONS = ImmutableSet.copyOf(
|
||||
Splitter.on('|').split(TArchiveDetector.ALL.getExtensions())
|
||||
);
|
||||
|
||||
private TrueVfsArchiveNioSupport() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ArchiveDir> tryOpenAsDir(Path archive) throws IOException {
|
||||
String fileName = archive.getFileName().toString();
|
||||
int dot = fileName.indexOf('.');
|
||||
if (dot < 0 || dot >= fileName.length() || !ALLOWED_EXTENSIONS
|
||||
.contains(fileName.substring(dot + 1))) {
|
||||
return Optional.empty();
|
||||
}
|
||||
TFileSystem fileSystem = new TPath(archive).getFileSystem();
|
||||
TPath root = fileSystem.getPath("/");
|
||||
Path realRoot = ArchiveNioSupports.skipRootSameName(
|
||||
root, fileName.substring(0, dot)
|
||||
);
|
||||
return Optional.of(new ArchiveDir() {
|
||||
@Override
|
||||
public Path getPath() {
|
||||
return realRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
fileSystem.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -19,8 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.util.report;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -29,7 +29,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class ShallowObjectReport extends DataReport {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ShallowObjectReport.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public ShallowObjectReport(String title, Object object) {
|
||||
super(title);
|
||||
@ -53,7 +53,7 @@ public class ShallowObjectReport extends DataReport {
|
||||
Object value = field.get(object);
|
||||
append(field.getName(), String.valueOf(value));
|
||||
} catch (IllegalAccessException e) {
|
||||
log.warn("Failed to get value of '" + field.getName() + "' on " + type);
|
||||
LOGGER.warn("Failed to get value of '" + field.getName() + "' on " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class BlockTypesCache {
|
||||
/*
|
||||
-----------------------------------------------------
|
||||
|
@ -28,11 +28,11 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -55,7 +55,7 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public final class BundledBlockData {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BundledBlockData.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static BundledBlockData INSTANCE;
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@ -70,7 +70,7 @@ public final class BundledBlockData {
|
||||
try {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
log.warn("Failed to load the built-in block registry", e);
|
||||
LOGGER.warn("Failed to load the built-in block registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public final class BundledBlockData {
|
||||
if (url == null) {
|
||||
throw new IOException("Could not find blocks.json");
|
||||
}
|
||||
log.debug("Using {} for bundled block data.", url);
|
||||
LOGGER.debug("Using {} for bundled block data.", url);
|
||||
String data = Resources.toString(url, Charset.defaultCharset());
|
||||
List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() {}.getType());
|
||||
|
||||
|
@ -26,11 +26,11 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -53,7 +53,7 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public final class BundledItemData {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BundledItemData.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static BundledItemData INSTANCE;
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@ -68,7 +68,7 @@ public final class BundledItemData {
|
||||
try {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
log.warn("Failed to load the built-in item registry", e);
|
||||
LOGGER.warn("Failed to load the built-in item registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public final class BundledItemData {
|
||||
if (url == null) {
|
||||
throw new IOException("Could not find items.json");
|
||||
}
|
||||
log.debug("Using {} for bundled item data.", url);
|
||||
LOGGER.debug("Using {} for bundled item data.", url);
|
||||
String data = Resources.toString(url, Charset.defaultCharset());
|
||||
List<ItemEntry> entries = gson.fromJson(data, new TypeToken<List<ItemEntry>>() {}.getType());
|
||||
|
||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
@ -44,8 +45,7 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -56,7 +56,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public final class LegacyMapper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
private static LegacyMapper INSTANCE;
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@ -79,7 +79,7 @@ public final class LegacyMapper {
|
||||
try {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
log.warn("Failed to load the built-in legacy id registry", e);
|
||||
LOGGER.warn("Failed to load the built-in legacy id registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public final class LegacyMapper {
|
||||
|
||||
// if it's still null, both fixer and default failed
|
||||
if (state == null) {
|
||||
log.debug("Unknown block: " + value);
|
||||
LOGGER.debug("Unknown block: " + value);
|
||||
} else {
|
||||
// it's not null so one of them succeeded, now use it
|
||||
blockToStringMap.put(state, id);
|
||||
@ -174,7 +174,7 @@ public final class LegacyMapper {
|
||||
type = ItemTypes.get(value);
|
||||
}
|
||||
if (type == null) {
|
||||
log.debug("Unknown item: " + value);
|
||||
LOGGER.debug("Unknown item: " + value);
|
||||
} else {
|
||||
try {
|
||||
itemMap.put(getCombinedId(id), type);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
package com.sk89q.worldedit.world.snapshot;
|
||||
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.FileLegacyChunkStore;
|
||||
@ -29,8 +30,7 @@ import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -43,7 +43,7 @@ import java.util.zip.ZipFile;
|
||||
*/
|
||||
public class Snapshot implements Comparable<Snapshot> {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(Snapshot.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
protected File file;
|
||||
protected String name;
|
||||
@ -70,7 +70,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
||||
public ChunkStore getChunkStore() throws IOException, DataException {
|
||||
ChunkStore chunkStore = internalGetChunkStore();
|
||||
|
||||
logger.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName()
|
||||
LOGGER.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName()
|
||||
+ " for loading snapshot '" + file.getAbsolutePath() + "'");
|
||||
|
||||
return chunkStore;
|
||||
@ -156,7 +156,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// Skip the file, but print an error
|
||||
logger.info("Could not load snapshot: "
|
||||
LOGGER.info("Could not load snapshot: "
|
||||
+ file.getPath());
|
||||
} catch (DataException ex) {
|
||||
// No truezip, so tar file not supported.
|
||||
|
Reference in New Issue
Block a user