Complicated attacks.

Discussion in 'Plugin Development' started by MagmaticBacca, Oct 22, 2015.

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

    MagmaticBacca

    Im making a plugin where you have a ghast tear and when you right click it it gives you an item, but it has a cooldown, and there is a runnable that checks if that player has said item, if it does it makes particles around them, if that player hits another player with that said item, it does stuff and the item is replaced with another ghast tear which now has a cooldown. i have been working on this for a while now and im not asking for code (but it would save some time) just a little push to how to get this working in an organized manner.
     
  2. Offline

    teej107

    @MagmaticBacca So can you simplify your explanation so I don't have to decipher a wall of text?
     
  3. @MagmaticBacca You don't need to give the player another ghast tear, you can store the player on the cooldown instead, something like:

    class Runnable {

    ConcurrentSet Cooldowns

    run() {
    for (Cooldown : list)
    if (!tick()) list.remove(cooldown);
    }

    remove(cooldown cooldown) {
    list.remove(cooldown)
    }

    }

    class Cooldown {

    Player player;
    Integer cooldown;

    constructor(Player, Integer);

    boolean tick() {
    if (cooldown > 0 && player.inventory.hasTear()) cooldown--;
    else return false;
    //Do Particles
    return true;
    }

    }
     
  4. Why you need a runnable ? Just store the UUID and the millies from when the player used it and then check the time difference
     
  5. Offline

    Lolmewn

    What have you tried?
     
  6. Offline

    MagmaticBacca

    To simplify: Right click ghast tear, has no cooldown, gives item, checks if item is in hand,if so play particles, if hits player with item does stuff, removes item and partivcles, gives ghast tear, ghast tear now has cool down


    @Juancomaster1998 thanks thats a way better runnable than mine.

    @MaTaMoR_ thanks for the tip.
    Ill report back if there are complications
     
Thread Status:
Not open for further replies.

Share This Page