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:
NotMyFault 2021-03-29 15:29:16 +02:00
parent 2dc89f735d
commit b96cea75b8
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
118 changed files with 700 additions and 743 deletions

View File

@ -11,9 +11,6 @@ repositories {
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
content {
includeGroupByRegex("com.sk89q.*")
}
}
}

View File

@ -2,6 +2,7 @@ import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.repositories
import org.gradle.kotlin.dsl.the
@ -14,19 +15,10 @@ fun Project.applyCommonConfiguration() {
maven {
name = "IntellectualSites"
url = uri("https://mvn.intellectualsites.com/content/groups/public/")
content {
includeGroup("com.plotsquared")
includeGroup("com.intellectualsites.paster")
includeGroup("com.github.intellectualsites.plotsquared")
}
}
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
content {
includeGroupByRegex("org.enginehub.*")
includeGroupByRegex("com.sk89q.*")
}
}
maven {
name = "OSS Sonatype Snapshots"
@ -39,13 +31,6 @@ fun Project.applyCommonConfiguration() {
maven {
name = "Athion"
url = uri("https://ci.athion.net/plugin/repository/tools/")
content {
includeGroup("com.massivecraft")
includeGroup("com.thevoxelbox.voxelsniper")
includeGroup("com.palmergames.bukkit")
includeGroup("net.fabiozumbi12")
includeGroupByRegex("com.destroystokyo.*")
}
}
}
@ -55,6 +40,14 @@ fun Project.applyCommonConfiguration() {
}
}
configurations.findByName("compileClasspath")?.apply {
resolutionStrategy.componentSelection {
withModule("org.slf4j:slf4j-api") {
reject("No SLF4J allowed on compile classpath")
}
}
}
plugins.withId("java") {
the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(8))

View File

@ -38,7 +38,7 @@ fun Project.applyLibrariesConfiguration() {
exclude(dependency("com.google.guava:guava"))
exclude(dependency("com.google.code.gson:gson"))
exclude(dependency("org.checkerframework:checker-qual"))
exclude(dependency("org.slf4j:slf4j-api"))
exclude(dependency("org.apache.logging.log4j:log4j-api"))
}
relocations.forEach { (from, to) ->

View File

@ -3,11 +3,10 @@ import org.gradle.api.Project
object Versions {
const val TEXT = "3.0.4"
const val TEXT_EXTRAS = "3.0.6"
const val PISTON = "0.5.6"
const val PISTON = "0.5.7"
const val AUTO_VALUE = "1.7.4"
const val JUNIT = "5.7.0"
const val MOCKITO = "3.8.0"
const val SLF4J = "1.7.30"
const val LOGBACK = "1.2.3"
const val FAST_UTIL = "8.2.1"
const val GUAVA = "21.0"

View File

@ -15,9 +15,6 @@ dependencyResolutionManagement {
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
content {
includeGroupByRegex("com.sk89q.*")
}
}
}
}

View File

