[Easy] Toggle command

Discussion in 'Plugin Development' started by foldagerdk, Jan 30, 2013.

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

    foldagerdk

    Thanks for taking a look on this!

    I have tried to add a toggle command to my plugin, but I know that I am failing horribly. I am not sure where I failed exactly, but I hope you guys can give a hand.

    The toggle is in Orelis btw.
    The plugin registers fine, and the command works (sends the error msg specified in plugin.yml)

    Class: Orelis
    http://pastebin.com/L4jeMw9k
    Class: Notif
    http://pastebin.com/uhkj4BMe
    PDF: plugin.yml
    http://pastebin.com/deT7UwCu
     
  2. Offline

    slater96

    foldagerdk
    Instead of using a HashMap with <Player, Boolean>, use a HashSet with <String> which will be for the players name. By storing the Player object you can run into memory leak issues so it's best to use the string and then if you need the player do Player p = Bukkit.getPlayer("player");
    Then if the players name is not in the HashSet, put it in and say that it is enabled, and if they do the command and are in the HashSet, then take them out and disable the toggle.
     
  3. Offline

    foldagerdk

    Thanks man!
    I will try changing the code and checking again
     
Thread Status:
Not open for further replies.

Share This Page