Better logger support

This commit is contained in:
MattBDev 2020-10-06 14:44:33 -04:00
parent 96dcb95b7c
commit f5a42c63a7
27 changed files with 124 additions and 114 deletions

View File

@ -18,7 +18,6 @@ import com.boydti.fawe.bukkit.regions.TownyFeature;
import com.boydti.fawe.bukkit.regions.Worldguard;
import com.boydti.fawe.bukkit.util.BukkitTaskMan;
import com.boydti.fawe.bukkit.util.ItemUtil;
import com.boydti.fawe.bukkit.util.VaultUtil;
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.regions.FaweMaskManager;
@ -69,7 +68,7 @@ public class FaweBukkit implements IFawe, Listener {
try {
new BrushListener(plugin);
} catch (Throwable e) {
log.debug("Brush Listener Failed", e);
log.error("Brush Listener Failed", e);
}
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
new RenderListener(plugin);
@ -147,10 +146,6 @@ public class FaweBukkit implements IFawe, Listener {
return null;
}
@Override public void debug(final String message) {
Bukkit.getConsoleSender().sendMessage(message);
}
@Override public File getDirectory() {
return plugin.getDataFolder();
}
@ -163,7 +158,7 @@ public class FaweBukkit implements IFawe, Listener {
this.itemUtil = tmp = new ItemUtil();
} catch (Throwable e) {
Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES = false;
log.debug("Persistent Brushes Failed", e);
log.error("Persistent Brushes Failed", e);
}
}
return tmp;

View File

