Java Code Examples for org.bukkit.plugin.Plugin

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project authme-2.0, under directory /src/uk/org/whoami/authme/citizens/.

Source file: CitizensCommunicator.java

  22 
vote

public static boolean isNPC(Entity player){
  PluginManager pm=player.getServer().getPluginManager();
  Plugin plugin=pm.getPlugin("Citizens");
  if (plugin != null) {
    return CitizensManager.isNPC(player);
  }
  return false;
}
 

Example 2

From project AuthMe-Reloaded, under directory /src/main/java/uk/org/whoami/authme/plugin/manager/.

Source file: CitizensCommunicator.java

  22 
vote

public static boolean isNPC(Entity player){
  PluginManager pm=player.getServer().getPluginManager();
  Plugin plugin=pm.getPlugin("Citizens");
  if (plugin != null) {
    String Ver=plugin.getDescription().getVersion();
    String[] args=Ver.split("\\.");
    if (args[0].equals("1"))     return CitizensManager.isNPC(player);
 else     return CitizensAPI.getNPCRegistry().isNPC(player);
  }
  return false;
}
 

Example 3

From project BetterShop_1, under directory /src/me/jascotty2/bettershop/.

Source file: BSEcon.java

  22 
vote

private boolean setupEconomy(){
  Plugin v=plugin.getServer().getPluginManager().getPlugin("Vault");
  if (!(v instanceof Vault)) {
    return false;
  }
  RegisteredServiceProvider<Economy> rsp=plugin.getServer().getServicesManager().getRegistration(Economy.class);
  if (rsp == null) {
    return false;
  }
  econ=rsp.getProvider();
  return econ != null;
}
 

Example 4

From project ChessCraft, under directory /src/main/java/me/desht/chesscraft/.

Source file: ChessCraft.java

  22 
vote

private void setupVault(PluginManager pm){
  Plugin vault=pm.getPlugin("Vault");
  if (vault != null && vault instanceof net.milkbowl.vault.Vault) {
    LogUtils.fine("Loaded Vault v" + vault.getDescription().getVersion());
    if (!setupEconomy()) {
      LogUtils.warning("No economy plugin detected - game stakes not available");
    }
  }
 else {
    LogUtils.warning("Vault not loaded: game stakes not available");
  }
}
 

Example 5

From project core_3, under directory /src/net/sacredlabyrinth/Phaed/Core/.

Source file: Core.java

  22 
vote

private void setupVanish(){
  Plugin this_plugin=getServer().getPluginManager().getPlugin("VanishNoPacket");
  if (vanishPlugin == null) {
    if (this_plugin != null) {
      vanishPlugin=((VanishPlugin)this_plugin);
    }
 else {
      log.info("[" + getDescription().getName() + "] Failed to find VanishNoPacket");
    }
  }
}
 

Example 6

From project DimensionDoor, under directory /src/main/java/name/richardson/james/bukkit/dimensiondoor/.

Source file: World.java

  22 
vote

/** 
 * Gets the custom chunk generator.
 * @return the custom chunk generator
 */
private ChunkGenerator getCustomChunkGenerator(){
  if (this.generatorPluginName != null) {
    final Plugin generatorPlugin=this.plugin.getServer().getPluginManager().getPlugin(this.generatorPluginName);
    if (generatorPlugin != null) {
      return generatorPlugin.getDefaultWorldGenerator(this.worldName,this.generatorID);
    }
 else {
      throw new IllegalStateException("Unable to load world generation plugin!");
    }
  }
  return null;
}
 

Example 7

From project DragonTravel, under directory /src/main/java/com/xemsdoom/dt/spout/.

Source file: DragonTravelSpout.java

  22 
vote

public static boolean getSpout(){
  Plugin plugin=DragonTravelMain.pm.getPlugin("Spout");
  if (plugin == null)   return false;
  DragonTravelMain.spout=true;
  DragonTravelMain.sound=SpoutManager.getSoundManager();
  return true;
}
 

Example 8

From project EasyBan, under directory /src/uk/org/whoami/easyban/.

Source file: EasyBan.java

  22 
