@Override
  public final void onDisable() {
    PluginDescriptionFile pdf = getDescription();
    log.info(pdf.getName() + " is now disabled.");

    machinaCore.unRegisterBlueprint(blueprint.blueprint);
  }
示例#2
0
  @Override
  public void onEnable() {
    plugin = this;
    commands.register(TargetCommands.class);
    commands.register(MovementCommands.class);
    commands.register(ManagementCommands.class);

    PluginManager pm = getServer().getPluginManager();
    pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.ENTITY_TARGET, entityListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_ANIMATION, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY, playerListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.CHUNK_UNLOAD, worldListener, Priority.Normal, this);
    pm.registerEvent(Event.Type.CHUNK_LOAD, worldListener, Priority.Normal, this);
    PluginDescriptionFile pdfFile = this.getDescription();
    DataHandler.loadSettings();
    DataHandler.loadUsers();

    getServer().getScheduler().scheduleSyncRepeatingTask(this, new TickTask(), 5, 1);
    Messaging.log("version [" + pdfFile.getVersion() + "] (" + codename + ") loaded");
  }
示例#3
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!");
  }
示例#4
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");
  }
示例#5
0
  /** Generic method that posts a plugin to the metrics website */
  private void postPlugin(boolean isPing) throws IOException {
    // The plugin's description file containg all of the plugin data such as name, version, author,
    // etc
    final PluginDescriptionFile description = this.plugin.getDescription();

    // Construct the post data
    String data =
        Metrics.encode("guid")
            + '='
            + Metrics.encode(this.guid)
            + Metrics.encodeDataPair("version", description.getVersion())
            + Metrics.encodeDataPair("server", Bukkit.getVersion())
            + Metrics.encodeDataPair(
                "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length))
            + Metrics.encodeDataPair("revision", String.valueOf(Metrics.REVISION));

    // If we're pinging, append it
    if (isPing) {
      data += Metrics.encodeDataPair("ping", "true");
    }

    // Create the url
    final URL url =
        new URL(
            Metrics.BASE_URL
                + String.format(Metrics.REPORT_URL, this.plugin.getDescription().getName()));

    // Connect to the website
    URLConnection connection;

    // Mineshafter creates a socks proxy, so we can safely bypass it
    // It does not reroute POST requests so we need to go around it
    if (this.isMineshafterPresent()) {
      connection = url.openConnection(Proxy.NO_PROXY);
    } else {
      connection = url.openConnection();
    }

    connection.setDoOutput(true);

    // Write the data
    final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
    writer.write(data);
    writer.flush();

    // Now read the response
    final BufferedReader reader =
        new BufferedReader(new InputStreamReader(connection.getInputStream()));
    final String response = reader.readLine();

    // close resources
    writer.close();
    reader.close();

    if (response.startsWith("ERR")) {
      throw new IOException(response); // Throw the exception
    }
    // if (response.startsWith("OK")) - We should get "OK" followed by an optional description if
    // everything goes right
  }
示例#6
0
 public boolean onCommand(CommandSender sender, Command cmd1, String commandLabel, String[] args) {
   PluginDescriptionFile pdfFile = getDescription();
   Player player = null;
   if ((sender instanceof Player)) {
     player = (Player) sender;
     if ((args.length == 1) && (player.hasPermission("tabapi.reload"))) {
       reloadConfiguration();
       updateAll();
     } else {
       player.sendMessage(
           ChatColor.DARK_RED
               + ""
               + ChatColor.BOLD
               + "TabAPI - Double0negative, NeT32"
               + ChatColor.RESET
               + ChatColor.RED
               + " Version: "
               + pdfFile.getVersion());
     }
   } else {
     sender.sendMessage(
         ChatColor.DARK_RED
             + ""
             + ChatColor.BOLD
             + "TabAPI - Double0negative, NeT32"
             + ChatColor.RESET
             + ChatColor.RED
             + " Version: "
             + pdfFile.getVersion());
     return true;
   }
   return true;
 }
示例#7
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);
    }
  }
示例#8
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));
  }
示例#9
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()});
  }
示例#10
0
  @Override
  public void onEnable() {
    packages = file.load();

    PluginDescriptionFile pdfFile = this.getDescription();
    System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
  }
  @Override
  public void onEnable() {
    getServer().getPluginManager().registerEvents(new VehicleRemoverListener(), this);

    PluginDescriptionFile pff = this.getDescription();
    log.info(pff.getName() + " " + pff.getVersion() + " is enabled.");
  }
  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");
  }
示例#13
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);
    }
  }
示例#14
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!");
  }
示例#15
0
  @Override
  public void onDisable() {
    saveGameConfig();

    PluginDescriptionFile file_pdf = this.getDescription();
    logger.info("[" + file_pdf.getName() + "] v" + file_pdf.getVersion() + " is disabled!");
  }
示例#16
0
 @Override
 public void onEnable() {
   loadConfiguration();
   PluginManager pm = this.getServer().getPluginManager();
   pm.registerEvents(PlayerListener, this);
   PluginDescriptionFile pdfFile = this.getDescription();
   log.info("[AdminWatch] version " + pdfFile.getVersion() + " enabled");
 }
示例#17
0
  public BukkitPlayerDebugger(JavaPlugin plugin) {
    this.plugin = plugin;

    PluginDescriptionFile pdfFile = plugin.getDescription();
    debugCommand = "/debug_" + pdfFile.getName();
    undebugCommand = "/undebug_" + pdfFile.getName();
    prepend = pdfFile.getName() + ": ";
  }
示例#18
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();
 }
示例#19
0
  @Override
  public void onDisable() {

    PluginDescriptionFile pdf = getDescription();
    GamesManager.endAll();
    DataManager.saveArenas();
    logger.info("[" + pdf.getName() + "] disabled!");
  }
示例#20
0
  @Override
  public void onEnable() {
    PluginManager pm = getServer().getPluginManager();
    PluginDescriptionFile pdf = this.getDescription();
    buildConfig();

    System.out.println(pdf.getName() + " is now enabled");
  }
示例#21
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;
 }
示例#22
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
 }
示例#23
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);
 }
示例#24
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 !");
   }
 }
示例#25
0
 public boolean isUpdated() {
   PluginDescriptionFile pdffile = getDescription();
   String current = pdffile.getVersion();
   String latest = getLatest();
   boolean updated = false;
   if (!current.equalsIgnoreCase(latest)) {
     updated = true;
   }
   return updated;
 }
示例#26
0
文件: SRPG.java 项目: 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.");
 }
示例#27
0
  public void onEnable() {
    try {
      load();
    } catch (Exception e) {

    }
    PluginDescriptionFile desc = this.getDescription();
    System.out.println("KeepShit " + desc.getVersion() + " is beeing enabled");
    EventListener(this);
  }
示例#28
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!");
  }
示例#29
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!");
 }
示例#30
0
  @Override
  public void onEnable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    log.info("[NerdLocker] " + pdfFile.getVersion() + " Enabled!");

    loadConfiguration();
    getServer().getPluginManager().registerEvents(new lockPlayer(this), this);
    getServer().getPluginManager().registerEvents(new lockBlock(this), this);
    getServer().getPluginManager().registerEvents(new lockEntity(this), this);
  }