Esempio n. 1
0
  public void onEnable() {

    PluginDescriptionFile pdfFile = this.getDescription();

    Properties props = new Properties();
    try {
      props.load(new FileInputStream("server.properties"));
      if (props.containsKey("regen-rate"))
        rate = Double.parseDouble(props.getProperty("regen-rate"));
      if (props.containsKey("regen-amount"))
        healAmount = Integer.parseInt(props.getProperty("regen-amount"));
      if (props.containsKey("regen-max"))
        maxHeal = Integer.parseInt(props.getProperty("regen-max"));
      if (props.containsKey("regen-min"))
        maxHurt = Integer.parseInt(props.getProperty("regen-min"));
      if (props.containsKey("min-altitude"))
        minAltitude = Integer.parseInt(props.getProperty("min-altitude"));
    } catch (IOException ioe) {
      System.out.println(pdfFile.getName() + " : ERROR CAN/'T FIND server.properties");
    }
    System.out.print(
        pdfFile.getName()
            + " "
            + pdfFile.getVersion()
            + " enabled! Rate: "
            + rate
            + "s | Amount: "
            + healAmount);
    if (healAmount >= 0) System.out.println(" | Max: " + maxHeal);
    else System.out.println(" | Min: " + maxHurt);
    m_Timer.schedule(new SimpleTimer(this), 0, (long) (rate * 1000));
  }
Esempio n. 2
0
  public BukkitPlayerDebugger(JavaPlugin plugin) {
    this.plugin = plugin;

    PluginDescriptionFile pdfFile = plugin.getDescription();
    debugCommand = "/debug_" + pdfFile.getName();
    undebugCommand = "/undebug_" + pdfFile.getName();
    prepend = pdfFile.getName() + ": ";
  }
Esempio n. 3
0
 protected void logmsg(boolean enable) {
   PluginDescriptionFile pdfile = this.getDescription();
   if (enable) {
     log.info(
         "[" + pdfile.getName() + "]" + " version: " + pdfile.getVersion() + " is now enabled !");
   } else {
     log.info("[" + pdfile.getName() + "]" + " is now disabled !");
   }
 }
Esempio n. 4
0
 /** Called on plug-in disable. */
 @Override
 public void onDisable() {
   PluginDescriptionFile pdfFile = this.getDescription();
   log.info(
       "["
           + pdfFile.getName()
           + "] "
           + pdfFile.getName()
           + " version "
           + pdfFile.getVersion()
           + " is disabled!");
 }
Esempio n. 5
0
 // Log error message to console, disable plugin. These really never should occur, if they do we
 // need to shut down the plugin and let the sever manager know.
 public void logError(String message) {
   amcLogger.severe("[" + amcPdf.getName() + "] WARNING " + message);
   amcLogger.severe("[" + amcPdf.getName() + "] WARNING Plugin auto disable triggered.");
   if (this.isEnabled()) {
     this.getServer().getPluginManager().disablePlugin(this);
     amcLogger.severe(
         "["
             + amcPdf.getName()
             + "] WARNING "
             + amcPdf.getName()
             + " has been disabled automatically as a safty measure.");
     amcLogger.severe("[" + amcPdf.getName() + "] WARNING Contact developer!!!");
   }
 }
