本文整理汇总了Java中net.minecraft.network.play.server.S40PacketDisconnect类的典型用法代码示例。如果您正苦于以下问题:Java S40PacketDisconnect类的具体用法?Java S40PacketDisconnect怎么用?Java S40PacketDisconnect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
S40PacketDisconnect类属于net.minecraft.network.play.server包,在下文中一共展示了S40PacketDisconnect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: kickPlayerFromServer
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* 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();
}
}));
}
示例2: kickWithMessage
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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);
}
示例3: kickWithMessage
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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);
}
示例4: kickPlayerFromServer
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* 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();
}
示例5: kickPlayerFromServer
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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()));
}
示例6: kickPlayerFromServer
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
示例7: kickPlayerFromServer
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
示例8: stopEndpoints
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
}
示例9: processQueuedPackets
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
}
}
}
}
示例10: networkTick
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* 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();
}
}
}
}
}
}
示例11: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
public void handleDisconnect(S40PacketDisconnect packetIn)
{
this.netManager.closeChannel(packetIn.getReason());
}
示例12: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
public void handleDisconnect(S40PacketDisconnect packetIn) {
this.netManager.closeChannel(packetIn.getReason());
}
示例13: networkTick
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* 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();
}
}
}
}
}
示例14: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
public void handleDisconnect(S40PacketDisconnect p_147253_1_)
{
this.netManager.closeChannel(p_147253_1_.func_149165_c());
}
示例15: networkTick
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
}
}
}
}