当前位置: 首页>>代码示例>>Java>>正文


Java ModEvent类代码示例

本文整理汇总了Java中ethanjones.cubes.core.mod.event.ModEvent的典型用法代码示例。如果您正苦于以下问题:Java ModEvent类的具体用法?Java ModEvent怎么用?Java ModEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModEvent类属于ethanjones.cubes.core.mod.event包,在下文中一共展示了ModEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
protected void init() {
  for (Method method : mod.getClass().getMethods()) {
    if (method.getAnnotation(ModEventHandler.class) != null) {
      boolean error = false;
      if (Modifier.isStatic(method.getModifiers())) {
        Log.error("Methods annotated with " + ModEventHandler.class.getSimpleName() + " must not be static");
        error = true;
      }
      if (method.getParameterTypes().length != 1 || method.getParameterTypes()[0].getSuperclass() != ModEvent.class) {
        Log.error("Methods annotated with " + ModEventHandler.class.getSimpleName() + " must have only one parameter which must be the " + ModEvent.class.getSimpleName() + " instance");
        error = true;
      }
      if (error) {
        Log.error("Mod:" + name + " Class:" + mod.getClass().getName() + " Method:" + method);
        continue;
      }
      modEventHandlers.put(method.getParameterTypes()[0].asSubclass(ModEvent.class), method);
    }
  }
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:21,代码来源:JavaModInstance.java

示例2: postModEvent

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
public static void postModEvent(ModEvent modEvent) {
	synchronized (currentMod) {
		Log.debug("Posting " + modEvent.getClass().getSimpleName());
		for (ModInstance mod : mods) {
			currentMod = mod;
			try {
				mod.event(modEvent);
			} catch (Exception e) {
				mod.addState(ModState.Error);
				currentMod = null;
				throw new CubesException(
						"Exception while posting " + modEvent.getClass().getSimpleName() + " to mod " + mod.name,
						e);
			}
		}
		currentMod = null;
		Log.debug("Finished posting " + modEvent.getClass().getSimpleName());
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:20,代码来源:ModManager.java

示例3: event

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
protected void event(ModEvent modEvent) throws Exception {
  Method method = modEventHandlers.get(modEvent.getClass());
  if (method == null) {
    Log.debug("No method to handle " + modEvent.getClass().getSimpleName() + " in mod " + name);
    return;
  }
  addState(modEvent.getModState());
  Log.debug("Posting " + modEvent.getClass().getSimpleName() + " to mod " + name);
  method.invoke(mod, modEvent);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:JavaModInstance.java

示例4: event

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
@Override
protected void event(ModEvent modEvent) throws Exception {
	if (modEvent instanceof PreInitializationEvent)
		JsonLoader.firstStage(map);
	if (modEvent instanceof InitializationEvent)
		JsonLoader.secondStage(map);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:8,代码来源:JsonModInstance.java

示例5: postModEvent

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
public synchronized static void postModEvent(ModEvent modEvent) {
  Log.debug("Posting " + modEvent.getClass().getSimpleName());
  for (ModInstance mod : mods) {
    currentMod = mod;
    try {
      mod.event(modEvent);
    } catch (Exception e) {
      mod.addState(ModState.Error);
      currentMod = null;
      throw new CubesException("Exception while posting " + modEvent.getClass().getSimpleName() + " to mod " + mod.name, e);
    }
  }
  currentMod = null;
  Log.debug("Finished posting " + modEvent.getClass().getSimpleName());
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:16,代码来源:ModManager.java

示例6: JavaModInstance

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
public JavaModInstance(String name, FileHandle file, AssetManager assetManager, T mod) {
  super(name, file, assetManager);
  this.mod = mod;
  modStates = new ArrayList<ModState>();
  modEventHandlers = new HashMap<Class<? extends ModEvent>, Method>();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:7,代码来源:JavaModInstance.java

示例7: event

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
@Override
protected void event(ModEvent modEvent) throws Exception {
  if (modEvent instanceof PreInitializationEvent) JsonLoader.firstStage(map);
  if (modEvent instanceof InitializationEvent) JsonLoader.secondStage(map);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:6,代码来源:JsonModInstance.java

示例8: event

import ethanjones.cubes.core.mod.event.ModEvent; //导入依赖的package包/类
protected abstract void event(ModEvent modEvent) throws Exception; 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:2,代码来源:ModInstance.java


注:本文中的ethanjones.cubes.core.mod.event.ModEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。