Need help with one part

Discussion in 'Plugin Development' started by _Doc__, Mar 13, 2016.

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

    _Doc__

    I am having a problem where i can get my plugin to run 1/3 of the command function that it needs to. I am trying to make a shinyall command for my pixelmon server i have gotten the command to run the /pokegive command but i need it to find the player name to put in to the command then do it for everyone else that is on the server, so i need so the when I or any other person has the permission types /shinyall it will run the /pokegive <player> random s for every player on the server, i have gotten it where it will run the command for just me but it will not replace the <player>. here is what i have so far, https://gyazo.com/c65555a2570b47f6b8eb8a5e64429be9 any suggestions?
     
  2. Offline

    Zombie_Striker

    @_Doc__
    1. Please either post the code here or in Pastebin.com. Images are not that helpful.
    2. Unless the exact phrase "<player>" is supposed to be the first arg, I think you want the "player.getName" to replace that line. Either do that while creating the string, or use String.replace() to create a new string with the player's name.
    3. To do this for every player online, you will need to for loop through all the player's online, get their names, and send the command.
     
  3. Offline

    87pen

    When someone runs the command, Loop through every player on the server after grabbing a players name, "pokegive " +playername+ "random s"

    psych Ninja'd
     
  4. Offline

    xXkguyXx

    Arighty, well like @87pen said you should loop trew all the online players

    So what your going to want to do it loop trew all the online players how you would do this is using a loop.
    What this will do it loop trew the collection(like a arraylist, a collection, etc).
    So the variable you would use would be on the left of the :, and the collection or arraylist on the right, so what this is doing is setting the variable on the left to something on the right that was in the collection or arraylist and in the brackets, you can run code for that variable.
    I would recommend doing somthing like this:

    Code:
    for (Player online : Bukkt.getServer().getOnlinePlayers() {
    // code here
    }
     
    Last edited: Mar 14, 2016
  5. Offline

    Zombie_Striker

  6. Offline

    xXkguyXx

  7. Offline

    87pen

    @xXkguyXx If it's possible to copy and paste the code you give into their plugin, then thats spoonfeeding, they won't learn and will come back later if you spoonfeed. Telling them what their problem is and what to do so they can figure it out solves more problems than posting the code.
     
  8. Offline

    xXkguyXx

    Aright I'll edit my post :)
     
Thread Status:
Not open for further replies.

Share This Page