<commit_before>package net.glowstone.net.handler.play.player;

import com.flowpowered.networking.MessageHandler;
import net.glowstone.GlowServer;
import net.glowstone.entity.GlowPlayer;
import net.glowstone.net.GlowSession;
import net.glowstone.net.message.play.player.PlayerActionMessage;

public final class PlayerActionHandler implements MessageHandler<GlowSession, PlayerActionMessage> {
    public void handle(GlowSession session, PlayerActionMessage message) {
        final GlowPlayer player = session.getPlayer();
        if (message.getId() != player.getEntityId()) {
            // vanilla client doesn't send this, ignore the message for now
            return;
        }

        switch (message.getAction()) {
            case 1: // crouch
                player.setSneaking(true);
                break;
            case 2: // uncrouch
                player.setSneaking(false);
                break;
            case 3: // leave bed
                // todo
                break;
            case 4: // start sprinting
                player.setSprinting(true);
                break;
            case 5: // stop sprinting
                player.setSprinting(false);
                break;
            default:
                GlowServer.logger.info("Player " + player + " sent unknown PlayerAction: " + message.getAction());
        }
    }
}<commit_msg>Fixed sneaking and sprinting handling in PlayerActionHandler (fixes #165).<commit_after>package net.glowstone.net.handler.play.player;

import com.flowpowered.networking.MessageHandler;
import net.glowstone.GlowServer;
import net.glowstone.entity.GlowPlayer;
import net.glowstone.net.GlowSession;
import net.glowstone.net.message.play.player.PlayerActionMessage;

public final class PlayerActionHandler implements MessageHandler<GlowSession, PlayerActionMessage> {
    public void handle(GlowSession session, PlayerActionMessage message) {
        final GlowPlayer player = session.getPlayer();

        switch (message.getAction()) {
            case 0: // crouch
                player.setSneaking(true);
                break;
            case 1: // uncrouch
                player.setSneaking(false);
                break;
            case 2: // leave bed
                // todo
                break;
            case 3: // start sprinting
                player.setSprinting(true);
                break;
            case 4: // stop sprinting
                player.setSprinting(false);
                break;
            default:
                GlowServer.logger.info("Player " + player + " sent unknown PlayerAction: " + message.getAction());
        }
    }
}
{'fraction_non_alphanumeric': 0.08970476911430735, 'fraction_numerical': 0.004920514761544285, 'mean_word_length': 1.9630044843049328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3753524', 'n_tokens_mistral': 713, 'n_tokens_neox': 672, 'n_words': 154}