use of net.minecraft.network.play.ServerPlayNetHandler in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method kick.
// Paper start
@Override
public void kick(final net.kyori.adventure.text.Component message) {
org.spigotmc.AsyncCatcher.catchOp("player kick");
final ServerPlayNetHandler connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
}
}
use of net.minecraft.network.play.ServerPlayNetHandler in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method setScoreboard.
@Override
public void setScoreboard(Scoreboard scoreboard) {
Validate.notNull(scoreboard, "Scoreboard cannot be null");
ServerPlayNetHandler connection = getHandle().connection;
if (connection == null) {
throw new IllegalStateException("Cannot set scoreboard yet");
}
if (connection.isDisconnected()) {
// throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); // Spigot - remove this as Mojang's semi asynchronous Netty implementation can lead to races
}
this.server.getScoreboardManager().setPlayerBoard(this, scoreboard);
}
use of net.minecraft.network.play.ServerPlayNetHandler in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method showTitle.
@Override
public void showTitle(final net.kyori.adventure.title.Title title) {
final ServerPlayNetHandler connection = this.getHandle().connection;
final net.kyori.adventure.title.Title.Times times = title.times();
if (times != null) {
connection.send(new STitlePacket(ticks(times.fadeIn()), ticks(times.stay()), ticks(times.fadeOut())));
}
final STitlePacket sp = new STitlePacket(STitlePacket.Type.SUBTITLE, null);
sp.adventure$text = title.subtitle();
connection.send(sp);
final STitlePacket tp = new STitlePacket(STitlePacket.Type.TITLE, null);
tp.adventure$text = title.title();
connection.send(tp);
}
use of net.minecraft.network.play.ServerPlayNetHandler in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method adventure$sendPlayerListHeaderAndFooter.
private void adventure$sendPlayerListHeaderAndFooter() {
final ServerPlayNetHandler connection = this.getHandle().connection;
if (connection == null)
return;
final SPlayerListHeaderFooterPacket packet = new SPlayerListHeaderFooterPacket();
packet.adventure$header = (this.playerListHeader == null) ? net.kyori.adventure.text.Component.empty() : this.playerListHeader;
packet.adventure$footer = (this.playerListFooter == null) ? net.kyori.adventure.text.Component.empty() : this.playerListFooter;
connection.send(packet);
}
use of net.minecraft.network.play.ServerPlayNetHandler in project AstralSorcery by HellFirePvP.
the class ASMHookEndpoint method getOverriddenSeenEntityReachMaximum.
// Kept as JS since mixins might clash if multiple mods are targeting the 36.0 constant
public static double getOverriddenSeenEntityReachMaximum(ServerPlayNetHandler handler, double original) {
PlayerEntity player = handler.player;
PlayerProgress prog = ResearchHelper.getProgress(player, player.getEntityWorld().isRemote() ? LogicalSide.CLIENT : LogicalSide.SERVER);
if (prog.isValid() && prog.getPerkData().hasPerkEffect(perk -> perk instanceof KeyEntityReach)) {
return 999_999_999.0;
}
return original;
}
Aggregations