@ -11,25 +11,14 @@ repositories {
maven {
name = "SpigotMC"
url = uri("https://hub.spigotmc.org/nexus/content/groups/public")
content {
includeGroup("org.bukkit")
includeGroup("org.spigotmc")
}
}
maven {
name = "PaperMC"
url = uri("https://papermc.io/repo/repository/maven-public/")
content {
includeGroup("io.papermc")
includeGroup("com.destroystokyo.paper")
}
}
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
content {
includeGroupByRegex("com.sk89q.*")
}
}
maven {
name = "Athion"
@ -38,45 +27,26 @@ repositories {
maven {
name = "JitPack"
url = uri("https://jitpack.io")
content {
includeGroup("com.github.MilkBowl")
includeGroup("com.github.TechFortress")
}
}
maven {
name = "ProtocolLib"
url = uri("https://repo.dmulloy2.net/nexus/repository/public/")
content {
includeGroup("com.comphenix.protocol")
}
}
maven {
name = "Inventivetalent"
url = uri("https://repo.inventivetalent.org/content/groups/public/")
content {
includeGroupByRegex("org.inventivetalent.*")
}
}
maven {
name = "IntellectualSites 3rd Party"
url = uri("https://mvn.intellectualsites.com/content/repositories/thirdparty")
content {
includeGroup("de.notmyfault")
}
}
maven {
name = "OSS Sonatype Snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
content {
includeGroup("net.kyori")
}
}
maven {
name = "OSS Sonatype Releases"
url = uri("https://oss.sonatype.org/content/repositories/releases/")
content {
includeGroup("net.kyori")
}
}
flatDir { dir(File("src/main/resources")) }
}
@ -105,7 +75,13 @@ dependencies {
api("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT") {
exclude("junit", "junit")
isTransitive = false
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
// Note: Paper will bump to 2.11.2, but we should only depend on 2.8 APIs for compatibility.
because("Spigot provides Log4J (sort of, not in API, implicitly part of server)")
})
implementation("org.apache.logging.log4j:log4j-api")
compileOnly("org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:20.1.0")
testCompileOnly("org.jetbrains:annotations:20.1.0")
@ -113,7 +89,6 @@ dependencies {
compileOnly("com.sk89q:dummypermscompat:1.10") {
exclude("com.github.MilkBowl", "VaultAPI")
}
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
testImplementation("org.mockito:mockito-core:3.8.0")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.4") {
exclude("com.sk89q.worldedit", "worldedit-bukkit")
@ -162,13 +137,14 @@ tasks.named<ShadowJar>("shadowJar") {
})
archiveFileName.set("FastAsyncWorldEdit-Bukkit-${project.version}.jar")
dependencies {
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
// In tandem with not bundling log4j, we shouldn't relocate base package here.
// relocate("org.apache.logging", "com.sk89q.worldedit.log4j")
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
include(dependency(":worldedit-core"))
include(dependency(":worldedit-libs:bukkit"))
include(dependency("org.slf4j:slf4j-api"))
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
// Purposefully not included, we assume (even though no API exposes it) that Log4J will be present at runtime
// If it turns out not to be true for Spigot/Paper, our only two official platforms, this can be uncommented.
// include(dependency("org.apache.logging.log4j:log4j-api"))
include(dependency("org.antlr:antlr4-runtime"))
relocate("org.bstats", "com.sk89q.worldedit.bstats") {
include(dependency("org.bstats:"))

View File

@ -28,7 +28,9 @@ import com.boydti.fawe.util.WEManager;
import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import io.papermc.lib.PaperLib;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -38,8 +40,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
@ -50,7 +50,7 @@ import java.util.function.Supplier;
public class FaweBukkit implements IFawe, Listener {
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Plugin plugin;
private ItemUtil itemUtil;
@ -70,7 +70,7 @@ public class FaweBukkit implements IFawe, Listener {
try {
new BrushListener(plugin);
} catch (Throwable e) {
log.error("Brush Listener Failed", e);
LOGGER.error("Brush Listener Failed", e);
}
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
new RenderListener(plugin);
@ -162,7 +162,7 @@ public class FaweBukkit implements IFawe, Listener {
this.itemUtil = tmp = new ItemUtil();
} catch (Throwable e) {
Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES = false;
log.error("Persistent Brushes Failed", e);
LOGGER.error("Persistent Brushes Failed", e);
}
}
return tmp;
@ -208,7 +208,7 @@ public class FaweBukkit implements IFawe, Listener {
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
try {
managers.add(new Worldguard(worldguardPlugin));
log.debug("Attempting to use plugin 'WorldGuard'");
LOGGER.info("Attempting to use plugin 'WorldGuard'");
} catch (Throwable ignored) {
}
}
@ -216,7 +216,7 @@ public class FaweBukkit implements IFawe, Listener {
if (townyPlugin != null && townyPlugin.isEnabled()) {
try {
managers.add(new TownyFeature(townyPlugin));
log.debug("Attempting to use plugin 'Towny'");
LOGGER.info("Attempting to use plugin 'Towny'");
} catch (Throwable ignored) {
}
}
@ -224,7 +224,7 @@ public class FaweBukkit implements IFawe, Listener {
if (residencePlugin != null && residencePlugin.isEnabled()) {
try {
managers.add(new ResidenceFeature(residencePlugin, this));
log.debug("Attempting to use plugin 'Residence'");
LOGGER.info("Attempting to use plugin 'Residence'");
} catch (Throwable ignored) {
}
}
@ -233,7 +233,7 @@ public class FaweBukkit implements IFawe, Listener {
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
log.debug("Attempting to use plugin 'GriefPrevention'");
LOGGER.debug("Attempting to use plugin 'GriefPrevention'");
} catch (Throwable ignored) {
}
}
@ -307,6 +307,6 @@ public class FaweBukkit implements IFawe, Listener {
WEManager.IMP.managers
.add(new com.boydti.fawe.bukkit.regions.plotsquared.PlotSquaredFeature());
}
log.info("Plugin 'PlotSquared' found. Using it now.");
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
}
}

View File

@ -3,13 +3,16 @@ package com.boydti.fawe.bukkit.adapter;
import co.aikar.timings.Timings;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.bukkit.listener.ChunkListener;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.spigotmc.AsyncCatcher;
import java.lang.reflect.Method;
import static org.slf4j.LoggerFactory.getLogger;
public class BukkitQueueHandler extends QueueHandler {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private volatile boolean timingsEnabled;
private static boolean alertTimingsChange = true;
@ -32,7 +35,7 @@ public class BukkitQueueHandler extends QueueHandler {
if (timingsEnabled) {
if (alertTimingsChange) {
alertTimingsChange = false;
getLogger(BukkitQueueHandler.class).debug("Having `parallel-threads` > 1 interferes with the timings.");
LOGGER.debug("Having `parallel-threads` > 1 interferes with the timings.");
}
Timings.setTimingsEnabled(false);
methodCheck.invoke(null);

View File

@ -24,6 +24,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_15_R2;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -50,14 +51,13 @@ import net.minecraft.server.v1_15_R1.NibbleArray;
import net.minecraft.server.v1_15_R1.SectionPosition;
import net.minecraft.server.v1_15_R1.TileEntity;
import net.minecraft.server.v1_15_R1.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.AbstractSet;
import java.util.Arrays;
@ -74,11 +74,9 @@ import java.util.concurrent.Future;
import java.util.function.Function;
import javax.annotation.Nullable;
import static org.slf4j.LoggerFactory.getLogger;
public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_15_2.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_15_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@ -438,7 +436,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
} else {
existingSection = sections[layer];
if (existingSection == null) {
log.error("Skipping invalid null section. chunk:" + chunkX + ","
LOGGER.error("Skipping invalid null section. chunk:" + chunkX + ","
+ chunkZ + " layer: " + layer);
continue;
}
@ -466,7 +464,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
}
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::loadPrivately, setArr, fastmode);
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
LOGGER.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
}
@ -546,7 +544,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
getLogger(BukkitGetBlocks_1_15_2.class).debug("Unknown entity tag: " + nativeTag);
LOGGER.debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);

View File

@ -24,6 +24,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_16_R1;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -50,14 +51,13 @@ import net.minecraft.server.v1_16_R1.NibbleArray;
import net.minecraft.server.v1_16_R1.SectionPosition;
import net.minecraft.server.v1_16_R1.TileEntity;
import net.minecraft.server.v1_16_R1.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R1.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.AbstractSet;
import java.util.Arrays;
@ -74,11 +74,9 @@ import java.util.concurrent.Future;
import java.util.function.Function;
import javax.annotation.Nullable;
import static org.slf4j.LoggerFactory.getLogger;
public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_1.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_1(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@ -438,7 +436,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
} else {
existingSection = sections[layer];
if (existingSection == null) {
log.error("Skipping invalid null section. chunk:" + chunkX + "," +
LOGGER.error("Skipping invalid null section. chunk:" + chunkX + "," +
chunkZ + " layer: " + layer);
continue;
}
@ -468,7 +466,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
.newChunkSection(layer, this::loadPrivately, setArr, fastmode);
if (!BukkitAdapter_1_16_1
.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
LOGGER.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
}
@ -548,8 +546,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
getLogger(
BukkitGetBlocks_1_16_1.class).debug("Unknown entity tag: " + nativeTag);
LOGGER.debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);

View File

@ -24,6 +24,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_16_R2;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -51,14 +52,13 @@ import net.minecraft.server.v1_16_R2.NibbleArray;
import net.minecraft.server.v1_16_R2.SectionPosition;
import net.minecraft.server.v1_16_R2.TileEntity;
import net.minecraft.server.v1_16_R2.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.AbstractSet;
@ -75,11 +75,9 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
import static org.slf4j.LoggerFactory.getLogger;
public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_2.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@ -441,7 +439,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
} else {
existingSection = sections[layer];
if (existingSection == null) {
log.error("Skipping invalid null section. chunk:" + chunkX + ","
LOGGER.error("Skipping invalid null section. chunk:" + chunkX + ","
+ chunkZ + " layer: " + layer);
continue;
}
@ -471,7 +469,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
.newChunkSection(layer, this::loadPrivately, setArr, fastmode);
if (!BukkitAdapter_1_16_2
.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
LOGGER.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
}
@ -551,8 +549,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
getLogger(
BukkitGetBlocks_1_16_2.class).debug("Unknown entity tag: " + nativeTag);
LOGGER.debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);

View File

@ -24,6 +24,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_16_R3;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -51,14 +52,13 @@ import net.minecraft.server.v1_16_R3.NibbleArray;
import net.minecraft.server.v1_16_R3.SectionPosition;
import net.minecraft.server.v1_16_R3.TileEntity;
import net.minecraft.server.v1_16_R3.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.AbstractSet;
@ -75,11 +75,9 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
import static org.slf4j.LoggerFactory.getLogger;
public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_5.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@ -441,7 +439,7 @@ public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBl
} else {
existingSection = sections[layer];
if (existingSection == null) {
log.error("Skipping invalid null section. chunk:" + chunkX + ","
LOGGER.error("Skipping invalid null section. chunk:" + chunkX + ","
+ chunkZ + " layer: " + layer);
continue;
}
@ -471,7 +469,7 @@ public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBl
.newChunkSection(layer, this::loadPrivately, setArr, fastmode);
if (!BukkitAdapter_1_16_5
.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
LOGGER.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
}
@ -551,8 +549,7 @@ public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBl
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
getLogger(
BukkitGetBlocks_1_16_5.class).debug("Unknown entity tag: " + nativeTag);
LOGGER.debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);

View File

@ -3,18 +3,22 @@ package com.boydti.fawe.bukkit.filter;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import org.apache.logging.log4j.Logger;
import org.bukkit.World;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
public class WorldGuardFilter extends CuboidRegionFilter {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final World world;
private boolean large;
private RegionManager manager;
@ -33,7 +37,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
if (max.getBlockX() - min.getBlockX() > 1024 || max.getBlockZ() - min.getBlockZ() > 1024) {
getLogger(WorldGuardFilter.class).debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
LOGGER.debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
large = true;
break;
}

View File

@ -6,8 +6,10 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.FaweTimer;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
@ -42,13 +44,10 @@ import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.util.Vector;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
public abstract class ChunkListener implements Listener {
private final Logger logger = getLogger(ChunkListener.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
protected int rateLimit = 0;
protected Location lastCancelPos;
private int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
@ -62,7 +61,7 @@ public abstract class ChunkListener implements Listener {
TaskManager.IMP.repeat(() -> {
Location tmpLoc = lastCancelPos;
if (tmpLoc != null) {
logger.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
LOGGER.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
+ tmpLoc);
}
rateLimit--;
@ -378,7 +377,7 @@ public abstract class ChunkListener implements Listener {
double vertical = Math.abs(velocity.getY());
if (Math.abs(velocity.getX()) > vertical
|| Math.abs(velocity.getZ()) > vertical) {
logger.warn(
LOGGER.warn(
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
+ ent.getLocation());
ent.remove();
@ -409,7 +408,7 @@ public abstract class ChunkListener implements Listener {
cancelNearby(cx, cz);
if (rateLimit <= 0) {
rateLimit = 20;
logger.warn(
LOGGER.warn(
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
}
event.setCancelled(true);

View File

@ -4,23 +4,25 @@ import com.boydti.fawe.bukkit.filter.GriefPreventionFilter;
import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.general.RegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Material;
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 {
private static final Logger LOGGER = LogManagerCompat.getLogger();
public GriefPreventionFeature(final Plugin griefpreventionPlugin) {
super(griefpreventionPlugin.getName());
getLogger(GriefPreventionFeature.class).debug("Plugin 'GriefPrevention' found. Using it now.");
LOGGER.debug("Plugin 'GriefPrevention' found. Using it now.");
}
public boolean isAllowed(Player player, Claim claim, MaskType type) {

View File

@ -6,15 +6,18 @@ import com.bekvon.bukkit.residence.protection.CuboidArea;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.apache.logging.log4j.Logger;
import org.bukkit.Location;
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 static final Logger LOGGER = LogManagerCompat.getLogger();
private FaweBukkit plugin;
private Plugin residence;
@ -22,7 +25,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.");
LOGGER.debug("Plugin 'Residence' found. Using it now.");
}
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {

View File

@ -10,25 +10,26 @@ import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.palmergames.bukkit.towny.object.WorldCoord;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.apache.logging.log4j.Logger;
import org.bukkit.Chunk;
import org.bukkit.Location;
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 static final Logger LOGGER = LogManagerCompat.getLogger();
private final Plugin towny;
public TownyFeature(Plugin townyPlugin) {
super(townyPlugin.getName());
this.towny = townyPlugin;
getLogger(TownyFeature.class).debug("Plugin 'Towny' found. Using it now.");
LOGGER.debug("Plugin 'Towny' found. Using it now.");
}
public boolean isAllowed(Player player, TownBlock block) {

View File

@ -5,6 +5,7 @@ import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.general.RegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.CuboidRegion;
@ -21,20 +22,17 @@ import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
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 static final Logger LOGGER = LogManagerCompat.getLogger();
private WorldGuardPlugin getWorldGuard() {
final Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldGuard");
@ -50,19 +48,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.");
LOGGER.debug("Plugin 'WorldGuard' found. Using it now.");
}
public ProtectedRegion getRegion(LocalPlayer player, Location location) {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
if (container == null) {
logger.info("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) {
logger.info("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

@ -18,13 +18,13 @@ import com.plotsquared.core.util.RegionManager;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.WEManager;
import com.sk89q.worldedit.entity.Player;
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;
import com.sk89q.worldedit.regions.RegionIntersection;
import com.sk89q.worldedit.world.World;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import java.util.List;
import java.util.Locale;
@ -34,11 +34,11 @@ import java.util.stream.Collectors;
public class PlotSquaredFeature extends FaweMaskManager {
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
LOGGER.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
@ -46,7 +46,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
setupSchematicHandler();
setupRegionManager();
} catch (Throwable ignored) {
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/plotsquared-v5.77506/");
LOGGER.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
}
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
new FaweTrim();
@ -82,12 +82,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
private void setupRegionManager() throws RuntimeException {
RegionManager.manager = new FaweRegionManager(RegionManager.manager);
log.debug(" - RegionManager: " + RegionManager.manager);
LOGGER.debug(" - RegionManager: " + RegionManager.manager);
}
private void setupSchematicHandler() throws RuntimeException {
SchematicHandler.manager = new FaweSchematicHandler();
log.debug(" - SchematicHandler: " + SchematicHandler.manager);
LOGGER.debug(" - SchematicHandler: " + SchematicHandler.manager);
}
public boolean isAllowed(Player player, Plot plot, MaskType type) {

View File

@ -18,13 +18,13 @@ import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.sk89q.worldedit.entity.Player;
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;
import com.sk89q.worldedit.regions.RegionIntersection;
import com.sk89q.worldedit.world.World;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import java.util.HashSet;
import java.util.List;
@ -35,11 +35,11 @@ import java.util.stream.Collectors;
public class PlotSquaredFeature extends FaweMaskManager {
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
LOGGER.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
@ -47,7 +47,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
setupSchematicHandler();
setupChunkManager();
} catch (Throwable ignored) {
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
LOGGER.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
}
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
new FaweTrim();
@ -83,12 +83,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
private void setupChunkManager() throws RuntimeException {
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
log.debug(" - ChunkManager: " + ChunkManager.manager);
LOGGER.debug(" - ChunkManager: " + ChunkManager.manager);
}
private void setupSchematicHandler() throws RuntimeException {
SchematicHandler.manager = new FaweSchematicHandler();
log.debug(" - SchematicHandler: " + SchematicHandler.manager);
LOGGER.debug(" - SchematicHandler: " + SchematicHandler.manager);
}
public boolean isAllowed(Player player, Plot plot, MaskType type) {

View File

@ -1,20 +1,20 @@
package com.boydti.fawe.bukkit.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class JavaVersionCheck {
public static final Logger logger = LoggerFactory.getLogger(JavaVersionCheck.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static int checkJavaVersion() {
String javaVersion = System.getProperty("java.version");
final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion);
if (!matcher.find()) {
logger.warn("Failed to determine Java version; Could not parse: {}", javaVersion);
LOGGER.warn("Failed to determine Java version; Could not parse: {}", javaVersion);
return -1;
}
@ -22,32 +22,32 @@ public class JavaVersionCheck {
try {
return Integer.parseInt(version);
} catch (final NumberFormatException e) {
logger.warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e);
LOGGER.warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e);
return -1;
}
}
public static void checkJvm() {
if (checkJavaVersion() < 11) {
logger.warn("************************************************************");
logger.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA.");
logger.warn("* FASTASYNCWORLDEDIT WILL STOP BEING COMPATIBLE WITH THIS VERSION OF");
logger.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED.");
logger.warn("*");
logger.warn("* Please update the version of Java to 11. When Minecraft 1.17");
logger.warn("* is released, support for versions of Java prior to 11 will");
logger.warn("* be dropped.");
logger.warn("*");
logger.warn("* Current Java version: {}", System.getProperty("java.version"));
logger.warn("************************************************************");
LOGGER.warn("************************************************************");
LOGGER.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA.");
LOGGER.warn("* FASTASYNCWORLDEDIT WILL STOP BEING COMPATIBLE WITH THIS VERSION OF");
LOGGER.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED.");
LOGGER.warn("*");
LOGGER.warn("* Please update the version of Java to 11. When Minecraft 1.17");
LOGGER.warn("* is released, support for versions of Java prior to 11 will");
LOGGER.warn("* be dropped.");
LOGGER.warn("*");
LOGGER.warn("* Current Java version: {}", System.getProperty("java.version"));
LOGGER.warn("************************************************************");
}
if (checkJavaVersion() >= 15) {
logger.warn("************************************************************");
logger.warn("* FastAsyncWorldEdit uses Nashorn for the craftscript engine.");
logger.warn("* Within Java 15, Nashorn has been removed from Java.");
logger.warn("* Until we add a suitable workaround, you should stick to Java 11");
logger.warn("* to use all features of FastAsyncWorldEdit.");
logger.warn("************************************************************");
LOGGER.warn("************************************************************");
LOGGER.warn("* FastAsyncWorldEdit uses Nashorn for the craftscript engine.");
LOGGER.warn("* Within Java 15, Nashorn has been removed from Java.");
LOGGER.warn("* Until we add a suitable workaround, you should stick to Java 11");
LOGGER.warn("* to use all features of FastAsyncWorldEdit.");
LOGGER.warn("************************************************************");
}
}
}

View File

@ -22,9 +22,8 @@ package com.sk89q.wepif;
import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
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;
import java.io.FileReader;
@ -38,7 +37,7 @@ import java.util.Set;
public class FlatFilePermissionsResolver implements PermissionsResolver {
private static final Logger log = LoggerFactory.getLogger(FlatFilePermissionsResolver.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private Map<String, Set<String>> userPermissionsCache;
private Set<String> defaultPermissionsCache;
@ -99,7 +98,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
}
}
} catch (IOException e) {
log.warn("Failed to load permissions", e);
LOGGER.warn("Failed to load permissions", e);
} finally {
try {
if (buff != null) {
@ -165,7 +164,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
}
}
} catch (IOException e) {
log.warn("Failed to load permissions", e);
LOGGER.warn("Failed to load permissions", e);
} finally {
try {
if (buff != null) {

View File

@ -21,6 +21,8 @@ package com.sk89q.wepif;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
@ -28,12 +30,10 @@ import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NijiPermissionsResolver implements PermissionsResolver {
private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Server server;
private final Permissions api;
@ -85,7 +85,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.permission(player, permission);
}
} catch (Throwable t) {
log.warn("Failed to check permissions", t);
LOGGER.warn("Failed to check permissions", t);
return false;
}
}
@ -99,7 +99,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.getHandler().has(server.getPlayerExact(name), permission);
}
} catch (Throwable t) {
log.warn("Failed to check permissions", t);
LOGGER.warn("Failed to check permissions", t);
return false;
}
}
@ -118,7 +118,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.inGroup(name, group);
}
} catch (Throwable t) {
log.warn("Failed to check groups", t);
LOGGER.warn("Failed to check groups", t);
return false;
}
}
@ -146,7 +146,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return groups;
}
} catch (Throwable t) {
log.warn("Failed to get groups", t);
LOGGER.warn("Failed to get groups", t);
return new String[0];
}
}

View File

@ -21,14 +21,14 @@ package com.sk89q.wepif;
import com.sk89q.util.yaml.YAMLFormat;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.event.EventHandler;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@ -59,6 +59,8 @@ public class PermissionsResolverManager implements PermissionsResolver {
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
+ "\r\n";
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static PermissionsResolverManager instance;
public static void initialize(Plugin plugin) {
@ -81,7 +83,6 @@ public class PermissionsResolverManager implements PermissionsResolver {
private final Server server;
private PermissionsResolver permissionResolver;
private YAMLProcessor config;
private final Logger logger = LoggerFactory.getLogger(getClass());
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
@SuppressWarnings("unchecked")
@ -115,7 +116,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
break;
}
} catch (Throwable e) {
logger.warn("Error in factory method for " + resolverClass.getSimpleName(), e);
LOGGER.warn("Error in factory method for " + resolverClass.getSimpleName(), e);
continue;
}
}
@ -123,7 +124,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
permissionResolver = new ConfigurationPermissionsResolver(config);
}
permissionResolver.load();
logger.info("WEPIF: " + permissionResolver.getDetectionMessage());
LOGGER.info("WEPIF: " + permissionResolver.getDetectionMessage());
}
public void setPluginPermissionsResolver(Plugin plugin) {
@ -132,7 +133,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
}
permissionResolver = new PluginPermissionsResolver((PermissionsProvider) plugin, plugin);
logger.info("WEPIF: " + permissionResolver.getDetectionMessage());
LOGGER.info("WEPIF: " + permissionResolver.getDetectionMessage());
}
@Override
@ -191,14 +192,14 @@ public class PermissionsResolverManager implements PermissionsResolver {
try {
file.createNewFile();
} catch (IOException e) {
logger.warn("Failed to create new configuration file", e);
LOGGER.warn("Failed to create new configuration file", e);
}
}
config = new YAMLProcessor(file, false, YAMLFormat.EXTENDED);
try {
config.load();
} catch (IOException e) {
logger.warn("Error loading WEPIF configuration", e);
LOGGER.warn("Error loading WEPIF configuration", e);
}
List<String> keys = config.getKeys(null);
config.setHeader(CONFIG_HEADER);
@ -229,7 +230,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
}
if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) {
logger.warn("WEPIF: Invalid or unknown class found in enabled resolvers: "
LOGGER.warn("WEPIF: Invalid or unknown class found in enabled resolvers: "
+ nextName + ". Moving to disabled resolvers list.");
i.remove();
disabledResolvers.add(nextName);
@ -243,7 +244,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
if (!stagedEnabled.contains(clazz.getSimpleName())
&& !disabledResolvers.contains(clazz.getSimpleName())) {
disabledResolvers.add(clazz.getSimpleName());
logger.info("New permissions resolver: "
LOGGER.info("New permissions resolver: "
+ clazz.getSimpleName() + " detected. "
+ "Added to disabled resolvers list.");
isUpdated = true;
@ -264,7 +265,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
isUpdated = true;
}
if (isUpdated) {
logger.info("WEPIF: Updated config file");
LOGGER.info("WEPIF: Updated config file");
config.save();
}
return isUpdated;

View File

@ -22,14 +22,14 @@ package com.sk89q.worldedit.bukkit;
import com.sk89q.bukkit.util.CommandInspector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.inject.MapBackedValueStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Optional;
@ -38,7 +38,7 @@ import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
class BukkitCommandInspector implements CommandInspector {
private static final Logger logger = LoggerFactory.getLogger(BukkitCommandInspector.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final WorldEditPlugin plugin;
private final CommandManager dispatcher;
@ -55,7 +55,7 @@ class BukkitCommandInspector implements CommandInspector {
if (mapping.isPresent()) {
return reduceToText(mapping.get().getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale);
} else {
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
return "Help text not available";
}
}
@ -66,7 +66,7 @@ class BukkitCommandInspector implements CommandInspector {
if (mapping.isPresent()) {
return reduceToText(mapping.get().getFullHelp(), WorldEdit.getInstance().getConfiguration().defaultLocale);
} else {
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
return "Help text not available";
}
}
@ -80,7 +80,7 @@ class BukkitCommandInspector implements CommandInspector {
Optional.of(plugin.wrapCommandSender(sender)));
return mapping.get().getCondition().satisfied(store);
} else {
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
return false;
}
}

View File

@ -20,9 +20,11 @@
package com.sk89q.worldedit.bukkit;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.util.YAMLConfiguration;
import com.sk89q.worldedit.util.report.Unreported;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.nio.file.Path;
@ -32,12 +34,14 @@ import java.nio.file.Path;
*/
public class BukkitConfiguration extends YAMLConfiguration {
private static final Logger LOGGER = LogManagerCompat.getLogger();
public boolean noOpPermissions = false;
public boolean commandBlockSupport = false;
@Unreported private final WorldEditPlugin plugin;
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
super(config, LoggerFactory.getLogger(plugin.getLogger().getName()));
super(config, LogManager.getLogger(plugin.getLogger().getName()));
this.plugin = plugin;
}
@ -60,10 +64,10 @@ public class BukkitConfiguration extends YAMLConfiguration {
File toDir = new File(getWorkingDirectory(), file);
if (fromDir.exists() & !toDir.exists()) {
if (fromDir.renameTo(toDir)) {
plugin.getLogger().info("Migrated " + name + " folder '" + file
LOGGER.info("Migrated " + name + " folder '" + file
+ "' from server root to plugin data folder.");
} else {
plugin.getLogger().warning("Error while migrating " + name + " folder!");
LOGGER.warn("Error while migrating " + name + " folder!");
}
}
}

View File

@ -26,13 +26,13 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
@ -50,6 +50,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import io.papermc.lib.PaperLib;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.TreeType;
@ -61,7 +62,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.slf4j.Logger;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
@ -77,7 +77,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class BukkitWorld extends AbstractWorld {
private static final Logger logger = WorldEdit.logger;
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final boolean HAS_3D_BIOMES;
@ -213,7 +213,7 @@ public class BukkitWorld extends AbstractWorld {
throw new UnsupportedOperationException("Missing BukkitImplAdapater for this version.");
}
} catch (Exception e) {
logger.warn("Regeneration via adapter failed.", e);
LOGGER.warn("Regeneration via adapter failed.", e);
return false;
}
}
@ -292,9 +292,9 @@ public class BukkitWorld extends AbstractWorld {
treeTypeMapping.put(TreeGenerator.TreeType.RANDOM_MUSHROOM, TreeType.BROWN_MUSHROOM);
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
if (treeTypeMapping.get(type) == null) {
WorldEdit.logger.error("No TreeType mapping for TreeGenerator.TreeType." + type);
LOGGER.error("No TreeType mapping for TreeGenerator.TreeType." + type);
// FAWE start
WorldEdit.logger.warn("Your FAWE version is newer than " + Bukkit.getVersion() + " and contains features of future minecraft versions which do not exist in " + Bukkit.getVersion() + ", hence the tree type " + type + " is not available.");
LOGGER.warn("Your FAWE version is newer than " + Bukkit.getVersion() + " and contains features of future minecraft versions which do not exist in " + Bukkit.getVersion() + ", hence the tree type " + type + " is not available.");
// FAWE end
}
}
@ -449,7 +449,7 @@ public class BukkitWorld extends AbstractWorld {
} catch (Exception e) {
if (!hasWarnedImplError) {
hasWarnedImplError = true;
logger.warn("Unable to retrieve block via impl adapter", e);
LOGGER.warn("Unable to retrieve block via impl adapter", e);
}
}
}
@ -464,10 +464,10 @@ public class BukkitWorld extends AbstractWorld {
return worldNativeAccess.setBlock(position, block, sideEffects);
} catch (Exception e) {
if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) {
logger.warn("Tried to set a corrupt tile entity at " + position.toString()
LOGGER.warn("Tried to set a corrupt tile entity at " + position.toString()
+ ": " + ((BaseBlock) block).getNbtData(), e);
} else {
logger.warn("Failed to set block via adapter, falling back to generic", e);
LOGGER.warn("Failed to set block via adapter, falling back to generic", e);
}
}
}

View File

@ -43,6 +43,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.anvil.ChunkDeleter;
import com.sk89q.worldedit.internal.command.CommandUtil;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.entity.EntityType;
@ -51,6 +52,7 @@ import com.sk89q.worldedit.world.item.ItemCategory;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import de.notmyfault.serverlib.ServerLib;
import io.papermc.lib.PaperLib;
import org.apache.logging.log4j.Logger;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -68,8 +70,6 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
@ -93,7 +93,7 @@ import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAM
*/
public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
private static final Logger log = LoggerFactory.getLogger(WorldEditPlugin.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui";
private static WorldEditPlugin INSTANCE;
@ -129,7 +129,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
}
return false;
}).length > 0) {
getLogger().warning("DummyFawe detected and automatically deleted! This file is no longer necessary.");
LOGGER.warn("DummyFawe detected and automatically deleted! This file is no longer necessary.");
}
}
@ -162,8 +162,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
// register this so we can load world-dependent data right as the first world is loading
getServer().getPluginManager().registerEvents(new WorldInitListener(), this);
} else {
getLogger().warning("Server reload detected. This may cause various issues with FastAsyncWorldEdit and dependent plugins.");
getLogger().warning("For more information, see https://matthewmiller.dev/blog/problem-with-reload/");
LOGGER.warn("Server reload detected. This may cause various issues with FastAsyncWorldEdit and dependent plugins.");
LOGGER.warn("For more information, see https://matthewmiller.dev/blog/problem-with-reload/");
try {
setupPreWorldData();
// since worlds are loaded already, we can do this now
@ -226,7 +226,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
}
return defaultState;
} catch (InputParseException e) {
getLogger().log(Level.WARNING, "Error loading block state for " + material.getKey(), e);
LOGGER.warn("Error loading block state for " + material.getKey(), e);
return blockState;
}
}));
@ -260,7 +260,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString()));
}
} catch (NoSuchMethodError ignored) {
getLogger().warning("The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update.");
LOGGER.warn("The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update.");
}
}
@ -301,23 +301,23 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
try {
adapterLoader.addFromPath(getClass().getClassLoader());
} catch (IOException e) {
log.warn("Failed to search path for Bukkit adapters");
LOGGER.warn("Failed to search path for Bukkit adapters");
}
try {
adapterLoader.addFromJar(getFile());
} catch (IOException e) {
log.warn("Failed to search " + getFile() + " for Bukkit adapters", e);
LOGGER.warn("Failed to search " + getFile() + " for Bukkit adapters", e);
}
try {
bukkitAdapter = adapterLoader.loadAdapter();
log.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter");
LOGGER.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter");
} catch (AdapterLoadException e) {
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
if (platform instanceof BukkitServerInterface) {
log.warn(e.getMessage());
LOGGER.warn(e.getMessage());
} else {
log.info("WorldEdit could not find a Bukkit adapter for this MC version, "
LOGGER.info("WorldEdit could not find a Bukkit adapter for this MC version, "
+ "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") "
+ "that handles the world editing.");
}
@ -365,7 +365,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
}
copyDefaultConfig(stream, actual, name);
} catch (IOException e) {
getLogger().severe("Unable to read default configuration: " + name);
LOGGER.error("Unable to read default configuration: " + name);
}
}
}
@ -378,9 +378,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
output.write(buf, 0, length);
}
getLogger().info("Default configuration file written: " + name);
LOGGER.info("Default configuration file written: " + name);
} catch (IOException e) {
getLogger().log(Level.WARNING, "Failed to write default config file", e);
LOGGER.warn("Failed to write default config file", e);
}
}

