Configuration issue!

Discussion in 'Plugin Development' started by Zarkopafilis, Aug 5, 2013.

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

    Zarkopafilis

    Error log :
    http://pastebin.com/QUC8z66n
    My listener class:
    Code:
    public class FirstTimeItems implements Listener{
     
        @EventHandler
        public void onFirstTimePlayerJoin(PlayerJoinEvent e){
           
            Player p = e.getPlayer();
            Main m = new Main();
           
            if(!p.isOp() && !p.hasPlayedBefore()){
                p.getInventory().addItem(m.newItem(new ItemStack(Material.getMaterial(m.getConfig().getString("starterWeapon"))), m.getConfig().getString("starterWeaponName")));
                p.getLocation().setX(m.getConfig().getInt("fx"));
                p.getLocation().setY(m.getConfig().getInt("fy"));
                p.getLocation().setZ(m.getConfig().getInt("fz"));
            }else{
                p.getLocation().setX(m.getConfig().getInt("sx"));
                p.getLocation().setY(m.getConfig().getInt("sy"));
                p.getLocation().setZ(m.getConfig().getInt("sz"));
            }
        }
    Mah config file:
    http://pastebin.com/irE4T3Rj
    Mah onEnable():
    Code:
    public void onEnable(){
            this.saveDefaultConfig();
            manager = RemoteEntities.createManager(this);
            registerEvents();
            }
     
  2. Offline

    Robotia

    Try adding this to onEnable()
    Bukkit.getPluginManager().registerEvents(this, this);
     
  3. Offline

    Zarkopafilis

    it is on registerEvents()
     
  4. Offline

    Harry5573

    Add a config.yml to where your plugin.yml is and then onEnable() add saveDefaultConfig() like this

    Code:
    public void onEnable() {
    saveDefaultConfig();
    }
     
    Zarkopafilis likes this.
  5. Offline

    Syd

    You create a new Instance of Main, which is obviously not registered and intialized by Bukkit.

    Just hand over the instance of your Main class via the constructor of your Listener...
     
Thread Status:
Not open for further replies.

Share This Page