Error I can't find, Bukkit won't load plugin

Discussion in 'Plugin Development' started by haydenaa, Dec 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    haydenaa

    Hello. I am in development of a plugin that is similar to factions. There's a big problem though. Whenever I go to register the plugin into my server's plugin folder and start the server, Bukkit doesn't even start loading the plugin. It doesn't even show up in the stack-trace once. I'll post my code below and hopefully you guys can help me.

    Main Class:
    Code:
    package com.guildlaunch.platinumverse.republics;
    
    
    
    import org.bukkit.Bukkit;
    
    import org.bukkit.ChatColor;
    
    import org.bukkit.command.Command;
    
    import org.bukkit.command.CommandSender;
    
    import org.bukkit.entity.Player;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    
    
    public class Main extends JavaPlugin {
    
    
    publicstatic Main plugin;
    
    
    public Main(Main instance) {
    
    plugin = instance;
    
    }
    
    
    public static Main getPlugin() {
    
    returnplugin;
    
    }
    
    
    public void onEnable() {
    
    getServer().getPluginManager().registerEvents(new Listeners(), this);
    
    SLAPI.loadRepublics();
    
    getLogger().info("Successfully loaded Republics!");
    
    }
    
    
    public void onDisable() {
    
    SLAPI.saveRepublics();
    
    getLogger().info("Successfully saved Republics!");
    
    }
    
    
    @SuppressWarnings("deprecation")
    
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    
    
    Player player = (Player) sender;
    
    
    if(cmd.getName().equalsIgnoreCase("republics")) {
    
    if(!player.hasPermission("republics.use")) {
    
    player.sendMessage(ChatColor.RED + "Permission Denied!");
    
    return false;
    
    }else
    
    if(args.length == 0) {
    
    if(Ranks.inRepublic(player.getName())) {
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("member")) {
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.GREEN + "You are a Member in republic " + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "/republics info");
    
    player.sendMessage(ChatColor.GOLD + "/republics home");
    
    player.sendMessage(ChatColor.GOLD + "/republics members");
    
    player.sendMessage(ChatColor.GOLD + "/republics leave");
    
    return true;
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("mod")) {
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.GOLD + "You are a Moderator in republic " + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "/republics info");
    
    player.sendMessage(ChatColor.GOLD + "/republics requested");
    
    player.sendMessage(ChatColor.GOLD + "/republics accept");
    
    player.sendMessage(ChatColor.GOLD + "/republics reject");
    
    player.sendMessage(ChatColor.GOLD + "/republics kick");
    
    player.sendMessage(ChatColor.GOLD + "/republics home");
    
    player.sendMessage(ChatColor.GOLD + "/republics leave");
    
    return true;
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("admin")) {
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.AQUA + "You are an Administrator in republic " + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "/republics info");
    
    player.sendMessage(ChatColor.GOLD + "/republics requested");
    
    player.sendMessage(ChatColor.GOLD + "/republics accept");
    
    player.sendMessage(ChatColor.GOLD + "/republics reject");
    
    player.sendMessage(ChatColor.GOLD + "/republics kick");
    
    player.sendMessage(ChatColor.GOLD + "/republics description");
    
    player.sendMessage(ChatColor.GOLD + "/republics type");
    
    player.sendMessage(ChatColor.GOLD + "/republics home");
    
    player.sendMessage(ChatColor.GOLD + "/republics leave");
    
    return true;
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder")) {
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.RED + "You are a Co-Founder in republic " + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "/republics info");
    
    player.sendMessage(ChatColor.GOLD + "/republic requested");
    
    player.sendMessage(ChatColor.GOLD + "/republics accept");
    
    player.sendMessage(ChatColor.GOLD + "/republics reject");
    
    player.sendMessage(ChatColor.GOLD + "/republics kick");
    
    player.sendMessage(ChatColor.GOLD + "/republics description");
    
    player.sendMessage(ChatColor.GOLD + "/republics type");
    
    player.sendMessage(ChatColor.GOLD + "/republics sethome");
    
    player.sendMessage(ChatColor.GOLD + "/republics home");
    
    player.sendMessage(ChatColor.GOLD + "/republics leave");
    
    return true;
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) {
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.DARK_RED + "You are the Founder of republic " + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "/republics info");
    
    player.sendMessage(ChatColor.GOLD + "/republic requested");
    
    player.sendMessage(ChatColor.GOLD + "/republics accept");
    
    player.sendMessage(ChatColor.GOLD + "/republics reject");
    
    player.sendMessage(ChatColor.GOLD + "/republics kick");
    
    player.sendMessage(ChatColor.GOLD + "/republics description");
    
    player.sendMessage(ChatColor.GOLD + "/republics type");
    
    player.sendMessage(ChatColor.GOLD + "/republics sethome");
    
    player.sendMessage(ChatColor.GOLD + "/republics home");
    
    player.sendMessage(ChatColor.GOLD + "/republics leave");
    
    player.sendMessage(ChatColor.RED + "/republics destroy");
    
    return true;
    
    }else{
    
    player.sendMessage(String.format("%s%s=-=-=-=-=-=-= %s%sRepublics %s%s=-=-=-=-=-=-=", ChatColor.GOLD, ChatColor.MAGIC, ChatColor.DARK_BLUE, ChatColor.BOLD, ChatColor.GOLD, ChatColor.MAGIC));
    
    player.sendMessage(ChatColor.GREEN + "/republics join");
    
    player.sendMessage(ChatColor.GREEN + "/republics create");
    
    return true;
    
    }
    
    }else
    
    if(args.length >= 2) {
    
    if(!Ranks.inRepublic(player.getName())) {
    
    if(args[0].equalsIgnoreCase("join")) {
    
    if(args.length==1) {
    
    player.sendMessage(ChatColor.GREEN + "/republics join [Republic]");
    
    return true;
    
    }else{
    
    if(Republic.isRepublic(args[1])) {
    
    Republic.addRequestee(args[1], player.getName());
    
    }
    
    }
    
    }
    
    if(args[0].equalsIgnoreCase("create")) {
    
    if(args.length>=1 && args.length <= 3) {
    
    player.sendMessage(ChatColor.GREEN + "/republics create [Republic Name] [Description] [Type] (For the description: Do NOT type in spaces. For example: Bob_Likes_Pizza NOT: Bob Likes Pizza)");
    
    return true;
    
    }else{
    
    Republic.addRepublic(args[1], player.getName(), args[2].split("_"), args[3]);
    
    player.sendMessage(ChatColor.GOLD + "You have created Republic: " + args[1]);
    
    return true;
    
    }
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("info")) {
    
    player.sendMessage(ChatColor.GREEN + Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.GOLD + "Description: " + Republic.getDescription(Ranks.getRepublic(player.getName())));
    
    player.sendMessage(ChatColor.GOLD + "Type: " + Republic.getType(Ranks.getRepublic(player.getName())));
    
    }else
    
    if(args[0].equalsIgnoreCase("home")) {
    
    if(Republic.hasHome(Ranks.getRepublic(player.getName()))) {
    
    player.teleport(Republic.getHome(Ranks.getRepublic(player.getName())));
    
    player.sendMessage(ChatColor.GREEN + "Teleported to your Republic's home!");
    
    return true;
    
    }else{
    
    player.sendMessage(ChatColor.RED + "You do not have a home for your Republic!");
    
    return true;
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("members")) {
    
    for(String players : getConfig().getConfigurationSection("republics." + Ranks.getRepublic(player.getName()) + ".members").getKeys(false)) {
    
    player.sendMessage(ChatColor.AQUA + "Members: " + ChatColor.GOLD + players.split(ChatColor.AQUA + ", "));
    
    return true;
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("leave")) {
    
    if(Ranks.inRepublic(player.getName())) {
    
    Ranks.removeFromRepublic(player.getName());
    
    player.sendMessage(ChatColor.RED + "You have left your republic!");
    
    return true;
    
    }else{
    
    player.sendMessage(ChatColor.RED + "You aren't in a republic!");
    
    return true;
    
    }
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("mod") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("admin") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) { 
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("mod") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("admin") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) {
    
    if(args[0].equalsIgnoreCase("requested")) {
    
    for(String players : getConfig().getConfigurationSection("republics." + Ranks.getRepublic(player.getName()) + ".requested").getKeys(false)) {
    
    player.sendMessage(ChatColor.AQUA + "Players that have requested to join your Republic: " + ChatColor.GOLD + players.split(ChatColor.AQUA + ", "));
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("accept")) {
    
    if(args.length >= 3) {
    
    Player target = null;
    
    try {
    
    target = Bukkit.getPlayer(args[1]);
    
    } catch(Exception e) {
    
    
    }
    
    if(target != null) {
    
    if(Republic.getRepublicWhichIsRequested(target.getName()).equalsIgnoreCase(Ranks.getRepublic(player.getName()))) {
    
    Republic.removeRequestee(target.getName());
    
    Ranks.addToRepublic(target.getName(), Ranks.getRepublic(player.getName()));
    
    target.sendMessage(ChatColor.AQUA + "You have been accepted to Republic " + Ranks.getRepublic(target.getName()) + "!");
    
    player.sendMessage(ChatColor.GREEN + "Successfully accepted player " + target.getName() + " into your republic!");
    
    return true;
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player hasn't requested to join!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player either isn't online or doesn't exist!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.GREEN + "/republics accept [Player]");
    
    return true;
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("reject")) {
    
    if(args.length >= 3) {
    
    Player target = null;
    
    try {
    
    target = Bukkit.getPlayer(args[1]);
    
    } catch(Exception e) {
    
    
    }
    
    if(target != null) {
    
    if(Republic.getRepublicWhichIsRequested(target.getName()).equalsIgnoreCase(Ranks.getRepublic(player.getName()))) {
    
    target.sendMessage(ChatColor.RED + "You have been rejected from Republic " + Republic.getRepublicWhichIsRequested(target.getName()));
    
    Republic.removeRequestee(target.getName());
    
    player.sendMessage(ChatColor.GREEN + "Successfully rejected player " + target.getName());
    
    return true;
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player hasn't requested to join!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player either isn't online or doesn't exist!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.GREEN + "/republics reject [Player]");
    
    return true;
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("kick")) {
    
    if(args.length >= 3) {
    
    Player target = null;
    
    try {
    
    target = Bukkit.getPlayer(args[1]);
    
    } catch(Exception e) {
    
    
    }
    
    if(target != null) {
    
    if(Ranks.getRepublic(target.getName()).equalsIgnoreCase(Ranks.getRepublic(player.getName()))) {
    
    Ranks.removeFromRepublic(player.getName());
    
    player.sendMessage(ChatColor.GOLD + "You have kicked " + target.getName() + " from your republic!");
    
    target.sendMessage(ChatColor.RED + "You have been kicked from your republic by " + player.getName());
    
    return true;
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player is not in your republic!");
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "That player either isn't online or doesn't exist!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.GREEN + "/republics kick [Player]");
    
    }
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "No Permission");
    
    return true;
    
    }
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("admin") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) { 
    
    if(args[0].equalsIgnoreCase("description")) {
    
    if(args.length >= 3) {
    
    Republic.setDescription(Ranks.getRepublic(player.getName()), args[1].split("_"));
    
    }else{
    
    player.sendMessage(ChatColor.GREEN + "Your current description is: " + Republic.getDescription(Ranks.getRepublic(player.getName())));
    
    player.sendMessage(ChatColor.GREEN + "/republics description [Description] (Do NOT type in spaces. For example: Bob_Likes_Pizza NOT: Bob Likes Pizza)");
    
    return true;
    
    }
    
    }else
    
    if(args[0].equalsIgnoreCase("type")) {
    
    if(args.length >= 3) {
    
    if(args[1].equalsIgnoreCase("closed") || args[1].equalsIgnoreCase("open")) {
    
    Republic.setType(Ranks.getRepublic(player.getName()), args[1]);
    
    player.sendMessage(ChatColor.GREEN + "Successfully changed type to: " + args[1]);
    
    }else{
    
    player.sendMessage(ChatColor.RED + "Invalid type! " + ChatColor.GREEN + "Types: Closed, Open");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.GREEN + "Your current type is: " + Republic.getType(Ranks.getRepublic(player.getName())));
    
    player.sendMessage(ChatColor.GREEN + "/republics type [Type]");
    
    return true;
    
    }
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "No Permission");
    
    return true;
    
    }
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder") || Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) {
    
    if(args[0].equalsIgnoreCase("sethome")) {
    
    Republic.setHome(Ranks.getRepublic(player.getName()), player.getLocation());
    
    player.sendMessage(ChatColor.GREEN + "Successfully set your republic's home at your current location!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "No Permission");
    
    }
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) {
    
    if(args[0].equalsIgnoreCase("destroy")) {
    
    for(String players : getConfig().getConfigurationSection("republics." + Ranks.getRepublic(player.getName()) + ".members").getKeys(false)) {
    
    Ranks.ranks1.remove(players);
    
    Ranks.ranks2.remove(players);
    
    }
    
    Republic.removeRepublic(Ranks.getRepublic(player.getName()));
    
    player.sendMessage(ChatColor.RED + "You have destroyed your republic!");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "No Permission");
    
    return true;
    
    }
    
    }else{
    
    player.sendMessage(ChatColor.RED + "No Permission");
    
    return true;
    
    }
    
    }
    
    }
    
    
    return true;
    
    }
    
    
    return false;
    
    }
    
    
    
    }
    

    SLAPI(Saving Loading API) Class:
    Code:
    package com.guildlaunch.platinumverse.republics;
    
    
    
    publicclass SLAPI {
    
    
    private static Main plugin = Main.getPlugin();
    
    
    public static void saveRepublics() {
    
    plugin.saveConfig();
    
    }
    
    
    public static void loadRepublics() {
    
    if(!plugin.getConfig().contains("republics")) return;
    
    String republicName = null;
    
    for(String s : plugin.getConfig().getConfigurationSection("republics").getKeys(false)) {
    
    republicName = s;
    
    }
    
    if(republicName != null) {
    
    for(String s : plugin.getConfig().getConfigurationSection("republics." + republicName + ".members").getKeys(false)) {
    
    Ranks.addToRepublic(s, republicName);
    
    Ranks.setPlayerRank(s, plugin.getConfig().getString("republics." + republicName + ".members." + s));
    
    }
    
    for(String s : plugin.getConfig().getConfigurationSection("republics." + republicName + ".requested").getKeys(false)) {
    
    Republic.addRequestee(republicName, s);
    
    }
    
    for(String s : plugin.getConfig().getConfigurationSection("republics." + republicName + ".type").getKeys(false)) {
    
    Republic.setType(republicName, s);
    
    }
    
    }
    
    }
    
    
    
    }
    

    Ranks Class:
    Code:
    package com.guildlaunch.platinumverse.republics;
    
    
    
    import java.util.HashMap;
    
    import java.util.List;
    
    
    
    publicclass Ranks {
    
    
    public static Main plugin = Main.getPlugin();
    
    
    //Player, Republic Name -- To get which Republic a player is in
    
    public static HashMap<String, String> ranks1 = new HashMap<String, String>();
    
    //Player, Rank -- To get a player's rank in a Republic
    
    public static HashMap<String, String> ranks2 = new HashMap<String, String>();
    
    
    public static boolean inRepublic(String player) {
    
    return ranks1.containsKey(player);
    
    }
    
    
    public static String getRepublic(String player) {
    
    return ranks1.get(player);
    
    }
    
    
    
    @SuppressWarnings("unchecked")
    
    public static void addToRepublic(String player, String republicName) {
    
    ranks1.put(player, republicName);
    
    ranks2.put(player, "member");
    
    List<String> members = (List<String>) Main.plugin.getConfig().getList("republics." + republicName + ".members");
    
    members.add(player);
    
    plugin.getConfig().set(Main.plugin.getConfig().getString("republics." + republicName + ".members." + player), "member");
    
    }
    
    
    public static String getPlayerRank(String player) {
    
    return ranks2.get(player);
    
    }
    
    
    public static void setPlayerRank(String player, String rank) {
    
    ranks2.put(player, rank);
    
    plugin.getConfig().set(Main.plugin.getConfig().getString("republics." + getRepublic(player) + ".members." + player), rank);
    
    }
    
    
    public static void removeFromRepublic(String player) {
    
    ranks1.remove(player);
    
    ranks2.remove(player);
    
    plugin.getConfig().set(Main.plugin.getConfig().getString("republics." + getRepublic(player) + ".members." + player), null);
    
    }
    
    
    
    }
    

    Listeners Class:
    Code:
    package com.guildlaunch.platinumverse.republics;
    
    
    
    import org.bukkit.ChatColor;
    
    import org.bukkit.entity.Player;
    
    import org.bukkit.event.EventHandler;
    
    import org.bukkit.event.Listener;
    
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    
    
    
    public class Listeners implements Listener {
    
    
    @EventHandler
    
    public void onChat(AsyncPlayerChatEvent e) {
    
    Player player = e.getPlayer();
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("member")) {
    
    e.setFormat(ChatColor.GREEN + "~" + Ranks.getRepublic(player.getName()) + " " + e.getFormat());
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("mod")) {
    
    e.setFormat(ChatColor.GOLD + "~" + Ranks.getRepublic(player.getName()) + " " + e.getFormat());
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("admin")) {
    
    e.setFormat(ChatColor.AQUA + "~" + Ranks.getRepublic(player.getName()) + " " + e.getFormat());
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("cofounder")) {
    
    e.setFormat(ChatColor.RED + "~" + Ranks.getRepublic(player.getName()) + " " + e.getFormat());
    
    }else
    
    if(Ranks.getPlayerRank(player.getName()).equalsIgnoreCase("founder")) {
    
    e.setFormat(ChatColor.DARK_RED + "~" + Ranks.getRepublic(player.getName()) + " " + e.getFormat());
    
    }else{
    
    return;
    
    }
    
    }
    
    
    
    }
    

    Republic Class:
    Code:
    package com.guildlaunch.platinumverse.republics;
    
    
    
    import java.util.HashMap;
    
    
    
    import org.bukkit.Bukkit;
    
    import org.bukkit.ChatColor;
    
    import org.bukkit.Location;
    
    
    
    public class Republic {
    
    
    private static Main plugin = Main.getPlugin();
    
    
    //Faction Name, Description
    
    private static HashMap<String, String[]> republics1 = new HashMap<String, String[]>();
    
    //Faction Name, Founder Name
    
    private static HashMap<String, String> republics2 = new HashMap<String, String>();
    
    //Faction Name, Type
    
    private static HashMap<String, String> republics3 = new HashMap<String, String>();
    
    //Faction Name, Home
    
    private static HashMap<String, Location> republics4 = new HashMap<String, Location>();
    
    //Requestee, Faction Name
    
    private static HashMap<String, String> republics5 = new HashMap<String, String>();
    
    
    public static void addRepublic(String republicName, String founder, String[] description, String type) {
    
    if(!republics1.containsKey(republicName) && !republics2.containsKey(republicName)) {
    
    republics1.put(republicName, description);
    
    republics2.put(republicName, founder);
    
    republics3.put(republicName, type);
    
    plugin.getConfig().set("republics", republicName);
    
    plugin.getConfig().set("republics." + republicName + ".description", description);
    
    plugin.getConfig().set("republics." + republicName + ".founder", founder);
    
    plugin.getConfig().set("republics." + republicName + ".type", type);
    
    Bukkit.getServer().broadcastMessage(ChatColor.GREEN + "A new republic has been founded: " + republicName);
    
    }
    
    }
    
    
    public static void removeRepublic(String republicName) {
    
    if(republics1.containsKey(republicName) && republics2.containsKey(republicName)) {
    
    republics1.remove(republicName);
    
    republics2.remove(republicName);
    
    republics3.remove(republicName);
    
    republics4.remove(republicName);
    
    plugin.getConfig().set(republicName, null);
    
    Bukkit.getServer().broadcastMessage(ChatColor.RED + republicName + " has been destroyed.");
    
    }
    
    }
    
    
    public static boolean isRepublic(String republicName) {
    
    return republics1.containsKey(republicName);
    
    }
    
    
    
    public static void setDescription(String republicName, String[] description) {
    
    if(republics1.containsKey(republicName) && republics2.containsKey(republicName)) {
    
    republics1.remove(republicName);
    
    republics1.put(republicName, description);
    
    plugin.getConfig().set("republics." + republicName + ".description", description);
    
    Bukkit.getServer().broadcastMessage(ChatColor.GREEN + republicName + " has changed their description to: " + description);
    
    }
    
    }
    
    
    public static String[] getDescription(String republicName) {
    
    if(republics1.containsKey(republicName)) {
    
    return republics1.get(republicName);
    
    }else
    
    returnnull;
    
    }
    
    
    public static String getType(String republicName) {
    
    if(republics3.containsKey(republicName)) {
    
    return republics3.get(republicName);
    
    }else
    
    returnnull;
    
    }
    
    
    public static void setType(String republicName, String type) {
    
    if(republics3.containsKey(republicName)) {
    
    republics3.remove(republicName);
    
    republics3.put(republicName, type);
    
    plugin.getConfig().set("republics." + republicName + ".type", type);
    
    Bukkit.getServer().broadcastMessage(ChatColor.GREEN + republicName + " has changed their type to: " + type);
    
    }
    
    }
    
    
    public static Location getHome(String republicName) {
    
    return republics4.get(republicName);
    
    }
    
    
    public static boolean hasHome(String republicName) {
    
    return republics4.containsKey(republicName);
    
    }
    
    
    
    public static void setHome(String republicName, Location location) {
    
    if(republics4.containsKey(republicName)) {
    
    republics4.remove(republicName);
    
    republics4.put(republicName, location);
    
    plugin.getConfig().set("republics." + republicName + ".home.world", location.getWorld());
    
    plugin.getConfig().set("republics." + republicName + ".home.x", location.getX());
    
    plugin.getConfig().set("republics." + republicName + ".home.y", location.getY());
    
    plugin.getConfig().set("republics." + republicName + ".home.z", location.getZ());
    
    }
    
    }
    
    
    public static void addRequestee(String republicName, String player) {
    
    plugin.getConfig().set("republics." + republicName + ".requested", player);
    
    republics5.put(player, republicName);
    
    }
    
    
    //Note: Add the player to the republic before executing this method or else it will return an NPE
    
    public static void removeRequestee(String player) {
    
    plugin.getConfig().set("republics." + Ranks.getRepublic(player) + ".requested." + player, null);
    
    republics5.remove(player);
    
    }
    
    
    public static String getRepublicWhichIsRequested(String player) {
    
    return republics5.get(player);
    
    }
    
    
    public static boolean isRequestee(String player) {
    
    return republics5.containsKey(player);
    
    }
    
    
    
    }
    

    Thanks for all the help, I really appriciate it! :)

    When I was pasting the code over, sometimes this forum posted two words together for some reason. That's not the error. Thanks :)
     
    Last edited by a moderator: Dec 27, 2014
  2. Offline

    mine-care

    Check before casting! read my signature.
    Stop abusing static, it ruins the concept of OOP, use constructors and parameters to pass info rather than static.
    Make sure:
    1. plugin is placed in the right folder,
    2. there is a plugin.yml
    3. bukkit console says "loading <yourplugin'sname>"
    4. if there is a stacktrace please post it .
     
    Konato_K likes this.
  3. Offline

    haydenaa

    1. Check 2. Check 3. Doesn't say 4. None

    @mine-care also, does the static ruin any of the plugin or is it just a preference thing?
     
    Last edited by a moderator: Dec 27, 2014
  4. Offline

    ChipDev

    Memory leaks.
     
  5. Offline

    teej107

    It ruins OOP.
    Also your Main class doesn't need a constructor and a stacktrace will help greatly.
     
  6. Offline

    Konato_K

    @haydenaa If the plugin is in the plugin folders and it doesn't load, then there must be a stacktrace, or you're not putting plugin.yml.
     
  7. Offline

    haydenaa

    @ChipDev Got it

    @teej107 There is no point of posting a stack trace, it doesn't even mention the plugin once in it. Also, I need a constructor for the main class because I need it to be static because in my SLAPI class some of the methods are only static.

    @Konato_K There's no stack trace... like I said before.... and i've checked my plugin.yml about 50 times now.

    Plugin.yml:
    Code:
    main: com.guildlaunch.platinumverse.republics.Main
    name: Republics
    version: 1.0
    commands:
      republics:
        description: Main Command for Republics
        usage: /republics
    
    Where com.guildlaunch.platinumverse.republics is my package and Main is my main class

    <merged by Eyamaz. 5 posts! Use the edit button!>
     
    Last edited by a moderator: Dec 26, 2014
  8. Offline

    Rocoty

    Don't declare a constructor in your main class. Use onEnable for initialisation. If you truly believe you need an explicitly declared constructor, this should be a no-arg constructor.
     
  9. Offline

    mythbusterma

    @haydenaa

    There is nothing saying that static methods may only be invoked from static contexts, why in the world would you think you NEED static for that? Just access it in your onEnable(), also what Rocoty said.

    Creating a separate constructor will effectively delete the default constructor, which Bukkit relies on to instantiate your plugin. You cannot create another constructor, and doing so makes no difference at all, as you have no control over the instantiation of the class anyway.
     
  10. Offline

    haydenaa

    @Rocoty @mythbusterma Ok, so would it be ok to do something like this:
    Code:
    Plugin plugin;
    public void onEnable() {
    plugin = this;
    }
    
    public void onDisable() {
    plugin = null;
    }
    
    Saw that from someone else with the same difficulties, trying not to use static but then how would they access the method from a different class? Not the best with these types of situations but don't you dare go tell me to read a 1000 page java book, I know enough about this stuff, thank you.
     
  11. Offline

    teej107

  12. Offline

    mine-care

    @haydenaa And also static can cause ram leaks when used over variables (non primitive datatypes) when server reloads.
     
  13. Offline

    haydenaa

    @teej107 Thanks for the links, I knew about getters and setters already. I still have a question about accessing information from different classes though. Before I was using static, because it worked and kind of made sense to me. Should I try:
    Code:
    private Main plugin = new Main();
    public Main getMain() {
          return plugin;
    }
    
    Yeah, I tested this, it still won't allow me to access this from a different class.

    I watched a tutorial on how to make an economy plugin, will post the code for the accessor here:
    Code:
    private static Main plugin;
    public EconomyManager(Main instance) {
    plugin = instance;
    }
    public static Main getPlugin() {
    return plugin;
    }
    
    And then inside a different class to access it:
    Code:
    private static Main plugin = EconomyManager.getPlugin();
    
    So here this guy uses the static in order to access it in a different class, and it works perfectly fine, so i'm not sure why I can't use static in at least my getClass methods

    @mine-care @teej107 @Rocoty @mythbusterma So can we get back to the topic, what is the error here? Is it my constructor?
     
    Last edited by a moderator: Dec 27, 2014
  14. Offline

    Rocoty

    @haydenaa No one says you can't use static for this to work. What we're saying is that if you decide to use static in this way your code will gradually become less maintainable as it gets more complex. It will look ugly and errors will be hard to track down. You'll also be regarded as a bad developer by any decent developer out there. Making the variable static like you did there makes no sense in an OOP environment.

    So I recommend you find a good book about Java and read it until you understand a little bit more about what OOP is all about. It would help you greatly.
     
  15. Offline

    teej107

    From a Java stance, yes that looks good as long as you have an instance of the object that the method is in. From a Bukkit stand point, you should never instantiate your JavaPlugin class.
     
    Last edited: Dec 28, 2014
  16. Offline

    haydenaa

    @teej107 then what am I supposed to do? I don't see a way of accessing the JavaPlugin enviroment in a different class without using a static method.
     
    Last edited by a moderator: Dec 27, 2014
  17. Offline

    teej107

  18. Offline

    Skionz

    @haydenaa Constructors, accessors, mutators.
     
  19. Offline

    timtower Administrator Administrator Moderator

    @haydenaa Merged all your posts.
    Don't double post. Use the edit button instead
     
  20. Offline

    mythbusterma

    @haydenaa

    The issue is that everything is so poorly referenced that none of us can decipher what the issue may be. Plus, you still won't post the stack trace, which I'm certain does reference your plugin.

    Um, no, you don't.
     
  21. Offline

    haydenaa

    @teej107 Yeah, got that link before, looking through it and nothing that it says really is answering how to access a method from a different class..
    @Skionz Yes I believe before I was trying to access the methods using a constructor, however some people said that you're not supposed to use it or something
    @mythbusterma What is poorly referenced? I put a plugin there, I'm not sure how to make it "better referenced" then how it already is. I'll post the entire stack-trace when I restart the server with the plugin.
    Stack trace:
    Code:
    27.12 18:34:18 [Server] INFO [UpdateChecker] RegionForSale is out of date! Check out the project page: "http://dev.bukkit.org/server-mods/regionforsale/" 27.12 18:34:17 [Server] WARN Update at: http://dev.bukkit.org/server-mods/vault 27.12 18:34:17 [Server] WARN Stable Version: 1.5.0 is out! You are still running version: 1.4.1 27.12 18:34:17 [Server] INFO Checking for Updates: 27.12 18:34:17 [Server] INFO Post-enable finished. 27.12 18:34:16 [Server] INFO Loaded 5 package(s) into the cache. 27.12 18:34:16 [Server] INFO Post-enable running... 27.12 18:34:15 [Server] INFO Plugin is now ready to be used. 27.12 18:34:15 [Server] INFO Authenticated with the specified Secret key. 27.12 18:34:15 [Server] INFO dev.bukkit.org/bukkit-plugins/holographic-displays 27.12 18:34:15 [Server] INFO Download it on Bukkit Dev: 27.12 18:34:15 [Server] INFO Found a new version available: v2.0.2 27.12 18:34:15 [Server] INFO Hooked into PermissionsEx! 27.12 18:34:15 [Server] Startup Done (12.552s)! For help, type "help" or "?" 27.12 18:34:15 [Server] INFO Server permissions file permissions.yml is empty, ignoring it 27.12 18:34:15 [Server] INFO Enabling EssentialsChat v2.13.1 27.12 18:34:15 [Server] INFO Ready! 27.12 18:34:14 [Server] INFO Loading regions for world 'Prison'... 27.12 18:34:14 [Server] INFO Loading regions for world 'Random'... 27.12 18:34:14 [Server] INFO Loading regions for world 'Factions'... 27.12 18:34:14 [Server] INFO Loading regions for world 'world_the_end'... 27.12 18:34:14 [Server] INFO Loading regions for world 'world_nether'... 27.12 18:34:14 [Server] INFO Loading regions for world 'world'... 27.12 18:34:14 [Server] INFO Loading global configuration... 27.12 18:34:14 [Server] INFO Enabling RegionForSale v2.4 27.12 18:34:14 [Server] INFO Enabling EssentialsSpawn v2.13.1 27.12 18:34:14 [Server] INFO RankupPro Version  1.0.0 has been enabled! 27.12 18:34:14 [Server] INFO Enabling RankupPro v1.0.0 27.12 18:34:14 [Server] INFO has been enabled. 27.12 18:34:14 [Server] INFO Enabling floAuction v3.0.4 27.12 18:34:14 [Server] INFO Essentials: Using PermissionsEx based permissions. 27.12 18:34:14 [Server] INFO [Vault][Economy] Essentials Economy hooked. 27.12 18:34:14 [Server] WARN ยง4Version mismatch! Please update EssentialsKitManager to the same version. 27.12 18:34:14 [Server] INFO Enabling Essentials v2.13.1 27.12 18:34:14 [Server] INFO PrisonMine started [ 6 mine(s) found ] 27.12 18:34:14 [Server] INFO PrisonMine registered 27.12 18:34:14 [Server] INFO Enabling PrisonMine v1.32.106 27.12 18:34:14 [Server] INFO Enabling ForceCommand v1.0 27.12 18:34:14 [Server] INFO Enabling EssentialsKitManager v1.0.2 27.12 18:34:14 [Server] WARN Hologram 'home' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'laws' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'staffhall' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'cafe' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'egg' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'baker' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'hottub' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2f' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2e' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2d' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2c' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2b' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '2a' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '1c' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '1b' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram '1' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'staffvillage' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'horsestables' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'church' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'lounge' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'open' was in the world 'Free' but it wasn't loaded. 27.12 18:34:14 [Server] WARN Hologram 'hay' was in the world 'Free' but it wasn't loaded. 27.12 18:34:13 [Server] INFO Loaded animation 'example.txt', speed 20. 27.12 18:34:13 [Server] INFO Enabling HolographicDisplays v1.8.6 27.12 18:34:13 [Server] INFO Votifier enabled. 27.12 18:34:13 [Server] INFO Enabling Votifier v1.9 27.12 18:34:13 [Server] INFO Update by executing: /ne update 27.12 18:34:13 [Server] INFO An update is available: NametagEdit v2.4, a release for CB 1.7.9-R0.1 available at http://servermods.cursecdn.com/files/790/383/NametagEdit.jar 27.12 18:34:13 [Server] INFO No updates found! 27.12 18:34:13 [Server] INFO Enabling NametagEdit v2.4 27.12 18:34:13 [Server] INFO Enabling FirstJoinPlus v2.2 27.12 18:34:13 [Server] INFO Checking for updates... 27.12 18:34:13 [Server] INFO Clearlag is now enabled! 27.12 18:34:13 [Server] INFO Modules have been loaded! 27.12 18:34:13 [Server] WARN mob-range requires you to use bukkit v1.7_r4 (1.7.10) 27.12 18:34:13 [Server] INFO Loading modules... 27.12 18:34:13 [Server] INFO Enabling ClearLag v2.7.2 27.12 18:34:13 [Server] INFO has been enabled. 27.12 18:34:13 [Server] INFO Enabling WhatIsIt v1.3.8 27.12 18:34:13 [Server] INFO Enabling UnknownMessage v1.0 27.12 18:34:13 [Server] INFO PlatinumEmotions v1.0 starting... 27.12 18:34:13 [Server] INFO Enabling PlatinumEmotions v1.0 27.12 18:34:13 [Server] INFO Hooked with Essentials Economy using Vault 27.12 18:34:12 [Server] INFO Finished updating. 27.12 18:34:12 [Server] INFO Downloading update: 100% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 90% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 80% of 110779 bytes. 27.12 18:34:12 [Server] ERROR Marriage kissing will be disabled! 27.12 18:34:12 [Server] ERROR Marriage is not compatible with the version of minecraft you are using! 27.12 18:34:12 [Server] INFO Enabling Marriage v1.2.5 27.12 18:34:12 [Server] INFO Downloading update: 70% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 70% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 60% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 50% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 40% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 30% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 20% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 10% of 110779 bytes. 27.12 18:34:12 [Server] INFO Downloading update: 0% of 110779 bytes. 27.12 18:34:12 [Server] INFO About to download a new update: QuickSell v1.7.6 27.12 18:34:12 [Server] INFO All Items have been loaded. 27.12 18:34:12 [Server] INFO All Enchantments have been loaded. 27.12 18:34:12 [Server] INFO Enabling CustomEnchantments v2.0 27.12 18:34:11 [Server] INFO Successfully loaded Plugin "QuickSell" 27.12 18:34:11 [Server] INFO QuickSell v1.7.5 has been enabled! 27.12 18:34:11 [Server] INFO Internal Clock is now at 2014-12-27-18-34 27.12 18:34:11 [Server] INFO CS-CoreLib initialized! 27.12 18:34:11 [Server] INFO Successfully loaded! 27.12 18:34:11 [Server] INFO Loading CS-CoreLib... 27.12 18:34:11 [Server] INFO Enabling QuickSell v1.7.5 27.12 18:34:11 [Server] INFO Enabling ServerMarriage v1.0 27.12 18:34:11 [Server] INFO MineCrates v1.0 starting... 27.12 18:34:11 [Server] INFO Enabling MineCrates v1.0 27.12 18:34:11 [Server] INFO Enabled! 27.12 18:34:11 [Server] INFO ...finished loading files and data! 27.12 18:34:11 [Server] INFO Added Milestone: GodApple 27.12 18:34:11 [Server] INFO Added Milestone: Money 27.12 18:34:11 [Server] INFO Added Reward: 2Token 27.12 18:34:11 [Server] INFO Added Reward: Token 27.12 18:34:11 [Server] INFO Setting default command alias: vr 27.12 18:34:11 [Server] INFO Loading all files and data... 27.12 18:34:11 [Server] INFO Hooked into Vault! 27.12 18:34:11 [Server] INFO Hooked into Votifier! 27.12 18:34:11 [Server] INFO Enabling VoteRoulette v2.3.2 27.12 18:34:11 [Server] INFO PrisonCore started 27.12 18:34:11 [Server] INFO Vault found, using it for the economy 27.12 18:34:11 [Server] INFO WorldEdit found, using it for region selection 27.12 18:34:11 [Server] INFO Language file used: english.yml 27.12 18:34:11 [Server] INFO Enabling PrisonSuite v1.3 27.12 18:34:11 [Server] INFO PlatinumEconomy starting... 27.12 18:34:11 [Server] INFO Enabling PlatinumEconomy v1.0 27.12 18:34:11 [Server] INFO Enabling BasicRPG v1.0 27.12 18:34:11 [Server] INFO PlatinumWarps is up and running v1.0! 27.12 18:34:11 [Server] INFO Enabling PlatinumWarpsAlias v1.0 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:182) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.a(MinecraftServer.java:282) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.g(MinecraftServer.java:326) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.n(MinecraftServer.java:352) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlugins(CraftServer.java:380) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin(CraftServer.java:446) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at com.guildlaunch.platinumverse.mineparty.Main.onEnable(Main.java:20) ~[?:?] 27.12 18:34:11 [Server] INFO java.lang.NullPointerException 27.12 18:34:11 [Server] ERROR Error occurred while enabling MineParty v1.0 (Is it up to date?) 27.12 18:34:11 [Server] INFO Enabling MineParty v1.0 27.12 18:34:11 [Server] INFO Enabling Block v1.0 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:182) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.a(MinecraftServer.java:282) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.g(MinecraftServer.java:326) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.n(MinecraftServer.java:352) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlugins(CraftServer.java:380) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin(CraftServer.java:446) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:11 [Server] INFO at com.guildlaunch.platinumverse.statspro.Main.onEnable(Main.java:20) ~[?:?] 27.12 18:34:11 [Server] INFO at com.guildlaunch.platinumverse.statspro.SLAPI.loadStats(SLAPI.java:23) ~[?:?] 27.12 18:34:11 [Server] INFO java.lang.NullPointerException 27.12 18:34:11 [Server] ERROR Error occurred while enabling StatsPro v1.0 (Is it up to date?) 27.12 18:34:11 [Server] INFO Enabling StatsPro v1.0 27.12 18:34:11 [Server] INFO 74 regions loaded for 'Prison' 27.12 18:34:11 [Server] INFO 0 regions loaded for 'Random' 27.12 18:34:11 [Server] INFO 1 regions loaded for 'Factions' 27.12 18:34:11 [Server] INFO 0 regions loaded for 'world_the_end' 27.12 18:34:11 [Server] INFO 0 regions loaded for 'world_nether' 27.12 18:34:11 [Server] INFO 0 regions loaded for 'world' 27.12 18:34:11 [Server] INFO Loaded configuration for world 'Prison' 27.12 18:34:11 [Server] INFO (Prison) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (Prison) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (Prison) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (Prison) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Loaded configuration for world 'Random' 27.12 18:34:11 [Server] INFO (Random) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (Random) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (Random) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (Random) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Loaded configuration for world 'Factions' 27.12 18:34:11 [Server] INFO (Factions) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (Factions) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (Factions) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (Factions) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Loaded configuration for world 'world_the_end' 27.12 18:34:11 [Server] INFO (world_the_end) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (world_the_end) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (world_the_end) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (world_the_end) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Loaded configuration for world 'world_nether' 27.12 18:34:11 [Server] INFO (world_nether) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (world_nether) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (world_nether) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (world_nether) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Loaded configuration for world 'world' 27.12 18:34:11 [Server] INFO (world) Fire spread is UNRESTRICTED. 27.12 18:34:11 [Server] INFO (world) Lava fire is blocked. 27.12 18:34:11 [Server] INFO (world) Lighters are PERMITTED. 27.12 18:34:11 [Server] INFO (world) TNT ignition is PERMITTED. 27.12 18:34:11 [Server] INFO Enabling WorldGuard v5.9 27.12 18:34:11 [Server] INFO Enabling TeleportationPro v1.0 27.12 18:34:11 [Server] WARN An update to PermissionsEx version 1.23 is available to download from http://dev.bukkit.org/bukkit-plugins/permissionsex/. Please review the changes and update as soon as possible! 27.12 18:34:11 [Server] INFO Enabling LogBlock v1.80 27.12 18:34:11 [Server] INFO [Vault][Chat] PermissionsEx_Chat hooked. 27.12 18:34:11 [Server] INFO [Vault][Permission] PermissionsEx hooked. 27.12 18:34:11 [Server] INFO WEPIF: PermissionsEx detected! Using PermissionsEx for permissions. 27.12 18:34:10 [Server] INFO Permissions file successfully reloaded 27.12 18:34:10 [Server] INFO Initializing file backend 27.12 18:34:10 [Server] INFO Enabling PermissionsEx v1.22.6 27.12 18:34:10 [Server] INFO Version 2.5-b691 (API v18) Enabled - By Rigby, fernferret, lithium3141 and main-- 27.12 18:34:10 [Server] INFO 6 - World(s) loaded. 27.12 18:34:09 [Server] INFO Preparing start region for level 5 (Seed: -7897125530385579664) 27.12 18:34:09 [Server] INFO Preparing start region for level 4 (Seed: 9022983876249449482) 27.12 18:34:08 [Server] INFO Preparing start region for level 3 (Seed: 2741733790207005822) 27.12 18:34:07 [Server] INFO [AllPay] - Version 13.0 - hooked into Essentials Economy for Multiverse-Core v2.5-b691 27.12 18:34:07 [Server] INFO Enabling Multiverse-Core v2.5-b691 27.12 18:34:07 [Server] INFO PlatinumTokenShop v1.0 up and running! 27.12 18:34:07 [Server] INFO Enabling PlatinumTokenShop v1.0 27.12 18:34:07 [Server] INFO SimpleSmelt Version 1.1 enabled. 27.12 18:34:07 [Server] INFO Enabling SimpleSmelt v1.1 27.12 18:34:07 [Server] INFO Enabling Buycraft v6.7 27.12 18:34:07 [Server] INFO Using hooks for CraftBukkit v1_7_R3 27.12 18:34:07 [Server] INFO Enabling TagAPI v3.0.6 27.12 18:34:07 [Server] INFO PlatinumShop starting... 27.12 18:34:07 [Server] INFO Enabling PlatinumShop v1.0 27.12 18:34:07 [Server] INFO WEPIF: Using the Bukkit Permissions API. 27.12 18:34:07 [Server] INFO Enabling WorldEdit v5.6.3 27.12 18:34:06 [Server] INFO Version 3.11.0-RC-sMD5NET-b739 is enabled. 27.12 18:34:06 [Server] INFO Packet level access: ProtocolLib is not available. 27.12 18:34:06 [Server] INFO Inventory checks: FastConsume is available, disabled InstantEat. 27.12 18:34:06 [Server] INFO Added block-info for Minecraft 1.7.2 blocks. 27.12 18:34:06 [Server] INFO Added block-info for Minecraft 1.6.1 blocks. 27.12 18:34:06 [Server] INFO Added block-info for Minecraft 1.5 blocks. 27.12 18:34:06 [Server] INFO McAccess set to: 1.7.8|1.7.9 / CB3043 27.12 18:34:05 [Server] INFO Enabling NoCheatPlus v3.11.0-RC-sMD5NET-b739 27.12 18:34:05 [Server] INFO Enabling ChairStairs v1.1 27.12 18:34:05 [Server] INFO Preparing start region for level 2 (Seed: 5124723328553211959) 27.12 18:34:05 [Server] INFO Preparing spawn area: 85% 27.12 18:34:04 [Server] INFO Preparing start region for level 1 (Seed: 5124723328553211959) 27.12 18:34:03 [Server] INFO Preparing spawn area: 63% 27.12 18:34:02 [Server] INFO Preparing start region for level 0 (Seed: 5124723328553211959) 27.12 18:34:02 [Server] INFO Preparing level "world" 27.12 18:34:02 [Server] INFO Enabled Version 1.4.1-b436 27.12 18:34:02 [Server] INFO [Chat] PermissionsEx found: Waiting 27.12 18:34:02 [Server] INFO [Permission] SuperPermissions loaded as backup permission system. 27.12 18:34:02 [Server] INFO [Permission] PermissionsEx found: Waiting 27.12 18:34:02 [Server] INFO [Economy] Essentials Economy found: Waiting 27.12 18:34:02 [Server] INFO Enabling Vault v1.4.1-b436 27.12 18:34:02 [Server] INFO Loading EssentialsChat v2.13.1 27.12 18:34:02 [Server] INFO Loading RegionForSale v2.4 27.12 18:34:02 [Server] INFO Loading EssentialsSpawn v2.13.1 27.12 18:34:02 [Server] INFO Loading RankupPro v1.0.0 27.12 18:34:02 [Server] INFO Loading floAuction v3.0.4 27.12 18:34:02 [Server] INFO Loading Essentials v2.13.1 27.12 18:34:02 [Server] INFO Loading PrisonMine v1.32.106 27.12 18:34:02 [Server] INFO Loading ForceCommand v1.0 27.12 18:34:02 [Server] INFO Loading EssentialsKitManager v1.0.2 27.12 18:34:02 [Server] INFO Loading HolographicDisplays v1.8.6 27.12 18:34:02 [Server] INFO Loading Votifier v1.9 27.12 18:34:02 [Server] INFO Loading NametagEdit v2.4 27.12 18:34:02 [Server] INFO Loading FirstJoinPlus v2.2 27.12 18:34:02 [Server] INFO Loading ClearLag v2.7.2 27.12 18:34:02 [Server] INFO Loading WhatIsIt v1.3.8 27.12 18:34:02 [Server] INFO Loading UnknownMessage v1.0 27.12 18:34:02 [Server] INFO Loading PlatinumEmotions v1.0 27.12 18:34:02 [Server] INFO Loading Marriage v1.2.5 27.12 18:34:02 [Server] INFO Loading CustomEnchantments v2.0 27.12 18:34:02 [Server] INFO Loading QuickSell v1.7.5 27.12 18:34:02 [Server] INFO Loading ServerMarriage v1.0 27.12 18:34:02 [Server] INFO Loading MineCrates v1.0 27.12 18:34:02 [Server] INFO Loading VoteRoulette v2.3.2 27.12 18:34:02 [Server] INFO Loading PrisonSuite v1.3 27.12 18:34:02 [Server] INFO Loading PlatinumEconomy v1.0 27.12 18:34:02 [Server] INFO Loading BasicRPG v1.0 27.12 18:34:02 [Server] INFO Loading PlatinumWarpsAlias v1.0 27.12 18:34:02 [Server] INFO Loading MineParty v1.0 27.12 18:34:02 [Server] INFO Loading Block v1.0 27.12 18:34:02 [Server] INFO Loading StatsPro v1.0 27.12 18:34:02 [Server] INFO Loading WorldGuard v5.9 27.12 18:34:02 [Server] INFO Loading TeleportationPro v1.0 27.12 18:34:02 [Server] INFO ... 24 more 27.12 18:34:02 [Server] INFO at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:292) ~[craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:254) ~[craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at java.net.Socket.&lt;init&gt;(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.Socket.&lt;init&gt;(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.Socket.connect(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.Socket.connect(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.7.0_55] 27.12 18:34:02 [Server] INFO Caused by: java.net.ConnectException: Connection refused 27.12 18:34:02 [Server] INFO at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedPlayerList.&lt;init&gt;(SourceFile:14) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks] 27.12 18:34:02 [Server] INFO at net.minecraft.server.v1_7_R3.PlayerList.&lt;init&gt;(PlayerList.java:68) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    
    Try to find my plugin in that :p
     
  22. Offline

    teej107

    Get the object instance, access any public method! LIKE MAGIC!!!!!!

    Did they give a valid reason? Because that's bull****.
     
  23. Offline

    haydenaa

    Got it, but...
    Doesn't that mean i'm not supposed to access the JavaPlugin methods from a different class then?
     
  24. Offline

    Rocoty

    @haydenaa Pretty sure he meant "instantiate", which is a whole lot different from "initialize". Basically, you should never explicitly create a new instance of your main class, because it makes no sense for you to do so. That's supposed to happen internally in Bukkit once, and only once.
     
    teej107 likes this.
  25. Offline

    teej107

    @Rocoty Yes I did mean that. Correcting my post now.
     
  26. Offline

    mythbusterma

    @haydenaa

    By "poorly referenced," I mean the way you maintain references, i.e. STATIC EVERYTHIGN HIRUURDDRUURR

    Fix that, and we might be able to actually understand what is going on in there.
     
  27. Offline

    haydenaa

    @Rocoty @teej107 then how do I access the JavaPlugin methods from a different class other than my main??
    @mythbusterma why can't you understand it the way it is right now...
     
  28. Offline

    mythbusterma

    @haydenaa

    When developers try to visualise and understand code, they rely on a set of skills that they have honed for years that they use to dissect other people's code.

    Using static references all over the place breaks the flow/structure that experienced developers have come to expect and makes it very difficult for us to understand what you're doing.

    You access them by passing a reference of your JavaPlugin class to your dependent classes.
     
  29. Offline

    1Rogue

  30. Offline

    haydenaa

    @1Rogue so something like...
    Code:
    private Main main;
    public Main(Main instance) {
    this.main = instance;
    }
    public Main() {}
    
    If that works, does it disturb Bukkit and Minecraft's way of accessing the plugin through the predefined constructor, or not?
     
Thread Status:
Not open for further replies.

Share This Page