use of org.bukkit.plugin.Plugin in project Prism-Bukkit by prism.
the class Prism method checkPluginDependancies.
/**
*
*/
public void checkPluginDependancies() {
// WorldEdit
final Plugin we = getServer().getPluginManager().getPlugin("WorldEdit");
if (we != null) {
plugin_worldEdit = (WorldEditPlugin) we;
//Easier and foolproof way.
try {
WorldEdit.getInstance().getEventBus().register(new PrismBlockEditHandler());
log("WorldEdit found. Associated features enabled.");
} catch (Throwable error) {
log("Required WorldEdit version is 6.0.0 or greater! Certain optional features of Prism disabled.");
}
} else {
log("WorldEdit not found. Certain optional features of Prism disabled.");
}
}
use of org.bukkit.plugin.Plugin in project AuthMeReloaded by AuthMe.
the class ServerListenerTest method mockEventWithPluginName.
private static <T extends PluginEvent> T mockEventWithPluginName(Class<T> eventClass, String name) {
T event = mock(eventClass);
Plugin plugin = mock(Plugin.class);
given(plugin.getName()).willReturn(name);
given(event.getPlugin()).willReturn(plugin);
return event;
}
use of org.bukkit.plugin.Plugin in project TotalFreedomMod by TotalFreedom.
the class Command_commandlist method run.
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
List<String> commands = new ArrayList<>();
for (Plugin targetPlugin : server.getPluginManager().getPlugins()) {
try {
PluginDescriptionFile desc = targetPlugin.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
if (map != null) {
for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
String command_name = (String) entry.getKey();
commands.add(command_name);
}
}
} catch (Throwable ex) {
}
}
Collections.sort(commands);
sender.sendMessage(StringUtils.join(commands, ","));
return true;
}
use of org.bukkit.plugin.Plugin in project Bukkit by Bukkit.
the class VersionCommand method tabComplete.
@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();
}
use of org.bukkit.plugin.Plugin in project Bukkit by Bukkit.
the class PluginsCommand method getPluginList.
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();
}
Aggregations