3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 02:20:07 +01:00

Switch to SLF4J logging.

Dieser Commit ist enthalten in:
Kenzie Togami 2019-03-13 19:51:48 -07:00
Ursprung 4191f017f1
Commit d6804737cf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 5D200B325E157A81
46 geänderte Dateien mit 247 neuen und 318 gelöschten Zeilen

Datei anzeigen

@ -15,6 +15,7 @@
<allow pkg="com.google.gson"/> <allow pkg="com.google.gson"/>
<allow pkg="net.royawesome.jlibnoise"/> <allow pkg="net.royawesome.jlibnoise"/>
<allow pkg="org.json.simple" /> <allow pkg="org.json.simple" />
<allow pkg="org.slf4j"/>
<subpackage name="util.yaml"> <subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/> <allow pkg="org.yaml.snakeyaml"/>

Datei anzeigen

@ -14,6 +14,7 @@ dependencies {
compile 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz compile 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz
compile 'org.bstats:bstats-bukkit:1.4' compile 'org.bstats:bstats-bukkit:1.4'
compile "io.papermc:paperlib:1.0.1" compile "io.papermc:paperlib:1.0.1"
compile 'org.slf4j:slf4j-jdk14:1.7.26'
testCompile 'org.mockito:mockito-core:1.9.0-rc1' testCompile 'org.mockito:mockito-core:1.9.0-rc1'
} }

Datei anzeigen

@ -22,6 +22,8 @@ package com.sk89q.wepif;
import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Server; import org.bukkit.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -32,12 +34,10 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
public class FlatFilePermissionsResolver implements PermissionsResolver { public class FlatFilePermissionsResolver implements PermissionsResolver {
private static final Logger log = Logger.getLogger(FlatFilePermissionsResolver.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(FlatFilePermissionsResolver.class);
private Map<String, Set<String>> userPermissionsCache; private Map<String, Set<String>> userPermissionsCache;
private Set<String> defaultPermissionsCache; private Set<String> defaultPermissionsCache;
@ -98,7 +98,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
} }
} }
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to load permissions", e); log.warn("Failed to load permissions", e);
} finally { } finally {
try { try {
if (buff != null) { if (buff != null) {
@ -164,7 +164,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
} }
} }
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to load permissions", e); log.warn("Failed to load permissions", e);
} finally { } finally {
try { try {
if (buff != null) { if (buff != null) {

Datei anzeigen

@ -28,13 +28,12 @@ import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.slf4j.Logger;
import java.util.logging.Level; import org.slf4j.LoggerFactory;
import java.util.logging.Logger;
public class NijiPermissionsResolver implements PermissionsResolver { public class NijiPermissionsResolver implements PermissionsResolver {
private static final Logger log = Logger.getLogger(NijiPermissionsResolver.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class);
private Server server; private Server server;
private Permissions api; private Permissions api;
@ -84,7 +83,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.permission(player, permission); return api.Security.permission(player, permission);
} }
} catch (Throwable t) { } catch (Throwable t) {
log.log(Level.WARNING, "Failed to check permissions", t); log.warn("Failed to check permissions", t);
return false; return false;
} }
} }
@ -98,7 +97,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.getHandler().has(server.getPlayerExact(name), permission); return api.getHandler().has(server.getPlayerExact(name), permission);
} }
} catch (Throwable t) { } catch (Throwable t) {
log.log(Level.WARNING, "Failed to check permissions", t); log.warn("Failed to check permissions", t);
return false; return false;
} }
} }
@ -115,7 +114,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return api.Security.inGroup(name, group); return api.Security.inGroup(name, group);
} }
} catch (Throwable t) { } catch (Throwable t) {
log.log(Level.WARNING, "Failed to check groups", t); log.warn("Failed to check groups", t);
return false; return false;
} }
} }
@ -139,7 +138,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
return groups; return groups;
} }
} catch (Throwable t) { } catch (Throwable t) {
log.log(Level.WARNING, "Failed to get groups", t); log.warn("Failed to get groups", t);
return new String[0]; return new String[0];
} }
} }

Datei anzeigen