vote

private GeoIPLookup getGeoIPLookup(){
  Plugin pl=this.getServer().getPluginManager().getPlugin("GeoIPTools");
  if (pl != null) {
    return ((GeoIPTools)pl).getGeoIPLookup(GeoIPLookup.COUNTRYDATABASE | GeoIPLookup.IPV6DATABASE);
  }
 else {
    return null;
  }
}
 

Example 9

From project EasyTravel, under directory /src/at/co/hohl/easytravel/.

Source file: TravelPlugin.java

  22 
vote

/** 
 * Setups the WorldEdit client.
 */
private void setupWorldEdit(){
  Plugin plugin=getServer().getPluginManager().getPlugin("WorldEdit");
  if (plugin != null) {
    worldEditPlugin=(WorldEditPlugin)plugin;
    logger.info(String.format("%s connected to WorldEdit successfully!",getDescription().getName()));
  }
 else {
    logger.severe(String.format("%s requires WorldEdit! Please install first!",getDescription().getName()));
  }
}
 

Example 10

From project ExperienceMod, under directory /ExperienceMod/src/com/comphenix/xp/history/.

Source file: LogBlockService.java

  22 
vote

/** 
 * Attempts to create a log block service. 
 * @param manager - local plugin manager.
 * @return A LogBlockService if successful, otherwise NULL.
 */
public static LogBlockService create(PluginManager manager){
  Plugin plugin=manager.getPlugin("LogBlock");
  if (plugin != null) {
    return new LogBlockService((LogBlock)plugin);
  }
 else {
    return null;
  }
}
 

Example 11

From project Jobs, under directory /src/main/java/me/zford/jobs/bukkit/.

Source file: JobsPlugin.java

  22 
vote

/** 
 * Loads vault and sets as default economy
 */
private boolean loadVault(){
  Plugin test=getServer().getPluginManager().getPlugin("Vault");
  if (test == null)   return false;
  economy=new BufferedEconomy(this);
  getLogger().info("[" + getDescription().getName() + "] Successfully linked with Vault.");
  return true;
}
 

Example 12

From project LyTreeHelper, under directory /src/net/darklikally/LyTreeHelper/.

Source file: LyTreeHelperPermissions.java

  22 
vote

/** 
 * Setups the Permissions handler
 */
private void setupPermissions(){
  Plugin test=this.plugin.getServer().getPluginManager().getPlugin("Permissions");
  if (this.Permissions == null) {
    if (test != null) {
      this.Permissions=((Permissions)test).getHandler();
      this.plugin.getLogger().log(Level.INFO,"[LyTreeHelper] Permission plugin detected, using Permissions plugin for permissions.");
    }
  }
}
 

Example 13

From project MachinaCraft, under directory /MachinaCore/src/me/lyneira/MachinaCore/plugin/.

Source file: MachinaPlugin.java

  22 
vote

@Override public final void onEnable(){
  super.onEnable();
  Plugin plugin=getServer().getPluginManager().getPlugin("MachinaCore");
  if (plugin == null) {
    logSevere("Could not retrieve MachinaCore plugin from server, something is very wrong! Not continuing with enable.");
    return;
  }
  machinaCore=(MachinaCore)plugin;
  mpEnable();
  registerBlueprints();
}
 

Example 14

From project MagicCarpet, under directory /src/main/java/net/digiex/magiccarpet/.

Source file: MagicCarpet.java

  22 
vote

private void getWorldGuard(){
  Plugin plugin=getServer().getPluginManager().getPlugin("WorldGuard");
  if (plugin == null || !(plugin instanceof com.sk89q.worldguard.bukkit.WorldGuardPlugin)) {
    return;
  }
  worldGuardHandler=new WorldGuardHandler((com.sk89q.worldguard.bukkit.WorldGuardPlugin)plugin);
}
 

Example 15

From project MineStarLibrary, under directory /src/main/java/de/minestar/minestarlibrary/.

Source file: AbstractCore.java

  22 
vote

/** 
 * Searching first for the Plugin "Illuminati" and check whether it is enabled. When the plugin is enabled it will call the overriden methode
 */
