Examples of PluginDescriptionFile


Examples of org.bukkit.plugin.PluginDescriptionFile

public class HomeBukkit extends JavaPlugin {
    public void onDisable() {
    }

    public void onEnable() {
        PluginDescriptionFile desc = getDescription();

        System.out.println(desc.getFullName() + " has been enabled");

        getCommand("listhomes").setExecutor(new ListHomesCommand(this));
        getCommand("sethome").setExecutor(new SetHomeCommand(this));
        getCommand("gohome").setExecutor(new GoHomeCommand(this));
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

 
    public void onDisable() {
    }

    public void onEnable() {
        PluginDescriptionFile pdfFile = this.getDescription();
        System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
        setupPermissions(); // fonction pour les permissions

        // Module Random
        getCommand("dice").setExecutor(new Dice(this));
        getCommand("random").setExecutor(new Random(this));
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

    /**
     * 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

Examples of org.bukkit.plugin.PluginDescriptionFile

    /**
     * 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

Examples of org.bukkit.plugin.PluginDescriptionFile

    /**
* 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().length;

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

View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

  private boolean crouchDef = true;
  private boolean glowCenter = true;
  private int carpSize = 5;

    public void onEnable() {
        PluginDescriptionFile pdfFile = this.getDescription();
        String name = pdfFile.getName();
        config = getConfiguration();
       
        loadConfig();
        if (!getDataFolder().exists()) getDataFolder().mkdirs();
        fileName = getDataFolder().getPath() + File.separator + "magiccarpet.properties";
       
        setupPermissions();
       
        log.info( "[" + name + "] " + name + " version " + pdfFile.getVersion() + " is enabled!" );
        log.info( "[" + name + "] Take yourself wonder by wonder, using /magiccarpet or /mc. " );
        if(permissions != null) log.info("[" + name + "] Using Permissions.");
        else if(!all_can_fly) log.info("[" + name + "] Anyone can use the Magic Carpet.");
        else if(ignore) log.info("[" + name + "] Ignore: " + bums.toString());
        else log.info("[" + name + "] Restricted to: " + owners.toString());
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

        if (!file.exists()) {
            throw new InvalidPluginException(new FileNotFoundException(file.getPath() + " does not exist"));
        }

        final PluginDescriptionFile description;
        try {
            description = getPluginDescription(file);
        } catch (InvalidDescriptionException ex) {
            throw new InvalidPluginException(ex);
        }

        final File parentFile = file.getParentFile();
        final File dataFolder = new File(parentFile, description.getName());
        @SuppressWarnings("deprecation")
        final File oldDataFolder = new File(parentFile, description.getRawName());

        // Found old data folder
        if (dataFolder.equals(oldDataFolder)) {
            // They are equal -- nothing needs to be done!
        } else if (dataFolder.isDirectory() && oldDataFolder.isDirectory()) {
            server.getLogger().warning(String.format(
                "While loading %s (%s) found old-data folder: `%s' next to the new one `%s'",
                description.getFullName(),
                file,
                oldDataFolder,
                dataFolder
            ));
        } else if (oldDataFolder.isDirectory() && !dataFolder.exists()) {
            if (!oldDataFolder.renameTo(dataFolder)) {
                throw new InvalidPluginException("Unable to rename old data folder: `" + oldDataFolder + "' to: `" + dataFolder + "'");
            }
            server.getLogger().log(Level.INFO, String.format(
                "While loading %s (%s) renamed data folder: `%s' to `%s'",
                description.getFullName(),
                file,
                oldDataFolder,
                dataFolder
            ));
        }

        if (dataFolder.exists() && !dataFolder.isDirectory()) {
            throw new InvalidPluginException(String.format(
                "Projected datafolder: `%s' for %s (%s) exists and is not a directory",
                dataFolder,
                description.getFullName(),
                file
            ));
        }

        for (final String pluginName : description.getDepend()) {
            if (loaders == null) {
                throw new UnknownDependencyException(pluginName);
            }
            PluginClassLoader current = loaders.get(pluginName);

            if (current == null) {
                throw new UnknownDependencyException(pluginName);
            }
        }

        final PluginClassLoader loader;
        try {
            loader = new PluginClassLoader(this, getClass().getClassLoader(), description, dataFolder, file);
        } catch (InvalidPluginException ex) {
            throw ex;
        } catch (Throwable ex) {
            throw new InvalidPluginException(ex);
        }

        loaders.put(description.getName(), loader);

        return loader.plugin;
    }
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

                throw new InvalidDescriptionException(new FileNotFoundException("Jar does not contain plugin.yml"));
            }

            stream = jar.getInputStream(entry);

            return new PluginDescriptionFile(stream);

        } catch (IOException ex) {
            throw new InvalidDescriptionException(ex);
        } catch (YAMLException ex) {
            throw new InvalidDescriptionException(ex);
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

        }
        return true;
    }

    private void describeToSender(Plugin plugin, CommandSender sender) {
        PluginDescriptionFile desc = plugin.getDescription();
        sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());

        if (desc.getDescription() != null) {
            sender.sendMessage(desc.getDescription());
        }

        if (desc.getWebsite() != null) {
            sender.sendMessage("Website: " + ChatColor.GREEN + desc.getWebsite());
        }

        if (!desc.getAuthors().isEmpty()) {
            if (desc.getAuthors().size() == 1) {
                sender.sendMessage("Author: " + getAuthors(desc));
            } else {
                sender.sendMessage("Authors: " + getAuthors(desc));
            }
        }
View Full Code Here

Examples of org.bukkit.plugin.PluginDescriptionFile

   * 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
    PluginDescriptionFile description = RecipeManager.plugin.getDescription();
   
    // Construct the post data
    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
Copyright © 2018 www.massapi.com. 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.