@ -27,6 +27,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -35,8 +37,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class PermissionsResolverManager implements PermissionsResolver { public class PermissionsResolverManager implements PermissionsResolver {
@ -85,7 +85,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
private Server server; private Server server;
private PermissionsResolver permissionResolver; private PermissionsResolver permissionResolver;
private YAMLProcessor config; private YAMLProcessor config;
private Logger logger = Logger.getLogger(getClass().getCanonicalName()); private Logger logger = LoggerFactory.getLogger(getClass());
private List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>(); private List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -119,7 +119,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
break; break;
} }
} catch (Throwable e) { } catch (Throwable e) {
logger.log(Level.WARNING, "Error in factory method for " + resolverClass.getSimpleName(), e); logger.warn("Error in factory method for " + resolverClass.getSimpleName(), e);
continue; continue;
} }
} }
@ -195,14 +195,14 @@ public class PermissionsResolverManager implements PermissionsResolver {
try { try {
file.createNewFile(); file.createNewFile();
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Failed to create new configuration file", e); logger.warn("Failed to create new configuration file", e);
} }
} }
config = new YAMLProcessor(file, false, YAMLFormat.EXTENDED); config = new YAMLProcessor(file, false, YAMLFormat.EXTENDED);
try { try {
config.load(); config.load();
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Error loading WEPIF configuration", e); logger.warn("Error loading WEPIF configuration", e);
} }
List<String> keys = config.getKeys(null); List<String> keys = config.getKeys(null);
config.setHeader(CONFIG_HEADER); config.setHeader(CONFIG_HEADER);
@ -232,7 +232,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
} catch (ClassNotFoundException e) {} } catch (ClassNotFoundException e) {}
if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) { if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) {
logger.warning("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."); + nextName + ". Moving to disabled resolvers list.");
i.remove(); i.remove();
disabledResolvers.add(nextName); disabledResolvers.add(nextName);

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.bukkit.util.CommandInspector; import com.sk89q.bukkit.util.CommandInspector;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
@ -29,12 +27,14 @@ import com.sk89q.worldedit.util.command.Description;
import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.util.command.Dispatcher;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull;
class BukkitCommandInspector implements CommandInspector { class BukkitCommandInspector implements CommandInspector {
private static final Logger logger = Logger.getLogger(BukkitCommandInspector.class.getCanonicalName()); private static final Logger logger = LoggerFactory.getLogger(BukkitCommandInspector.class);
private final WorldEditPlugin plugin; private final WorldEditPlugin plugin;
private final Dispatcher dispatcher; private final Dispatcher dispatcher;
@ -51,7 +51,7 @@ class BukkitCommandInspector implements CommandInspector {
if (mapping != null) { if (mapping != null) {
return mapping.getDescription().getDescription(); return mapping.getDescription().getDescription();
} else { } else {
logger.warning("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"; return "Help text not available";
} }
} }
@ -63,7 +63,7 @@ class BukkitCommandInspector implements CommandInspector {
Description description = mapping.getDescription(); Description description = mapping.getDescription();
return "Usage: " + description.getUsage() + (description.getHelp() != null ? "\n" + description.getHelp() : ""); return "Usage: " + description.getUsage() + (description.getHelp() != null ? "\n" + description.getHelp() : "");
} else { } else {
logger.warning("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"; return "Help text not available";
} }
} }
@ -76,7 +76,7 @@ class BukkitCommandInspector implements CommandInspector {
locals.put(Actor.class, plugin.wrapCommandSender(sender)); locals.put(Actor.class, plugin.wrapCommandSender(sender));
return mapping.getCallable().testPermission(locals); return mapping.getCallable().testPermission(locals);
} else { } else {
logger.warning("BukkitCommandInspector doesn't know how about the command '" + command + "'"); logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
return false; return false;
} }
} }

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.util.YAMLConfiguration; import com.sk89q.worldedit.util.YAMLConfiguration;
import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.util.report.Unreported;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
@ -34,7 +35,7 @@ public class BukkitConfiguration extends YAMLConfiguration {
@Unreported private final WorldEditPlugin plugin; @Unreported private final WorldEditPlugin plugin;
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) { public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
super(config, plugin.getLogger()); super(config, LoggerFactory.getLogger(plugin.getLogger().getName()));
this.plugin = plugin; this.plugin = plugin;
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -48,17 +46,17 @@ import org.bukkit.block.Chest;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.inventory.DoubleChestInventory; import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.slf4j.Logger;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
public class BukkitWorld extends AbstractWorld { public class BukkitWorld extends AbstractWorld {
@ -118,9 +116,9 @@ public class BukkitWorld extends AbstractWorld {
return null; return null;
} }
} catch (Exception e) { } catch (Exception e) {
logger.warning("Corrupt entity found when creating: " + entity.getType().getId()); logger.warn("Corrupt entity found when creating: " + entity.getType().getId());
if (entity.getNbtData() != null) { if (entity.getNbtData() != null) {
logger.warning(entity.getNbtData().toString()); logger.warn(entity.getNbtData().toString());
} }
e.printStackTrace(); e.printStackTrace();
return null; return null;
@ -183,7 +181,7 @@ public class BukkitWorld extends AbstractWorld {
try { try {
getWorld().regenerateChunk(chunk.getBlockX(), chunk.getBlockZ()); getWorld().regenerateChunk(chunk.getBlockX(), chunk.getBlockZ());
} catch (Throwable t) { } catch (Throwable t) {
logger.log(Level.WARNING, "Chunk generation via Bukkit raised an error", t); logger.warn("Chunk generation via Bukkit raised an error", t);
} }
// Then restore // Then restore
@ -280,7 +278,7 @@ public class BukkitWorld extends AbstractWorld {
treeTypeMapping.put(TreeGenerator.TreeType.RANDOM_MUSHROOM, TreeType.BROWN_MUSHROOM); treeTypeMapping.put(TreeGenerator.TreeType.RANDOM_MUSHROOM, TreeType.BROWN_MUSHROOM);
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
if (treeTypeMapping.get(type) == null) { if (treeTypeMapping.get(type) == null) {
WorldEdit.logger.severe("No TreeType mapping for TreeGenerator.TreeType." + type); WorldEdit.logger.error("No TreeType mapping for TreeGenerator.TreeType." + type);
} }
} }
} }
@ -426,8 +424,8 @@ public class BukkitWorld extends AbstractWorld {
return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight); return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight);
} catch (Exception e) { } catch (Exception e) {
if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) { if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) {
logger.warning("Tried to set a corrupt tile entity at " + position.toString()); logger.warn("Tried to set a corrupt tile entity at " + position.toString());
logger.warning(((BaseBlock) block).getNbtData().toString()); logger.warn(((BaseBlock) block).getNbtData().toString());
} }
e.printStackTrace(); e.printStackTrace();
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.wepif.PermissionsResolverManager; import com.sk89q.wepif.PermissionsResolverManager;
@ -58,7 +56,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter; import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -68,17 +69,16 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Plugin for Bukkit. * Plugin for Bukkit.
*/ */
public class WorldEditPlugin extends JavaPlugin implements TabCompleter { public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
private static final Logger log = Logger.getLogger(WorldEditPlugin.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(WorldEditPlugin.class);
public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui";
private static WorldEditPlugin INSTANCE; private static WorldEditPlugin INSTANCE;
@ -194,23 +194,23 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
try { try {
adapterLoader.addFromPath(getClass().getClassLoader()); adapterLoader.addFromPath(getClass().getClassLoader());
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to search path for Bukkit adapters"); log.warn("Failed to search path for Bukkit adapters");
} }
try { try {
adapterLoader.addFromJar(getFile()); adapterLoader.addFromJar(getFile());
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to search " + getFile() + " for Bukkit adapters", e); log.warn("Failed to search " + getFile() + " for Bukkit adapters", e);
} }
try { try {
bukkitAdapter = adapterLoader.loadAdapter(); bukkitAdapter = adapterLoader.loadAdapter();
log.log(Level.INFO, "Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter"); log.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter");
} catch (AdapterLoadException e) { } catch (AdapterLoadException e) {
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
if (platform instanceof BukkitServerInterface) { if (platform instanceof BukkitServerInterface) {
log.log(Level.WARNING, e.getMessage()); log.warn(e.getMessage());
} else { } else {
log.log(Level.INFO, "WorldEdit could not find a Bukkit adapter for this MC version, " + log.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() + ") " + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " +
"that handles the world editing."); "that handles the world editing.");
} }

Datei anzeigen

@ -20,6 +20,8 @@
package com.sk89q.worldedit.bukkit.adapter; package com.sk89q.worldedit.bukkit.adapter;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -29,15 +31,13 @@ import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Loads Bukkit implementation adapters. * Loads Bukkit implementation adapters.
*/ */
public class BukkitImplLoader { public class BukkitImplLoader {
private static final Logger log = Logger.getLogger(BukkitImplLoader.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(BukkitImplLoader.class);
private final List<String> adapterCandidates = new ArrayList<>(); private final List<String> adapterCandidates = new ArrayList<>();
private String customCandidate; private String customCandidate;
@ -73,7 +73,7 @@ public class BukkitImplLoader {
if (className != null) { if (className != null) {
customCandidate = className; customCandidate = className;
adapterCandidates.add(className); adapterCandidates.add(className);
log.log(Level.INFO, "-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters"); log.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters");
} }
} }
@ -157,18 +157,18 @@ public class BukkitImplLoader {
if (BukkitImplAdapter.class.isAssignableFrom(cls)) { if (BukkitImplAdapter.class.isAssignableFrom(cls)) {
return (BukkitImplAdapter) cls.newInstance(); return (BukkitImplAdapter) cls.newInstance();
} else { } else {
log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + log.warn("Failed to load the Bukkit adapter class '" + className +
"' because it does not implement " + BukkitImplAdapter.class.getCanonicalName()); "' because it does not implement " + BukkitImplAdapter.class.getCanonicalName());
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + log.warn("Failed to load the Bukkit adapter class '" + className +
"' that is not supposed to be missing", e); "' that is not supposed to be missing", e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + log.warn("Failed to load the Bukkit adapter class '" + className +
"' that is not supposed to be raising this error", e); "' that is not supposed to be raising this error", e);
} catch (Throwable e) { } catch (Throwable e) {
if (className.equals(customCandidate)) { if (className.equals(customCandidate)) {
log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + "'", e); log.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
} }
} }
} }

Datei anzeigen

@ -12,6 +12,7 @@ dependencies {
compile 'com.google.code.gson:gson:2.8.0' compile 'com.google.code.gson:gson:2.8.0'
compile 'com.sk89q.lib:jlibnoise:1.0.0' compile 'com.sk89q.lib:jlibnoise:1.0.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1' compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.slf4j:slf4j-api:1.7.26'
//compile 'net.sf.trove4j:trove4j:3.0.3' //compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1' testCompile 'org.mockito:mockito-core:1.9.0-rc1'
} }

