本文整理了Java中org.bukkit.plugin.Plugin.getLogger()
方法的一些代码示例,展示了Plugin.getLogger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getLogger()
方法的具体详情如下:
包路径:org.bukkit.plugin.Plugin
类名称:Plugin
方法名:getLogger
[英]Returns the plugin logger associated with this server's logger. The returned logger automatically tags all log messages with the plugin's name.
[中]返回与此服务器的记录器关联的插件记录器。返回的记录器会自动用插件的名称标记所有日志消息。
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
protected void done() {
super.done();
if (isCancelled()) {
return;
}
try {
get();
} catch (ExecutionException ex) {
Logger log = owner == null ? GlowServer.logger : owner.getLogger();
log.log(Level.SEVERE, "Error while executing " + this, ex.getCause());
} catch (InterruptedException e) {
// Task is already done, see the fact that we're in done() method
}
}
}
代码示例来源:origin: Bukkit/Bukkit
plugin.getLogger().severe("Plugin " + plugin.getDescription().getFullName() + " has failed to register events for " + listener.getClass() + " because " + e.getMessage() + " does not exist.");
return ret;
final Class<?> checkClass;
if (method.getParameterTypes().length != 1 || !Event.class.isAssignableFrom(checkClass = method.getParameterTypes()[0])) {
plugin.getLogger().severe(plugin.getDescription().getFullName() + " attempted to register an invalid EventHandler method signature \"" + method.toGenericString() + "\" in " + listener.getClass());
continue;
break;
plugin.getLogger().log(
Level.WARNING,
String.format(
代码示例来源:origin: Bukkit/Bukkit
public void enablePlugin(final Plugin plugin) {
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
if (!plugin.isEnabled()) {
plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName());
JavaPlugin jPlugin = (JavaPlugin) plugin;
String pluginName = jPlugin.getDescription().getName();
if (!loaders.containsKey(pluginName)) {
loaders.put(pluginName, (PluginClassLoader) jPlugin.getClassLoader());
}
try {
jPlugin.setEnabled(true);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
// Perhaps abort here, rather than continue going, but as it stands,
// an abort is not possible the way it's currently written
server.getPluginManager().callEvent(new PluginEnableEvent(plugin));
}
}
代码示例来源:origin: Bukkit/Bukkit
plugin.getLogger().info(message);
代码示例来源:origin: aadnk/ProtocolLib
/**
* Retrieve a logger, even if we're running in a CraftBukkit version that doesn't support it.
* @param plugin - the plugin to retrieve.
* @return The logger.
*/
private Logger getLogger(Plugin plugin) {
try {
return plugin.getLogger();
} catch (NoSuchMethodError e) {
return Logger.getLogger("Minecraft");
}
}
代码示例来源:origin: aadnk/ProtocolLib
/**
* Logs a message to console with a given level and exception.
* @param level Logging level
* @param message Message to log
* @param ex Exception to log
*/
public static void log(Level level, String message, Throwable ex) {
plugin.getLogger().log(level, message, ex);
}
代码示例来源:origin: aadnk/ProtocolLib
/**
* Logs a message to console with a given level.
* @param level Logging level
* @param message Message to log
* @param args Arguments to format in
*/
public static void log(Level level, String message, Object... args) {
plugin.getLogger().log(level, MessageFormat.format(message, args));
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
private File[] listFilesOrError(File folder) {
File[] contents = folder.listFiles();
if (contents == null) {
this.plugin.getLogger()
.severe("The updater could not access files at: " + this.updateFolder.getAbsolutePath());
return new File[0];
} else {
return contents;
}
}
代码示例来源:origin: aadnk/ProtocolLib
public static void debug(String message, Throwable ex) {
if (isDebugEnabled()) {
plugin.getLogger().log(Level.WARNING, "[Debug] " + message, ex);
}
}
}
代码示例来源:origin: MilkBowl/Vault
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (chat.totalPermissions != null) {
if (event.getPlugin().getDescription().getName().equals("TotalPermissions")) {
chat.totalPermissions = null;
plugin.getLogger().info(String.format("[Chat] %s un-hooked.", chat.name));
}
}
}
}
代码示例来源:origin: MilkBowl/Vault
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (privs != null) {
if (PLUGIN_NAME.equals(event.getPlugin().getDescription().getName())) {
privs = null;
plugin.getLogger().info(String.format("[Chat] %s un-hooked.", FRIENDLY_NAME));
}
}
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerRemove(String world, String player, String permission) {
try {
PermissionBase user = manager.getUser(player);
user.remPerm(permission, world);
return true;
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
String.format("[%s] An error occured while saving perms", totalperms.getDescription().getName()), ex);
return false;
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean groupRemove(String world, String group, String permission) {
try {
PermissionBase permGroup = manager.getGroup(group);
permGroup.remPerm(permission, world);
return true;
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
String.format("[%s] An error occured while saving perms", totalperms.getDescription().getName()), ex);
return false;
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerAdd(String world, String player, String permission) {
try {
PermissionBase user = manager.getUser(player);
user.addPerm(permission, world);
return true;
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
String.format("[%s] An error occured while saving perms", totalperms.getDescription().getName()), ex);
return false;
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerAddGroup(String world, String player, String group) {
try {
PermissionUser user = manager.getUser(player);
user.addGroup(group, world);
return true;
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
String.format("[%s] An error occured while saving perms", totalperms.getDescription().getName()), ex);
return false;
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerRemoveGroup(String world, String player, String group) {
try {
PermissionUser user = manager.getUser(player);
user.remGroup(group, world);
return true;
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
String.format("[%s] An error occured while saving perms", totalperms.getDescription().getName()), ex);
return false;
}
}
代码示例来源:origin: MilkBowl/Vault
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (privs == null) {
Plugin permChat = event.getPlugin();
if (PLUGIN_NAME.equals(permChat.getDescription().getName())) {
if (permChat.isEnabled()) {
privs = (Privileges) permChat;
plugin.getLogger().info(String.format("[Chat] %s hooked.", FRIENDLY_NAME));
}
}
}
}
代码示例来源:origin: MilkBowl/Vault
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if ((chat.overPerms != null) &&
(event.getPlugin().getDescription().getName().equals("OverPermissions"))) {
chat.overPerms = null;
plugin.getLogger().info(String.format("[%s][Chat] %s un-hooked.", new Object[] {plugin.getDescription().getName(), getName()}));
}
}
}
代码示例来源:origin: MilkBowl/Vault
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (chat.overPerms == null) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("OverPermissions");
if (chat != null) {
this.chat.overPerms = (OverPermissions) chat;
plugin.getLogger().info(String.format("[%s][Chat] %s hooked.", new Object[] {plugin.getDescription().getName(), getName()}));
}
}
}
代码示例来源:origin: MilkBowl/Vault
public Permission_KPerms(Plugin plugin) {
super();
this.vault = plugin;
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), vault);
if (kperms == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("KPerms");
if (perms != null && perms.isEnabled()) {
this.kperms = (KPermsPlugin) perms;
plugin.getLogger().info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), "KPerms"));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!