private void handleRegisterStatistic(){
  Plugin p=getServer().getPluginManager().getPlugin("Illuminati");
  boolean illuminatiEnabled=p != null && p.isEnabled();
  if (illuminatiEnabled) {
    if (!registerStatistics())     ConsoleUtils.printError(tempName,"Can't register statistics! Statistics are disabled!");
 else     ConsoleUtils.printInfo(tempName,"Statistics are registered!");
  }
 else   ConsoleUtils.printWarning(tempName,"Illuminati was not found. Can't register statistics!");
}
 

Example 16

From project mmSupernaturals, under directory /src/me/matterz/supernaturals/.

Source file: SupernaturalsPlugin.java

  22 
vote

private WorldGuardPlugin getWorldGuard(){
  Plugin plugin=getServer().getPluginManager().getPlugin("WorldGuard");
  if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
    return null;
  }
  return (WorldGuardPlugin)plugin;
}
 

Example 17

From project palisade, under directory /Collapse/src/blakesteel/Collapse/.

Source file: SupportFactions.java

  22 
vote

static public Plugin getPlugin(Server server) throws PluginUnavailableException {
  Plugin plugin=server.getPluginManager().getPlugin("Factions");
  if (plugin == null) {
    throw new PluginUnavailableException();
  }
  return plugin;
}
 

Example 18

From project AdminCmd, under directory /src/main/java/be/Balor/Manager/Commands/Server/.

Source file: Reload.java

  21 
vote

@Override public void execute(final CommandSender sender,final CommandArgs args) throws ActionNotPermitedException, PlayerNotFound {
  if (args.length >= 1 && !args.getString(0).equals("AdminCmd")) {
    final Plugin plugin=sender.getServer().getPluginManager().getPlugin(args.getString(0));
    if (plugin == null) {
      Utils.sI18n(sender,"pluginNotFound","plugin",args.getString(0));
      return;
    }
    ACPluginManager.scheduleSyncTask(new Runnable(){
      @Override public void run(){
        ACPluginManager.getServer().getPluginManager().disablePlugin(plugin);
        ACPluginManager.getServer().getPluginManager().enablePlugin(plugin);
      }
    }
);
    Utils.sI18n(sender,"pluginReloaded","plugin",args.getString(0));
  }
 else {
    ACHelper.getInstance().reload();
    Utils.sI18n(sender,"pluginReloaded","plugin","AdminCmd");
  }
}
 

Example 19

From project AuthDB, under directory /src/main/java/com/authdb/.

Source file: AuthDB.java

  21 
vote

void CheckPermissions(){
  Plugin Check1=getServer().getPluginManager().getPlugin("Permissions");
  if (Check1 != null) {
    ZPermissions.hasPlugin=true;
  }
  Plugin Check2=getServer().getPluginManager().getPlugin("PermissionsBukkit");
  if (Check2 != null) {
    if (ZPermissions.hasPlugin) {
      Util.logging.Info("Found 2 supported permissions plugins: " + Check1.getDescription().getName() + " "+ Check1.getDescription().getVersion()+ " and "+ Check2.getDescription().getName()+ " "+ Check2.getDescription().getVersion());
      Util.logging.Info("Defaulting permissions to: " + Check2.getDescription().getName() + " "+ Check2.getDescription().getVersion());
    }
 else {
      Util.logging.Info("Found supported plugin: " + Check2.getDescription().getName() + " "+ Check2.getDescription().getVersion());
    }
    ZPermissions.hasPermissionsBukkit=true;
  }
 else {
    if (ZPermissions.hasPlugin) {
      ZPermissions.permissionsHandler=((Permissions)Check1).getHandler();
      Util.logging.Info("Found supported plugin: " + Check1.getDescription().getName() + " "+ Check1.getDescription().getVersion());
    }
 else {
      Util.logging.Info("Could not load a permissions plugin, going over to OP!");
    }
  }
}
 

Example 20

From project BetterMechanics, under directory /src/net/edoxile/bettermechanics/handlers/.

Source file: PermissionHandler.java

  21 
vote

