use of org.lanternpowered.server.entity.living.player.LanternPlayer in project LanternServer by LanternPowered.
the class HandlerPlayInPlayerBlockPlacement method handle.
@Override
public void handle(NetworkContext context, MessagePlayInPlayerBlockPlacement message) {
final LanternPlayer player = context.getSession().getPlayer();
player.resetIdleTimeoutCounter();
player.getInteractionHandler().handleBlockPlacing(message);
}
use of org.lanternpowered.server.entity.living.player.LanternPlayer in project LanternServer by LanternPowered.
the class HandlerPlayInPlayerDigging method handle.
@Override
public void handle(NetworkContext context, MessagePlayInPlayerDigging message) {
final LanternPlayer player = context.getSession().getPlayer();
player.resetIdleTimeoutCounter();
player.getInteractionHandler().handleDigging(message);
}
use of org.lanternpowered.server.entity.living.player.LanternPlayer in project LanternServer by LanternPowered.
the class HandlerPlayInPlayerLook method handle.
@Override
public void handle(NetworkContext context, MessagePlayInPlayerLook message) {
final LanternPlayer player = context.getSession().getPlayer();
player.setRawRotation(toRotation(message.getPitch(), message.getYaw()));
player.handleOnGroundState(message.isOnGround());
}
use of org.lanternpowered.server.entity.living.player.LanternPlayer in project LanternServer by LanternPowered.
the class HandlerPlayInPlayerSwingArm method handle.
@Override
public void handle(NetworkContext context, MessagePlayInPlayerSwingArm message) {
final LanternPlayer player = context.getSession().getPlayer();
player.resetIdleTimeoutCounter();
player.getInteractionHandler().handleSwingArm(message);
}
use of org.lanternpowered.server.entity.living.player.LanternPlayer in project LanternServer by LanternPowered.
the class HandlerPlayInResourcePackStatus method handle.
@Override
public void handle(NetworkContext context, MessagePlayInResourcePackStatus message) {
final Optional<ResourcePack> resourcePack = context.getSession().getPlayer().getResourcePackSendQueue().poll(message.getStatus());
final LanternPlayer player = context.getSession().getPlayer();
if (!resourcePack.isPresent()) {
Lantern.getLogger().warn("{} received a unexpected resource pack status message ({}), no resource pack was pending", player.getName(), message.getStatus());
return;
}
final CauseStack causeStack = CauseStack.current();
try (CauseStack.Frame frame = causeStack.pushCauseFrame()) {
frame.addContext(EventContextKeys.PLAYER, player);
Sponge.getEventManager().post(SpongeEventFactory.createResourcePackStatusEvent(frame.getCurrentCause(), resourcePack.get(), player, message.getStatus()));
}
}
Aggregations