From 7b3cc2a65a9e536a5f79b9004b6f68f503b5c8f3 Mon Sep 17 00:00:00 2001 From: Wolfieheart Date: Sun, 8 Dec 2024 22:29:25 +0100 Subject: [PATCH] [CORE] Be lest stingy on the Min/Max Checks Signed-off-by: Wolfieheart --- .../armorstandeditor/menu/SizeMenu.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/menu/SizeMenu.java b/src/main/java/io/github/rypofalem/armorstandeditor/menu/SizeMenu.java index a1a0a2bc..3f9cf138 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/menu/SizeMenu.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/menu/SizeMenu.java @@ -181,38 +181,40 @@ private void setArmorStandScale(Player player, String itemName, double scaleValu // Can be overwritten currentScaleValue = 0; - // Basically go from 0 to ItemSize + // Basically go from 0 directly to ItemSize if(itemName.equals(SCALE1) || itemName.equals(SCALE2) || itemName.equals(SCALE3) || itemName.equals(SCALE4)|| itemName.equals(SCALE5)|| itemName.equals(SCALE6) || itemName.equals(SCALE7)|| itemName.equals(SCALE8)|| itemName.equals(SCALE9) || itemName.equals(SCALE10)){ newScaleValue = currentScaleValue + scaleValue; - if(newScaleValue >= plugin.getMaxScaleValue()){ - pe.plugin.getLang().getMessage("scalemaxwarn","warn"); + if(newScaleValue > plugin.getMaxScaleValue()){ + pe.getPlayer().sendMessage(plugin.getLang().getMessage("scalemaxwarn", "warn")); return; - } else if(newScaleValue <= plugin.getMinScaleValue()){ - pe.plugin.getLang().getMessage("scaleminwarn","warn"); + } else if(newScaleValue < plugin.getMinScaleValue()){ + pe.getPlayer().sendMessage(plugin.getLang().getMessage("scaleminwarn","warn")); return; } else { as.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(newScaleValue); } + // Add either 0.1 or 0.5 to the current } else if(itemName.equals(SCALEPLUS12) || itemName.equals(SCALEPLUS110)){ currentScaleValue = as.getAttribute(Attribute.GENERIC_SCALE).getBaseValue(); newScaleValue = currentScaleValue + scaleValue; // Add for increments - if(newScaleValue >= plugin.getMaxScaleValue()){ - pe.plugin.getLang().getMessage("scalemaxwarn", "warn"); + if(newScaleValue > plugin.getMaxScaleValue()){ + pe.getPlayer().sendMessage(plugin.getLang().getMessage("scalemaxwarn","warn")); return; } as.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(newScaleValue); + //Subtract either 0.1 or 0.5 from the current } else if(itemName.equals(SCALEMINUS12) || itemName.equals(SCALEMINUS110)){ currentScaleValue = as.getAttribute(Attribute.GENERIC_SCALE).getBaseValue(); newScaleValue = currentScaleValue - scaleValue; // Subtract for decrements - if(newScaleValue <= plugin.getMinScaleValue()){ - pe.plugin.getLang().getMessage("scaleminwarn", "warn"); + if(newScaleValue < plugin.getMinScaleValue()){ + pe.getPlayer().sendMessage(plugin.getLang().getMessage("scaleminwarn","warn")); return; } as.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(newScaleValue); - }else if(itemName.equals(RESET)){ + }else if(itemName.equals(RESET)){ // Set it back to 1 newScaleValue = 1; as.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(newScaleValue); }