Explosive Arrow Toggle

Discussion in 'Plugin Development' started by XxZHALO13Xx, Aug 18, 2014.

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

    XxZHALO13Xx

    How would i make a explosive arrow toggle? And they can only toggle if they have permission "arrow.donor" if they dont have permission its disabled, Thanks
     
  2. Offline

    Forseth11

    XxZHALO13Xx
    When use an arrow hit event and check if the shooter is a player.
    Then check if they player has the permission.
    If they have it make the explosion.
     
  3. Offline

    bennie3211

    and for the toggle, add the player to a list when the explosions should be done, else remove them :)
     
  4. Offline

    XxZHALO13Xx

  5. Offline

    Forseth11

    I am not going to write out all the code. Do you have ProjectileHitEvent? If not make that event and check if the projectile is an Arrow.

    Also by toogle do you mean /toggleArrowExplode or just where donors get it and players don't?
     
  6. Offline

    Dubehh

    XxZHALO13Xx

    Add the UUID of the shooter to an Arraylist,
    Code:java
    1. ArrayList<UUID> toggle = new ArrayList<UUID>();

    The toggler should be something like this:
    Code:java
    1. if(toggle.contains(thePlayersUUID){
    2. toggle.remove(thePlayersUUID);
    3. else{
    4. toggle.add(thePlayersUUID);


    For the explosion, check if the shooter (uuid) is in the arraylist, if so, create an explosion on the location where the projectile landed (ProjectileHitEvent) using TheProjectile.getWorld().createExplosion(something);

    EDIT: I think the toggle can be much easier than 4 lines of code, must look into that.

    PS: I didn't write actual methods because I shouldn't spoonfed you. But just follow the steps.
     
  7. Offline

    bennie3211

    If this is new for you, you should start with learning the basics of Java before you start working with the Bukkit API
     
    Dubehh likes this.
  8. Offline

    fireblast709

    Dubehh HashSet please :3. Same code (aside the collection), more efficient.
     
  9. Offline

    joeygallegos

    Since you're so dearly obsessed with everything Turqmelon related, watch his other videos about permissions and then just learn to store a player name (String) in the List. It took me all of 5 minutes to make the other day. XxZHALO13Xx
     
Thread Status:
Not open for further replies.

Share This Page