@Override public String getHostname() { return event.getHostname(); } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerLogin(PlayerLoginEvent event) { Static.SetPlayerHost(event.getPlayer().getName(), event.getHostname()); } }
@EventHandler(ignoreCancelled = true) public void onPlayerLogin(PlayerLoginEvent event) { Player player = event.getPlayer(); ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager(); String hostKey = cfg.hostKeys.get(player.getUniqueId().toString()); if (hostKey == null) { hostKey = cfg.hostKeys.get(player.getName().toLowerCase()); } if (hostKey != null) { String hostname = event.getHostname(); int colonIndex = hostname.indexOf(':'); if (colonIndex != -1) { hostname = hostname.substring(0, colonIndex); } if (!hostname.equals(hostKey) && !(cfg.hostKeysAllowFMLClients && hostname.equals(hostKey + "\u0000FML\u0000"))) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You did not join with the valid host key!"); log.warning("WorldGuard host key check: " + player.getName() + " joined with '" + hostname + "' but '" + hostKey + "' was expected. Kicked!"); return; } } if (cfg.deopOnJoin) { player.setOp(false); } }
final String hostname = event.getHostname().replace("\u0000FML\u0000", ""); // Forge fix - https://github.com/TotalFreedom/TotalFreedomMod/issues/493 final String connectAddress = ConfigEntry.SERVER_ADDRESS.getString(); final int connectPort = server.getPort();