codacy issue #1 and #5 fix

This commit is contained in:
rycbar0 2022-09-26 22:23:38 +02:00
parent a091c17b83
commit 8aa8918124

View File

@ -37,7 +37,9 @@ import java.util.*;
* *
*/ */
public final class LitematicaSchematic extends StaticSchematic { public final class LitematicaSchematic extends StaticSchematic {
int minX=0,minY=0,minZ=0; int minX=0;
int minY=0;
int minZ=0;
private static final String reg = "Regions"; private static final String reg = "Regions";
private static final String meta = "Metadata"; private static final String meta = "Metadata";
private static final String schemSize = "EnclosingSize"; private static final String schemSize = "EnclosingSize";
@ -277,6 +279,7 @@ public final class LitematicaSchematic extends StaticSchematic {
public static long roundUp(long number, long interval) public static long roundUp(long number, long interval)
{ {
int sign = 1;
if (interval == 0) if (interval == 0)
{ {
return 0; return 0;
@ -289,11 +292,11 @@ public final class LitematicaSchematic extends StaticSchematic {
{ {
if (number < 0) if (number < 0)
{ {
interval *= -1; sign = -1;
} }
long i = number % interval; long i = number % (interval * sign);
return i == 0 ? number : number + interval - i; return i == 0 ? number : number + (interval * sign) - i;
} }
} }
} }