1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

feat: 添加代理方法

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-25 13:53:57 +08:00
parent 73eeac2484
commit 1a7e967826
2 changed files with 107 additions and 77 deletions

View File

@ -4,6 +4,9 @@ import java.util.logging.Handler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
/** /**
* 插件日志输出类 * 插件日志输出类
* *
@ -12,11 +15,19 @@ import java.util.logging.Logger;
*/ */
public class Log { public class Log {
private static Logger logger = P.instance.getLogger(); private static Logger logger = P.instance.getLogger();
private static String prefix = String.format("§6[§b%s§6]§r ", P.instance.getName());
private static CommandSender console = Bukkit.getConsoleSender();
public static void addHandler(final Handler handler) throws SecurityException { public static void addHandler(final Handler handler) throws SecurityException {
logger.addHandler(handler); logger.addHandler(handler);
} }
public static void console(final String... msg) {
for (final String str : msg) {
console.sendMessage(prefix + str);
}
}
public static void info(final String msg) { public static void info(final String msg) {
logger.info(msg); logger.info(msg);
} }

View File

@ -1,7 +1,10 @@
package pw.yumc.YumCore.bukkit; package pw.yumc.YumCore.bukkit;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.logging.Logger;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
/** /**
@ -26,4 +29,20 @@ public class P {
e.printStackTrace(); e.printStackTrace();
} }
} }
public PluginCommand getCommand(final String name) {
return instance.getCommand(name);
}
public FileConfiguration getConfig() {
return instance.getConfig();
}
public final Logger getLogger() {
return instance.getLogger();
}
public final String getName() {
return instance.getName();
}
} }