Exemplo n.º 1
0
 public void onUse(Player player) {
   ItemBehavior ib = ScriptManager.instance().getItemBehavior(behavior);
   if (ib != null) {
     try {
       ib.onUse(player, this);
     } catch (Exception e) {
       log.log(Level.SEVERE, "Exception in onUse: " + e.getMessage(), e);
     }
   }
 }
Exemplo n.º 2
0
 public void setBehavior(String behavior) {
   this.behavior = behavior;
   ItemBehavior ib = ScriptManager.instance().getItemBehavior(behavior);
   if (ib != null) {
     try {
       ib.onBehaviorChange(this);
     } catch (Exception e) {
       log.log(Level.SEVERE, "Script error in onBehaviorSet: " + e.getMessage(), e);
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public void onLoad() {
   ItemBehavior ib = ScriptManager.instance().getItemBehavior(behavior);
   if (ib != null) {
     try {
       ib.onLoad(this);
     } catch (Exception e) {
       log.log(Level.SEVERE, "Script error in onLoad: " + e.getMessage(), e);
     }
   }
 }
Exemplo n.º 4
0
 public Item(long serial, int graphic, String behavior) {
   super(serial);
   this.graphic = graphic; // might be overridden by onCreate
   this.behavior = behavior;
   ItemBehavior ib = ScriptManager.instance().getItemBehavior(behavior);
   if (ib == null) {
     throw new UnsupportedOperationException("invalid behavior");
   } else {
     try {
       ib.onCreate(this);
     } catch (Exception e) {
       log.log(Level.SEVERE, "Script error in onCreate: " + e.getMessage(), e);
       delete();
     }
   }
   setBasicAttributes();
 }