Beispiel #1
0
  @Override
  public void onEnable() {
    log = getLogger();
    PluginManager pm = getServer().getPluginManager();

    Config.init(this);
    ColorConfig.init(this);

    setupVault();

    Config.setup();
    ColorConfig.setup();

    getCommand(Commands.getMain()).setExecutor(commands);

    setupMetrics();
  }
  // Preinitialisation Event
  @PreInit
  public void preInit(FMLPreInitializationEvent event) throws Exception {
    logger.setParent(FMLLog.getLogger());
    try {
      if (CoreLoadingPlugin.callBack()) {
        CraftMineCore.logger.info("nintendofan9797-Core callback succeeded!");
      } else {
        throw new Exception();
      }
    } catch (Exception e) {
      throw new RuntimeException("nintendofan9797-Core is not installed/corrupt! Cannot proceed!");
    }

    try {
      Validator.verify(); // Do some loading checks, for example checking
      // the jar signature.

      EnumPacketType.put(
          "KEYARMOR",
          PacketKeyArmor.class,
          "KEYARMOR",
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "SOUND",
          PacketSound.class,
          "SOUND",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "ENDPICK",
          PacketEndPick.class,
          "ENDPICK",
          PacketChannelLib.CHANNEL_ENDPICK,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "RENAME",
          PacketRename.class,
          "RENAME",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "GUI", PacketGui.class, "GUI", PacketChannelLib.CHANNEL_SV_TO_CL, EnumDirection.CLIENT);
      EnumPacketType.put(
          "CAMO", PacketCamo.class, "CAMO", PacketChannelLib.CHANNEL_CAMO, EnumDirection.CLIENT);
      EnumPacketType.put(
          "KEY", PacketKey.class, "KEY", PacketChannelLib.CHANNEL_KEY, EnumDirection.SERVER);

      CoreLoadingPlugin.manager.registerMod(new PacketHandlerClient(), "CMPKC");
      CoreLoadingPlugin.manager.registerMod(new PacketHandlerServer(), "CMPKS");

      CoreLoadingPlugin.manager.getContainerForId("CMPKC").setSide(Side.CLIENT);
      CoreLoadingPlugin.manager.getContainerForId("CMPKS").setSide(Side.SERVER);

      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CL_TO_SV, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_DATA_UPDATE, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ENDPICK, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_INV_CHANGE, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_MAIN, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_SV_TO_CL, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CAMO, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_KEY, "CMPKS");

      proxy.registerConfigurationCategories();

      ReferenceLib.DAY = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
      // CraftMineCore.logger.info("Day: " + ReferenceLib.DAY);
      ReferenceLib.MONTH = Calendar.getInstance().get(Calendar.MONTH);
      // CraftMineCore.logger.info("Month: " + ReferenceLib.MONTH);

      logger.info("Attempting AutoUpdate...");
      UpdateMain.doVersionCheck();

      CapeLib.init();
      proxy.registerGuis();

      logger.info("Configuring API...");
      CraftMineApi.constructionTab = tabsCraftMineConstruction;
      CraftMineApi.coreTab = tabsCraftMine;
      CraftMineApi.toolsTab = tabsCraftMineTools;

      if (event.getSide() == Side.SERVER) {
        logger.info("Initializing Server-side...");
        isServer = true;
      } else {
        logger.info("Initializing Client-side...");
      }

      proxy.registerSounds();

      MinecraftForge.EVENT_BUS.register(new AttackHandler());

      logger.info("Reading/Writing configuration values...");

      try {
        Config.init();
      } catch (Exception e) {
        CraftMineCore.logger.warning("Error while initialising configuration!");
        CraftMineCore.logger.warning("Re-writing configuration file.");
        Config.rewriteConfig();
        Config.init();
      }

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during pre-initialization");
    }
  }
Beispiel #3
0
 @Override
 public void injectData(Map<String, Object> data) {
   Transformer.obfuscatedEnvironment = (Boolean) data.get("runtimeDeobfuscationEnabled");
   Config.location = (File) data.get("coremodLocation");
   Config.init();
 }
 public SimpleApplicationManager(Config _config) {
   config = _config;
   config.init();
   // this.users = new ArrayList<User>();
   // this.roles = new ArrayList<Role>();
 }
Beispiel #5
0
 private static String getProperty(String key) {
   if (config == null) init();
   return config.get(key);
 }