Esempio n. 6
0
  @Override
  public void onEnable() {

    pluginInstance = this;

    getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);

    this.initConfig();

    PluginDescriptionFile pluginInfo = this.getDescription();

    PluginUtil.initPlugin();

    ServerUtil.initServer();

    WorldUtil.initWorldUtil();

    WorldUtil.switchToNewWorld();

    this.initCommands();

    this.initEvents();

    getLogger()
        .log(
            Level.INFO,
            "{0} ({1}) has successfully been initialized!",
            new Object[] {pluginInfo.getName(), pluginInfo.getVersion()});
  }
  public void onEnable() {
    //        PluginManager pm = getServer().getPluginManager();
    //        pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
    //        pm.registerEvent(Event.Type.WORLD_INIT, worldListener, Event.Priority.High, this);
    //        reload();

    World bio = getServer().getWorld("biosphere");
    if (null == bio) {
      //            BiosphereGenerator gen = new BiosphereGenerator();
      //            bio =
      // getServer().createWorld("biosphere",Environment.NORMAL,getServer().getWorlds().get(0).getSeed(), gen);
      /*
      WorldCreator wc = new WorldCreator("biosphere");
         wc.environment(Environment.NORMAL);
         wc.seed(getServer().getWorlds().get(0).getSeed());
         wc.generator((ChunkGenerator) (bio = getServer().createWorld(wc)));
         */
      WorldCreator wc = new WorldCreator("biosphere");
      wc.environment(Environment.NORMAL);
      wc.seed(getServer().getWorlds().get(0).getSeed());
      BiosphereGenerator gen = new BiosphereGenerator();
      wc.generator(gen);
      System.out.printf("start making world");
      bio = getServer().createWorld(wc);
    }

    // Register our commands
    getCommand("biosphere").setExecutor(new BiosphereCommand(this));
    getCommand("biome").setExecutor(new BiomeCommand(this));
    getCommand("test").setExecutor(new TestCommand(this));

    PluginDescriptionFile pdfFile = this.getDescription();
    System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " enabled");
  }
Esempio n. 8
0
  @Override
  public void onEnable() {
    this.log = this.getLogger();
    this.pdf = this.getDescription();

    this.runnable_initmysql = new InitMySQL(this);
    this.runnable_logstartup = new LogStartup(this);

    this.log.info(
        "Loading " + pdf.getName() + " version " + pdf.getVersion() + " by " + pdf.getAuthors());

    this.getConfig().options().copyDefaults(true);
    this.saveConfig();

    this.getCommand("warp").setExecutor(new WarpCommand(this));
    this.getCommand("warplist").setExecutor(new WarpListCommand(this));
    this.getCommand("warpinfo").setExecutor(new WarpInfoCommand(this));
    this.getCommand("setwarp").setExecutor(new SetWarpCommand(this));
    this.getCommand("removewarp").setExecutor(new RemoveWarpCommand(this));

    this.log.info("Loaded");

    this.getServer().getScheduler().scheduleSyncDelayedTask(this, runnable_initmysql, 1);
    if (this.getConfig().getBoolean("logstartup")) {
      this.getServer().getScheduler().scheduleSyncDelayedTask(this, runnable_logstartup);
    }
  }
Esempio n. 9
0
  @Override
  public void onEnable() {
    // initialize
    chestchk = new OGGChestChecker(this);
    blockgen = new OGGBlockGenerator(this);

    cmdstate = new HashMap<String, EnumCommandStatus>();
    genloc = new ArrayList<GenerateLocation>();

    // 設定データの読み出し
    loadGameConfig();

    // イベントリスナーの登録
    getServer().getPluginManager().registerEvents(new OGGEventListener(this), this);
    getServer().getPluginManager().registerEvents(new OGGPlayerEventListener(this), this);

    // コマンド「oregathergame(ogg)」を登録(詳しい動作は引数で捌く)
    getCommand("oregathergame").setExecutor(new OGGCommandExecutor(this));

    // 【要トリガー設置】ブロックジェネレーターの起動
    // getServer().getScheduler().scheduleSyncRepeatingTask(this, blockgen, 0L, TASK_PERIOD );

    // 起動メッセージ
    PluginDescriptionFile file_pdf = this.getDescription();
    logger.info("[" + file_pdf.getName() + "] v" + file_pdf.getVersion() + " is enabled!");
  }
Esempio n. 10
0
  @Override
  public void onDisable() {
    saveGameConfig();

    PluginDescriptionFile file_pdf = this.getDescription();
    logger.info("[" + file_pdf.getName() + "] v" + file_pdf.getVersion() + " is disabled!");
  }
