/** * Kick a player from the server with a reason */ public void kickPlayerFromServer(String reason) { final ChatComponentText chatcomponenttext = new ChatComponentText(reason); this.netManager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener < Future <? super Void >> () { public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception { NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext); } }, new GenericFutureListener[0]); this.netManager.disableAutoRead(); Futures.getUnchecked(this.serverController.addScheduledTask(new Runnable() { public void run() { NetHandlerPlayServer.this.netManager.checkDisconnected(); } })); }
private void kickWithMessage(String message) { final ChatComponentText chatcomponenttext = new ChatComponentText(message); if (side == Side.CLIENT) { manager.func_150718_a(chatcomponenttext); } else { manager.func_150725_a(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener<Future<?>>() { @Override public void operationComplete(Future<?> result) { manager.func_150718_a(chatcomponenttext); } }); } manager.channel().config().setAutoRead(false); }
private void kickWithMessage(String message) { final ChatComponentText chatcomponenttext = new ChatComponentText(message); if (side == Side.CLIENT) { manager.closeChannel(chatcomponenttext); } else { manager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener<Future<?>>() { @Override public void operationComplete(Future<?> result) { manager.closeChannel(chatcomponenttext); } }); } manager.channel().config().setAutoRead(false); }
/** * Kick a player from the server with a reason */ public void kickPlayerFromServer(String p_147360_1_) { final ChatComponentText var2 = new ChatComponentText(p_147360_1_); this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(var2), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001453"; public void operationComplete(Future p_operationComplete_1_) { NetHandlerPlayServer.this.netManager.closeChannel(var2); } } }); this.netManager.disableAutoRead(); }
public static void kickPlayerFromServer(EntityPlayerMP player, String reason) { final ChatComponentText component = new ChatComponentText(reason); player.playerNetServerHandler.getNetworkManager().sendPacket(new S40PacketDisconnect(component), future -> player.playerNetServerHandler.getNetworkManager().closeChannel(component)); player.playerNetServerHandler.getNetworkManager().disableAutoRead(); Futures.getUnchecked(MinecraftServer.getServer().addScheduledTask(() -> player.playerNetServerHandler.getNetworkManager().checkDisconnected())); }
public void kickPlayerFromServer(String p_147360_1_) { // CraftBukkit start String leaveMessage = EnumChatFormatting.YELLOW + this.playerEntity.getCommandSenderName() + " left the game."; PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.playerEntity), p_147360_1_, leaveMessage); if (this.server.getServer().isServerRunning()) { this.server.getPluginManager().callEvent(event); } if (event.isCancelled()) { // Do not kick the player return; } // Send the possibly modified leave message p_147360_1_ = event.getReason(); // CraftBukkit end final ChatComponentText chatcomponenttext = new ChatComponentText(p_147360_1_); this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001453"; public void operationComplete(Future p_operationComplete_1_) { NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext); } }}); this.onDisconnect(chatcomponenttext); // CraftBukkit - Process quit immediately this.netManager.disableAutoRead(); }
public void kickPlayerFromServer(String p_147360_1_) { final ChatComponentText chatcomponenttext = new ChatComponentText(p_147360_1_); this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001453"; public void operationComplete(Future p_operationComplete_1_) { NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext); } } }); this.netManager.disableAutoRead(); }
public static void stopEndpoints(){ final ChatComponentText msg = new ChatComponentText("Server shutting down"); for(final NetworkManager manager : networkManagers){ manager.sendPacket(new S40PacketDisconnect(msg), new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture channelFuture) throws Exception { manager.closeChannel(msg); } }); manager.disableAutoRead(); } for(Channel endpoint : endpoints){ endpoint.close().syncUninterruptibly(); } }
public static void processQueuedPackets(){ synchronized (networkManagers){ Iterator<NetworkManager> it = networkManagers.iterator(); while(it.hasNext()){ final NetworkManager manager = it.next(); if(!manager.isChannelOpen()){ it.remove(); if(manager.getExitMessage() != null){ manager.getNetHandler().onDisconnect(manager.getExitMessage()); }else if(manager.getNetHandler() != null){ manager.getNetHandler().onDisconnect(new ChatComponentText("Disconnected")); } }else{ try{ manager.processReceivedPackets(); }catch(Exception e){ logger.warn("Error while handling packet for client " + manager.getRemoteAddress(), e); final ChatComponentText msg = new ChatComponentText("Internal server error"); manager.sendPacket(new S40PacketDisconnect(msg), new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture channelFuture) throws Exception { manager.closeChannel(msg); } }); manager.disableAutoRead(); } } } } }
/** * Will try to process the packets received by each NetworkManager, gracefully manage processing failures and cleans * up dead connections */ public void networkTick() { synchronized (this.networkManagers) { Iterator<NetworkManager> iterator = this.networkManagers.iterator(); while (iterator.hasNext()) { final NetworkManager networkmanager = (NetworkManager)iterator.next(); if (!networkmanager.hasNoChannel()) { if (!networkmanager.isChannelOpen()) { iterator.remove(); networkmanager.checkDisconnected(); } else { try { networkmanager.processReceivedPackets(); } catch (Exception exception) { if (networkmanager.isLocalChannel()) { CrashReport crashreport = CrashReport.makeCrashReport(exception, "Ticking memory connection"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Ticking connection"); crashreportcategory.addCrashSectionCallable("Connection", new Callable<String>() { public String call() throws Exception { return networkmanager.toString(); } }); throw new ReportedException(crashreport); } logger.warn((String)("Failed to handle packet for " + networkmanager.getRemoteAddress()), (Throwable)exception); final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); networkmanager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener < Future <? super Void >> () { public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception { networkmanager.closeChannel(chatcomponenttext); } }, new GenericFutureListener[0]); networkmanager.disableAutoRead(); } } } } } }
/** * Closes the network channel */ public void handleDisconnect(S40PacketDisconnect packetIn) { this.netManager.closeChannel(packetIn.getReason()); }
/** * Will try to process the packets received by each NetworkManager, gracefully manage processing failures and cleans * up dead connections */ public void networkTick() { List var1 = this.networkManagers; synchronized (this.networkManagers) { Iterator var2 = this.networkManagers.iterator(); while (var2.hasNext()) { final NetworkManager var3 = (NetworkManager)var2.next(); if (!var3.isChannelOpen()) { var2.remove(); if (var3.getExitMessage() != null) { var3.getNetHandler().onDisconnect(var3.getExitMessage()); } else if (var3.getNetHandler() != null) { var3.getNetHandler().onDisconnect(new ChatComponentText("Disconnected")); } } else { try { var3.processReceivedPackets(); } catch (Exception var8) { if (var3.isLocalChannel()) { CrashReport var10 = CrashReport.makeCrashReport(var8, "Ticking memory connection"); CrashReportCategory var6 = var10.makeCategory("Ticking connection"); var6.addCrashSectionCallable("Connection", new Callable() { private static final String __OBFID = "CL_00001450"; public String call() { return var3.toString(); } }); throw new ReportedException(var10); } logger.warn("Failed to handle packet for " + var3.getSocketAddress(), var8); final ChatComponentText var5 = new ChatComponentText("Internal server error"); var3.scheduleOutboundPacket(new S40PacketDisconnect(var5), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001451"; public void operationComplete(Future p_operationComplete_1_) { var3.closeChannel(var5); } } }); var3.disableAutoRead(); } } } } }
/** * Closes the network channel */ public void handleDisconnect(S40PacketDisconnect p_147253_1_) { this.netManager.closeChannel(p_147253_1_.func_149165_c()); }
public void networkTick() { List list = this.networkManagers; synchronized (this.networkManagers) { // Spigot Start // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order if (org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0) { Collections.shuffle(this.networkManagers); } // Spigot End Iterator iterator = this.networkManagers.iterator(); while (iterator.hasNext()) { final NetworkManager networkmanager = (NetworkManager)iterator.next(); if (!networkmanager.isChannelOpen()) { iterator.remove(); if (networkmanager.getExitMessage() != null) { networkmanager.getNetHandler().onDisconnect(networkmanager.getExitMessage()); } else if (networkmanager.getNetHandler() != null) { networkmanager.getNetHandler().onDisconnect(new ChatComponentText("Disconnected")); } } else { try { networkmanager.processReceivedPackets(); } catch (Exception exception) { if (networkmanager.isLocalChannel()) { CrashReport crashreport = CrashReport.makeCrashReport(exception, "Ticking memory connection"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Ticking connection"); crashreportcategory.addCrashSectionCallable("Connection", new Callable() { private static final String __OBFID = "CL_00001450"; public String call() { return networkmanager.toString(); } }); throw new ReportedException(crashreport); } logger.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); networkmanager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001451"; public void operationComplete(Future p_operationComplete_1_) { networkmanager.closeChannel(chatcomponenttext); } } }); networkmanager.disableAutoRead(); } } } } }
public void handleDisconnect(S40PacketDisconnect p_147253_1_) { this.netManager.closeChannel(p_147253_1_.func_149165_c()); }
public void networkTick() { List list = this.networkManagers; synchronized (this.networkManagers) { Iterator iterator = this.networkManagers.iterator(); while (iterator.hasNext()) { final NetworkManager networkmanager = (NetworkManager)iterator.next(); if (!networkmanager.isChannelOpen()) { iterator.remove(); if (networkmanager.getExitMessage() != null) { networkmanager.getNetHandler().onDisconnect(networkmanager.getExitMessage()); } else if (networkmanager.getNetHandler() != null) { networkmanager.getNetHandler().onDisconnect(new ChatComponentText("Disconnected")); } } else { try { networkmanager.processReceivedPackets(); } catch (Exception exception) { if (networkmanager.isLocalChannel()) { CrashReport crashreport = CrashReport.makeCrashReport(exception, "Ticking memory connection"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Ticking connection"); crashreportcategory.addCrashSectionCallable("Connection", new Callable() { private static final String __OBFID = "CL_00001450"; public String call() { return networkmanager.toString(); } }); throw new ReportedException(crashreport); } logger.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); networkmanager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener() { private static final String __OBFID = "CL_00001451"; public void operationComplete(Future p_operationComplete_1_) { networkmanager.closeChannel(chatcomponenttext); } } }); networkmanager.disableAutoRead(); } } } } }
/** * Closes the network channel */ void handleDisconnect(S40PacketDisconnect packetIn);
/** * Closes the network channel */ void handleDisconnect(S40PacketDisconnect var1);
void handleDisconnect(S40PacketDisconnect p_147253_1_);