View File

@ -19,9 +19,9 @@
package com.sk89q.worldedit.bukkit.adapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.util.io.Closer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
@ -37,7 +37,7 @@ import java.util.jar.JarFile;
*/
public class BukkitImplLoader {
private static final Logger log = LoggerFactory.getLogger(BukkitImplLoader.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final List<String> adapterCandidates = new ArrayList<>();
private String customCandidate;
@ -72,7 +72,7 @@ public class BukkitImplLoader {
if (className != null) {
customCandidate = className;
adapterCandidates.add(className);
log.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters");
LOGGER.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters");
}
}
@ -165,14 +165,14 @@ public class BukkitImplLoader {
return (BukkitImplAdapter) cls.newInstance();
}
} catch (ClassNotFoundException e) {
log.warn("Failed to load the Bukkit adapter class '" + className
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
+ "' that is not supposed to be missing", e);
} catch (IllegalAccessException e) {
log.warn("Failed to load the Bukkit adapter class '" + className
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
+ "' that is not supposed to be raising this error", e);
} catch (Throwable e) {
if (className.equals(customCandidate)) {
log.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
LOGGER.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
}
}
}

View File

@ -6,6 +6,7 @@ import com.boydti.fawe.beta.implementation.queue.SingleThreadQueueExtent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
@ -28,9 +29,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.apache.logging.log4j.Logger;
import org.bukkit.generator.BlockPopulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Represents an abstract regeneration handler.
@ -41,7 +42,7 @@ import org.slf4j.LoggerFactory;
*/
public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess, Chunk extends IChunkAccess, ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>> {
public static final Logger logger = LoggerFactory.getLogger(Regenerator.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
protected final org.bukkit.World originalBukkitWorld;
protected final Region region;
@ -492,7 +493,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
try {
processChunk(xz, accessibleChunks);
} catch (Exception e) {
logger.error("Error while running " + name() + " on chunk " + MathMan.unpairIntX(xz) + "/" + MathMan.unpairIntY(xz), e);
LOGGER.error("Error while running " + name() + " on chunk " + MathMan.unpairIntX(xz) + "/" + MathMan.unpairIntY(xz), e);
}
}
}

