@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 } } }
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(
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)); } }
plugin.getLogger().info(message);
/** * 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"); } }
/** * 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); }
/** * 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)); }
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; } }
public static void debug(String message, Throwable ex) { if (isDebugEnabled()) { plugin.getLogger().log(Level.WARNING, "[Debug] " + message, ex); } } }
@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)); } } } }
@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)); } } } }
@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; } }
@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; } }
@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; } }
@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; } }
@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; } }
@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)); } } } }
@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()})); } } }
@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()})); } } }
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")); } } }