Advertisement
Brord

Event usage

Apr 9th, 2019
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1.     account.getEventManager().registerListener(new AccountListener(account));
  2.  
  3.     private class AccountListener implements EventListener {
  4.         private IotaAccount account;
  5.  
  6.         public AccountListener(IotaAccount account) {
  7.             this.account = account;
  8.         }
  9.        
  10.         @AccountEvent
  11.         public void confimed(EventTransferConfirmed e) {
  12.             System.out.println("account: " + account.getId());
  13.             System.out.println("confimed: " + e.getBundle().getBundleHash());
  14.         }
  15.        
  16.         @AccountEvent
  17.         public void promoted(EventPromotion e) {
  18.             System.out.println("account: " + account.getId());
  19.             System.out.println("promoted: " + e.getPromotedBundle());
  20.         }
  21.        
  22.         @AccountEvent
  23.         public void reattach(EventReattachment e) {
  24.             System.out.println("account: " + account.getId());
  25.             System.out.println("reattach: " + e.getNewBundle());
  26.         }
  27.        
  28.         @AccountEvent
  29.         public void sent(EventSentTransfer e) {
  30.             System.out.println("account: " + account.getId());
  31.             System.out.println("sent transfer: " + e.getBundle().getBundleHash());
  32.         }
  33.        
  34.         @AccountEvent
  35.         public void received(EventReceivedMessage e) {
  36.             System.out.println("account: " + account.getId());
  37.             System.out.println("message: " + e.getMessage());
  38.         }
  39.        
  40.         @AccountEvent
  41.         public void input(EventNewInput e) {
  42.             System.out.println("account: " + account.getId());
  43.             System.out.println("newInput: " + e.getAddress());
  44.         }
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement