@Override protected boolean isInputValid(ConversationContext context, String input) { return plugin.getServer().getPlayer(input) != null; }
/** * Stops the active inactivity timer. */ private void stopTimer() { if (taskId != -1) { plugin.getServer().getScheduler().cancelTask(taskId); taskId = -1; } }
@Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { return acceptValidatedInput(context, plugin.getServer().getPlayer(input)); }
void register(Plugin plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } }
/** * Starts an inactivity timer. */ private void startTimer() { taskId = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { if (conversation.getState() == Conversation.ConversationState.UNSTARTED) { startTimer(); } else if (conversation.getState() == Conversation.ConversationState.STARTED) { cancelling(conversation); conversation.abandon(new ConversationAbandonedEvent(conversation, InactivityConversationCanceller.this)); } } }, timeoutSeconds * 20); }
/** * Creates a new PluginLogger that extracts the name from a plugin. * * @param context A reference to the plugin */ public PluginLogger(Plugin context) { super(context.getClass().getCanonicalName(), null); String prefix = context.getDescription().getPrefix(); pluginName = prefix != null ? new StringBuilder().append("[").append(prefix).append("] ").toString() : "[" + context.getDescription().getName() + "] "; setParent(context.getServer().getLogger()); setLevel(Level.ALL); }
protected PermissionsResolverManager(Plugin plugin) { this.server = plugin.getServer(); (new ServerListener()).register(plugin); // Register the events loadConfig(new File("wepif.yml")); findResolver(); }
public CommandMap getCommandMap() { CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap"); if (commandMap == null) { if (fallbackCommands != null) { commandMap = fallbackCommands; } else { Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() + ": Could not retrieve server CommandMap, using fallback instead!"); fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer()); Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin); } } return commandMap; }
@Override protected void sendMessage() { plugin.getServer().broadcast(message, "mcmmo.chat.adminchat"); } }
@Override public double getBalance(String playerName) { List<World> worlds = plugin.getServer().getWorlds(); return getBalance(playerName, worlds.get(0).getName()); }
@Override public EconomyResponse depositPlayer(String playerName, double amount) { List<World> worlds = plugin.getServer().getWorlds(); return depositPlayer(playerName, worlds.get(0).getName(), amount); }
@Override public String getPlayerPrefix(String world, String player) { Player p = plugin.getServer().getPlayer(player); if (p == null) { throw new UnsupportedOperationException("iChat does not support offline player info nodes!"); } if (!p.getWorld().getName().equals(world)) { return null; } return iChat.getPrefix(p); }
@Override public String getPlayerSuffix(String world, String player) { Player p = plugin.getServer().getPlayer(player); if (p == null) { throw new UnsupportedOperationException("iChat does not support offline player info nodes!"); } if (!p.getWorld().getName().equals(world)) { return null; } return iChat.getSuffix(p); }
public void unload_api() { SDFEconomy pluginSDF = (SDFEconomy) plugin.getServer().getPluginManager().getPlugin("SDFEconomy"); if(isEnabled() && pluginSDF != null) { api = null; log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), name)); } }
@Override public boolean groupAdd(String world, String group, String permission) { if (world != null) { permission = world + ":" + permission; } return plugin.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "permissions group setperm " + group + " " + permission + " true"); }
public Economy_Craftconomy3(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); // Load Plugin in case it was loaded before if (economy == null) { Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3"); if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) { economy = (BukkitLoader) ec; log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); } } }
public Economy_SDFEconomy(Plugin _plugin) { plugin = _plugin; // Register a listener to wait for plugin being loaded plugin.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); // Try and Load API in case plugin was loaded before Vault load_api(); }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if (chat.overPerms == null) { Plugin chat = plugin.getServer().getPluginManager().getPlugin("OverPermissions"); if (chat != null) { this.chat.overPerms = (OverPermissions) chat; plugin.getLogger().info(String.format("[%s][Chat] %s hooked.", new Object[] {plugin.getDescription().getName(), getName()})); } } }
public Economy_CommandsEX(Plugin plugin){ this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); if (economy == null) { Plugin commandsex = plugin.getServer().getPluginManager().getPlugin("CommandsEX"); if (commandsex != null && commandsex.isEnabled()) { economy = (CommandsEX) commandsex; log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); } } }
public Economy_McMoney(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); // Load Plugin in case it was loaded before if (economy == null) { Plugin econ = plugin.getServer().getPluginManager().getPlugin("McMoney"); if (econ != null && econ.isEnabled()) { economy = McMoneyAPI.getInstance(); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); } } }