private String getPluginList() { StringBuilder pluginList = new StringBuilder(); Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); for (Plugin plugin : plugins) { if (pluginList.length() > 0) { pluginList.append(ChatColor.WHITE); pluginList.append(", "); } pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED); pluginList.append(plugin.getDescription().getName()); } return "(" + plugins.length + "): " + pluginList.toString(); } }
@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(); } }
public static Permission registerPermission(Permission perm, boolean withLegacy) { Permission result = perm; try { Bukkit.getPluginManager().addPermission(perm); } catch (IllegalArgumentException ex) { result = Bukkit.getPluginManager().getPermission(perm.getName()); } if (withLegacy) { Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE); legacy.getChildren().put(result.getName(), true); registerPermission(perm, false); } return result; }
Plugin exactPlugin = Bukkit.getPluginManager().getPlugin(pluginName); if (exactPlugin != null) { describeToSender(exactPlugin, sender); for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { if (plugin.getName().toLowerCase().contains(pluginName)) { describeToSender(plugin, sender);
fileNames = new PrintStream(names); for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { pluginIdx++; long totalTime = 0;
String[] split = name.split(":", 2); String id = (split.length > 1) ? split[1] : null; Plugin plugin = Bukkit.getPluginManager().getPlugin(split[0]);
@Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; if (sender instanceof Player) { Player player = (Player) sender; EntityDamageEvent ede = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.SUICIDE, 1000); Bukkit.getPluginManager().callEvent(ede); if (ede.isCancelled()) return true; ede.getEntity().setLastDamageCause(ede); player.setHealth(0); sender.sendMessage("Ouch. That look like it hurt."); } else { sender.sendMessage("You can only perform this command as a player"); } return true; }
Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE); String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + ChatColor.GRAY + ChatColor.ITALIC + "]";
sendBullet(sender, t, b, "glowstone.about.worlds", Bukkit.getWorlds().size()); sendBullet(sender, t, b, "glowstone.about.plugins", Bukkit.getPluginManager().getPlugins().length);
BukkitPlayer(WorldGuardPlugin plugin, Player player, boolean silenced) { super((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"), player); this.plugin = plugin; this.silenced = silenced; }
/** * Initializes a new listener by pluginname * * @param plugin plugin */ public SimpleListener(String plugin) { this(Bukkit.getPluginManager().getPlugin(plugin)); }
/** * Registers the listener to spigot */ final void register() { Bukkit.getPluginManager().registerEvents(this, this.plugin); }
/** * Registers the listener to spigot */ final void register() { Bukkit.getPluginManager().registerEvents(this, this.plugin); }
@Override public JsonObject getDump() { JsonObject platformSpecific = new JsonObject(); List<PluginInfo> plugins = new ArrayList<>(); for (Plugin p : Bukkit.getPluginManager().getPlugins()) plugins.add(new PluginInfo(p.isEnabled(), p.getDescription().getName(), p.getDescription().getVersion(), p.getDescription().getMain(), p.getDescription().getAuthors())); platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins)); // TODO more? ProtocolLib things etc? return platformSpecific; }
@Override public void broadcastNotification(String message) { Bukkit.broadcast(message, "worldguard.notify"); Set<Permissible> subs = Bukkit.getPluginManager().getPermissionSubscriptions("worldguard.notify"); for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (!(subs.contains(player) && player.hasPermission("worldguard.notify")) && WorldGuardPlugin.inst().hasPermission(player, "worldguard.notify")) { // Make sure the player wasn't already broadcasted to. player.sendMessage(message); } } WorldGuard.logger.info(message); }
@Override public void onReload() { if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) { getLogger().severe("ViaVersion is already loaded, we're going to kick all the players... because otherwise we'll crash because of ProtocolLib."); for (Player player : Bukkit.getOnlinePlayers()) { player.kickPlayer(ChatColor.translateAlternateColorCodes('&', getConf().getReloadDisconnectMsg())); } } else { getLogger().severe("ViaVersion is already loaded, this should work fine. If you get any console errors, try rebooting."); } }
/** * {@inheritDoc} */ @Override public T validateChange(String property, T newValue, T oldValue, MVWorld object) throws ChangeDeniedException { MVWorldPropertyChangeEvent<T> event = new MVWorldPropertyChangeEvent<T>(object, null, property, newValue); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) throw new ChangeDeniedException(); return event.getTheNewValue(); } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); Bukkit.getPluginManager().callEvent(new ConnectionCloseEvent(connection)); ProtocolStorage.removeConnection(connection.getRawAddress()); }
/** * Removes the ball. */ @Override public void remove() { Bukkit.getPluginManager().callEvent(new BallDeathEvent(this)); this.deGrab(); this.getSpigotEntity().remove(); this.hitBox.getSpigotEntity().remove(); }
/** * Removes the ball. */ @Override public void remove() { Bukkit.getPluginManager().callEvent(new BallDeathEvent(this)); this.deGrab(); this.getSpigotEntity().remove(); this.hitBox.getSpigotEntity().remove(); }