@Override public void onEnable() { // Inject Via.getManager().init(); }
@Listener public void onServerStart(GameAboutToStartServerEvent event) { // Inject! logger.info("ViaVersion is injecting!"); Via.getManager().init(); }
@Override public void onLoad() { // Spigot detector try { Class.forName("org.spigotmc.SpigotConfig"); } catch (ClassNotFoundException e) { spigot = false; } // Check if it's a spigot build with a protocol mod try { compatSpigotBuild = NMSUtil.nms("PacketEncoder").getDeclaredField("version") != null; } catch (Exception e) { compatSpigotBuild = false; } // Generate classes needed (only works if it's compat or ps) ClassGenerator.generate(); lateBind = !BukkitViaInjector.isBinded(); getLogger().info("ViaVersion " + getDescription().getVersion() + (compatSpigotBuild ? "compat" : "") + " is now loaded" + (lateBind ? ", waiting for boot. (late-bind)" : ", injecting!")); if (!lateBind) { Via.getManager().init(); } }
@Override public void onEnable() { if (lateBind) { Via.getManager().init(); } getCommand("viaversion").setExecutor(commandHandler); getCommand("viaversion").setTabCompleter(commandHandler); // Warn them if they have anti-xray on and they aren't using spigot if (conf.isAntiXRay() && !spigot) { getLogger().info("You have anti-xray on in your config, since you're not using spigot it won't fix xray!"); } // Run queued tasks for (Runnable r : queuedTasks) { Bukkit.getScheduler().runTask(this, r); } queuedTasks.clear(); // Run async queued tasks for (Runnable r : asyncQueuedTasks) { Bukkit.getScheduler().runTaskAsynchronously(this, r); } asyncQueuedTasks.clear(); }
@Subscribe public void onProxyInit(ProxyInitializeEvent e) { PROXY = proxy; VelocityCommandHandler commandHandler = new VelocityCommandHandler(); PROXY.getCommandManager().register(commandHandler, "viaver", "vvvelocity", "viaversion"); api = new VelocityViaAPI(); conf = new VelocityViaConfig(configDir.toFile()); logger = new LoggerWrapper(loggerslf4j); Via.init(ViaManager.builder() .platform(this) .commandHandler(commandHandler) .loader(new VelocityViaLoader()) .injector(new VelocityViaInjector()).build()); Via.getManager().init(); }