Execute a command once

Discussion in 'Plugin Development' started by Mig_B, Jun 24, 2013.

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

    Mig_B

    Hello bukkit!

    I have made this plugin where it sorts the player into one of the 4 groups on join. But when they rejoin it re-executes the command again which puts them in a different group. I want them to execute the command on first join then after if they join hey'll always stay in the same group.
     
  2. Offline

    jackwilsdon

    You need to add the user to a config the first time they join, and check whether they're in it every time they join. If they are in the list, don't set their group. Do you have groups saved to a config? Otherwise every time the server restarts or is reloaded, groups will be lost. If you have groups saved to a config, check if the user is in a group before setting it on join
     
  3. Offline

    Mig_B

    Like an arraylist or something?

    Can you put an example of what you mean because i understand partially
     
  4. Offline

    jackwilsdon

    First of all, how are your groups saved? Do you write them to file?
     
  5. Offline

    Mig_B

    Nope not at all, the groups are set using a command, like when they join, it puts a random leather colored chestplate that is not removable. I need so when they join again it doesnt redo it. (I am on my iphone) excuse me for spelling.
     
  6. Offline

    jackwilsdon

    Well, when the server restarts, are the groups not lost?
     
  7. Offline

    Mig_B

    They are not lost because it puts an armor on. I have setup some ArrayList for each of the group but i don't know how to store them into a yaml
     
  8. Offline

    jackwilsdon

    You should take a look at the Configuration API for saving your stuff. Iterate through each group and save them to the config.
     
  9. Offline

    Mig_B

    Ok thanks :p
     
Thread Status:
Not open for further replies.

Share This Page