Skip to content

Commit

Permalink
[CORE] Be lest stingy on the Min/Max Checks
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfieheart <[email protected]>
  • Loading branch information
Wolfieheart committed Dec 8, 2024
1 parent 1833e32 commit 7b3cc2a
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7b3cc2a

Please sign in to comment.