public void init() { if (System.getProperty("ViaVersion") != null) { // Reload? platform.onReload(); } // Check for updates if (platform.getConf().isCheckForUpdates()) UpdateUtil.sendUpdateMessage(); // Force class load ProtocolRegistry.getSupportedVersions(); // Inject try { injector.inject(); } catch (Exception e) { getPlatform().getLogger().severe("ViaVersion failed to inject:"); e.printStackTrace(); return; } // Mark as injected System.setProperty("ViaVersion", getPlatform().getPluginVersion()); // If successful platform.runSync(new Runnable() { @Override public void run() { onServerLoaded(); } }); }
@Override public boolean execute(ViaCommandSender sender, String[] args) { ConfigurationProvider provider = Via.getPlatform().getConfigurationProvider(); boolean newValue = !Via.getConfig().isCheckForUpdates(); provider.set("checkforupdates", newValue); provider.saveConfig(); sendMessage(sender, "&6We will %snotify you about updates.", (newValue ? "&a" : "&cnot ")); return true; } }
@Listener public void onJoin(ClientConnectionEvent.Join join) { if (join.getTargetEntity().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(join.getTargetEntity().getUniqueId()); } } }
@EventHandler public void onJoin(PostLoginEvent e) { if (e.getPlayer().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } }
@EventHandler public void onJoin(PlayerJoinEvent e) { if (e.getPlayer().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } }
@Subscribe public void onJoin(PostLoginEvent e) { if (e.getPlayer().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } }