Package org.bukkit.plugin

Examples of org.bukkit.plugin.PluginDescriptionFile


        // TODO: Place any custom enable code here including the registration of any events
       

        // EXAMPLE: Custom code, here we just output some info so we can check all is well
      setupPermissions();
        PluginDescriptionFile pdfFile = this.getDescription();
        if(Permissions != null)
          System.out.println( "Take yourself wonder by wonder, using /magiccarpet or /mc. " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
    }
View Full Code Here


    public void onEnable() {
        this.bukkitListener = new BukkitListener(this);
        listener = new IrcListener(this);
        getConfig() .options().copyDefaults(true);
        PluginManager pm = getServer().getPluginManager();
        PluginDescriptionFile pdfFile = this.getDescription();
        if (getConfig().getString("server.address") == null) {
            LOG.severe(pdfFile.getName() + ": set \"server.address\" in "
                    + this.getDataFolder() + "/config.yml");
            return;
        }

        getConfig()
                .options()
                .header("Config File for IRCTransport\nSee the website for more information");
        saveConfig();
        initDatabase();

        // establish list of players
        Player[] players = getServer().getOnlinePlayers();
        for (Player player : players) {
            IrcAgent agent = new IrcAgent(this, player);
            agent.getListenerManager().addListener(getListener());
            this.bots.put(player.getEntityId(), agent);
            new Connect(agent).run();
        }

        // register for events we care about
        pm.registerEvents(bukkitListener, this);

        // set command executors
        IRCTransportCommandExecutor commandExecutor = new IRCTransportCommandExecutor(this);
        getCommand("join").setExecutor(commandExecutor);
        getCommand("leave").setExecutor(commandExecutor);
        getCommand("channel").setExecutor(commandExecutor);
        getCommand("msg").setExecutor(commandExecutor);
        getCommand("nick").setExecutor(commandExecutor);
        getCommand("names").setExecutor(commandExecutor);
        getCommand("me").setExecutor(commandExecutor);
        getCommand("topic").setExecutor(commandExecutor);
        getCommand("whois").setExecutor(commandExecutor);
        getCommand("irc_listbots").setExecutor(commandExecutor);

        startMetrics();

        LOG.log(Level.INFO, pdfFile.getFullName() + " is enabled!");
    }
View Full Code Here

     * @param  isPing are we pinging?
     * @throws IOException A problem reading data from server.
     */
    private void postPlugin(final boolean isPing) throws IOException {
        // The plugin's description file containg all of the plugin data such as name, version, author, etc
        PluginDescriptionFile description = plugin.getDescription();

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

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

        // Acquire a lock on the graphs, which lets us make the assumption we also lock everything
        // inside of the graph (e.g plotters)
        synchronized (graphs) {
            Iterator<Graph> iter = graphs.iterator();

            while (iter.hasNext()) {
                Graph graph = iter.next();

                // Because we have a lock on the graphs set already, it is reasonable to assume
                // that our lock transcends down to the individual plotters in the graphs also.
                // Because our methods are private, no one but us can reasonably access this list
                // without reflection so this is a safe assumption without adding more code.
                for (Plotter plotter : graph.getPlotters()) {
                    // The key name to send to the metrics server
                    // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top
                    // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME
                    String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName());

                    // The value to send, which for the foreseeable future is just the string
                    // value of plotter.getValue()
                    String value = Integer.toString(plotter.getValue());

                    // Add it to the http post data :)
                    data.append(encodeDataPair(key, value));
                }
            }
        }

        // Create the url
        URL url = new URL(BASE_URL + String.format(REPORT_URL, description.getName()));

        // Connect to the website
        URLConnection connection;

        // Mineshafter creates a socks proxy, so we can safely bypass it
View Full Code Here

    /**
* Generic method that posts a plugin to the metrics website
*/
    private void postPlugin(final boolean isPing) throws IOException {
        // The plugin's description file containg all of the plugin data such as name, version, author, etc
        final PluginDescriptionFile description = plugin.getDescription();

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

        // If we're pinging, append it
View Full Code Here

    //helpinfo.put("sponsor", 1);
  }

  @Override
  public boolean onCommand(CommandSender sender, Command cmd1, String commandLabel, String[] args) {
    PluginDescriptionFile pdfFile = plugin.getDescription();
    if (!(sender instanceof Player)) {
      msgmgr.logMessage(PrefixType.WARNING, "Only in-game players can use SurvivalGames commands! ");
      return true;
    }

    Player player = (Player) sender;

    if (SurvivalGames.config_todate == false) {
      msgmgr.sendMessage(PrefixType.WARNING, "The config file is out of date. Please tell an administrator to reset the config.", player);
      return true;
    }

    if (SurvivalGames.dbcon == false) {
      msgmgr.sendMessage(PrefixType.WARNING, "Could not connect to server. Plugin disabled.", player);
      return true;
    }

    if (cmd1.getName().equalsIgnoreCase("survivalgames")) {
      if (args == null || args.length < 1) {
        msgmgr.sendMessage(PrefixType.INFO, "Version " + pdfFile.getVersion() + " by Double0negative", player);
        msgmgr.sendMessage(PrefixType.INFO, "Type /sg help <player | staff | admin> for command information", player);
        return true;
      }
      if (args[0].equalsIgnoreCase("help")) {
        if (args.length == 1) {
View Full Code Here

  });

  SurvivalGames p = this;
  public void onDisable() {
    disabling = false;
    PluginDescriptionFile pdfFile = p.getDescription();
    SettingsManager.getInstance().saveSpawns();
    SettingsManager.getInstance().saveSystemConfig();
    for (Game g: GameManager.getInstance().getGames()) {
      try{
        g.disable();
      }catch(Exception e){
        //will throw useless "tried to register task blah blah error." Use the method below to reset the arena without a task.
      }
      QueueManager.getInstance().rollback(g.getID(), true);
    }

    logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " has now been disabled and reset");
  }
View Full Code Here

     * Generic method that posts a plugin to the metrics website
     */
    private void postPlugin(final boolean isPing) throws IOException
    {
        // Server software specific section
        PluginDescriptionFile description = plugin.getDescription();
        String pluginName = description.getName();
        boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if
                                                                 // online mode
                                                                 // is enabled
        String pluginVersion = description.getVersion();
        String serverVersion = Bukkit.getVersion();
        int playersOnline = Bukkit.getServer().getOnlinePlayers().size();

        // END server software specific section -- all code below does not use
        // any code outside of this class / Java
View Full Code Here

     * Generic method that posts a plugin to the metrics website
     */
    private void postPlugin(boolean isPing) throws IOException
    {
        // Server software specific section
        PluginDescriptionFile description = plugin.getDescription();
        String pluginName = description.getName();
        boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
        String pluginVersion = description.getVersion();
        String serverVersion = Bukkit.getVersion();
        int playersOnline = Bukkit.getServer().getOnlinePlayers().length;

        // END server software specific section -- all code below does not use any code outside of this class / Java

View Full Code Here

  // -------------------------------------------- //
 
  @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);
    }
View Full Code Here

    /**
     * Generic method that posts a plugin to the metrics website
     */
    private void postPlugin(final boolean isPing) throws IOException {
        // The plugin's description file containg all of the plugin data such as name, version, author, etc
        final PluginDescriptionFile description = plugin.getDescription();

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

        // If we're pinging, append it
View Full Code Here

TOP

Related Classes of org.bukkit.plugin.PluginDescriptionFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.