private PermissionHandler(){
  ConfigHandler.PermissionsConfig config=BetterMechanics.getInstance().getConfigHandler().getPermissionsConfig();
  enabled=config.isEnabled();
  if (config.canUseZones()) {
    Plugin p=BetterMechanics.getInstance().getServer().getPluginManager().getPlugin("Zones");
    if (p != null && p instanceof Zones) {
      zones=(Zones)p;
      zonesEnabled=true;
    }
 else {
      zonesEnabled=false;
    }
  }
 else {
    zonesEnabled=false;
  }
  if (config.canUseWorldGuard()) {
    Plugin p=BetterMechanics.getInstance().getServer().getPluginManager().getPlugin("WorldGuard");
    if (p != null && p instanceof WorldGuardPlugin) {
      worldGuard=(WorldGuardPlugin)p;
      worldGuardEnabled=true;
    }
 else {
      worldGuardEnabled=false;
    }
  }
 else {
    worldGuardEnabled=false;
  }
}
 

Example 21

From project CookieMonster, under directory /src/com/nijikokun/register_1_3/payment/.

Source file: Methods.java

  21 
vote

/** 
 * Checks Plugin Class against a multitude of checks to verify it's usability as a payment method.
 * @param <code>PluginManager</code> the plugin manager for the server
 * @return <code>boolean</code> True on success, False on failure.
 */
public static boolean setMethod(PluginManager manager){
  if (hasMethod())   return true;
  if (self) {
    self=false;
    return false;
  }
  int count=0;
  boolean match=false;
  Plugin plugin=null;
  for (  String name : getDependencies()) {
    if (hasMethod())     break;
    plugin=manager.getPlugin(name);
    if (plugin == null)     continue;
    Method current=createMethod(plugin);
    if (current == null)     continue;
    if (preferred.isEmpty())     Method=current;
 else     Attachables.add(current);
  }
  if (!preferred.isEmpty()) {
    do {
      if (hasMethod())       match=true;
 else {
        for (        Method attached : Attachables) {
          if (attached == null)           continue;
          if (hasMethod()) {
            match=true;
            break;
          }
          if (preferred.isEmpty())           Method=attached;
          if (count == 0)           if (preferred.equalsIgnoreCase(attached.getName()))           Method=attached;
 else           Method=attached;
        }
        count++;
      }
    }
 while (!match);
  }
  return hasMethod();
}
 

Example 22

From project core_1, under directory /src/com/iCo6/.

Source file: iConomy.java

  21 
vote

public boolean hasPermissions(CommandSender sender,String command){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (player == null) {
      System.out.println("[iConomy] Cannot execute command with false player");
      return false;
    }
    if (Commands.hasPermission(command)) {
      String node=Commands.getPermission(command);
      if (node == null)       return true;
      if (this.Permissions == null)       if (!this.testedPermissions) {
        Plugin Perms=Server.getPluginManager().getPlugin("Permissions");
        if (Perms != null) {
          if (Perms.isEnabled()) {
            this.Permissions=((Permissions)Perms);
            System.out.println("[iConomy] hooked into Permissions.");
          }
        }
        this.testedPermissions=true;
      }
      if (this.Permissions != null) {
        if (Permissions.Security.permission(player,node) || Permissions.Security.permission(player,node.toLowerCase()))         return true;
        return false;
      }
 else {
        try {
          Permission perm=new Permission(node);
          if (player.hasPermission(perm) || player.hasPermission(node) || player.hasPermission(node.toLowerCase()))           return true;
          return false;
        }
 catch (        Exception e) {
          return player.isOp();
        }
      }
    }
  }
  return true;
}
 

Example 23

From project CraftBay, under directory /src/edu/self/startux/craftBay/chat/.

Source file: ChannelChat.java

  21 
vote

@Override public boolean enable(ConfigurationSection section){
  String channelName=section.getString("channel");
  Plugin p=plugin.getServer().getPluginManager().getPlugin("ChannelChat");
  if (p == null) {
    plugin.log("ChannelChat system could not be loaded!",Level.WARNING);
    return false;
  }
  channel=ChannelManager.getManager().getChannel(channelName);
  if (channel == null) {
    plugin.log("Channel `" + channelName + "' does not exist!",Level.WARNING);
    return false;
  }
  plugin.log("ChannelChat enabled. Using channel `" + channel.getName() + "'");
  return true;
}
 

