From 6147ef85a6ff2d993019f22b01a75ce66de2bbd2 Mon Sep 17 00:00:00 2001 From: Ghost_chu <30802565+Ghost-chu@users.noreply.github.com> Date: Fri, 24 Apr 2020 23:15:24 +0800 Subject: [PATCH] Fix java.lang.IllegalArgumentException Fixed java.lang.IllegalArgumentException: View distance 1 is out of range of [2, 32] exception when user using Console Client --- .../me/lxct/bestviewdistance/functions/BVDPlayer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/lxct/bestviewdistance/functions/BVDPlayer.java b/src/main/java/me/lxct/bestviewdistance/functions/BVDPlayer.java index e8f055f..9a2256d 100644 --- a/src/main/java/me/lxct/bestviewdistance/functions/BVDPlayer.java +++ b/src/main/java/me/lxct/bestviewdistance/functions/BVDPlayer.java @@ -148,11 +148,16 @@ public int getPing() { } public int getSettingsViewDistance() { // Get View Distance in settings + int vd; if (!serverVersion.contains("1.13")) { - return this.settingsViewDistance; + vd = this.settingsViewDistance; } else { - return this.p.getClientViewDistance(); + vd = this.p.getClientViewDistance(); } + if(vd < 2){ + vd = 2; + } + return vd; } // CHECK AND USE PERMISSIONS