Solved Problem with KillForMoney plugin.

Discussion in 'Plugin Development' started by MM1990d, Nov 1, 2012.

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

    MM1990d

    Hi, I created this plugin for my friend's pvp server. When I'm killing someone with permission kfm.czarodziej.5 I should get 5$ and a message. But it doesn't work. Can you please check what is wrong? (No errors in console)I know it's a long code, but it repeats.

     
  2. Offline

    ZeusAllMighty11

    In your onEnable() method, put

    PluginManager pm = Bukkit.getPluginManager();
    pm.registerEvents(this, this);
     
  3. Offline

    MM1990d

    But there will be Syntax error on tokens error.
     
  4. Offline

    ZeusAllMighty11

    what? lol
     
  5. Offline

    fireblast709

    He is probably making a typo somewhere, like ',' instead of '.', etc
     
    ZeusAllMighty11 likes this.
  6. Offline

    MM1990d

    in eclipse and console.

     
  7. Offline

    ZeusAllMighty11

    Place in onEnable method, don't forget to import. Works fine.
     
  8. Offline

    MM1990d

    Oh god, I'm idiot. I placed it in wrong place, thanks.

    There are wrong arguments. (this, this) = (plugin, plugin) but it should be (listener, plugin)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  9. Offline

    ZeusAllMighty11


    this is your listener class (if you only have 1 class)
    2nd this is plugin variable. I never use it, I just use this this
     
  10. Offline

    the_merciless

    He has a seperate listener class here

    Your main class should look like this.

    Code:
    public class KillForMoneyMain extends JavaPlugin {
    final Player listener = new Player(); //although i would change the name of this class as Player() will prob cause errors
    private Logger logger = Logger.getLogger("Minecraft");
     
    public void onDisable()
    {
     
    PluginDescriptionFile pdfFile = getDescription();
    this.logger.info("[" + pdfFile.getName() + "] v"+ pdfFile.getVersion() + "Disabled.");
    }
    public void onEnable()
    {
    getServer().getPluginManager().registerEvents(this.listener, this);
    PluginDescriptionFile pdfFile = getDescription();
    this.logger.info("[" + pdfFile.getName() + "] v"+ pdfFile.getVersion() + " Enabled.");
    setupEconomy();
    setupPermissions();
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
    MM1990d likes this.
  11. Offline

    MM1990d

    Thank you!
     
  12. Offline

    the_merciless

    I see you are using the for loop i suggested for the permissions, is that working out ok?
     
    MM1990d likes this.
  13. Offline

    MM1990d

    Yeah, great :) Thanks for this too.
     
Thread Status:
Not open for further replies.

Share This Page