@SuppressFBWarnings("REC_CATCH_EXCEPTION") private ModuleVersion getVersion(File file) { try ( JarFile jar = new JarFile( file ) ) { JarEntry pdf = jar.getJarEntry( "plugin.yml" ); Preconditions.checkNotNull( pdf, "Plugin must have a plugin.yml" ); try ( InputStream in = jar.getInputStream( pdf ) ) { PluginDescription desc = new Yaml().loadAs( in, PluginDescription.class ); return ModuleVersion.parse( desc.getVersion() ); } } catch ( Exception ex ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not check module from file " + file, ex ); } return null; } }
ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[] plugin.getName(), plugin.getVersion(), plugin.getAuthor() } ); } catch ( Throwable 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 ); } } }
@Override public String getPluginVersion() { return getDescription().getVersion(); }
@Override public String getPluginVersion() { return plugin.getDescription().getVersion(); }
@Override public String getVersion() { return super.getDescription().getVersion(); }
@Override public String getVersion() { return getDescription().getVersion(); }
@SuppressFBWarnings("REC_CATCH_EXCEPTION") private ModuleVersion getVersion(File file) { try ( JarFile jar = new JarFile( file ) ) { JarEntry pdf = jar.getJarEntry( "plugin.yml" ); Preconditions.checkNotNull( pdf, "Plugin must have a plugin.yml" ); try ( InputStream in = jar.getInputStream( pdf ) ) { PluginDescription desc = new Yaml().loadAs( in, PluginDescription.class ); return ModuleVersion.parse( desc.getVersion() ); } } catch ( Exception ex ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not check module from file " + file, ex ); } return null; } }
/** * 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; }
@Override public String getVersion() { return ((Plugin) getPlugin()).getDescription().getVersion(); }
/** * 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; }
output.writeInt(BridgeProtocolConstants.VERSION); output.writeInt(BridgeProtocolConstants.VERSION); output.writeUTF(plugin.getPlugin().getDescription().getVersion());
String runningVersion = plugin.getDescription().getVersion(); updateAvailable = compareVersions(newVersion, runningVersion);
private void sendVersion(CommandSender sender) { PluginDescription description = TimoCloudBungee.getInstance().getDescription(); BungeeMessageManager.sendMessage(sender, "&bTimoCloud Version &e[&6" + description.getVersion() + "&e] &bby &6TimoCrafter"); }
@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; }
String pluginName = description.getName(); boolean onlineMode = ProxyServer.getInstance().getConfigurationAdapter().getBoolean("online_mode", true); // TRUE if online mode is enabled String pluginVersion = description.getVersion(); String serverVersion = ProxyServer.getInstance().getVersion(); int playersOnline = ProxyServer.getInstance().getPlayers().size();
ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[] plugin.getName(), plugin.getVersion(), plugin.getAuthor() } ); } catch ( Throwable 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 ); } } }
@Override public void onEnable() { try { instance = this; info("&eEnabling &bTimoCloudBungee &eversion &7[&6" + getDescription().getVersion() + "&7]&e..."); makeInstances(); registerCommands(); registerListeners(); registerTasks(); Executors.newSingleThreadExecutor().submit(this::connectToCore); while (!((TimoCloudUniversalAPIBasicImplementation) TimoCloudAPI.getUniversalAPI()).gotAnyData()) { try { Thread.sleep(50); // Wait until we get the API data } catch (Exception e) {} } info("&aSuccessfully started TimoCloudBungee!"); } catch (Exception e) { severe("Error while enabling TimoCloudBungee: "); TimoCloudBungee.getInstance().severe(e); } }
private void commandStatus(CommandSender sender) { String version = BungeeTabListPlus.getInstance().getPlugin().getDescription().getVersion(); sender.sendMessage(ChatUtil.parseBBCode("&eYou are running BungeeTabListPlus version " + version));