Example 24

From project ForceCraft, under directory /src/main/java/de/Lathanael/ForceCraft/Listeners/.

Source file: FCPluginListener.java

  21 
vote

public void hook(){
  ForcePlugin instance=ForcePlugin.getInstance();
  if (!instance.config.getBoolean("IgnorePermissionBridge")) {
    if (instance.getServer().getPluginManager().getPlugin("Permissions").isEnabled()) {
      ForcePlugin.log.info("Found Permission 2.x/3.x, hooking in!");
      PermissionsHandler.setYetiPerm(instance.getServer().getPluginManager().getPlugin("Permissions"));
    }
  }
  Plugin plugin=instance.getServer().getPluginManager().getPlugin("PermissionsEx");
  if (plugin != null)   if (PermissionsHandler.setPermEx(instance.getServer().getPluginManager().getPlugin("PermissionsEx")))   ForcePlugin.log.info("Found PermissionsEx, hooking in!");
  plugin=instance.getServer().getPluginManager().getPlugin("bPermissions");
  if (plugin != null)   if (PermissionsHandler.setbPerm())   ForcePlugin.log.info("Found bPermissions, hooking in!");
  plugin=instance.getServer().getPluginManager().getPlugin("PermissionsBukkit");
  if (plugin != null)   if (PermissionsHandler.setPermBukkit())   ForcePlugin.log.info("Found PermissionsBukkit, hooking in!");
}
 

Example 25

From project mcMMOIRC, under directory /src/main/java/org/mcmmoirc/.

Source file: mcMMOIRC.java

  21 
vote

public void onEnable(){
  PluginCommand command;
  PluginManager pm;
  Plugin plugin;
  String party, tag;
  PartyPoint partyp;
  config.load();
  partyPoints.clear();
  pm=getServer().getPluginManager();
  plugin=pm.getPlugin("CraftIRC");
  if (plugin == null) {
    Log.severe("Unable to find CraftIRC");
    return;
  }
  craftirc=(CraftIRC)plugin;
  registerEndPoint(config.adminTag,adminPoint);
  registerEndPoint(config.defaultTag,defaultPoint);
  registerEndPoint(config.partyTag,partyPoint);
  for (  Entry<String,String> e : config.parties.entrySet()) {
    party=e.getKey();
    tag=e.getValue();
    partyp=new PartyPoint(this,tag,party);
    if (registerEndPoint(tag,partyp))     partyPoints.put(party,partyp);
  }
  command=getServer().getPluginCommand("a");
  adminExec=command.getExecutor();
  command.setExecutor(new CA(this));
  command=getServer().getPluginCommand("ircreload");
  ircrExec=command.getExecutor();
  command.setExecutor(new CIRCReload(this));
  command=getServer().getPluginCommand("p");
  partyExec=command.getExecutor();
  command.setExecutor(new CP(this));
  events.register();
}
 

Example 26

From project mcore, under directory /src/com/massivecraft/mcore4/util/.

Source file: EventUtil.java

  21 
vote

/** 
 * This is the for-loop part of SimplePluginManager#fireEvent
 */
public static void fireEventRegistration(Event event,RegisteredListener registration){
  if (!registration.getPlugin().isEnabled())   return;
  try {
    registration.callEvent(event);
  }
 catch (  AuthorNagException ex) {
    Plugin plugin=registration.getPlugin();
    if (plugin.isNaggable()) {
      plugin.setNaggable(false);
      String author="<NoAuthorGiven>";
      if (plugin.getDescription().getAuthors().size() > 0) {
        author=plugin.getDescription().getAuthors().get(0);
      }
      Bukkit.getServer().getLogger().log(Level.SEVERE,String.format("Nag author: '%s' of '%s' about the following: %s",author,plugin.getDescription().getName(),ex.getMessage()));
    }
  }
catch (  Throwable ex) {
    Bukkit.getServer().getLogger().log(Level.SEVERE,"Could not pass event " + event.getEventName() + " to "+ registration.getPlugin().getDescription().getName(),ex);
  }
}
 