View File

@ -42,6 +42,7 @@ import com.sk89q.worldedit.bukkit.adapter.impl.regen.Regen_v1_15_R2;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.LazyBaseEntity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.Property;
@ -80,6 +81,7 @@ import net.minecraft.server.v1_15_R1.PlayerChunk;
import net.minecraft.server.v1_15_R1.TileEntity;
import net.minecraft.server.v1_15_R1.World;
import net.minecraft.server.v1_15_R1.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
@ -101,9 +103,10 @@ import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Spigot_v1_15_R2 parent;
private char[] ibdToStateOrdinal;
private int[] ordinalToIbdID;
@ -343,8 +346,7 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
getLogger(FAWE_Spigot_v1_15_R2.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
LOGGER.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

@ -42,6 +42,7 @@ import com.sk89q.worldedit.bukkit.adapter.impl.regen.Regen_v1_16_R1;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.LazyBaseEntity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.Property;
@ -80,6 +81,7 @@ 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.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
@ -101,9 +103,10 @@ import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Spigot_v1_16_R1 parent;
private char[] ibdToStateOrdinal;
private int[] ordinalToIbdID;
@ -343,8 +346,7 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
getLogger(FAWE_Spigot_v1_16_R1.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
LOGGER.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

@ -42,6 +42,7 @@ import com.sk89q.worldedit.bukkit.adapter.impl.regen.Regen_v1_16_R2;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.LazyBaseEntity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.Property;
@ -81,6 +82,7 @@ import net.minecraft.server.v1_16_R2.PlayerChunk;
import net.minecraft.server.v1_16_R2.TileEntity;
import net.minecraft.server.v1_16_R2.World;
import net.minecraft.server.v1_16_R2.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
@ -102,9 +104,10 @@ import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Spigot_v1_16_R2 parent;
private char[] ibdToStateOrdinal;
private int[] ordinalToIbdID;
@ -345,8 +348,7 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
getLogger(FAWE_Spigot_v1_16_R2.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
LOGGER.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

@ -42,6 +42,7 @@ import com.sk89q.worldedit.bukkit.adapter.impl.regen.Regen_v1_16_R3;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.LazyBaseEntity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.Property;
@ -81,6 +82,7 @@ import net.minecraft.server.v1_16_R3.PlayerChunk;
import net.minecraft.server.v1_16_R3.TileEntity;
import net.minecraft.server.v1_16_R3.World;
import net.minecraft.server.v1_16_R3.WorldServer;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
@ -102,9 +104,10 @@ import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static org.slf4j.LoggerFactory.getLogger;
public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Spigot_v1_16_R3 parent;
private char[] ibdToStateOrdinal;
private int[] ordinalToIbdID;
@ -345,8 +348,7 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
init();
return adaptToChar(ibd);
} catch (ArrayIndexOutOfBoundsException e1) {
getLogger(FAWE_Spigot_v1_16_R3.class)
.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!",
LOGGER.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

@ -10,13 +10,15 @@ applyShadowConfiguration()
addJarManifest(WorldEditKind.Standalone("com.sk89q.worldedit.cli.CLIWorldEdit"))
dependencies {
"api"(project(":worldedit-core"))
"implementation"(platform("org.apache.logging.log4j:log4j-bom:2.14.0"))
"implementation"("org.apache.logging.log4j:log4j-core")
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl")
"implementation"("commons-cli:commons-cli:1.4")
"implementation"("com.google.guava:guava")
"implementation"("com.google.code.gson:gson")
api(project(":worldedit-core"))
implementation(platform("org.apache.logging.log4j:log4j-bom:2.14.1") {
because("We control Log4J on this platform")
})
implementation("org.apache.logging.log4j:log4j-api")
implementation("org.apache.logging.log4j:log4j-core")
implementation("commons-cli:commons-cli:1.4")
implementation("com.google.guava:guava")
implementation("com.google.code.gson:gson")
}
tasks.named<ShadowJar>("shadowJar") {

View File

@ -28,8 +28,7 @@ import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.WorldEditText;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.serializer.plain.PlainComponentSerializer;
import org.slf4j.Logger;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.Locale;
import java.util.Map;

View File

@ -31,6 +31,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
@ -44,8 +45,7 @@ import com.sk89q.worldedit.world.item.ItemType;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -67,7 +67,7 @@ import java.util.Scanner;
*/
public class CLIWorldEdit {
private static final Logger LOGGER = LoggerFactory.getLogger(CLIWorldEdit.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
public static CLIWorldEdit inst;

View File

@ -12,11 +12,6 @@ repositories {
maven {
name = "IntellectualSites"
url = uri("https://mvn.intellectualsites.com/content/groups/public/")
content {
includeGroup("com.plotsquared")
includeGroup("com.intellectualsites.paster")
includeGroup("com.github.intellectualsites.plotsquared")
}
}
}
@ -32,13 +27,14 @@ dependencies {
api(project(":worldedit-libs:core"))
implementation("de.schlichtherle:truezip:6.8.4")
implementation("net.java.truevfs:truevfs-profile-default_2.13:0.12.2")
implementation("org.mozilla:rhino-runtime:1.7.13")
implementation("org.yaml:snakeyaml")
implementation("com.google.guava:guava")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.google.code.gson:gson")
implementation("org.slf4j:slf4j-api:${Versions.SLF4J}")
implementation("org.apache.logging.log4j:log4j-api:2.8.1") {
because("Mojang provides Log4J 2.8.1")
}
implementation("it.unimi.dsi:fastutil")
val antlrVersion = "4.9.1"
@ -54,7 +50,7 @@ dependencies {
annotationProcessor("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
testImplementation("ch.qos.logback:logback-core:${Versions.LOGBACK}")
testImplementation("ch.qos.logback:logback-classic:${Versions.LOGBACK}")
implementation("com.github.luben:zstd-jni:1.4.8-6")
implementation("com.github.luben:zstd-jni:1.4.9-2")
compileOnly("net.fabiozumbi12:redprotect:1.9.6")
api("com.github.intellectualsites.plotsquared:PlotSquared-API:4.514") { isTransitive = false }
api("com.plotsquared:PlotSquared-Core:5.13.3") { isTransitive = false }
@ -109,7 +105,7 @@ tasks.named<Copy>("processResources") {
}
tasks.named<ShadowJar>("shadowJar") {
dependencies {
include(dependency("com.github.luben:zstd-jni:1.4.8-6"))
include(dependency("com.github.luben:zstd-jni:1.4.9-2"))
}
}

View File

@ -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'.");
}

View File

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

View File

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

View File

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

View File

@ -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(", ", "{", "}")));
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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,13 +199,12 @@ 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
LOGGER.error("Could not call method '" + method.toString() + "' of " + this.clazz
+ " for deserialization",
ex instanceof InvocationTargetException ? ex.getCause() : ex);
}
@ -214,7 +216,7 @@ 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
LOGGER.error("Could not call constructor '" + ctor.toString() + "' of " + this.clazz
+ " for deserialization",
ex instanceof InvocationTargetException ? ex.getCause() : ex);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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(".")) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 {
/*
-----------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More