@Override public void onCommand(Sender sender, String commandLabel, String[] args) { runnableFactory.create("Reload task", new AbsRunnable() { @Override public void run() { try { plugin.reloadPlugin(true); } catch (Exception e) { errorHandler.log(L.CRITICAL, this.getClass(), e); sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED)); } sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE)); } }).runTaskAsynchronously(); } }
private void actOnJoinEvent(ClientConnectionEvent.Join event) { Player player = event.getTargetEntity(); UUID uuid = player.getUniqueId(); long time = System.currentTimeMillis(); SpongeAFKListener.AFK_TRACKER.performedAction(uuid, time); String world = player.getWorld().getName(); Optional<GameMode> gameMode = player.getGameModeData().get(Keys.GAME_MODE); String gm = gameMode.map(mode -> mode.getName().toUpperCase()).orElse("ADVENTURE"); InetAddress address = player.getConnection().getAddress().getAddress(); String playerName = player.getName(); String displayName = player.getDisplayNameData().displayName().get().toPlain(); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); processing.submitCritical(() -> sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, world, gm))); runnableFactory.create("Player Register: " + uuid, processors.player().registerProcessor(uuid, () -> time, playerName, gatheringGeolocations ? processors.player().ipUpdateProcessor(uuid, address, time) : null, processors.player().nameProcessor(uuid, playerName, displayName), processors.info().playerPageUpdateProcessor(uuid) ) ).runTaskAsynchronously(); }
private void actOnJoinEvent(PlayerJoinEvent event) { Player player = event.getPlayer(); // TODO Move update notification to the website. UUID uuid = player.getUniqueId(); long time = System.currentTimeMillis(); AFKListener.AFK_TRACKER.performedAction(uuid, time); String world = player.getWorld().getName(); String gm = player.getGameMode().name(); InetAddress address = player.getAddress().getAddress(); String playerName = player.getName(); String displayName = player.getDisplayName(); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); processing.submitCritical(() -> sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, world, gm))); runnableFactory.create("Player Register: " + uuid, processors.player().registerProcessor(uuid, player::getFirstPlayed, playerName, gatheringGeolocations ? processors.player().ipUpdateProcessor(uuid, address, time) : null, processors.player().nameProcessor(uuid, playerName, displayName), processors.info().playerPageUpdateProcessor(uuid) ) ).runTaskAsynchronously(); }