From 74866de04095acda92c05a8ac9f67de736b02226 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 13 Dec 2021 11:59:20 +0100 Subject: [PATCH] Fix SWCommandUtils.numberMapper --- .../src/de/steamwar/command/SWCommandUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java b/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java index 68a795c..265f874 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommandUtils.java @@ -260,11 +260,14 @@ public class SWCommandUtils { private static Function numberMapper(Function mapper) { return s -> { + if (s.equalsIgnoreCase("nan")) return null; try { - if (s.equalsIgnoreCase("nan")) { - return null; - } return mapper.apply(s); + } catch (NumberFormatException e) { + // Ignored + } + try { + return mapper.apply(s.replace(',', '.')); } catch (NumberFormatException e) { return null; }