Make a link between two events

Discussion in 'Plugin Development' started by 4z3rty, Jun 26, 2012.

  1. Offline

    4z3rty

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi,
    I have two events :
    Code:
    public void tapeCommand(PlayerCommandPreprocessEvent e){ ... }
    public void ouvreCoffre(PlayerInteractEvent e){ ... }
    I would like to execute my code in the second event if the command was typed.
    I have tried to link the two with a variable but once the order has been entered all players can use the second part.

    I hope I was clear ^^

    This post has been edited 2 times. It was last edited by 4z3rty Jun 26, 2012.
  2. Offline

    kumpelblase2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Tried doing a separate method that gets passed over all the variables that you need and both events can offer?
  3. Offline

    4z3rty

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm newbie to java, I start ...
    Can you write a few lines of code?
  4. Offline

    caldabeast

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Code:java
    1.  
    2. public void event1(Event e){
    3. run(e.getPlayer);
    4. }
    5. public void event2(Event e){
    6. run(e.getPlayer);
    7. }
    8. public void run(Player p){ //and any other information you can get from both events that you may need
    9. }
    10.  
    ferrybig likes this.
  5. Offline

    4z3rty

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I don't understand, can you me explain a little ?

Share This Page