Sending message to all players in hashmap

Discussion in 'Plugin Development' started by RuthlessRage, Apr 6, 2015.

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

    RuthlessRage

    i can do this when i have the players names as strings but for this project it has to be their uuids...


    for(Player p2 : Bukkit.getOnlinePlayers()) {
    if(plugin.claymore.containsKey(p2.getUniqueId())){



    p2.sendMessage("yourgay");



    this code will only send the message to one onlne player please help
     
  2. Offline

    nverdier

  3. Offline

    RuthlessRage

    @nverdier i'm adding it when the player types the command /test (playername)
    it then saves the player who types command as key and the player who is (playername) as value
    the hashmap is claymore(UUID, UUID)
     
  4. Offline

    nverdier

    @RuthlessRage So only one person has used '.test'... Can you please post all code?
     
  5. Offline

    RuthlessRage

    @nverdier must i past my code.... say a layer does /test (playername)
    5 times then there should be 5 playernames associated with his name. what i want is to send all 5 of those layers a message that theyre in the hashmap. i don't really have an idea what i will use this for in the future, but its something i was wondering
     
  6. Offline

    nverdier

    @RuthlessRage Well are you sure everybody is being added to the HashMap? Please post all code.
     
  7. Offline

    RuthlessRage

    wam i the only one that has to wait for a moderator to approve my post before it gets posted?!?! they take so long...anyways im not sure it may only be putting one player in the hashmap and thats why i only one layer get the "your happy'' message. ths is how i put them in
    @nverdier

    Code:
    for(Player p1 : Bukkit.getOnlinePlayers())                                         {
        if(p1.getLocation().distance(lk.getClickedBlock().getLocation()) <= 15){
         
     
           plugin.claymore.put(p1.getUniqueId(), plugin.name.get(locationofblock));
        

    {{Edited by Myrathi: Try not to be offensive in your posts. Also, no you're not.}}
     
    Last edited by a moderator: Apr 6, 2015
  8. Offline

    Zombie_Striker

  9. Offline

    Gater12

  10. Offline

    Zombie_Striker

    Also, did you Debug?

    [edit] Ninja'd
     
  11. Offline

    RuthlessRage

  12. Offline

    8jy89hui

    Last edited: Apr 7, 2015
  13. Offline

    RuthlessRage

    @8jy89hui cause the last time i did that someone literally copied it. then like 2 days later asked a question about adding something to my same code...
    and i alreayd posted main parts of my code which is all you really need to awnser my question...
     
  14. Online

    timtower Administrator Administrator Moderator

  15. Offline

    SuperOriginal

    @RuthlessRage
    If your current code was worth copying you probably wouldn't be asking this question in the first place.
     
    nverdier and dlange like this.
  16. Offline

    Tecno_Wizard

  17. Offline

    RuthlessRage

    @timtower @SuperOriginal @Tecno_Wizard i develop for craft realms,cosmiccraft, and guildcraft and i get big bucks to do so. My mind has never ending ideas so i'm always making something better. My codes are one of a kind anything i ask on here is an example of the code i have. Too many people come on here just to copy and paste when they dont know what there doing. i post on here so i can further my knowledge and so other people who view this forum can learn a thing or two.

    say a layer does /test (playername)
    5 times wit different playernames each time ,then there should be 5 playernames associated with his name. what i want is to send all 5 of those players a message that they're in the hashmap. the asmap for thisis Hashmap(uuid, uuid) the key is the player whos running the command and the value is the (playername) the person who does the command typed.. this is as simple as possible if you still need code to understand what im reffering to dont even bother replying
    HERE IS THE CODE IM TRYING TO USE:

    Code:
    for(Player p2 : Bukkit.getOnlinePlayers()) {
    if(plugin.fire.containsKey(p2.getUniqueId())){
    p2.sendMessage("yourgay");
    
     
    Last edited: Apr 7, 2015
  18. Offline

    SuperOriginal

    Nobody here cares who you work for. You need to show the code that has your problem or nobody can help you. This snippet is useless.
     
    Last edited: Apr 7, 2015
    bwfcwalshy likes this.
  19. Offline

    RuthlessRage

    @SuperOriginal 1. you don't speak for everyone

    2."this is as simple as possible if you still need code to understand what im reffering to dont even bother replying"

    what part of this dont you understand
     
    Last edited: Apr 7, 2015
  20. Offline

    Msrules123

    None of us are omniscient. Stop trying to treat us that way. If you don't post your code, you are basically asking for help from a brick wall. Nothing can be done, and it wastes everyone's time.

    Also, if you really develop for big bucks, I doubt you wouldn't know how to properly use a hashmap.
     
  21. Offline

    SuperOriginal

    We don't need more code to understand what you're doing. We need more code to help you. But if you are going to act this hotheaded and stubborn you're not going to get any more replies.

    So again,
     
  22. Offline

    dlange

    @RuthlessRage there is no need to get aggressive towards a community that is trying to help you solve the problem that you asked the to help you solve.
     
Thread Status:
Not open for further replies.

Share This Page