@ -14,10 +14,13 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import static org.slf4j.LoggerFactory.getLogger;
public class GriefPreventionFeature extends BukkitMaskManager implements Listener {
public GriefPreventionFeature(final Plugin griefpreventionPlugin) {
super(griefpreventionPlugin.getName());
getLogger(GriefPreventionFeature.class).debug("Plugin 'GriefPrevention' found. Using it now.");
}
public boolean isAllowed(Player player, Claim claim, MaskType type) {

View File

@ -12,6 +12,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import static org.slf4j.LoggerFactory.getLogger;
public class ResidenceFeature extends BukkitMaskManager implements Listener {
private FaweBukkit plugin;
private Plugin residence;
@ -20,7 +22,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
super(residencePlugin.getName());
this.residence = residencePlugin;
this.plugin = p3;
getLogger(ResidenceFeature.class).debug("Plugin 'Residence' found. Using it now.");
}
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {

View File

@ -18,6 +18,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import static org.slf4j.LoggerFactory.getLogger;
public class TownyFeature extends BukkitMaskManager implements Listener {
private final Plugin towny;
@ -25,6 +27,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
public TownyFeature(Plugin townyPlugin) {
super(townyPlugin.getName());
this.towny = townyPlugin;
getLogger(TownyFeature.class).debug("Plugin 'Towny' found. Using it now.");
}
public boolean isAllowed(Player player, TownBlock block) {

View File

@ -26,11 +26,15 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.slf4j.Logger;
import java.util.Locale;
import static org.slf4j.LoggerFactory.getLogger;
public class Worldguard extends BukkitMaskManager implements Listener {
private final WorldGuardPlugin worldguard;
private static final Logger logger = getLogger(Worldguard.class);
private WorldGuardPlugin getWorldGuard() {
final Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldGuard");
@ -46,17 +50,19 @@ public class Worldguard extends BukkitMaskManager implements Listener {
public Worldguard(Plugin p2) {
super(p2.getName());
this.worldguard = this.getWorldGuard();
logger.debug("Plugin 'WorldGuard' found. Using it now.");
}
public ProtectedRegion getRegion(LocalPlayer player, Location location) {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
if (container == null) {
System.out.println("Region capability is not enabled for WorldGuard.");
logger.info("Region capability is not enabled for WorldGuard.");
return null;
}
RegionManager manager = container.get(BukkitAdapter.adapt(location.getWorld()));
if (manager == null) {
System.out.println("Region capability is not enabled for that world.");
logger.info("Region capability is not enabled for that world.");
return null;
}
final ProtectedRegion global = manager.getRegion("__global__");

View File

@ -114,6 +114,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private final Spigot_v1_15_R2 parent;
@ -339,7 +340,9 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
getLogger(FAWE_Spigot_v1_15_R2.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
ibd.getBlock(), Block.REGISTRY_ID.getId(ibd), ibdToStateOrdinal.length, e1);
return 0;
}
}

View File

@ -19,13 +19,17 @@
package com.sk89q.worldedit.bukkit.adapter.impl;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.*;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.BlockMaterial_1_16_1;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.BukkitAdapter_1_16_1;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.BukkitGetBlocks_1_16_1;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.FAWEWorldNativeAccess_1_16;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.MapChunkUtil_1_16_1;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.nbt.LazyCompoundTag_1_16_1;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseItemStack;
@ -42,11 +46,35 @@ import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
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.*;
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 com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import net.minecraft.server.v1_16_R1.*;
import net.minecraft.server.v1_16_R1.BiomeBase;
import net.minecraft.server.v1_16_R1.Block;
import net.minecraft.server.v1_16_R1.BlockPosition;
import net.minecraft.server.v1_16_R1.Chunk;
import net.minecraft.server.v1_16_R1.ChunkCoordIntPair;
import net.minecraft.server.v1_16_R1.ChunkSection;
import net.minecraft.server.v1_16_R1.Entity;
import net.minecraft.server.v1_16_R1.EntityPlayer;
import net.minecraft.server.v1_16_R1.EntityTypes;
import net.minecraft.server.v1_16_R1.IBlockData;
import net.minecraft.server.v1_16_R1.IRegistry;
import net.minecraft.server.v1_16_R1.ItemStack;
import net.minecraft.server.v1_16_R1.MinecraftKey;
import net.minecraft.server.v1_16_R1.NBTBase;
import net.minecraft.server.v1_16_R1.NBTTagCompound;
import net.minecraft.server.v1_16_R1.NBTTagInt;
import net.minecraft.server.v1_16_R1.PacketPlayOutMapChunk;
import net.minecraft.server.v1_16_R1.PlayerChunk;
import net.minecraft.server.v1_16_R1.TileEntity;
import net.minecraft.server.v1_16_R1.World;
import net.minecraft.server.v1_16_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
@ -59,16 +87,16 @@ import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.OptionalInt;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.StringTag;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private final Spigot_v1_16_R1 parent;
@ -294,7 +322,9 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
getLogger(FAWE_Spigot_v1_16_R1.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
ibd.getBlock(), Block.REGISTRY_ID.getId(ibd), ibdToStateOrdinal.length, e1);
return 0;
}
}

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.bukkit.adapter.impl;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
@ -98,6 +97,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private final Spigot_v1_16_R2 parent;
@ -321,7 +321,9 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
getLogger(FAWE_Spigot_v1_16_R2.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
ibd.getBlock(), Block.REGISTRY_ID.getId(ibd), ibdToStateOrdinal.length, e1);
return 0;
}
}

View File

@ -14,10 +14,6 @@ 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 com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -120,40 +116,6 @@ public class Fawe {
instance = new Fawe(implementation);
}
public static void debugPlain(String s) {
if (instance != null) {
instance.implementation.debug(s);
} else {
log.debug(s);
}
}
/**
* Write something to the console.
*/
public static void debug(String s) {
Actor actor = Request.request().getActor();
if (actor != null && actor.isPlayer()) {
actor.printInfo(TextComponent.of(s));
return;
}
debugPlain(s);
}
/**
* Write something to the console.
*
* @param c The Component to be printed
*/
public static void debug(Component c) {
Actor actor = Request.request().getActor();
if (actor != null && actor.isPlayer()) {
actor.printDebug(c);
return;
}
debugPlain(c.toString());
}
/**
* The platform specific implementation.
*/
@ -311,7 +273,7 @@ public class Fawe {
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"
+ "FAWE will still work but compression won't work as well.\n", e);
+ "FAWE will still work but compression won't work as well.\n", e);
}
}
try {
@ -326,9 +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) {
debug("====== UPGRADE TO 64-BIT JAVA ======");
debug("You are running 32-bit Java on a 64-bit machine");
debug("====================================");
log.info("You are running 32-bit Java on a 64-bit machine. Please upgrade to 64-bit Java.");
}
}
@ -362,11 +322,9 @@ public class Fawe {
}
}
} catch (Throwable ignored) {
debug("====== MEMORY LISTENER ERROR ======");
debug("FAWE needs access to the JVM memory system:");
debug(" - Change your Java security settings");
debug(" - Disable this with `max-memory-percent: -1`");
debug("===================================");
log.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'.");
}
}

View File