Example 27

From project mmoCore, under directory /src/main/java/mmo/Core/.

Source file: MMOCore.java

  21 
vote

public void checkVersion(){
  try {
    final URL url=new URL("http://files.mmo.me.uk/versions.txt");
    final BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
    String str;
    while ((str=in.readLine()) != null) {
      final String[] tokens=str.split(":");
      if (tokens.length == 3) {
        final Plugin mmo=pm.getPlugin(tokens[0]);
        if (mmo instanceof MMOPlugin && !((MMOPlugin)mmo).update) {
          final String[] newVersion=tokens[1].split("\\.");
          final int newVer=Integer.parseInt(newVersion[0]), newRev=Integer.parseInt(newVersion[1]);
          if (newVer > ((MMOPlugin)mmo).version || (newVer == ((MMOPlugin)mmo).version && newRev > ((MMOPlugin)mmo).revision)) {
            ((MMOPlugin)mmo).update=true;
            log("Update found: %s",((MMOPlugin)mmo).description.getName());
          }
        }
      }
    }
    in.close();
  }
 catch (  Exception e) {
  }
}
 

Example 28

From project MyWolf, under directory /src/de/Keyle/MyWolf/util/.

Source file: MyWolfPermissions.java

  21 
vote

public static void setup(){
  Plugin p;
  p=MyWolfPlugin.getPlugin().getServer().getPluginManager().getPlugin("Vault");
  if (p != null && PermissionsMode == PermissionsType.NONE) {
    PermissionsMode=PermissionsType.Vault;
    Permissions=null;
    RegisteredServiceProvider<Permission> permissionProvider=MyWolfPlugin.getPlugin().getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
    if (permissionProvider != null) {
      Permissions=permissionProvider.getProvider();
    }
    if (Permissions != null) {
      MyWolfUtil.getLogger().info("Vault integration enabled!");
      MyWolfUtil.getDebugLogger().info("Permissions: Vault");
      return;
    }
    PermissionsMode=PermissionsType.NONE;
  }
  if (PermissionsMode == PermissionsType.NONE && MyWolfConfig.Superperms) {
    PermissionsMode=PermissionsType.Superperms;
    MyWolfUtil.getLogger().info("Superperms integration enabled!");
    MyWolfUtil.getDebugLogger().info("Permissions: Superperms");
    return;
  }
  MyWolfUtil.getLogger().info("No permissions system found!");
  MyWolfUtil.getDebugLogger().info("Permissions: -");
}
 

Example 29

From project AntiCheat, under directory /src/main/java/net/h31ix/anticheat/metrics/.

Source file: Metrics.java

  19 
vote

public Metrics(Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  File file=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(file);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true);
    configuration.save(file);
  }
  guid=configuration.getString("guid");
}
 

Example 30

From project AuthMe-Reloaded-Charge-fix, under directory /src/uk/org/whoami/authme/settings/.

Source file: Settings.java

  19 
vote

public Settings(Plugin plugin){
  this.file=new File(plugin.getDataFolder(),"config.yml");
  this.plugin=plugin;
  if (exists()) {
    load();
  }
 else {
    loadDefaults(file.getName());
    load();
  }
  configFile=(YamlConfiguration)plugin.getConfig();
}
 

Example 31

From project BabelCraft-Legacy, under directory /src/main/java/com/craftfire/babelcraft/util/managers/.

Source file: LoggingManager.java

  19 
vote