Esempio n. 11
0
  private void checkEbean() {

    File ep =
        new File(
            directory
                + File.separator
                + ".."
                + File.separator
                + ".."
                + File.separator
                + "ebean.properties");

    try {
      if (!ep.exists()) {

        ep.createNewFile();
        logger.info(
            "["
                + pdfFile.getName()
                + "] Had to create ebean.properties. It may be a good idea to restart your server now.");
      }
    } catch (IOException e) {

      logger.warning("failed to create ebean.properties");
    }
  }
  @Override
  public final void onDisable() {
    PluginDescriptionFile pdf = getDescription();
    log.info(pdf.getName() + " is now disabled.");

    machinaCore.unRegisterBlueprint(blueprint.blueprint);
  }
Esempio n. 13
0
  @Override
  public void onEnable() {
    pdfFile = this.getDescription();
    logPrefix = "[" + pdfFile.getName() + "] ";
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvents(new TTBlockListener(this), this);

    Plugin spout = pm.getPlugin("Spout");
    if (spout != null && spout.isEnabled()) {
      this.spoutEnabled = true;
      String v = spout.getDescription().getVersion();
      log.info(logPrefix + "Spout detected! Using version " + v);
    }

    Plugin permissionsEx = pm.getPlugin("PermissionsEx");
    Plugin permissions = pm.getPlugin("Permissions");
    if (permissionsEx != null && permissionsEx.isEnabled()) {
      permissionsExHandler = PermissionsEx.getPermissionManager();
      String v = permissionsEx.getDescription().getVersion();
      log.info(logPrefix + "PermissionsEx detected! Using version " + v);
    } else if (permissions != null && permissions.isEnabled()) {
      permissionsHandler = ((Permissions) permissions).getHandler();
      String v = permissions.getDescription().getVersion();
      log.info(logPrefix + "Permissions detected! Using version " + v);
    }

    log.info(logPrefix + "Version " + pdfFile.getVersion() + " is enabled!");
  }
  @Override
  public void perform() {
    PluginDescriptionFile pdf = this.getPlugin().getDescription();

    String name = pdf.getName();
    String version = pdf.getVersion();
    String website = pdf.getWebsite();

    String description = pdf.getDescription();
    if (description != null) description = Txt.parse("<i>" + description);

    String authors = null;
    List<String> authorList = pdf.getAuthors();
    if (authorList != null && authorList.size() > 0) {
      authors = Txt.implodeCommaAndDot(authorList, "<aqua>%s", "<i>, ", " <i>and ", "");
      authors = Txt.parse(authors);
    }

    this.sendTitle();
    this.sendEntry("name", name);
    this.sendEntry("version", version);
    this.sendEntry("website", website);
    this.sendEntry("authors", authors);
    this.sendEntry("description", description);
  }
Esempio n. 15
0
  @Override
  public void onEnable() {
    packages = file.load();

    PluginDescriptionFile pdfFile = this.getDescription();
    System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
  }
Esempio n. 16
0
 private File initialiseDataFolder() {
   if (Utils.getOrDefault(rdescription, "jxpl.hasdatafolder", false)) {
     File tempFolder = new File(file.getParentFile(), description.getName());
     if (Utils.dirExistOrCreate(tempFolder)) return tempFolder;
   }
   return null;
 }
  @Override
  public void onEnable() {
    getServer().getPluginManager().registerEvents(new VehicleRemoverListener(), this);

    PluginDescriptionFile pff = this.getDescription();
    log.info(pff.getName() + " " + pff.getVersion() + " is enabled.");
  }
