@Override public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Plugin)) { return false; } return getName().equals(((Plugin) obj).getName()); }
private String getCommandPluginName(Command command) { if (command instanceof BukkitCommand) { return "Bukkit"; } if (command instanceof PluginIdentifiableCommand) { return ((PluginIdentifiableCommand) command).getPlugin().getName(); } return null; }
@Override public List<String> tabComplete(CommandSender sender, String alias, String[] args) { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be null"); if (args.length == 1) { List<String> completions = new ArrayList<String>(); String toComplete = args[0].toLowerCase(); for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { if (StringUtil.startsWithIgnoreCase(plugin.getName(), toComplete)) { completions.add(plugin.getName()); } } return completions; } return ImmutableList.of(); } }
Bukkit.getServer().getLogger().severe("Could not load command " + entry.getKey() + " for plugin " + plugin.getName() + ": Illegal Characters"); continue; for (Object o : (List<?>) aliases) { if (o.toString().contains(":")) { Bukkit.getServer().getLogger().severe("Could not load alias " + o.toString() + " for plugin " + plugin.getName() + ": Illegal Characters"); continue; Bukkit.getServer().getLogger().severe("Could not load alias " + aliases.toString() + " for plugin " + plugin.getName() + ": Illegal Characters"); } else { aliasList.add(aliases.toString());
pluginName = pluginName.toLowerCase(); for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { if (plugin.getName().toLowerCase().contains(pluginName)) { describeToSender(plugin, sender); found = true;
boolean hasSponge = false; for (Plugin plugin : plugins) { if (plugin.getName().equals("Bukkit2Sponge")) { hasSponge = true; // TODO: better detection method, plugin description file
public TLogger(String pattern, Plugin plugin, int level) { this.pattern = pattern; this.name = plugin.getName(); this.level = level; }
public EZPlaceholderHook(Plugin plugin, String identifier) { Validate.notNull(plugin, "Plugin can not be null!"); Validate.notNull(identifier, "Placeholder name can not be null!"); this.identifier = identifier; this.plugin = plugin.getName(); }
/** * Retrieve the timed tracker associated with the given plugin and listener type. * @param plugin - the plugin. * @param type - the listener type. * @return The timed tracker. */ public TimedTracker getTracker(Plugin plugin, ListenerType type) { return getTracker(plugin.getName(), type); }
/** * Check which plugins are up-to-date or not. * * @return a map of the plugins and the results. */ public static Map<String, UpdateResult> checkUpToDate() { Map<String, UpdateResult> results = new TreeMap<>(); for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { results.put(plugin.getName(), checkUpToDate(plugin.getName())); } return results; }
/** * Retrieve the timed tracker associated with the given listener and listener type. * @param listener - the listener. * @param type - the listener type. * @return The timed tracker. */ public TimedTracker getTracker(PacketListener listener, ListenerType type) { return getTracker(listener.getPlugin().getName(), type); }
@EventHandler private void vaultEnabled(PluginEnableEvent event) { if (event.getPlugin() != null && event.getPlugin().getName().equals("Vault")) { setupVaultEconomy(); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(PluginDisableEvent event) { if(permission.perms != null){ if(event.getPlugin().getName().equals("Xperms")){ permission.perms = null; log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name)); } } } }
public static HikariDataSource createDataSource(IHost host, HikariConfig hikariConfig) { MapDataSource mapDataSource = dataSource.computeIfAbsent(host, x -> new MapDataSource(x, new HikariDataSource(hikariConfig == null ? createConfig(host) : hikariConfig))); mapDataSource.getActivePlugin().getAndIncrement(); if (mapDataSource.getActivePlugin().get() == 1) { TLocale.Logger.info("MYSQL-HIKARI.CREATE-SUCCESS", host.getPlugin().getName(), host.getConnectionUrlSimple()); } else { TLocale.Logger.info("MYSQL-HIKARI.CREATE-EXISTS", host.getPlugin().getName(), mapDataSource.getHost().getPlugin().getName()); } return mapDataSource.getHikariDataSource(); }
@EventHandler private void vaultDisabled(PluginDisableEvent event) { if (event.getPlugin() != null && event.getPlugin().getName().equals("Vault")) { Logging.fine("Vault economy disabled"); economy = null; } } }
public static ArrayList<String> getPlugins() { ArrayList<String> pluginList = new ArrayList<String>(); Plugin[] plugins = BedwarsRel.getInstance().getServer().getPluginManager().getPlugins(); for (Plugin plugin : plugins) { pluginList.add(plugin.getName() + " (" + plugin.getDescription().getVersion() + ")"); } return pluginList; }
@EventHandler public void disable(PluginDisableEvent e) { if (e.getPlugin().equals(Main.getInst())) { return; } if (CACHE_DATA_PLUGIN.containsKey(e.getPlugin().getName())) { saveAllCaches(e.getPlugin(), true); } } }
public CitizensNpcFactory() { // create an enable hook for citizens Events.subscribe(PluginEnableEvent.class) .filter(e -> e.getPlugin().getName().equals("Citizens")) .expireAfter(1) // only call once .handler(e -> init()); }
@EventHandler public void onDisable(PluginDisableEvent event) { if (event.getPlugin().getName().equals(arena.getPlugin().getName()) && player.isConversing()) { player.abandonConversation(convo); } }