mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Logger changes
This commit is contained in:
parent
4ceb54b566
commit
4bd83ab298
@ -72,12 +72,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -93,6 +87,13 @@ import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
public static WorldEditPlugin worldEdit;
|
||||
@ -139,9 +140,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
message = ChatColor.stripColor(message);
|
||||
}
|
||||
this.getServer().getConsoleSender().sendMessage(message);
|
||||
return;
|
||||
} catch (Throwable ignored) {}
|
||||
System.out.println(ConsoleColors.fromString(message));
|
||||
} catch (Throwable ignored) {
|
||||
System.out.println(ConsoleColors.fromString(message));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||
import com.intellectualcrafters.plot.logger.DelegateLogger;
|
||||
import com.intellectualcrafters.plot.logger.ILogger;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
@ -49,6 +50,7 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||
import com.plotsquared.listener.WESubscriber;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -86,7 +88,6 @@ public class PS {
|
||||
|
||||
private static PS instance;
|
||||
public final IPlotMain IMP;
|
||||
public ILogger LOGGER;
|
||||
private final HashSet<Integer> plotAreaHashCheck = new HashSet<>();
|
||||
/**
|
||||
* All plot areas mapped by world (quick world access).
|
||||
@ -99,6 +100,7 @@ public class PS {
|
||||
private final int[] version;
|
||||
private final String platform;
|
||||
private final Thread thread;
|
||||
public ILogger logger;
|
||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
public File styleFile;
|
||||
@ -131,7 +133,7 @@ public class PS {
|
||||
PS.instance = this;
|
||||
this.thread = Thread.currentThread();
|
||||
this.IMP = iPlotMain;
|
||||
this.LOGGER = iPlotMain;
|
||||
this.logger = iPlotMain;
|
||||
this.platform = platform;
|
||||
this.version = this.IMP.getPluginVersion();
|
||||
try {
|
||||
@ -297,27 +299,6 @@ public class PS {
|
||||
return PS.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the logger
|
||||
* @see com.intellectualcrafters.plot.logger.DelegateLogger
|
||||
* @see #getLogger()
|
||||
* @param logger
|
||||
*/
|
||||
public void setLogger(ILogger logger) {
|
||||
if (logger == null) {
|
||||
throw new IllegalArgumentException("Logger may not be null");
|
||||
}
|
||||
LOGGER = logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current logger
|
||||
* @return
|
||||
*/
|
||||
public ILogger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message to the IPlotMain logger.
|
||||
*
|
||||
@ -325,7 +306,7 @@ public class PS {
|
||||
* @see IPlotMain#log(String)
|
||||
*/
|
||||
public static void log(Object message) {
|
||||
PS.get().LOGGER.log(StringMan.getString(message));
|
||||
PS.get().getLogger().log(StringMan.getString(message));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,6 +321,24 @@ public class PS {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current logger
|
||||
* @return
|
||||
*/
|
||||
public ILogger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Logger.
|
||||
* @see DelegateLogger
|
||||
* @see #getLogger()
|
||||
* @param logger
|
||||
*/
|
||||
public void setLogger(ILogger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
private void startUuidCatching() {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
|
@ -5,9 +5,6 @@ public class DelegateLogger implements ILogger {
|
||||
private final ILogger parent;
|
||||
|
||||
public DelegateLogger(ILogger parent) {
|
||||
if (parent == null) {
|
||||
throw new IllegalArgumentException("Parent cannot be null");
|
||||
}
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package com.intellectualcrafters.plot.logger;
|
||||
|
||||
public interface ILogger {
|
||||
public void log(String message);
|
||||
void log(String message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user