Esempio n. 18
0
  public void onEnable() {
    PluginDescriptionFile pdfFile = getDescription();

    getLogger().info(pdfFile.getName() + " " + pdfFile.getVersion() + " is starting... ");
    getLogger().info("Starting RealWorldWeather...");

    this.saveConfig();
    if (this.getConfig().getString("apikey").equalsIgnoreCase("not-setted")) {
      getLogger().warning("RealWorldWeather cannot find your apikey.");
    } else {
      this.weatherRetriever = new WeatherRetriever(this.getConfig().getString("apikey"));

      Bukkit.getServer()
          .getScheduler()
          .scheduleSyncRepeatingTask(
              this,
              new Runnable() {
                public void run() {
                  WeatherRetriever wr = Omenala.this.weatherRetriever;
                  wr.refreshWeather("Helsinki");
                  String wx = "temp " + wr.getTemperature() + " pressure " + wr.getPressure();
                  Bukkit.getServer()
                      .broadcastMessage(ChatColor.GREEN + wx + "sade: " + wr.doesItRain());
                  if (wr.doesItRain()) {
                    changeWeather(getServer().getWorld("world"), true);
                  } else {
                    changeWeather(getServer().getWorld("world"), false);
                  }
                }
              },
              60,
              600 * 20);
    }
  }
 private static void ReadFile(File file, PluginDescriptionFile desc, Setting[] config) {
   try {
     for (int i = 0; i < config.length; i++) {
       String value =
           MinecartManiaFlatFile.getValueFromSetting(
               file, config[i].getName(), config[i].getValue().toString());
       // Attempt to parse the value as boolean
       if (value.contains("true")) {
         MinecartManiaWorld.setConfigurationValue(config[i].getName(), Boolean.TRUE);
       } else if (value.contains("false")) {
         MinecartManiaWorld.setConfigurationValue(config[i].getName(), Boolean.FALSE);
       }
       // Attempt to parse the value as a double or integer
       else if (!StringUtils.getNumber(value).isEmpty()) {
         Double d = Double.valueOf(StringUtils.getNumber(value));
         if (d.intValue() == d) {
           MinecartManiaWorld.setConfigurationValue(
               config[i].getName(), new Integer(d.intValue()));
         } else {
           MinecartManiaWorld.setConfigurationValue(config[i].getName(), d);
         }
       }
       // Fallback on string
       else {
         MinecartManiaWorld.setConfigurationValue(config[i].getName(), value);
       }
     }
   } catch (Exception exception) {
     MinecartManiaCore.log.severe("Failed to read " + desc.getName() + " settings!");
     exception.printStackTrace();
   }
 }
Esempio n. 20
0
  private void printVersion(CommandSender sender) {
    PluginDescriptionFile desc = plugin.getDescription();

    sender.sendMessage(
        ChatColor.GREEN
            + desc.getName()
            + ChatColor.WHITE
            + " v"
            + ChatColor.GREEN
            + desc.getVersion());
    sender.sendMessage(
        ChatColor.WHITE
            + "Authors: "
            + ChatColor.GREEN
            + "dmulloy2"
            + ChatColor.WHITE
            + " and "
            + ChatColor.GREEN
            + "Comphenix");
    sender.sendMessage(
        ChatColor.WHITE
            + "Issues: "
            + ChatColor.GREEN
            + "https://github.com/dmulloy2/ProtocolLib/issues");
  }
Esempio n. 21
0
  @Override
  public void onEnable() {
    PluginManager pm = getServer().getPluginManager();
    PluginDescriptionFile pdf = this.getDescription();
    buildConfig();

    System.out.println(pdf.getName() + " is now enabled");
  }
Esempio n. 22
0
  @Override
  public void onDisable() {

    PluginDescriptionFile pdf = getDescription();
    GamesManager.endAll();
    DataManager.saveArenas();
    logger.info("[" + pdf.getName() + "] disabled!");
  }
Esempio n. 23
0
 @Override
 public void onEnable() {
   PluginDescriptionFile pdfile = this.getDescription();
   this.logger.info(pdfile.getName() + " has booted.");
   // generate config if one doesn't exist
   getConfig().options().copyDefaults(true);
   saveConfig();
 }
