本文整理汇总了Java中net.minecraft.network.play.server.S40PacketDisconnect类的典型用法代码示例。如果您正苦于以下问题:Java S40PacketDisconnect类的具体用法?Java S40PacketDisconnect怎么用?Java S40PacketDisconnect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
S40PacketDisconnect类属于net.minecraft.network.play.server包,在下文中一共展示了S40PacketDisconnect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}));
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:NetHandlerPlayServer.java
示例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);
}
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:21,代码来源:NetworkDispatcher.java
示例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);
}
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:21,代码来源:NetworkDispatcher.java
示例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();
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:18,代码来源:NetHandlerPlayServer.java
示例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()));
}
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:9,代码来源:NetHandlerPlayServerHelper.java
示例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();
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:33,代码来源:NetHandlerPlayServer.java
示例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();
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:15,代码来源:NetHandlerPlayServer.java
示例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();
}
}
开发者ID:nailed,项目名称:nailed,代码行数:16,代码来源:NailedNetworkManager.java
示例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();
}
}
}
}
}
开发者ID:nailed,项目名称:nailed,代码行数:31,代码来源:NailedNetworkManager.java
示例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();
}
}
}
}
}
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:60,代码来源:NetworkSystem.java
示例11: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
public void handleDisconnect(S40PacketDisconnect packetIn)
{
this.netManager.closeChannel(packetIn.getReason());
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:NetHandlerPlayClient.java
示例12: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
public void handleDisconnect(S40PacketDisconnect packetIn) {
this.netManager.closeChannel(packetIn.getReason());
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:NetHandlerPlayClient.java
示例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();
}
}
}
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:70,代码来源:NetworkSystem.java
示例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());
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:8,代码来源:NetHandlerPlayClient.java
示例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();
}
}
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:74,代码来源:NetworkSystem.java
示例16: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
public void handleDisconnect(S40PacketDisconnect p_147253_1_)
{
this.netManager.closeChannel(p_147253_1_.func_149165_c());
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:5,代码来源:NetHandlerPlayClient.java
示例17: networkTick
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
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();
}
}
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:66,代码来源:NetworkSystem.java
示例18: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
void handleDisconnect(S40PacketDisconnect packetIn);
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:INetHandlerPlayClient.java
示例19: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
/**
* Closes the network channel
*/
void handleDisconnect(S40PacketDisconnect var1);
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:INetHandlerPlayClient.java
示例20: handleDisconnect
import net.minecraft.network.play.server.S40PacketDisconnect; //导入依赖的package包/类
void handleDisconnect(S40PacketDisconnect p_147253_1_);
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:2,代码来源:INetHandlerPlayClient.java
注:本文中的net.minecraft.network.play.server.S40PacketDisconnect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论