Fix error in short item code generation logic (Fixes #395)

This commit is contained in:
Phoenix616 2021-01-06 20:08:38 +01:00
parent 66eaab7c4d
commit 71e8ef732f
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 2 additions and 2 deletions

View File

@ -64,10 +64,10 @@ public class ItemUtil {
int colonIndex = code.indexOf(':');
String material = code;
String rest = "";
if (poundIndex > 0 && poundIndex < colonIndex) {
if (poundIndex > 0 && (colonIndex < 0 || poundIndex < colonIndex)) {
material = code.substring(0, poundIndex);
rest = code.substring(poundIndex);
} else if (colonIndex > 0 && colonIndex < poundIndex) {
} else if (colonIndex > 0 && (poundIndex < 0 || colonIndex < poundIndex)) {
material = code.substring(0, colonIndex);
rest = code.substring(colonIndex);
}