Tagging other players

Discussion in 'Plugin Development' started by zorro1o1, Nov 4, 2013.

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

    zorro1o1

    Hello there bukkit community!

    I am a LITTLE (by little i really mean little) new to coding in bukkit and I have been giving up a lot of my time working and learning how to code.
    I was wondering, How can i possibly tag a player and do an event if he gets tagged by another player?

    Anyone got a good eh? Thanks!
     
  2. Offline

    Twisted_Panda

    Have you even tried?
     
  3. Offline

    zorro1o1

    Twisted_Panda
    Indeed I did, I spent 4 hours straight looking for tutorials, through other plugin's source codes. I even looked it up on bukkit documentation. I did everything. *Sigh*
     
  4. Offline

    Mathias Eklund

    What do you mean by tagged?
     
  5. Offline

    zorro1o1

    Mathias Eklund
    For example, If I punch steve using my first, I get tagged and I cant do any commands for a limited time (5-10 second)
     
  6. Offline

    tyler53


    I would use a config file that stores players names and information about them. That way you could have booleans like "hasBeenPunched" or "allowedToUseCommands" and set those to true or false in the config file on events in your code, and then check them whenever the player uses a command
     
  7. Offline

    Mathias Eklund

    public void onPlayerHit(EntityDamageByEntityEvent event)
     
    tyler53 likes this.
  8. Offline

    amhokies

  9. Offline

    zorro1o1

  10. zorro1o1
    You can add the tagged players to an array list. If they are "tagged", check the list and see if they are in it, then do what you want with that. If the list doesn't contain the player, add them and then you can do something like say "Bob has been tagged and is now it!"
     
  11. Offline

    PatrickH123

    Exactly what I was going to say, but you were first.
     
  12. :p
     
  13. Offline

    zorro1o1

    The Gaming Grunts
    PatrickH123
    I am a little confused now eh,
    So in conclusion the code I shall use is the following:
    public void onPlayerHit(EntityDamageByEntityEvent event)

    If it is wrong could anyone possibly correct it? :3
     
  14. zorro1o1
    Yes then use what I told you before :p
     
  15. Offline

    sgavster

    Use EntityDamageByEntityEvent. Make an arraylist, check if they're not in the arraylist, add them, if someone punches them back that isn't in the arraylist remove them from the arraylist, and add the person who punched the player that was in the arraylist to the arraylist.
     
Thread Status:
Not open for further replies.

Share This Page