@ -56,6 +56,7 @@ 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
@ -502,7 +503,7 @@ public enum FaweCache implements Trimable {
} else if (value instanceof Boolean) {
return asTag((byte) ((boolean) value ? 1 : 0));
}
System.out.println("Invalid nbt: " + value);
getLogger(FaweCache.class).error("Invalid nbt: {}", value);
return null;
}

View File

@ -13,8 +13,6 @@ import java.util.UUID;
public interface IFawe {
void debug(final String s);
File getDirectory();
TaskManager getTaskManager();

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor;
@ -14,6 +13,8 @@ import java.util.Set;
import java.util.concurrent.Future;
import java.util.function.Function;
import static org.slf4j.LoggerFactory.getLogger;
public interface IBatchProcessor {
/**
@ -79,9 +80,7 @@ public interface IBatchProcessor {
layer++;
}
} catch (ArrayIndexOutOfBoundsException exception) {
Fawe.imp().debug("minY = " + minY);
Fawe.imp().debug("layer = " + ((minY - 15) >> 4));
exception.printStackTrace();
getLogger(IBatchProcessor.class).error("minY = {} , layer = {}", minY, ((minY - 15) >> 4), exception);
}
return false;
}

View File

@ -6,9 +6,13 @@ import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypesCache;
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);
public static final Section FULL = new Section() {
@Override
public final char[] get(CharBlocks blocks, int layer) {
@ -17,7 +21,7 @@ public abstract class CharBlocks implements IBlocks {
};
public static final Section EMPTY = new Section() {
@Override
public synchronized final char[] get(CharBlocks blocks, int layer) {
public final synchronized char[] get(CharBlocks blocks, int layer) {
char[] arr = blocks.blocks[layer];
if (arr == null) {
arr = blocks.blocks[layer] = blocks.update(layer, null);
@ -120,10 +124,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 + ")");
assert Fawe.imp() != null;
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
Fawe.imp().debug("Layer variable was = " + layer);
exception.printStackTrace();
logger.error("Layer variable was = {}", layer, exception);
}
}

View File

@ -30,7 +30,7 @@ public class YamlConfiguration extends FileConfiguration {
private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given file.
* Creates a new {@link YamlConfiguration}, loading from the given file.
*
* <p>
* Any errors loading the Configuration will be logged and then ignored.
@ -46,12 +46,12 @@ public class YamlConfiguration extends FileConfiguration {
* @return Resulting configuration
* @throws IllegalArgumentException Thrown if file is null
*/
public static com.boydti.fawe.configuration.file.YamlConfiguration loadConfiguration(final File file) {
public static YamlConfiguration loadConfiguration(final File file) {
if (file == null) {
throw new NullPointerException("File cannot be null");
}
final com.boydti.fawe.configuration.file.YamlConfiguration config = new com.boydti.fawe.configuration.file.YamlConfiguration();
final YamlConfiguration config = new YamlConfiguration();
try {
config.load(file);
@ -64,11 +64,8 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
}
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
System.out.println("&dCould not read: &7" + file);
System.out.println("&dRenamed to: &7" + dest.getName());
System.out.println("&c============ Full stacktrace ============");
ex.printStackTrace();
System.out.println("&c=========================================");
getLogger(YamlConfiguration.class).error("Could not read: {}\n"
+ "Renamed to: {}", file, dest.getName(), ex);
} catch (final IOException e) {
e.printStackTrace();
}
@ -78,7 +75,7 @@ public class YamlConfiguration extends FileConfiguration {
}
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given reader.
* Creates a new {@link YamlConfiguration}, loading from the given reader.
*
* <p>
* Any errors loading the Configuration will be logged and then ignored.
@ -90,12 +87,12 @@ public class YamlConfiguration extends FileConfiguration {
* @return resulting configuration
* @throws IllegalArgumentException Thrown if stream is null
*/
public static com.boydti.fawe.configuration.file.YamlConfiguration loadConfiguration(final Reader reader) {
public static YamlConfiguration loadConfiguration(final Reader reader) {
if (reader == null) {
throw new NullPointerException("Reader cannot be null");
}
final com.boydti.fawe.configuration.file.YamlConfiguration config = new com.boydti.fawe.configuration.file.YamlConfiguration();
final YamlConfiguration config = new YamlConfiguration();
try {
config.load(reader);

View File

@ -44,6 +44,8 @@ import java.util.UUID;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
import static org.slf4j.LoggerFactory.getLogger;
public class MCAChunk implements IChunk {
public final boolean[] hasSections = new boolean[16];
@ -308,7 +310,7 @@ public class MCAChunk implements IChunk {
Object value = state.getState(property);
String valueStr = value.toString();
if (Character.isUpperCase(valueStr.charAt(0))) {
System.out.println("Invalid uppercase value " + value);
getLogger(MCAChunk.class).warn("Invalid uppercase value {}", value);
valueStr = valueStr.toLowerCase(Locale.ROOT);
}
out.writeNamedTag(key, valueStr);

View File

@ -272,7 +272,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
try (NBTInputStream nis = getChunkIS(offset)) {
chunk.read(nis, false);
}
System.out.println("TODO multithreaded"); // TODO
//TODO multithreaded
return chunk;
}

View File

@ -6,6 +6,8 @@ import com.sk89q.jnbt.NBTInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import static org.slf4j.LoggerFactory.getLogger;
public class StreamDelegate {
private static final byte[][] ZERO_KEYS = new byte[0][];
private static final StreamDelegate[] ZERO_VALUES = new StreamDelegate[0];
@ -39,7 +41,7 @@ public class StreamDelegate {
private StreamDelegate add(String name, StreamDelegate scope) {
if (valueReader != null) {
System.out.println("Scope " + name + " | " + scope + " may not run, as the stream is only read once, and a value reader is already set");
getLogger(StreamDelegate.class).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;
@ -167,7 +169,7 @@ public class StreamDelegate {
public StreamDelegate withValue(ValueReader valueReader) {
if (keys.length != 0) {
System.out.println("Reader " + valueReader + " may not run, as the stream is only read once, and a value reader is already set");
getLogger(StreamDelegate.class).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;

View File

@ -12,6 +12,8 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;
import static org.slf4j.LoggerFactory.getLogger;
public class RollbackOptimizedHistory extends DiskStorageHistory {
private long time;
@ -32,7 +34,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
super(world, uuid);
this.time = System.currentTimeMillis();
}
public RollbackOptimizedHistory(World world, UUID uuid, int index, long time, long size, CuboidRegion region, String command) {
super(world, uuid, index);
this.time = time;
@ -45,7 +47,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
this.blockSize = (int) size;
this.command = command;
this.closed = true;
System.out.println("Size " + size);
getLogger(RollbackOptimizedHistory.class).debug("Size {}", size);
}
public long getTime() {

View File

@ -30,6 +30,8 @@ import java.util.Iterator;
import java.util.UUID;
import java.util.function.Supplier;
import static org.slf4j.LoggerFactory.getLogger;
public class InspectBrush extends BrushTool {
/**
@ -62,13 +64,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"));
System.out.println("No tool control");
getLogger(InspectBrush.class).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 )"));
System.out.println("No db");
getLogger(InspectBrush.class).debug("No db");
return false;
}
try {
@ -109,10 +111,9 @@ public class InspectBrush extends BrushTool {
}
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer", count));
} catch (IOException e) {
System.out.println("IOE");
throw new RuntimeException(e);
} catch (Throwable e) {
System.out.println("E throw");
getLogger(InspectBrush.class).error("E throw", e);
}
return true;
}

View File

@ -352,7 +352,6 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
public IChunkSet getChunk(int chunkX, int chunkZ) {
// TODO don't generate new Writeable MCA chunk
System.out.println("TODO don't generate new Writeable MCA chunk");
MCAChunk tmp = new MCAChunk();
int bx = chunkX << 4;
int bz = chunkZ << 4;

View File

@ -38,9 +38,9 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.Locale;
import java.util.UUID;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -333,7 +333,7 @@ public class EditSessionBuilder {
// changeSet = new CPUOptimizedChangeSet(world);
} else {
if (combineStages && Settings.IMP.HISTORY.COMPRESSION_LEVEL == 0) {
System.out.println("TODO add CPUOptimizedChangeSet");
//TODO add CPUOptimizedChangeSet
}
changeSet = new MemoryOptimizedHistory(world);
}
@ -346,7 +346,7 @@ public class EditSessionBuilder {
}
if (!(changeSet instanceof NullChangeSet)) {
if (this.blockBag != null) {
System.out.println("TODO implement block bag as IBatchProcessor");
//TODO implement block bag as IBatchProcessor
changeSet = new BlockBagChangeSet(changeSet, blockBag, limit.INVENTORY_MODE == 1);
}
if (combineStages) {
@ -387,7 +387,7 @@ public class EditSessionBuilder {
this.extent = regionExtent;
}
if (this.limit != null && this.limit.STRIP_NBT != null && !this.limit.STRIP_NBT.isEmpty()) {
System.out.println("TODO add batch processor for strip nbt");
//TODO add batch processor for strip nbt
this.extent = new StripNBTExtent(this.extent, this.limit.STRIP_NBT);
}
this.extent = wrapExtent(this.extent, eventBus, event, EditSession.Stage.BEFORE_HISTORY);

View File

@ -858,7 +858,7 @@ public class MainUtil {
pool.submit(file::delete);
Component msg = TranslatableComponent.of("worldedit.schematic.delete.deleted");
if (printDebug) {
Fawe.debug(msg);
getLogger(MainUtil.class).debug(msg.toString());
}
}
});

View File

@ -652,7 +652,7 @@ public class TextureUtil implements TextureHolder {
String modelFileName = String.format(modelsDir, nameSpace, name);
ZipEntry entry = getEntry(zipFile, modelFileName);
if (entry == null) {
System.out.println("Cannot find " + modelFileName + " in " + file);
getLogger(TextureUtil.class).error("Cannot find {} in {}", modelFileName, file);
continue;
}
@ -690,7 +690,7 @@ public class TextureUtil implements TextureHolder {
BufferedImage image = readImage(zipFile, textureFileName);
if (image == null) {
System.out.println("Cannot find " + textureFileName);
getLogger(TextureUtil.class).error("Cannot find {}", textureFileName);
continue;
}
int color = ImageUtil.getColor(image);

View File

@ -69,6 +69,7 @@ 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
@ -149,7 +150,7 @@ public class BlockTransformExtent extends ResettableExtent {
case 2:
return adapt(combine(EAST, WEST), combine(SOUTH, NORTH));
default:
System.out.println("Invalid " + property.getName() + " " + property.getValues());
getLogger(BlockTransformExtent.class).error("Invalid {} {}", property.getName(), property.getValues());
return null;
}
case FACING: {
@ -181,7 +182,7 @@ public class BlockTransformExtent extends ResettableExtent {
result.add(notIndex(combine(NORTHEAST, NORTHWEST, SOUTHWEST, SOUTHEAST), property.getIndexFor("inner_left"), property.getIndexFor("inner_right")));
continue;
default:
System.out.println("Unknown direction " + value);
getLogger(BlockTransformExtent.class).warn("Unknown direction {}", value);
result.add(0L);
}
}
@ -221,7 +222,7 @@ public class BlockTransformExtent extends ResettableExtent {
directions.add(combine(NORTHEAST));
break;
default:
System.out.println("Unknown direction " + value);
getLogger(BlockTransformExtent.class).warn("Unknown direction {}", value);
directions.add(0L);
}
}

View File

@ -160,9 +160,9 @@ public class MaskIntersection extends AbstractMask {
while (combineMasks(pairingFunction(), failedCombines) && --maxIteration > 0);
if (maxIteration == 0) {
getLogger(MaskIntersection.class).debug("Failed optimize MaskIntersection");
getLogger(MaskIntersection.class).error("Failed optimize MaskIntersection");
for (Mask mask : masks) {
System.out.println(mask.getClass() + " / " + mask);
getLogger(MaskIntersection.class).error(mask.getClass() + " / " + mask);
}
}
// Return result

View File

@ -409,7 +409,7 @@ public class EllipsoidRegion extends AbstractRegion {
int yTopFull = Math.min(255, cy + diffYFull);
if (yBotFull == yTopFull || yBotFull > yTopFull) {
System.out.println("aa");
System.out.println("aa"); //why do we print "aa" here?
}
// Set those layers
filter(chunk, filter, block, get, set, yBotFull, yTopFull, full);

View File

@ -25,6 +25,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
public class BlockTypesCache {
/*
-----------------------------------------------------
@ -203,7 +205,7 @@ public class BlockTypesCache {
String defaultState = blockMap.remove(id);
if (defaultState == null) {
if (internalId != 0) {
System.out.println("Ignoring invalid block " + id);
getLogger(BlockTypesCache.class).info("Ignoring invalid block {}", id);
continue;
}
defaultState = id;