예제 #1
0
 private void registerEvents() {
   eventManager.register(
       ObservesEvent.class,
       new EventObserver<ObservesEvent>() {
         @Override
         public void trigger(ObservesEvent event) {
           target.observes(event);
         }
       });
   eventManager.register(
       Object.class,
       new EventObserver<Object>() {
         @Override
         public void trigger(Object event) {
           target.observes(event);
         }
       });
 }
예제 #2
0
  @Test
  public void testUnregister() {
    TargetEventTriggered trigger = new TargetEventTriggered();
    eventManager.register(ObservesEvent.class, trigger);
    eventManager.unregister(trigger);

    eventManager.trigger(new ObservesEvent());

    assertFalse(trigger.isTriggered());
  }
예제 #3
0
  @Override
  public void onEnable() {
    we = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
    try {
      am.load();
    } catch (IOException | InvalidConfigurationException ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
    gm.load();
    cm.register();
    em.register();
    sm.load();
    prefix = ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix"));

    String spawnWorldName = getConfig().getString("spawn.world");
    if (spawnWorldName != null) {
      World spawnWorld = getServer().getWorld(spawnWorldName);
      if (spawnWorld != null) {
        spawn = spawnWorld.getSpawnLocation();
      }
    }
  }