refactor!: Remove deprecated logging (#2523)

This commit is contained in:
Ben Woo 2023-02-03 22:45:55 +08:00 committed by GitHub
parent 3ec22fc578
commit 3377c1dbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 130 deletions

View File

@ -7,21 +7,6 @@
package com.onarandombox.MultiverseCore; package com.onarandombox.MultiverseCore;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import buscript.Buscript; import buscript.Buscript;
import com.dumptruckman.minecraft.util.Logging; import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MVWorld.NullLocation; import com.onarandombox.MultiverseCore.MVWorld.NullLocation;
@ -120,6 +105,20 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader; import org.bukkit.plugin.java.JavaPluginLoader;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
* The implementation of the Multiverse-{@link Core}. * The implementation of the Multiverse-{@link Core}.
*/ */
@ -837,47 +836,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
} }
} }
/**
* {@inheritDoc}
*
* @deprecated This is now deprecated, nobody needs it any longer.
* All logging is now done with {@link Logging}.
*/
@Override
@Deprecated
public void log(Level level, String msg) {
Logging.log(level, msg);
}
/**
* Logs a message at the specified level.
*
* @param level The Log-{@link Level}.
* @param msg The message to log.
*
* @deprecated Replaced by {@link Logging}. Please refrain from using this from a third party plugin as the
* messages will appear to originate from Multiverse-Core.
*/
@Deprecated
public static void staticLog(Level level, String msg) {
Logging.log(level, msg);
}
/**
* Print messages to the Debug Log, if the servers in Debug Mode then we also want to print the messages to the
* standard Server Console.
*
* @param level The Log-{@link Level}
* @param msg The message
*
* @deprecated Replaced by {@link Logging}. Please refrain from using this from a third party plugin as the
* messages will appear to originate from Multiverse-Core.
*/
@Deprecated
public static void staticDebugLog(Level level, String msg) {
Logging.log(level, msg);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -928,16 +886,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
return commandQueueManager; return commandQueueManager;
} }
/**
* Gets the log-tag.
*
* @return The log-tag
*/
// TODO this should be static!
public String getTag() {
return MultiverseCore.LOG_TAG;
}
/** /**
* Shows a message that the given world is not a MultiverseWorld. * Shows a message that the given world is not a MultiverseWorld.
* *

View File

@ -1,36 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.dumptruckman.minecraft.util.Logging;
import org.bukkit.Server;
import java.util.logging.Level;
/**
* A simple API to require plugins to have a log method.
*
* @deprecated Replaced by {@link Logging}.
* */
@Deprecated
public interface LoggablePlugin {
/**
* Logs a message at the specified level.
*
* @param level The Log-{@link Level}.
* @param msg The message to log.
*/
void log(Level level, String msg);
/**
* Gets the server instance that this plugin is attached to.
*
* @return A {@link Server} instance.
*/
Server getServer();
}

View File

@ -13,7 +13,7 @@ import com.onarandombox.MultiverseCore.event.MVVersionEvent;
/** /**
* This interface is implemented by every official Multiverse-plugin. * This interface is implemented by every official Multiverse-plugin.
*/ */
public interface MVPlugin extends LoggablePlugin { public interface MVPlugin {
/** /**
* Adds This plugin's version information to the buffer and returns the new string. * Adds This plugin's version information to the buffer and returns the new string.
* *

View File

@ -115,33 +115,6 @@ public abstract class MultiversePlugin extends JavaPlugin implements MVPlugin {
return this.getCore().getCommandHandler().locateAndRunCommand(sender, allArgs); return this.getCore().getCommandHandler().locateAndRunCommand(sender, allArgs);
} }
@Override
public void log(Level level, String msg) {
int debugLevel = this.getCore().getMVConfig().getGlobalDebug();
if ((level == Level.FINE && debugLevel >= 1) || (level == Level.FINER && debugLevel >= 2)
|| (level == Level.FINEST && debugLevel >= 3)) {
debugLog.log(level, msg);
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
String message = new StringBuilder(getLogTag()).append(msg).toString();
this.getServer().getLogger().log(level, message);
debugLog.log(level, message);
}
}
private String getLogTag() {
if (logTag == null)
logTag = String.format("[%s]", this.getDescription().getName());
return logTag;
}
/**
* Sets the debug log-tag.
* @param tag The new tag.
*/
protected final void setDebugLogTag(String tag) {
this.debugLog.setTag(tag);
}
@Override @Override
public final String dumpVersionInfo(String buffer) { public final String dumpVersionInfo(String buffer) {
throw new UnsupportedOperationException("This is gone."); throw new UnsupportedOperationException("This is gone.");