public void stackTrace(StackTraceElement[] stack,String function,int linenumber,String classname,String file){
  advancedWarning("StackTrace Error");
  plainWarning("Class name: " + classname);
  plainWarning("File name: " + file);
  plainWarning("Function name: " + function);
  plainWarning("Error line: " + linenumber);
  if (Config.plugin_logging) {
    DateFormat LogFormat=new SimpleDateFormat(Config.plugin_logformat);
    Date date=new Date();
    plainWarning("Check log file: " + plugin.getDataFolder() + "\\logs\\error\\"+ LogFormat.format(date)+ "-error.log");
  }
 else {
    plainWarning("Enable logging in the config to get more information about the error.");
  }
  logError("--------------------------- STACKTRACE ERROR ---------------------------");
  logError("Class name: " + classname);
  logError("File name: " + file);
  logError("Function name: " + function);
  logError("Error line: " + linenumber);
  logError("BabelCraft version: " + Variables.pluginVersion);
  Plugin[] plugins=plugin.getServer().getPluginManager().getPlugins();
  int counter=0;
  StringBuffer pluginsList=new StringBuffer();
  while (plugins.length > counter) {
    pluginsList.append(plugins[counter].getDescription().getName() + " " + plugins[counter].getDescription().getVersion()+ ", ");
    counter++;
  }
  logError("Plugins: " + pluginsList.toString());
  logError("--------------------------- STACKTRACE START ---------------------------");
  for (int i=0; i < stack.length; i++) {
    logError(stack[i].toString());
  }
  logError("---------------------------- STACKTRACE END ----------------------------");
}
 

Example 32

From project BleedingMobs, under directory /src/me/snowleo/bleedingmobs/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=getConfigFile();
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 33

From project Bukkit-Plugin-Utilties, under directory /src/main/java/de/xzise/.

Source file: MinecraftUtil.java

  19 
vote

public static void registerMultipleListeners(final Plugin plugin,final Listener... listeners){
  final PluginManager manager=plugin.getServer().getPluginManager();
  for (  Listener listener : listeners) {
    manager.registerEvents(listener,plugin);
  }
}
 

Example 34

From project BukkitUtilities, under directory /src/main/java/name/richardson/james/bukkit/utilities/metrics/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  this.configurationFile=this.getConfigFile();
  this.configuration=YamlConfiguration.loadConfiguration(this.configurationFile);
  this.configuration.addDefault("opt-out",false);
  this.configuration.addDefault("guid",UUID.randomUUID().toString());
  if (this.configuration.get("guid",null) == null) {
    this.configuration.options().header("http://mcstats.org").copyDefaults(true);
    this.configuration.save(this.configurationFile);
  }
  this.guid=this.configuration.getString("guid");
}
 

Example 35

From project Citizens, under directory /src/core/net/citizensnpcs/utils/.

Source file: Metrics.java

  19 
vote

/** 
 * Adds a custom data plotter for a given plugin
 * @param plugin
 * @param plotter
 */
public void addCustomData(Plugin plugin,Plotter plotter){
  Set<Plotter> plotters=customData.get(plugin);
  if (plotters == null) {
    plotters=Collections.synchronizedSet(new LinkedHashSet<Plotter>());
    customData.put(plugin,plotters);
  }
  plotters.add(plotter);
}
 

Example 36

From project craftbook, under directory /common/src/main/java/com/sk89q/craftbook/bukkit/.

Source file: MetricsLite.java

  19 
vote

