mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 13:08:19 +01:00
Ensure positive chunk view distance from the client
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
ffbc8e5f27
commit
025052102d
@ -5,14 +5,11 @@ import net.minestom.server.event.EventDispatcher;
|
||||
import net.minestom.server.event.player.PlayerSettingsChangeEvent;
|
||||
import net.minestom.server.network.packet.client.play.ClientSettingsPacket;
|
||||
|
||||
public class SettingsListener {
|
||||
|
||||
public final class SettingsListener {
|
||||
public static void listener(ClientSettingsPacket packet, Player player) {
|
||||
Player.PlayerSettings settings = player.getSettings();
|
||||
settings.refresh(packet.locale, packet.viewDistance, packet.chatMessageType, packet.chatColors, packet.displayedSkinParts, packet.mainHand);
|
||||
|
||||
PlayerSettingsChangeEvent playerSettingsChangeEvent = new PlayerSettingsChangeEvent(player);
|
||||
EventDispatcher.call(playerSettingsChangeEvent);
|
||||
final byte viewDistance = (byte) Math.abs(packet.viewDistance);
|
||||
settings.refresh(packet.locale, viewDistance, packet.chatMessageType, packet.chatColors, packet.displayedSkinParts, packet.mainHand);
|
||||
EventDispatcher.call(new PlayerSettingsChangeEvent(player));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user