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:
parent
70303080b6
commit
16a59470fc
@ -1170,8 +1170,10 @@ public class ConfigManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CMIItemStack item = CMIItemStack.deserialize(guiSection.getString("ItemStack"), ahead);
|
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());
|
gItem.setGuiItem(item.getItemStack());
|
||||||
|
}
|
||||||
|
|
||||||
} else if (guiSection.isString("Item")) {
|
} else if (guiSection.isString("Item")) {
|
||||||
String item = guiSection.getString("Item");
|
String item = guiSection.getString("Item");
|
||||||
@ -1212,45 +1214,49 @@ 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");
|
CMIMessages.consoleMessage("&5Update " + jobConfigName + " jobs gui item section to use `ItemStack` instead of `Item` sections format. More information inside _EXAMPLE job file");
|
||||||
informedGUI = true;
|
informedGUI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gItem.setGuiItem(guiItem);
|
||||||
} else if (guiSection.isInt("Id") && guiSection.isInt("Data")) {
|
} else if (guiSection.isInt("Id") && guiSection.isInt("Data")) {
|
||||||
guiItem = CMIMaterial.get(guiSection.getInt("Id"), guiSection.getInt("Data")).newItemStack();
|
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");
|
CMIMessages.consoleMessage("Update " + jobConfigName + " jobs gui item section to use `Item` instead of `Id` and `Data` sections");
|
||||||
} else
|
} else
|
||||||
log.warning("Job " + jobConfigName + " has an invalid (" + guiSection.getString("Item") + ") Gui property. Please fix this if you want to use it!");
|
log.warning("Job " + jobConfigName + " has an invalid (" + guiSection.getString("Item") + ") Gui property. Please fix this if you want to use it!");
|
||||||
|
|
||||||
for (String str4 : guiSection.getStringList("Enchantments")) {
|
if (guiSection.isList("Enchantments")) {
|
||||||
String[] id = str4.split(":", 2);
|
for (String str4 : guiSection.getStringList("Enchantments")) {
|
||||||
|
String[] id = str4.split(":", 2);
|
||||||
|
|
||||||
if (id.length < 2)
|
if (id.length < 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Enchantment enchant = CMIEnchantment.getEnchantment(id[0]);
|
Enchantment enchant = CMIEnchantment.getEnchantment(id[0]);
|
||||||
if (enchant == null)
|
if (enchant == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int level = 1;
|
int level = 1;
|
||||||
try {
|
try {
|
||||||
level = Integer.parseInt(id[1]);
|
level = Integer.parseInt(id[1]);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiItem.getItemMeta() instanceof EnchantmentStorageMeta) {
|
||||||
|
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) guiItem.getItemMeta();
|
||||||
|
enchantMeta.addStoredEnchant(enchant, level, true);
|
||||||
|
guiItem.setItemMeta(enchantMeta);
|
||||||
|
} else
|
||||||
|
guiItem.addUnsafeEnchantment(enchant, level);
|
||||||
}
|
}
|
||||||
|
gItem.setGuiItem(guiItem);
|
||||||
if (guiItem.getItemMeta() instanceof EnchantmentStorageMeta) {
|
|
||||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) guiItem.getItemMeta();
|
|
||||||
enchantMeta.addStoredEnchant(enchant, level, true);
|
|
||||||
guiItem.setItemMeta(enchantMeta);
|
|
||||||
} else
|
|
||||||
guiItem.addUnsafeEnchantment(enchant, level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String customSkull = guiSection.getString("CustomSkull", "");
|
String customSkull = guiSection.getString("CustomSkull", "");
|
||||||
if (!customSkull.isEmpty()) {
|
if (!customSkull.isEmpty()) {
|
||||||
guiItem = Util.getSkull(customSkull);
|
gItem.setGuiItem(Util.getSkull(customSkull));
|
||||||
}
|
}
|
||||||
gItem.setGuiSlot(guiSection.getInt("slot", -1));
|
gItem.setGuiSlot(guiSection.getInt("slot", -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
gItem.setGuiItem(guiItem);
|
|
||||||
|
|
||||||
job.setGuiItem(gItem);
|
job.setGuiItem(gItem);
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
@ -1554,10 +1560,10 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String key : typeSection.getKeys(false)) {
|
for (String key : typeSection.getKeys(false)) {
|
||||||
|
|
||||||
if (key.equalsIgnoreCase("materials"))
|
if (key.equalsIgnoreCase("materials"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ConfigurationSection section = typeSection.getConfigurationSection(key);
|
ConfigurationSection section = typeSection.getConfigurationSection(key);
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -28,37 +28,38 @@ public class DatabaseSaveThread extends Thread {
|
|||||||
private int sleep;
|
private int sleep;
|
||||||
|
|
||||||
public DatabaseSaveThread(int duration) {
|
public DatabaseSaveThread(int duration) {
|
||||||
super("Jobs-DatabaseSaveTask");
|
super("Jobs-DatabaseSaveTask");
|
||||||
this.sleep = duration * 60000;
|
this.sleep = duration * 60000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
CMIMessages.consoleMessage("&eStarted database save task.");
|
CMIMessages.consoleMessage("&eStarted database save task.");
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
try {
|
try {
|
||||||
sleep(sleep);
|
sleep(sleep);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Jobs.getPlayerManager().saveAll();
|
if (running)
|
||||||
} catch (Throwable t) {
|
Jobs.getPlayerManager().saveAll();
|
||||||
t.printStackTrace();
|
} catch (Throwable t) {
|
||||||
CMIMessages.consoleMessage("&c[Jobs] Exception in DatabaseSaveTask, stopping auto save!");
|
t.printStackTrace();
|
||||||
running = false;
|
CMIMessages.consoleMessage("&c[Jobs] Exception in DatabaseSaveTask, stopping auto save!");
|
||||||
}
|
running = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CMIMessages.consoleMessage("&eDatabase save task shutdown!");
|
CMIMessages.consoleMessage("&eDatabase save task shutdown!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
interrupt();
|
interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user