mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Update Upstream
609c7b8 Scrapped Logging Framework 4 Java Closes #997 Closes #998 Closes #999 Closes #1000 Closes #1001 Closes #1002
This commit is contained in:
@ -24,10 +24,10 @@ package com.sk89q.worldedit.util;
|
||||
import com.sk89q.util.StringUtil;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -49,7 +49,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class PropertiesConfiguration extends LocalConfiguration {
|
||||
|
||||
@Unreported private static final Logger log = LoggerFactory.getLogger(PropertiesConfiguration.class);
|
||||
@Unreported private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
@Unreported protected Properties properties;
|
||||
@Unreported protected File path;
|
||||
@ -82,7 +82,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
properties.load(stream);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to read configuration", e);
|
||||
LOGGER.warn("Failed to read configuration", e);
|
||||
}
|
||||
|
||||
loadExtra();
|
||||
@ -147,7 +147,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
try (OutputStream output = new FileOutputStream(path)) {
|
||||
properties.store(output, "Don't put comments; they get removed");
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to write configuration", e);
|
||||
LOGGER.warn("Failed to write configuration", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.session.SessionManager;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import org.slf4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
|
@ -22,8 +22,8 @@ package com.sk89q.worldedit.util.eventbus;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
@ -47,7 +47,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public final class EventBus {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(EventBus.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private final ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
|
||||
@ -192,7 +192,7 @@ public final class EventBus {
|
||||
try {
|
||||
handler.handleEvent(event);
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.error("Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
LOGGER.error("Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ package com.sk89q.worldedit.util.io;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
@ -35,7 +35,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class Closer implements Closeable {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Closer.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
/**
|
||||
* The suppressor implementation to use for the current Java version.
|
||||
@ -239,7 +239,7 @@ public final class Closer implements Closeable {
|
||||
@Override
|
||||
public void suppress(Object closeable, Throwable thrown, Throwable suppressed) {
|
||||
// log to the same place as Closeables
|
||||
logger.warn("Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
LOGGER.warn("Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,6 @@ public class ArchiveNioSupports {
|
||||
|
||||
static {
|
||||
ImmutableList.Builder<ArchiveNioSupport> builder = ImmutableList.builder();
|
||||
try {
|
||||
builder.add(TrueVfsArchiveNioSupport.getInstance());
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
// No TrueVFS available. That's OK.
|
||||
}
|
||||
SUPPORTS = builder.add(ZipArchiveNioSupport.getInstance())
|
||||
.addAll(ServiceLoader.load(ArchiveNioSupport.class))
|
||||
.build();
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.io.file;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.java.truevfs.access.TArchiveDetector;
|
||||
import net.java.truevfs.access.TFileSystem;
|
||||
import net.java.truevfs.access.TPath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public final class TrueVfsArchiveNioSupport implements ArchiveNioSupport {
|
||||
|
||||
private static final TrueVfsArchiveNioSupport INSTANCE = new TrueVfsArchiveNioSupport();
|
||||
|
||||
public static TrueVfsArchiveNioSupport getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static final Set<String> ALLOWED_EXTENSIONS = ImmutableSet.copyOf(
|
||||
Splitter.on('|').split(TArchiveDetector.ALL.getExtensions())
|
||||
);
|
||||
|
||||
private TrueVfsArchiveNioSupport() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ArchiveDir> tryOpenAsDir(Path archive) throws IOException {
|
||||
String fileName = archive.getFileName().toString();
|
||||
int dot = fileName.indexOf('.');
|
||||
if (dot < 0 || dot >= fileName.length() || !ALLOWED_EXTENSIONS
|
||||
.contains(fileName.substring(dot + 1))) {
|
||||
return Optional.empty();
|
||||
}
|
||||
TFileSystem fileSystem = new TPath(archive).getFileSystem();
|
||||
TPath root = fileSystem.getPath("/");
|
||||
Path realRoot = ArchiveNioSupports.skipRootSameName(
|
||||
root, fileName.substring(0, dot)
|
||||
);
|
||||
return Optional.of(new ArchiveDir() {
|
||||
@Override
|
||||
public Path getPath() {
|
||||
return realRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
fileSystem.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -19,8 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.util.report;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -29,7 +29,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class ShallowObjectReport extends DataReport {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ShallowObjectReport.class);
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
public ShallowObjectReport(String title, Object object) {
|
||||
super(title);
|
||||
@ -53,7 +53,7 @@ public class ShallowObjectReport extends DataReport {
|
||||
Object value = field.get(object);
|
||||
append(field.getName(), String.valueOf(value));
|
||||
} catch (IllegalAccessException e) {
|
||||
log.warn("Failed to get value of '" + field.getName() + "' on " + type);
|
||||
LOGGER.warn("Failed to get value of '" + field.getName() + "' on " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user