Datei anzeigen

@ -20,6 +20,8 @@
package com.sk89q.minecraft.util.commands; package com.sk89q.minecraft.util.commands;
import com.sk89q.util.StringUtil; import com.sk89q.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -30,8 +32,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Manager for handling commands. This allows you to easily process commands, * Manager for handling commands. This allows you to easily process commands,
@ -63,7 +63,7 @@ import java.util.logging.Logger;
public abstract class CommandsManager<T> { public abstract class CommandsManager<T> {
protected static final Logger logger = protected static final Logger logger =
Logger.getLogger(CommandsManager.class.getCanonicalName()); LoggerFactory.getLogger(CommandsManager.class);
/** /**
* Mapping of commands (including aliases) with a description. Root * Mapping of commands (including aliases) with a description. Root
@ -142,7 +142,7 @@ public abstract class CommandsManager<T> {
return registerMethods(cls, parent, obj); return registerMethods(cls, parent, obj);
} }
} catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
logger.log(Level.SEVERE, "Failed to register commands", e); logger.error("Failed to register commands", e);
} }
return null; return null;
} }
@ -523,7 +523,7 @@ public abstract class CommandsManager<T> {
try { try {
method.invoke(instance, methodArgs); method.invoke(instance, methodArgs);
} catch (IllegalArgumentException | IllegalAccessException e) { } catch (IllegalArgumentException | IllegalAccessException e) {
logger.log(Level.SEVERE, "Failed to execute command", e); logger.error("Failed to execute command", e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (e.getCause() instanceof CommandException) { if (e.getCause() instanceof CommandException) {
throw (CommandException) e.getCause(); throw (CommandException) e.getCause();

Datei anzeigen

@ -19,14 +19,15 @@
package com.sk89q.minecraft.util.commands; package com.sk89q.minecraft.util.commands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SimpleInjector implements Injector { public class SimpleInjector implements Injector {
private static final Logger log = Logger.getLogger(SimpleInjector.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(SimpleInjector.class);
private Object[] args; private Object[] args;
private Class<?>[] argClasses; private Class<?>[] argClasses;
@ -45,7 +46,7 @@ public class SimpleInjector implements Injector {
ctr.setAccessible(true); ctr.setAccessible(true);
return ctr.newInstance(args); return ctr.newInstance(args);
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); log.error("Error initializing commands class " + clazz, e);
return null; return null;
} }
} }

Datei anzeigen

@ -19,12 +19,6 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.event.extent.EditSessionEvent;
@ -117,7 +111,10 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -126,10 +123,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
/** /**
* An {@link Extent} that handles history, {@link BlockBag}s, change limits, * An {@link Extent} that handles history, {@link BlockBag}s, change limits,
@ -142,7 +141,7 @@ import javax.annotation.Nullable;
@SuppressWarnings({"FieldCanBeLocal"}) @SuppressWarnings({"FieldCanBeLocal"})
public class EditSession implements Extent, AutoCloseable { public class EditSession implements Extent, AutoCloseable {
private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(EditSession.class);
/** /**
* Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to * Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to
@ -1958,7 +1957,7 @@ public class EditSession implements Extent, AutoCloseable {
timedOut[0] = timedOut[0] + 1; timedOut[0] = timedOut[0] + 1;
return null; return null;
} catch (Exception e) { } catch (Exception e) {
log.log(Level.WARNING, "Failed to create shape", e); log.warn("Failed to create shape", e);
return null; return null;
} }
} }
@ -2322,7 +2321,7 @@ public class EditSession implements Extent, AutoCloseable {
timedOut[0] = timedOut[0] + 1; timedOut[0] = timedOut[0] + 1;
return null; return null;
} catch (Exception e) { } catch (Exception e) {
log.log(Level.WARNING, "Failed to create shape", e); log.warn("Failed to create shape", e);
return null; return null;
} }
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jchronic.Chronic; import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options; import com.sk89q.jchronic.Options;
import com.sk89q.jchronic.utils.Span; import com.sk89q.jchronic.utils.Span;
@ -53,6 +51,7 @@ import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.snapshot.Snapshot; import com.sk89q.worldedit.world.snapshot.Snapshot;
import javax.annotation.Nullable;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
@ -60,7 +59,7 @@ import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Stores session information. * Stores session information.
@ -798,7 +797,7 @@ public class LocalSession {
try { try {
setCUIVersion(Integer.parseInt(split[1])); setCUIVersion(Integer.parseInt(split[1]));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
WorldEdit.logger.warning("Error while reading CUI init message: " + e.getMessage()); WorldEdit.logger.warn("Error while reading CUI init message: " + e.getMessage());
this.failedCuiAttempts ++; this.failedCuiAttempts ++;
} }
} }

Datei anzeigen

@ -24,8 +24,6 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import java.util.logging.Level;
public class TracedEditSession extends EditSession { public class TracedEditSession extends EditSession {
TracedEditSession(EventBus eventBus, World world, int maxBlocks, BlockBag blockBag, EditSessionEvent event) { TracedEditSession(EventBus eventBus, World world, int maxBlocks, BlockBag blockBag, EditSessionEvent event) {
@ -39,9 +37,9 @@ public class TracedEditSession extends EditSession {
super.finalize(); super.finalize();
if (commitRequired()) { if (commitRequired()) {
WorldEdit.logger.warning("####### LEFTOVER BUFFER BLOCKS DETECTED #######"); WorldEdit.logger.warn("####### LEFTOVER BUFFER BLOCKS DETECTED #######");
WorldEdit.logger.warning("This means that some code did not flush their EditSession."); WorldEdit.logger.warn("This means that some code did not flush their EditSession.");
WorldEdit.logger.log(Level.WARNING, "Here is a stacktrace from the creation of this EditSession:", stacktrace); WorldEdit.logger.warn("Here is a stacktrace from the creation of this EditSession:", stacktrace);
} }
} }
} }

Datei anzeigen

@ -19,9 +19,6 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
@ -53,7 +50,6 @@ import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameException;
import com.sk89q.worldedit.util.io.file.FilenameResolutionException; import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
import com.sk89q.worldedit.util.io.file.InvalidFilenameException; import com.sk89q.worldedit.util.io.file.InvalidFilenameException;
import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler;
import com.sk89q.worldedit.util.task.SimpleSupervisor; import com.sk89q.worldedit.util.task.SimpleSupervisor;
import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.util.task.Supervisor;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -61,7 +57,11 @@ import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BundledBlockData; import com.sk89q.worldedit.world.registry.BundledBlockData;
import com.sk89q.worldedit.world.registry.BundledItemData; import com.sk89q.worldedit.world.registry.BundledItemData;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import javax.script.ScriptException;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -74,11 +74,9 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable; import static com.sk89q.worldedit.event.platform.Interaction.HIT;
import javax.script.ScriptException; import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
/** /**
* The entry point and container for a working implementation of WorldEdit. * The entry point and container for a working implementation of WorldEdit.
@ -95,7 +93,7 @@ import javax.script.ScriptException;
*/ */
public final class WorldEdit { public final class WorldEdit {
public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName()); public static final Logger logger = LoggerFactory.getLogger(WorldEdit.class);
private static final WorldEdit instance = new WorldEdit(); private static final WorldEdit instance = new WorldEdit();
private static String version; private static String version;
@ -112,7 +110,6 @@ public final class WorldEdit {
private final PatternFactory patternFactory = new PatternFactory(this); private final PatternFactory patternFactory = new PatternFactory(this);
static { static {
WorldEditPrefixHandler.register("com.sk89q.worldedit");
getVersion(); getVersion();
} }
@ -655,13 +652,13 @@ public final class WorldEdit {
} catch (ScriptException e) { } catch (ScriptException e) {
player.printError("Failed to execute:"); player.printError("Failed to execute:");
player.printRaw(e.getMessage()); player.printRaw(e.getMessage());
logger.log(Level.WARNING, "Failed to execute script", e); logger.warn("Failed to execute script", e);
} catch (NumberFormatException | WorldEditException e) { } catch (NumberFormatException | WorldEditException e) {
throw e; throw e;
} catch (Throwable e) { } catch (Throwable e) {
player.printError("Failed to execute (see console):"); player.printError("Failed to execute (see console):");
player.printRaw(e.getClass().getCanonicalName()); player.printRaw(e.getClass().getCanonicalName());
logger.log(Level.WARNING, "Failed to execute script", e); logger.warn("Failed to execute script", e);
} finally { } finally {
for (EditSession editSession : scriptContext.getEditSessions()) { for (EditSession editSession : scriptContext.getEditSessions()) {
editSession.flushSession(); editSession.flushSession();

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
@ -48,6 +46,8 @@ import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -58,10 +58,10 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Commands that work with schematic files. * Commands that work with schematic files.
*/ */
@ -71,7 +71,7 @@ public class SchematicCommands {
* 9 schematics per page fits in the MC chat window. * 9 schematics per page fits in the MC chat window.
*/ */
private static final int SCHEMATICS_PER_PAGE = 9; private static final int SCHEMATICS_PER_PAGE = 9;
private static final Logger log = Logger.getLogger(SchematicCommands.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(SchematicCommands.class);
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
/** /**
@ -123,7 +123,7 @@ public class SchematicCommands {
player.print(filename + " loaded. Paste it with //paste"); player.print(filename + " loaded. Paste it with //paste");
} catch (IOException e) { } catch (IOException e) {
player.printError("Schematic could not read or it does not exist: " + e.getMessage()); player.printError("Schematic could not read or it does not exist: " + e.getMessage());
log.log(Level.WARNING, "Failed to load a saved clipboard", e); log.warn("Failed to load a saved clipboard", e);
} }
} }
@ -179,7 +179,7 @@ public class SchematicCommands {
player.print(filename + " saved."); player.print(filename + " saved.");
} catch (IOException e) { } catch (IOException e) {
player.printError("Schematic could not written: " + e.getMessage()); player.printError("Schematic could not written: " + e.getMessage());
log.log(Level.WARNING, "Failed to write a saved clipboard", e); log.warn("Failed to write a saved clipboard", e);
} }
} }

Datei anzeigen

@ -40,14 +40,12 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
/** /**
* Snapshot commands. * Snapshot commands.
*/ */
public class SnapshotCommands { public class SnapshotCommands {
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
private final WorldEdit we; private final WorldEdit we;
@ -93,10 +91,10 @@ public class SnapshotCommands {
File dir = config.snapshotRepo.getDirectory(); File dir = config.snapshotRepo.getDirectory();
try { try {
logger.info("WorldEdit found no snapshots: looked in: " WorldEdit.logger.info("WorldEdit found no snapshots: looked in: "
+ dir.getCanonicalPath()); + dir.getCanonicalPath());
} catch (IOException e) { } catch (IOException e) {
logger.info("WorldEdit found no snapshots: looked in " WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): " + "(NON-RESOLVABLE PATH - does it exist?): "
+ dir.getPath()); + dir.getPath());
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
@ -41,12 +39,11 @@ import com.sk89q.worldedit.world.storage.MissingWorldException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Logger;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
public class SnapshotUtilCommands { public class SnapshotUtilCommands {
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
private final WorldEdit we; private final WorldEdit we;
public SnapshotUtilCommands(WorldEdit we) { public SnapshotUtilCommands(WorldEdit we) {
@ -97,10 +94,10 @@ public class SnapshotUtilCommands {
File dir = config.snapshotRepo.getDirectory(); File dir = config.snapshotRepo.getDirectory();
try { try {
logger.info("WorldEdit found no snapshots: looked in: " WorldEdit.logger.info("WorldEdit found no snapshots: looked in: "
+ dir.getCanonicalPath()); + dir.getCanonicalPath());
} catch (IOException e) { } catch (IOException e) {
logger.info("WorldEdit found no snapshots: looked in " WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): " + "(NON-RESOLVABLE PATH - does it exist?): "
+ dir.getPath()); + dir.getPath());
} }

Datei anzeigen

@ -19,9 +19,6 @@
package com.sk89q.worldedit.extension.platform; package com.sk89q.worldedit.extension.platform;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
@ -79,14 +76,18 @@ import com.sk89q.worldedit.util.formatting.ColorCodeBuilder;
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
import com.sk89q.worldedit.util.logging.DynamicStreamHandler; import com.sk89q.worldedit.util.logging.DynamicStreamHandler;
import com.sk89q.worldedit.util.logging.LogFormat; import com.sk89q.worldedit.util.logging.LogFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt;
/** /**
* Handles the registration and invocation of commands. * Handles the registration and invocation of commands.
* *
@ -95,8 +96,9 @@ import java.util.regex.Pattern;
public final class CommandManager { public final class CommandManager {
public static final Pattern COMMAND_CLEAN_PATTERN = Pattern.compile("^[/]+"); public static final Pattern COMMAND_CLEAN_PATTERN = Pattern.compile("^[/]+");
private static final Logger log = Logger.getLogger(CommandManager.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(CommandManager.class);
private static final Logger commandLog = Logger.getLogger(CommandManager.class.getCanonicalName() + ".CommandLog"); private static final java.util.logging.Logger commandLog =
java.util.logging.Logger.getLogger(CommandManager.class.getCanonicalName() + ".CommandLog");
private static final Pattern numberFormatExceptionPattern = Pattern.compile("^For input string: \"(.*)\"$"); private static final Pattern numberFormatExceptionPattern = Pattern.compile("^For input string: \"(.*)\"$");
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
@ -189,7 +191,7 @@ public final class CommandManager {
} }
void register(Platform platform) { void register(Platform platform) {
log.log(Level.FINE, "Registering commands with " + platform.getClass().getCanonicalName()); log.info("Registering commands with " + platform.getClass().getCanonicalName());
LocalConfiguration config = platform.getConfiguration(); LocalConfiguration config = platform.getConfiguration();
boolean logging = config.logCommands; boolean logging = config.logCommands;
@ -203,12 +205,12 @@ public final class CommandManager {
File file = new File(config.getWorkingDirectory(), path); File file = new File(config.getWorkingDirectory(), path);
commandLog.setLevel(Level.ALL); commandLog.setLevel(Level.ALL);
log.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath()); log.info("Logging WorldEdit commands to " + file.getAbsolutePath());
try { try {
dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true)); dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true));
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Could not use command log file " + path + ": " + e.getMessage()); log.warn("Could not use command log file " + path + ": " + e.getMessage());
} }
dynamicHandler.setFormatter(new LogFormat(config.logFormat)); dynamicHandler.setFormatter(new LogFormat(config.logFormat));
@ -302,14 +304,14 @@ public final class CommandManager {
Throwable t = e.getCause(); Throwable t = e.getCause();
actor.printError("Please report this error: [See console]"); actor.printError("Please report this error: [See console]");
actor.printRaw(t.getClass().getName() + ": " + t.getMessage()); actor.printRaw(t.getClass().getName() + ": " + t.getMessage());
log.log(Level.SEVERE, "An unexpected error while handling a WorldEdit command", t); log.error("An unexpected error while handling a WorldEdit command", t);
} catch (CommandException e) { } catch (CommandException e) {
String message = e.getMessage(); String message = e.getMessage();
if (message != null) { if (message != null) {
actor.printError(e.getMessage()); actor.printError(e.getMessage());
} else { } else {
actor.printError("An unknown error has occurred! Please see console."); actor.printError("An unknown error has occurred! Please see console.");
log.log(Level.SEVERE, "An unknown error occurred", e); log.error("An unknown error occurred", e);
} }
} finally { } finally {
EditSession editSession = locals.get(EditSession.class); EditSession editSession = locals.get(EditSession.class);
@ -359,7 +361,7 @@ public final class CommandManager {
return dispatcher; return dispatcher;
} }
public static Logger getLogger() { public static java.util.logging.Logger getLogger() {
return commandLog; return commandLog;
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.extension.platform; package com.sk89q.worldedit.extension.platform;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -44,7 +42,10 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Iterator; import java.util.Iterator;
@ -52,10 +53,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Manages registered {@link Platform}s for WorldEdit. Platforms are * Manages registered {@link Platform}s for WorldEdit. Platforms are
@ -65,7 +64,7 @@ import javax.annotation.Nullable;
*/ */
public class PlatformManager { public class PlatformManager {
private static final Logger logger = Logger.getLogger(PlatformManager.class.getCanonicalName()); private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
private final CommandManager commandManager; private final CommandManager commandManager;
@ -97,7 +96,7 @@ public class PlatformManager {
public synchronized void register(Platform platform) { public synchronized void register(Platform platform) {
checkNotNull(platform); checkNotNull(platform);
logger.log(Level.FINE, "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 // Just add the platform to the list of platforms: we'll pick favorites
// once all the platforms have been loaded // once all the platforms have been loaded
@ -106,7 +105,7 @@ public class PlatformManager {
// Make sure that versions are in sync // Make sure that versions are in sync
if (firstSeenVersion != null) { if (firstSeenVersion != null) {
if (!firstSeenVersion.equals(platform.getVersion())) { if (!firstSeenVersion.equals(platform.getVersion())) {
logger.log(Level.WARNING, "Multiple ports of WorldEdit are installed but they report different versions ({0} and {1}). " + logger.warn("Multiple ports of WorldEdit are installed but they report different versions ({0} and {1}). " +
"If these two versions are truly different, then you may run into unexpected crashes and errors.", "If these two versions are truly different, then you may run into unexpected crashes and errors.",
new Object[]{ firstSeenVersion, platform.getVersion() }); new Object[]{ firstSeenVersion, platform.getVersion() });
} }
@ -129,7 +128,7 @@ public class PlatformManager {
boolean removed = platforms.remove(platform); boolean removed = platforms.remove(platform);
if (removed) { if (removed) {
logger.log(Level.FINE, "Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit"); logger.info("Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit");
boolean choosePreferred = false; boolean choosePreferred = false;

Datei anzeigen

@ -19,13 +19,12 @@
package com.sk89q.worldedit.extent.clipboard.io; package com.sk89q.worldedit.extent.clipboard.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps; import com.google.common.collect.Multimaps;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -35,7 +34,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
public class ClipboardFormats { public class ClipboardFormats {
@ -51,7 +50,7 @@ public class ClipboardFormats {
ClipboardFormat old = aliasMap.put(lowKey, format); ClipboardFormat old = aliasMap.put(lowKey, format);
if (old != null) { if (old != null) {
aliasMap.put(lowKey, old); aliasMap.put(lowKey, old);
WorldEdit.logger.warning(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName()); WorldEdit.logger.warn(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName());
} }
} }
for (String ext : format.getFileExtensions()) { for (String ext : format.getFileExtensions()) {

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard.io; package com.sk89q.worldedit.extent.clipboard.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.IntTag;
@ -45,14 +43,16 @@ import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.entity.EntityTypes; import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.storage.NBTConversions; import com.sk89q.worldedit.world.storage.NBTConversions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Reads schematic files that are compatible with MCEdit and other editors. * Reads schematic files that are compatible with MCEdit and other editors.
@ -66,7 +66,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
// TODO Add a handler for skulls, flower pots, note blocks, etc. // TODO Add a handler for skulls, flower pots, note blocks, etc.
} }
private static final Logger log = Logger.getLogger(MCEditSchematicReader.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(MCEditSchematicReader.class);
private final NBTInputStream inputStream; private final NBTInputStream inputStream;
/** /**
@ -230,15 +230,15 @@ public class MCEditSchematicReader extends NBTSchematicReader {
clipboard.setBlock(region.getMinimumPoint().add(pt), state); clipboard.setBlock(region.getMinimumPoint().add(pt), state);
} }
} else { } else {
log.warning("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue."); log.warn("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue.");
} }
} catch (WorldEditException e) { } catch (WorldEditException e) {
switch (failedBlockSets) { switch (failedBlockSets) {
case 0: case 0:
log.log(Level.WARNING, "Failed to set block on a Clipboard", e); log.warn("Failed to set block on a Clipboard", e);
break; break;
case 1: case 1:
log.log(Level.WARNING, "Failed to set block on a Clipboard (again) -- no more messages will be logged", e); log.warn("Failed to set block on a Clipboard (again) -- no more messages will be logged", e);
break; break;
default: default:
} }
@ -268,7 +268,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
BaseEntity state = new BaseEntity(entityType, compound); BaseEntity state = new BaseEntity(entityType, compound);
clipboard.createEntity(location, state); clipboard.createEntity(location, state);
} else { } else {
log.warning("Unknown entity when pasting schematic: " + id.toLowerCase()); log.warn("Unknown entity when pasting schematic: " + id.toLowerCase());
} }
} }
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.extent.clipboard.io; package com.sk89q.worldedit.extent.clipboard.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
@ -42,15 +40,18 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Reads schematic files using the Sponge Schematic Specification. * Reads schematic files using the Sponge Schematic Specification.
*/ */
@ -62,7 +63,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
// If NBT Compat handlers are needed - add them here. // If NBT Compat handlers are needed - add them here.
} }
private static final Logger log = Logger.getLogger(SpongeSchematicReader.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(SpongeSchematicReader.class);
private final NBTInputStream inputStream; private final NBTInputStream inputStream;
/** /**

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.internal.command; package com.sk89q.worldedit.internal.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
@ -40,6 +38,8 @@ import java.lang.reflect.Method;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.Logger; import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Logs called commands to a logger. * Logs called commands to a logger.
*/ */

Datei anzeigen

@ -21,14 +21,15 @@
package com.sk89q.worldedit.math.interpolation; package com.sk89q.worldedit.math.interpolation;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Reparametrises another interpolation function by arc length. * Reparametrises another interpolation function by arc length.
@ -38,7 +39,7 @@ import java.util.logging.Logger;
*/ */
public class ReparametrisingInterpolation implements Interpolation { public class ReparametrisingInterpolation implements Interpolation {
private static final Logger log = Logger.getLogger(ReparametrisingInterpolation.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(ReparametrisingInterpolation.class);
private final Interpolation baseInterpolation; private final Interpolation baseInterpolation;
private double totalArcLength; private double totalArcLength;
@ -102,7 +103,7 @@ public class ReparametrisingInterpolation implements Interpolation {
Entry<Double, Double> ceilingEntry = cache.ceilingEntry(arc); Entry<Double, Double> ceilingEntry = cache.ceilingEntry(arc);
if (ceilingEntry == null) { if (ceilingEntry == null) {
log.warning("Error in arcToParameter: no ceiling entry for " + arc + " found!"); log.warn("Error in arcToParameter: no ceiling entry for " + arc + " found!");
return 0; return 0;
} }
final double rightArc = ceilingEntry.getKey(); final double rightArc = ceilingEntry.getKey();

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.session; package com.sk89q.worldedit.session;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.ListeningExecutorService;
@ -36,7 +34,10 @@ import com.sk89q.worldedit.session.storage.VoidStore;
import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors; import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
@ -46,10 +47,8 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Session manager for WorldEdit. * Session manager for WorldEdit.
@ -63,7 +62,7 @@ public class SessionManager {
public static int EXPIRATION_GRACE = 600000; public static int EXPIRATION_GRACE = 600000;
private static final int FLUSH_PERIOD = 1000 * 30; private static final int FLUSH_PERIOD = 1000 * 30;
private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5)); private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5));
private static final Logger log = Logger.getLogger(SessionManager.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
private final Timer timer = new Timer(); private final Timer timer = new Timer();
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
private final Map<UUID, SessionHolder> sessions = new HashMap<>(); private final Map<UUID, SessionHolder> sessions = new HashMap<>();
@ -149,7 +148,7 @@ public class SessionManager {
session = store.load(getKey(sessionKey)); session = store.load(getKey(sessionKey));
session.postLoad(); session.postLoad();
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to load saved session", e); log.warn("Failed to load saved session", e);
session = new LocalSession(); session = new LocalSession();
} }
@ -210,7 +209,7 @@ public class SessionManager {
try { try {
store.save(getKey(key), entry.getValue()); store.save(getKey(key), entry.getValue());
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to write session for UUID " + getKey(key), e); log.warn("Failed to write session for UUID " + getKey(key), e);
exception = e; exception = e;
} }
} }

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit.session.storage; package com.sk89q.worldedit.session.storage;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException; import com.google.gson.JsonIOException;
@ -28,6 +26,8 @@ import com.google.gson.JsonParseException;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.util.gson.GsonUtil; import com.sk89q.worldedit.util.gson.GsonUtil;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -37,8 +37,8 @@ import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Stores sessions as JSON files in a directory. * Stores sessions as JSON files in a directory.
@ -47,7 +47,7 @@ import java.util.logging.Logger;
*/ */
public class JsonFileSessionStore implements SessionStore { public class JsonFileSessionStore implements SessionStore {
private static final Logger log = Logger.getLogger(JsonFileSessionStore.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(JsonFileSessionStore.class);
private final Gson gson; private final Gson gson;
private final File dir; private final File dir;
@ -61,7 +61,7 @@ public class JsonFileSessionStore implements SessionStore {
if (!dir.isDirectory()) { if (!dir.isDirectory()) {
if (!dir.mkdirs()) { if (!dir.mkdirs()) {
log.log(Level.WARNING, "Failed to create directory '" + dir.getPath() + "' for sessions"); log.warn("Failed to create directory '" + dir.getPath() + "' for sessions");
} }
} }
@ -111,12 +111,12 @@ public class JsonFileSessionStore implements SessionStore {
if (finalFile.exists()) { if (finalFile.exists()) {
if (!finalFile.delete()) { if (!finalFile.delete()) {
log.log(Level.WARNING, "Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it"); log.warn("Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it");
} }
} }
if (!tempFile.renameTo(finalFile)) { if (!tempFile.renameTo(finalFile)) {
log.log(Level.WARNING, "Failed to rename temporary session file to " + finalFile.getPath()); log.warn("Failed to rename temporary session file to " + finalFile.getPath());
} }
} }

Datei anzeigen

@ -27,6 +27,8 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -39,8 +41,6 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Simple LocalConfiguration that loads settings using * Simple LocalConfiguration that loads settings using
@ -48,7 +48,7 @@ import java.util.logging.Logger;
*/ */
public class PropertiesConfiguration extends LocalConfiguration { public class PropertiesConfiguration extends LocalConfiguration {
@Unreported private static final Logger log = Logger.getLogger(PropertiesConfiguration.class.getCanonicalName()); @Unreported private static final Logger log = LoggerFactory.getLogger(PropertiesConfiguration.class);
@Unreported protected Properties properties; @Unreported protected Properties properties;
@Unreported protected File path; @Unreported protected File path;
@ -70,7 +70,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
properties.load(stream); properties.load(stream);
} catch (FileNotFoundException ignored) { } catch (FileNotFoundException ignored) {
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to read configuration", e); log.warn("Failed to read configuration", e);
} }
loadExtra(); loadExtra();
@ -131,7 +131,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
try (OutputStream output = new FileOutputStream(path)) { try (OutputStream output = new FileOutputStream(path)) {
properties.store(output, "Don't put comments; they get removed"); properties.store(output, "Don't put comments; they get removed");
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to write configuration", e); log.warn("Failed to write configuration", e);
} }
} }

Datei anzeigen

@ -26,11 +26,10 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.session.SessionManager; import com.sk89q.worldedit.session.SessionManager;
import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
import org.slf4j.Logger;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* A less simple implementation of {@link LocalConfiguration} * A less simple implementation of {@link LocalConfiguration}
@ -51,7 +50,7 @@ public class YAMLConfiguration extends LocalConfiguration {
try { try {
config.load(); config.load();
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
profile = config.getBoolean("debug", profile); profile = config.getBoolean("debug", profile);

Datei anzeigen

@ -19,13 +19,13 @@
package com.sk89q.worldedit.util.eventbus; package com.sk89q.worldedit.util.eventbus;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps; import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap; import com.google.common.collect.SetMultimap;
import com.google.common.eventbus.DeadEvent; import com.google.common.eventbus.DeadEvent;
import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava; import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,8 +36,8 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Dispatches events to listeners, and provides ways for listeners to register * Dispatches events to listeners, and provides ways for listeners to register
@ -53,7 +53,7 @@ import java.util.logging.Logger;
*/ */
public class EventBus { public class EventBus {
private final Logger logger = Logger.getLogger(EventBus.class.getCanonicalName()); private final Logger logger = LoggerFactory.getLogger(EventBus.class);
private final SetMultimap<Class<?>, EventHandler> handlersByType = private final SetMultimap<Class<?>, EventHandler> handlersByType =
Multimaps.newSetMultimap(new HashMap<>(), this::newHandlerSet); Multimaps.newSetMultimap(new HashMap<>(), this::newHandlerSet);
@ -186,8 +186,7 @@ public class EventBus {
try { try {
handler.handleEvent(event); handler.handleEvent(event);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
logger.log(Level.SEVERE, logger.error("Could not dispatch event: " + event + " to handler " + handler, e);
"Could not dispatch event: " + event + " to handler " + handler, e);
} }
} }

Datei anzeigen

@ -19,23 +19,23 @@
package com.sk89q.worldedit.util.io; package com.sk89q.worldedit.util.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.Deque; import java.util.Deque;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import static com.google.common.base.Preconditions.checkNotNull;
public final class Closer implements Closeable { public final class Closer implements Closeable {
private static final Logger logger = Logger.getLogger(Closer.class.getCanonicalName()); private static final Logger logger = LoggerFactory.getLogger(Closer.class);
/** /**
* The suppressor implementation to use for the current Java version. * The suppressor implementation to use for the current Java version.
@ -218,7 +218,7 @@ public final class Closer implements Closeable {
@Override @Override
public void suppress(Object closeable, Throwable thrown, Throwable suppressed) { public void suppress(Object closeable, Throwable thrown, Throwable suppressed) {
// log to the same place as Closeables // log to the same place as Closeables
logger.log(Level.WARNING, "Suppressing exception thrown when closing " + closeable, suppressed); logger.warn("Suppressing exception thrown when closing " + closeable, suppressed);
} }
} }

Datei anzeigen

@ -1,59 +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 Lesser 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 Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util.logging;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
/**
* Adds a WorldEdit prefix to WorldEdit's logger messages using a handler.
*/
public final class WorldEditPrefixHandler extends Handler {
private WorldEditPrefixHandler() {
}
@Override
public void publish(LogRecord record) {
String message = record.getMessage();
if (!message.startsWith("WorldEdit: ") && !message.startsWith("[WorldEdit] ")) {
record.setMessage("[WorldEdit] " + message);
}
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
}
/**
* Add the handler to the following logger name.
*
* @param name the logger name
*/
public static void register(String name) {
Logger.getLogger(name).addHandler(new WorldEditPrefixHandler());
}
}

Datei anzeigen

@ -26,14 +26,14 @@ import com.sk89q.worldedit.command.util.AsyncCommandHelper;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.util.task.Supervisor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL; import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ActorCallbackPaste { public class ActorCallbackPaste {
private static final Logger LOGGER = Logger.getLogger(ActorCallbackPaste.class.getSimpleName()); private static final Logger LOGGER = LoggerFactory.getLogger(ActorCallbackPaste.class);
private ActorCallbackPaste() { private ActorCallbackPaste() {
} }
@ -62,7 +62,7 @@ public class ActorCallbackPaste {
@Override @Override
public void onFailure(Throwable throwable) { public void onFailure(Throwable throwable) {
LOGGER.log(Level.WARNING, "Failed to submit pastebin", throwable); LOGGER.warn("Failed to submit pastebin", throwable);
sender.printError("Failed to submit to a pastebin. Please see console for the error."); sender.printError("Failed to submit to a pastebin. Please see console for the error.");
} }
}); });

Datei anzeigen

@ -19,16 +19,17 @@
package com.sk89q.worldedit.util.report; package com.sk89q.worldedit.util.report;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
public class ShallowObjectReport extends DataReport { public class ShallowObjectReport extends DataReport {
private static final Logger log = Logger.getLogger(ShallowObjectReport.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(ShallowObjectReport.class);
public ShallowObjectReport(String title, Object object) { public ShallowObjectReport(String title, Object object) {
super(title); super(title);
@ -52,7 +53,7 @@ public class ShallowObjectReport extends DataReport {
Object value = field.get(object); Object value = field.get(object);
append(field.getName(), String.valueOf(value)); append(field.getName(), String.valueOf(value));
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.log(Level.WARNING, "Failed to get value of '" + field.getName() + "' on " + type); log.warn("Failed to get value of '" + field.getName() + "' on " + type);
} }
} }
} }

Datei anzeigen

@ -107,7 +107,7 @@ public class BlockState implements BlockStateHolder<BlockState> {
states.put(property, value, modifiedState); states.put(property, value, modifiedState);
} else { } else {
System.out.println(stateMap); System.out.println(stateMap);
WorldEdit.logger.warning("Found a null state at " + this.withValue(property, value)); WorldEdit.logger.warn("Found a null state at " + this.withValue(property, value));
} }
} }
}); });

Datei anzeigen

@ -36,12 +36,11 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.storage.InvalidFormatException; import com.sk89q.worldedit.world.storage.InvalidFormatException;
import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable;
public class AnvilChunk implements Chunk { public class AnvilChunk implements Chunk {
private CompoundTag rootTag; private CompoundTag rootTag;
@ -259,7 +258,7 @@ public class AnvilChunk implements Chunk {
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
if (state == null) { if (state == null) {
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
} }
CompoundTag tileEntity = getBlockTileEntity(position); CompoundTag tileEntity = getBlockTileEntity(position);

Datei anzeigen

@ -182,7 +182,7 @@ public class OldChunk implements Chunk {
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal);
if (state == null) { if (state == null) {
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk."); WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
} }

Datei anzeigen

@ -25,17 +25,16 @@ import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.util.gson.VectorAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
/** /**
* Provides block data based on the built-in block database that is bundled * Provides block data based on the built-in block database that is bundled
@ -50,7 +49,7 @@ import javax.annotation.Nullable;
*/ */
public class BundledBlockData { public class BundledBlockData {
private static final Logger log = Logger.getLogger(BundledBlockData.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(BundledBlockData.class);
private static BundledBlockData INSTANCE; private static BundledBlockData INSTANCE;
private final Map<String, BlockEntry> idMap = new HashMap<>(); private final Map<String, BlockEntry> idMap = new HashMap<>();
@ -62,7 +61,7 @@ public class BundledBlockData {
try { try {
loadFromResource(); loadFromResource();
} catch (Throwable e) { } catch (Throwable e) {
log.log(Level.WARNING, "Failed to load the built-in block registry", e); log.warn("Failed to load the built-in block registry", e);
} }
} }

Datei anzeigen

@ -25,17 +25,16 @@ import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.util.gson.VectorAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
/** /**
* Provides item data based on the built-in item database that is bundled * Provides item data based on the built-in item database that is bundled
@ -50,7 +49,7 @@ import javax.annotation.Nullable;
*/ */
public class BundledItemData { public class BundledItemData {
private static final Logger log = Logger.getLogger(BundledItemData.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(BundledItemData.class);
private static BundledItemData INSTANCE; private static BundledItemData INSTANCE;
private final Map<String, ItemEntry> idMap = new HashMap<>(); private final Map<String, ItemEntry> idMap = new HashMap<>();
@ -62,7 +61,7 @@ public class BundledItemData {
try { try {
loadFromResource(); loadFromResource();
} catch (Throwable e) { } catch (Throwable e) {
log.log(Level.WARNING, "Failed to load the built-in item registry", e); log.warn("Failed to load the built-in item registry", e);
} }
} }

Datei anzeigen

@ -32,22 +32,21 @@ import com.sk89q.worldedit.util.gson.VectorAdapter;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
public class LegacyMapper { public class LegacyMapper {
private static final Logger log = Logger.getLogger(LegacyMapper.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class);
private static LegacyMapper INSTANCE; private static LegacyMapper INSTANCE;
private Multimap<String, BlockState> stringToBlockMap = HashMultimap.create(); private Multimap<String, BlockState> stringToBlockMap = HashMultimap.create();
@ -62,7 +61,7 @@ public class LegacyMapper {
try { try {
loadFromResource(); loadFromResource();
} catch (Throwable e) { } catch (Throwable e) {
log.log(Level.WARNING, "Failed to load the built-in legacy id registry", e); log.warn("Failed to load the built-in legacy id registry", e);
} }
} }
@ -94,7 +93,7 @@ public class LegacyMapper {
blockToStringMap.put(state, id); blockToStringMap.put(state, id);
stringToBlockMap.put(id, state); stringToBlockMap.put(id, state);
} catch (Exception e) { } catch (Exception e) {
log.warning("Unknown block: " + blockEntry.getValue()); log.warn("Unknown block: " + blockEntry.getValue());
} }
} }
@ -106,7 +105,7 @@ public class LegacyMapper {
itemToStringMap.put(type, id); itemToStringMap.put(type, id);
stringToItemMap.put(id, type); stringToItemMap.put(id, type);
} catch (Exception e) { } catch (Exception e) {
log.warning("Unknown item: " + itemEntry.getValue()); log.warn("Unknown item: " + itemEntry.getValue());
} }
} }
} }

Datei anzeigen

@ -29,11 +29,12 @@ import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore;
import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore; import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore;
import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore; import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore;
import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore; import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar; import java.util.Calendar;
import java.util.logging.Logger;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
/** /**
@ -41,7 +42,7 @@ import java.util.zip.ZipFile;
*/ */
public class Snapshot implements Comparable<Snapshot> { public class Snapshot implements Comparable<Snapshot> {
protected static Logger logger = Logger.getLogger(Snapshot.class.getCanonicalName()); protected static Logger logger = LoggerFactory.getLogger(Snapshot.class);
protected File file; protected File file;
protected String name; protected String name;

Datei anzeigen

@ -19,23 +19,23 @@
package com.sk89q.minecraft.util.commands; package com.sk89q.minecraft.util.commands;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.HashSet;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CommandContextTest { public class CommandContextTest {
private static final Logger log = Logger.getLogger(CommandContextTest.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(CommandContextTest.class);
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something"; private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
CommandContext firstCommand; CommandContext firstCommand;
@ -44,7 +44,7 @@ public class CommandContextTest {
try { try {
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w'))); firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Unexpected exception when creating CommandContext"); fail("Unexpected exception when creating CommandContext");
} }
} }
@ -83,7 +83,7 @@ public class CommandContextTest {
new CommandContext(cmd); new CommandContext(cmd);
new CommandContext(cmd2); new CommandContext(cmd2);
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -94,7 +94,7 @@ public class CommandContextTest {
try { try {
new CommandContext(cmd); new CommandContext(cmd);
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -105,7 +105,7 @@ public class CommandContextTest {
try { try {
new CommandContext(cmd); new CommandContext(cmd);
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -119,7 +119,7 @@ public class CommandContextTest {
CommandContext context2 = new CommandContext("r hello -f world"); CommandContext context2 = new CommandContext("r hello -f world");
assertTrue(context2.hasFlag('f')); assertTrue(context2.hasFlag('f'));
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -135,7 +135,7 @@ public class CommandContextTest {
CommandContext context2 = new CommandContext("pm name \"hello world\" foo bar"); CommandContext context2 = new CommandContext("pm name \"hello world\" foo bar");
assertEquals("\"hello world\" foo bar", context2.getJoinedStrings(1)); assertEquals("\"hello world\" foo bar", context2.getJoinedStrings(1));
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -147,7 +147,7 @@ public class CommandContextTest {
assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0)); assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0));
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }
@ -158,7 +158,7 @@ public class CommandContextTest {
CommandContext context = new CommandContext("region flag xmas blocked-cmds \"\""); CommandContext context = new CommandContext("region flag xmas blocked-cmds \"\"");
assertEquals(context.argsLength(), 3); assertEquals(context.argsLength(), 3);
} catch (CommandException e) { } catch (CommandException e) {
log.log(Level.WARNING, "Error", e); log.warn("Error", e);
fail("Error creating CommandContext"); fail("Error creating CommandContext");
} }
} }

Datei anzeigen

@ -18,6 +18,7 @@ def forgeVersion = "25.0.76"
dependencies { dependencies {
compile project(':worldedit-core') compile project(':worldedit-core')
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2'
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}" minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"

Datei anzeigen

@ -21,6 +21,8 @@ package com.sk89q.worldedit.sponge.adapter;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -30,15 +32,13 @@ import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Loads Sponge implementation adapters. * Loads Sponge implementation adapters.
*/ */
public class SpongeImplLoader { public class SpongeImplLoader {
private static final Logger log = Logger.getLogger(SpongeImplLoader.class.getCanonicalName()); private static final Logger log = LoggerFactory.getLogger(SpongeImplLoader.class);
private final List<String> adapterCandidates = new ArrayList<>(); private final List<String> adapterCandidates = new ArrayList<>();
private String customCandidate; private String customCandidate;
@ -71,7 +71,7 @@ public class SpongeImplLoader {
if (className != null) { if (className != null) {
customCandidate = className; customCandidate = className;
adapterCandidates.add(className); adapterCandidates.add(className);
log.log(Level.INFO, "-Dworldedit.sponge.adapter used to add " + className + " to the list of available Sponge adapters"); log.info("-Dworldedit.sponge.adapter used to add " + className + " to the list of available Sponge adapters");
} }
} }
@ -157,18 +157,18 @@ public class SpongeImplLoader {
if (SpongeImplAdapter.class.isAssignableFrom(cls)) { if (SpongeImplAdapter.class.isAssignableFrom(cls)) {
suitableAdapters.add((SpongeImplAdapter) cls.newInstance()); suitableAdapters.add((SpongeImplAdapter) cls.newInstance());
} else { } else {
log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + log.warn("Failed to load the Sponge adapter class '" + className +
"' because it does not implement " + SpongeImplAdapter.class.getCanonicalName()); "' because it does not implement " + SpongeImplAdapter.class.getCanonicalName());
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + log.warn("Failed to load the Sponge adapter class '" + className +
"' that is not supposed to be missing", e); "' that is not supposed to be missing", e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + log.warn("Failed to load the Sponge adapter class '" + className +
"' that is not supposed to be raising this error", e); "' that is not supposed to be raising this error", e);
} catch (Throwable e) { } catch (Throwable e) {
if (className.equals(customCandidate)) { if (className.equals(customCandidate)) {
log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + "'", e); log.warn("Failed to load the Sponge adapter class '" + className + "'", e);
} }
} }
} }