Solved Event question

Discussion in 'Plugin Development' started by tkuiyeager1, Aug 23, 2015.

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

    tkuiyeager1

    hi everyone,
    someone know how can i choose a player from the args[0] of the command in event.
    example: /test <Player Name>.
    how can i get this player name in to the event?

    thanks for reading
     
  2. Offline

    stefvanschie

    @tkuiyeager1 If I understand you're question right you mean something like this:
    Code:
    Player target = Bukkit.getPlayerExact(args[0]);
     
  3. Offline

    tkuiyeager1

    yes, i mean this, but i need to take the target on eventhandler
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    tkuiyeager1

    InventoryClickEvent
     
  6. Online

    timtower Administrator Administrator Moderator

    @tkuiyeager1 Based on what you told: you probably named the item something, you can use that
     
  7. Offline

    tkuiyeager1

    no, i want when the player click an item in the inventory so something will happend to the target player
     
  8. Online

    timtower Administrator Administrator Moderator

    @tkuiyeager1 Then you need to store the player name or uuid somewhere.
     
  9. Offline

    tkuiyeager1

    can you show me an example?
     
  10. Online

    timtower Administrator Administrator Moderator

  11. Offline

    tkuiyeager1

    @timtower can you send a code example? im kind of new to making plugins
     
    Last edited: Aug 23, 2015
  12. Online

    timtower Administrator Administrator Moderator

    @tkuiyeager1 Fields are java, not bukkit.
    Hashmaps, lists, string, integer, you name it.
    I won't spoon feed.
     
  13. Offline

    tkuiyeager1

  14. Offline

    SkyleTyler1337

    @tkuiyeager1 why don't you try. If you don't understand anything just post it in here?
     
  15. Offline

    MCMatters

  16. Offline

    boomboompower

    You could at least do a very small example.

    @tkuiyeager1 I would give you an example but I don't do those kinds of plugins.
     
  17. Offline

    tkuiyeager1

    @MCMatters i don't need who clicked. Let's say the command is /test <player name>, so I need to take this player name to the event and I don't know how
     
  18. Online

    timtower Administrator Administrator Moderator

    Been there, done that, didn't like it.


    @tkuiyeager1 Store the name in a hashmap, wait for the click, on the click: get the name from the hashmap and use it wherever you need it
     
  19. Offline

    tkuiyeager1

    Ok I'll try that later thanks.

    EDIT:

    And Thank you @boomboompower
     
  20. Offline

    boomboompower

    @tkuiyeager1 Are you trying to make a messaging plugin?
     
  21. Offline

    tkuiyeager1

    @boomboompower no, its for my plugin you can look at him on my profile, his name is FakeAlerts, i already solved the problem with my friend help.
     
Thread Status:
Not open for further replies.

Share This Page