use of org.spongepowered.common.network.status.SpongeStatusClient in project SpongeCommon by SpongePowered.
the class ServerStatusPacketListenerImplMixin method handleStatusRequest.
/**
* @author Minecrell - January 18th, 2015
* @reason Post the server status ping event for plugins.
*/
@Overwrite
public void handleStatusRequest(final ServerboundStatusRequestPacket packetIn) {
if (this.hasRequestedStatus) {
this.connection.disconnect(ServerStatusPacketListenerImplMixin.DISCONNECT_REASON);
} else {
this.hasRequestedStatus = true;
final ServerStatus response = SpongeStatusResponse.post(this.server, new SpongeStatusClient(this.connection));
if (response != null) {
this.connection.send(new ClientboundStatusResponsePacket(response));
} else {
this.connection.disconnect(null);
}
}
}
use of org.spongepowered.common.network.status.SpongeStatusClient in project Sponge by SpongePowered.
the class ServerStatusPacketListenerImplMixin method handleStatusRequest.
/**
* @author Minecrell - January 18th, 2015
* @reason Post the server status ping event for plugins.
*/
@Overwrite
public void handleStatusRequest(final ServerboundStatusRequestPacket packetIn) {
if (this.hasRequestedStatus) {
this.connection.disconnect(ServerStatusPacketListenerImplMixin.DISCONNECT_REASON);
} else {
this.hasRequestedStatus = true;
final ServerStatus response = SpongeStatusResponse.post(this.server, new SpongeStatusClient(this.connection));
if (response != null) {
this.connection.send(new ClientboundStatusResponsePacket(response));
} else {
this.connection.disconnect(null);
}
}
}
use of org.spongepowered.common.network.status.SpongeStatusClient in project SpongeCommon by SpongePowered.
the class MixinNetHandlerStatusServer method processServerQuery.
/**
* @author Minecrell - January 18th, 2015
* @reason Post the server status ping event for plugins.
*/
@Overwrite
public void processServerQuery(CPacketServerQuery packetIn) {
if (this.handled) {
this.networkManager.closeChannel(EXIT_MESSAGE);
} else {
this.handled = true;
ServerStatusResponse response = SpongeStatusResponse.post(this.server, new SpongeStatusClient(this.networkManager));
if (response != null) {
this.networkManager.sendPacket(new SPacketServerInfo(response));
} else {
this.networkManager.closeChannel(null);
}
}
}
Aggregations