public MetricsLite(Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=getConfigFile();
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 37

From project deadbolt, under directory /src/main/java/com/daemitus/deadbolt/listener/.

Source file: ListenerManager.java

  19 
vote

public void checkListeners(){
  for (  Plugin pl : plugin.getServer().getPluginManager().getPlugins()) {
    if (pl.isEnabled()) {
      checkListener(pl);
    }
  }
}
 

Example 38

From project DropChest, under directory /src/main/java/com/narrowtux/dropchest/.

Source file: Metrics.java

  19 
vote

/** 
 * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics website. Plotters can be added to the graph object returned.
 * @param plugin
 * @param type
 * @param name
 * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
 */
public Graph createGraph(Plugin plugin,Graph.Type type,String name){
  if (plugin == null || type == null || name == null) {
    throw new IllegalArgumentException("All arguments must not be null");
  }
  Graph graph=new Graph(type,name);
  Set<Graph> graphs=getOrCreateGraphs(plugin);
  graphs.add(graph);
  return graph;
}
 

Example 39

From project Flow, under directory /src/com/github/JamesNorris/Flow/.

Source file: MetricsLite.java

  19 
vote

public MetricsLite(Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=getConfigFile();
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 40

From project GlobalBank, under directory /src/main/java/net/ark3l/globalbank2/util/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 41

From project MCbb, under directory /de/javakara/manf/economy/.

Source file: PostEconomyManager.java

  19 
vote

public PostEconomyManager(Plugin p){
  List<String> l=Config.getStringList(ConfigItems.ECONOMY_REWARD);
  for (int i=0; i < l.size(); i++) {
    String[] args=l.get(i).split("|");
    if (args.length == 3) {
      int id=Integer.valueOf(args[0]);
      RewardType type=Reward.convertStringToType(args[1]);
      Reward r=null;
switch (type) {
case money:
        double amount=Double.valueOf(args[2]);
      r=new Reward(amount);
    rewards.add(id,r);
  break;
default :
break;
}
defaultReward=r;
}
 else {
System.out.println("Error in loading Economy Rewards: " + l.get(i));
Bukkit.getPluginManager().disablePlugin(p);
}
}
}
 

Example 42

From project MCStats3, under directory /src/com/ubempire/MCStats3/service/econ/.

Source file: EE17.java

  19 
vote

public boolean isCompatible(Plugin plugin){
  try {
    Class.forName("com.earth2me.essentials.api.Economy");
  }
 catch (  Exception e) {
    return false;
  }
  return plugin.getDescription().getName().equalsIgnoreCase("essentials") && plugin instanceof Essentials;
}
 

Example 43

From project Minequest-2-API, under directory /src/main/java/com/theminequest/MineQuest/API/Utils/.

Source file: GriefcraftMetrics.java

  19 
vote

public GriefcraftMetrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 44

From project MonsterFix, under directory /src/fromgate/mccity/monsterfix/.

Source file: MetricsLite.java

  19 
vote

public MetricsLite(Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 45

From project MoreMaterials, under directory /src/main/java/net/morematerials/metrics/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=getConfigFile();
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 46

From project NarrowtuxLib, under directory /src/main/java/com/nijikokun/register/narrowtuxlib/payment/methods/.

Source file: EE17.java

  19 
vote

public boolean isCompatible(Plugin plugin){
  try {
    Class.forName("com.earth2me.essentials.api.Economy");
  }
 catch (  Exception e) {
    return false;
  }
  return plugin.getDescription().getName().equalsIgnoreCase("essentials") && plugin instanceof Essentials;
}
 

Example 47

From project OpenInv, under directory /src/lishid/openinv/utils/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 48

From project Orebfuscator, under directory /src/com/lishid/orebfuscator/utils/.

Source file: Metrics.java

  19 
vote

public Metrics(final Plugin plugin) throws IOException {
  if (plugin == null) {
    throw new IllegalArgumentException("Plugin cannot be null");
  }
  this.plugin=plugin;
  configurationFile=new File(CONFIG_FILE);
  configuration=YamlConfiguration.loadConfiguration(configurationFile);
  configuration.addDefault("opt-out",false);
  configuration.addDefault("guid",UUID.randomUUID().toString());
  if (configuration.get("guid",null) == null) {
    configuration.options().header("http://mcstats.org").copyDefaults(true);
    configuration.save(configurationFile);
  }
  guid=configuration.getString("guid");
}
 

Example 49

From project PermissionsEx, under directory /src/main/java/ru/tehkode/permissions/bukkit/.

Source file: BukkitPermissions.java

  19 
vote

public BukkitPermissions(Plugin plugin,ConfigurationSection config){
  this.plugin=plugin;
  if (!config.getBoolean("enable",true)) {
    logger.info("[PermissionsEx] Superperms disabled. Check \"config.yml\" to enable.");
    return;
  }
  this.strictMode=config.getBoolean("strict-mode",strictMode);
  this.enableParentNodes=config.getBoolean("parent-nodes",this.enableParentNodes);
  this.registerEvents();
  this.checkAllParentPermissions(true);
  logger.info("[PermissionsEx] Superperms support enabled.");
}