@Deprecated public ExecutorService getExecutorService() { if ( service == null ) { String name = ( getDescription() == null ) ? "unknown" : getDescription().getName(); service = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat( name + " Pool Thread #%1$d" ) .setThreadFactory( new GroupedThreadFactory( this, name ) ).build() ); } return service; } //
/** * Gets the data folder where this plugin may store arbitrary data. It will * be a child of {@link ProxyServer#getPluginsFolder()}. * * @return the data folder of this plugin */ public final File getDataFolder() { return new File( getProxy().getPluginsFolder(), getDescription().getName() ); }
protected PluginLogger(Plugin plugin) { super( plugin.getClass().getCanonicalName(), null ); pluginName = "[" + plugin.getDescription().getName() + "] "; setParent( plugin.getProxy().getLogger() ); }
for ( PluginDescription element : dependStack ) dependencyGraph.append( element.getName() ).append( " -> " ); dependencyGraph.append( plugin.getName() ).append( " -> " ).append( dependName ); ProxyServer.getInstance().getLogger().log( Level.WARNING, "Circular dependency detected: {0}", dependencyGraph ); status = false; String.valueOf( dependName ), plugin.getName() } ); status = false; plugins.put( plugin.getName(), clazz ); clazz.onLoad(); ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[] plugin.getName(), plugin.getVersion(), plugin.getAuthor() } ); } catch ( Throwable t ) proxy.getLogger().log( Level.WARNING, "Error enabling plugin " + plugin.getName(), t );
public void enablePlugins() { for ( Plugin plugin : plugins.values() ) { try { plugin.onEnable(); ProxyServer.getInstance().getLogger().log( Level.INFO, "Enabled plugin {0} version {1} by {2}", new Object[] { plugin.getDescription().getName(), plugin.getDescription().getVersion(), plugin.getDescription().getAuthor() } ); } catch ( Throwable t ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Exception encountered when loading plugin: " + plugin.getDescription().getName(), t ); } } }
getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t );
@Override public String getName() { return getDescription().getName(); }
@Deprecated public ExecutorService getExecutorService() { if ( service == null ) { String name = ( getDescription() == null ) ? "unknown" : getDescription().getName(); service = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat( name + " Pool Thread #%1$d" ) .setThreadFactory( new GroupedThreadFactory( this, name ) ).build() ); } return service; } //
/** * Gets the plugin specific data. * This method is called using Reflection. * * @return The plugin specific data. */ public JsonObject getPluginData() { JsonObject data = new JsonObject(); String pluginName = plugin.getDescription().getName(); String pluginVersion = plugin.getDescription().getVersion(); data.addProperty("pluginName", pluginName); data.addProperty("pluginVersion", pluginVersion); JsonArray customCharts = new JsonArray(); data.add("customCharts", customCharts); return data; }
/** * Gets the data folder where this plugin may store arbitrary data. It will * be a child of {@link ProxyServer#getPluginsFolder()}. * * @return the data folder of this plugin */ public final File getDataFolder() { return new File( getProxy().getPluginsFolder(), getDescription().getName() ); }
@Override public void loadLanguages() { super.loadLanguages(); String pluginName = "acf-" + manager.plugin.getDescription().getName(); addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase()); } }
protected PluginLogger(Plugin plugin) { super( plugin.getClass().getCanonicalName(), null ); pluginName = "[" + plugin.getDescription().getName() + "] "; setParent( plugin.getProxy().getLogger() ); }
/** * Gets the plugin specific data. * This method is called using Reflection. * * @return The plugin specific data. */ public JsonObject getPluginData() { JsonObject data = new JsonObject(); String pluginName = plugin.getDescription().getName(); String pluginVersion = plugin.getDescription().getVersion(); data.addProperty("pluginName", pluginName); data.addProperty("pluginVersion", pluginVersion); JsonArray customCharts = new JsonArray(); for (CustomChart customChart : charts) { // Add the data of the custom charts JsonObject chart = customChart.getRequestJsonObject(plugin.getLogger(), logFailedRequests); if (chart == null) { // If the chart is null, we skip it continue; } customCharts.add(chart); } data.add("customCharts", customCharts); return data; }
URL url = new URL( "http://updates.codecrafter47.dyndns.eu/" + plugin. getDescription().getName() + "/version.txt"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.connect();
@Override public JsonObject getDump() { JsonObject platformSpecific = new JsonObject(); List<PluginInfo> plugins = new ArrayList<>(); for (Plugin p : ProxyServer.getInstance().getPluginManager().getPlugins()) plugins.add(new PluginInfo(true, p.getDescription().getName(), p.getDescription().getVersion(), p.getDescription().getMain(), Arrays.asList(p.getDescription().getAuthor()))); platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins)); platformSpecific.add("servers", GsonUtil.getGson().toJsonTree(ProtocolDetectorService.getDetectedIds())); return platformSpecific; }
public void enablePlugins() { for ( Plugin plugin : plugins.values() ) { try { plugin.onEnable(); ProxyServer.getInstance().getLogger().log( Level.INFO, "Enabled plugin {0} version {1} by {2}", new Object[] { plugin.getDescription().getName(), plugin.getDescription().getVersion(), plugin.getDescription().getAuthor() } ); } catch ( Throwable t ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Exception encountered when loading plugin: " + plugin.getDescription().getName(), t ); } } }
getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t );
@EventHandler public void onDevJoin(PostLoginEvent e) { if (plugin.getPlugin().getDescription().getAuthor().equalsIgnoreCase(e.getPlayer(). getName())) { e.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + "Hello " + e. getPlayer().getName() + ", this server uses " + plugin.getPlugin(). getDescription().getName() + ", one of you incredible good plugins"); } }