Пример #1
0
 /**
  * Registers the full and simple class name of the specified event and sets the default priority
  * of the event class.
  *
  * @param event an event belonging to the event class to register the class name for etc.
  */
 private void registerEventNames(Event event) {
   if (!HiddenAccess.isCriticalEvent(event)) {
     HiddenAccess.setDefaultPriority(event);
   }
   final Class<?> type = event.getClass();
   eventNames.put(type.getName(), event); // full name with package name
   eventNames.put(type.getSimpleName(), event); // only the class name
 }
Пример #2
0
  /**
   * Registers the full and simple class names of all events used by {@link
   * #getEventPriority(String)} and {@link #setEventPriority(String, int)} and sets the default
   * priority of each event class.
   */
  private void registerEventNames() {
    eventNames = new Hashtable<String, Event>();
    dummyScannedRobotEvent = new ScannedRobotEvent(null, 0, 0, 0, 0, 0);
    registerEventNames(new BattleEndedEvent(false, null));
    registerEventNames(new BulletHitBulletEvent(null, null));
    registerEventNames(new BulletHitEvent(null, 0, null));
    registerEventNames(new BulletMissedEvent(null));
    registerEventNames(new DeathEvent());
    registerEventNames(new HitByBulletEvent(0, null));
    registerEventNames(new HitRobotEvent(null, 0, 0, false));
    registerEventNames(new HitWallEvent(0));
    registerEventNames(new KeyPressedEvent(null));
    registerEventNames(new KeyReleasedEvent(null));
    registerEventNames(new KeyTypedEvent(null));
    registerEventNames(new MessageEvent(null, null));
    registerEventNames(new MouseClickedEvent(null));
    registerEventNames(new MouseDraggedEvent(null));
    registerEventNames(new MouseEnteredEvent(null));
    registerEventNames(new MouseExitedEvent(null));
    registerEventNames(new MouseMovedEvent(null));
    registerEventNames(new MousePressedEvent(null));
    registerEventNames(new MouseReleasedEvent(null));
    registerEventNames(new MouseWheelMovedEvent(null));
    registerEventNames(new PaintEvent());
    registerEventNames(new RobotDeathEvent(null));
    registerEventNames(new RoundEndedEvent(0, 0, 0));
    registerEventNames(dummyScannedRobotEvent);
    registerEventNames(new SkippedTurnEvent(0));
    registerEventNames(new StatusEvent(null));
    registerEventNames(new WinEvent());

    // same as any line above but for custom event
    final DummyCustomEvent customEvent = new DummyCustomEvent();
    eventNames.put("robocode.CustomEvent", customEvent); // full name with package name
    eventNames.put("CustomEvent", customEvent); // only the class name
  }