Esempio n. 24
0
 public static DatabaseBridge loadBridge(File file) {
   DatabaseBridge theBridge = null;
   PluginDescriptionFile bridgeDescription = null;
   try {
     // Load the jar
     JarFile jar = new JarFile(file);
     // Load the info about the bridge
     JarEntry entry = jar.getJarEntry("bridge.yml");
     InputStream stream = jar.getInputStream(entry);
     bridgeDescription = new PluginDescriptionFile(stream);
     // Get the main class
     String main = bridgeDescription.getMain();
     try {
       URL test =
           new URL(
               "http://guardian.nekotech.tk:8080/job/Guardian-MySQL/Guardian-MySQL-RB/api/json");
       HttpURLConnection connection = (HttpURLConnection) test.openConnection();
       connection.connect();
       JSONObject object =
           (JSONObject) new JSONParser().parse(new InputStreamReader(connection.getInputStream()));
       String version = bridgeDescription.getVersion();
       if (!version.equals("Unknown")
           && Integer.parseInt(version) < Integer.parseInt(object.get("number").toString())) {
         BukkitUtils.info("Guardian-Bridge is out of date, please download the latest");
       }
     } catch (Exception ex) {
       BukkitUtils.severe("Error occurred while checking if Guardian is up to date", ex);
     }
     // Clean it all up
     stream.close();
     jar.close();
     // Get a new classloader
     URLClassLoader classLoader =
         new URLClassLoader(
             new URL[] {file.toURI().toURL()}, DatabaseBridge.class.getClassLoader());
     // Load the class
     Class<?> clazz = classLoader.loadClass(main);
     // Construct it
     Object object = clazz.newInstance();
     // Verify it
     if (!(object instanceof DatabaseBridge)) {
       return null;
     }
     // Its all good
     theBridge = (DatabaseBridge) object;
   } catch (FileNotFoundException ex) {
     BukkitUtils.severe("Database bridge does not contain a valid bridge.yml");
   } catch (ZipException ex) {
     BukkitUtils.severe("The database bridge appears to be an invalid jar file");
   } catch (Exception ex) {
     ex.printStackTrace();
   }
   Guardian.getInstance().getConf().bridgeDescription = bridgeDescription;
   BukkitUtils.info(
       "Loading " + bridgeDescription.getName() + " v" + bridgeDescription.getVersion());
   // Lets return it
   return theBridge;
 }
Esempio n. 25
0
 @Override
 public void onDisable() {
   PluginDescriptionFile pdfFile = this.getDescription();
   this.logger.info(
       pdfFile.getName()
           + " Version "
           + pdfFile.getVersion()
           + " Plugin has been disabled!"); // Display in the console that the plugin was disabled
 }
Esempio n. 26
0
 @Override
 public void onEnable() {
   PluginDescriptionFile pdfFile = this.getDescription();
   this.logger.info(
       pdfFile.getName()
           + " Has Been Enabled!"); // Display in the console that the plugin was enabled
   PluginManager pm = getServer().getPluginManager();
   pm.registerEvents(this.pl, this);
 }
Esempio n. 27
0
File: SRPG.java Progetto: Nagib/sRPG
 @Override
 public void onDisable() {
   pdfFile = this.getDescription();
   for (World world : plugin.getServer().getWorlds()) {
     for (Player player : world.getPlayers()) {
       profileManager.save(player);
     }
   }
   log.info(LOG_PREFIX + pdfFile.getName() + " v" + pdfFile.getVersion() + " has been disabled.");
 }
Esempio n. 28
0
 @Override
 public void onEnable() {
   w = this.getServer().getWorlds().get(0);
   s = this.getServer();
   readMembers();
   loadConfig();
   PluginDescriptionFile pdfFile = this.getDescription();
   permValid = new PermissionValidator();
   log.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
 }
Esempio n. 29
0
  public void onEnable() {
    // TODO: Place any custom enable code here including the registration of any events

    // Register our events
    PluginManager pm = getServer().getPluginManager();

    // EXAMPLE: Custom code, here we just output some info so we can check all is well
    PluginDescriptionFile pdfFile = this.getDescription();
    System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
  }
Esempio n. 30
0
 @SuppressWarnings("static-access")
 public boolean onCommand(CommandSender sender, Command c, String commandLabel, String[] args) {
   String command = c.getName().toLowerCase();
   if (command.equalsIgnoreCase("bShortcut")) {
     bConfigManager.reload();
     bChat.sendMessageToCommandSender(
         sender, "&6[" + pdfFile.getName() + "]" + " config reloaded");
     return true;
   }
   return false;
 }