1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Fixing GUI icons for new ItemStack deserializator

This commit is contained in:
Zrips 2023-12-19 13:56:33 +02:00
parent 70303080b6
commit 16a59470fc
2 changed files with 53 additions and 46 deletions

View File

@ -1170,8 +1170,10 @@ public class ConfigManager {
};
CMIItemStack item = CMIItemStack.deserialize(guiSection.getString("ItemStack"), ahead);
if (!ahead.isAsyncHead() && item != null && item.getCMIType().isNone())
if (!ahead.isAsyncHead() && item != null && !item.getCMIType().isNone()) {
gItem.setGuiItem(item.getItemStack());
}
} else if (guiSection.isString("Item")) {
String item = guiSection.getString("Item");
@ -1212,12 +1214,16 @@ public class ConfigManager {
CMIMessages.consoleMessage("&5Update " + jobConfigName + " jobs gui item section to use `ItemStack` instead of `Item` sections format. More information inside _EXAMPLE job file");
informedGUI = true;
}
gItem.setGuiItem(guiItem);
} else if (guiSection.isInt("Id") && guiSection.isInt("Data")) {
guiItem = CMIMaterial.get(guiSection.getInt("Id"), guiSection.getInt("Data")).newItemStack();
gItem.setGuiItem(guiItem);
CMIMessages.consoleMessage("Update " + jobConfigName + " jobs gui item section to use `Item` instead of `Id` and `Data` sections");
} else
log.warning("Job " + jobConfigName + " has an invalid (" + guiSection.getString("Item") + ") Gui property. Please fix this if you want to use it!");
if (guiSection.isList("Enchantments")) {
for (String str4 : guiSection.getStringList("Enchantments")) {
String[] id = str4.split(":", 2);
@ -1241,16 +1247,16 @@ public class ConfigManager {
} else
guiItem.addUnsafeEnchantment(enchant, level);
}
gItem.setGuiItem(guiItem);
}
String customSkull = guiSection.getString("CustomSkull", "");
if (!customSkull.isEmpty()) {
guiItem = Util.getSkull(customSkull);
gItem.setGuiItem(Util.getSkull(customSkull));
}
gItem.setGuiSlot(guiSection.getInt("slot", -1));
}
gItem.setGuiItem(guiItem);
job.setGuiItem(gItem);
// Permissions

View File

@ -45,6 +45,7 @@ public class DatabaseSaveThread extends Thread {
continue;
}
try {
if (running)
Jobs.getPlayerManager().saveAll();
} catch (Throwable t) {
t.printStackTrace();