mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 01:47:54 +01:00
Prevent modified clients from messing with the chunk range
This commit is contained in:
parent
4bb04ba892
commit
51facb9f14
@ -2326,15 +2326,15 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
* based on which one is the lowest
|
||||
*/
|
||||
public int getChunkRange() {
|
||||
final int serverRange = MinecraftServer.getChunkViewDistance();
|
||||
final int playerRange = getSettings().viewDistance;
|
||||
if (playerRange == 0) {
|
||||
if (playerRange < 1) {
|
||||
// Didn't receive settings packet yet (is the case on login)
|
||||
// In this case we send the smallest amount of chunks possible
|
||||
// Will be updated in PlayerSettings#refresh.
|
||||
// Non-compliant clients might also be stuck with this view
|
||||
return 1;
|
||||
} else {
|
||||
final int serverRange = MinecraftServer.getChunkViewDistance();
|
||||
return Math.min(playerRange, serverRange);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user