示例#1
0
文件: Item.java 项目: macfusion/uosl
 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);
     }
   }
 }
示例#2
0
文件: Item.java 项目: macfusion/uosl
 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);
     }
   }
 }
示例#3
0
文件: Item.java 项目: macfusion/uosl
 @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);
     }
   }
 }
示例#4
0
文件: Item.java 项目: macfusion/uosl
 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();
 }