mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Fix when some of materials is not generated in translated file
This can reproducible in old versions like 1.12.2, such as Andesite is not exist in Material API, but its added in 1.8
This commit is contained in:
parent
2faae4cf08
commit
36a3051452
@ -424,7 +424,7 @@ public class ConfigManager {
|
||||
}
|
||||
if (matId != null) {
|
||||
material = CMIMaterial.get(matId);
|
||||
if (material != null) {
|
||||
if (material != CMIMaterial.NONE) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " " + actionType.getName() + " is using ID: " + myKey + "!");
|
||||
Jobs.getPluginLogger().warning("Please use the Material name instead: " + material.toString() + "!");
|
||||
}
|
||||
@ -439,15 +439,15 @@ public class ConfigManager {
|
||||
if (actionType == ActionType.STRIPLOGS && Version.isCurrentLower(Version.v1_13_R1))
|
||||
return null;
|
||||
|
||||
if (material != null && material.getMaterial() != null && material.isAir()) {
|
||||
if (material.getMaterial() != null && material.isAir()) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " " + actionType.getName() + " can't recognize material! (" + myKey + ")");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
|
||||
if (Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
|
||||
meta = String.valueOf(material.getData());
|
||||
|
||||
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
c: if (material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
// Need to include those ones and count as regular blocks
|
||||
switch (myKey.replace("_", "").toLowerCase()) {
|
||||
case "itemframe":
|
||||
@ -901,10 +901,10 @@ public class ConfigManager {
|
||||
|
||||
CMIMaterial material = CMIMaterial.get(item + (subType));
|
||||
|
||||
if (material == null)
|
||||
if (material == CMIMaterial.NONE)
|
||||
material = CMIMaterial.get(item.replace(' ', '_').toUpperCase());
|
||||
|
||||
if (material == null) {
|
||||
if (material == CMIMaterial.NONE) {
|
||||
// try integer method
|
||||
Integer matId = null;
|
||||
try {
|
||||
|
@ -957,13 +957,13 @@ public class GeneralConfigManager {
|
||||
jobsInfoOpensBrowse = c.get("Commands.JobsInfo.open-browse", false);
|
||||
|
||||
CMIMaterial tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN").toUpperCase());
|
||||
guiBackButton = (tmat == null ? CMIMaterial.JACK_O_LANTERN : tmat).newItemStack();
|
||||
guiBackButton = (tmat == CMIMaterial.NONE ? CMIMaterial.JACK_O_LANTERN : tmat).newItemStack();
|
||||
|
||||
tmat = CMIMaterial.get(c.get("JobsGUI.NextButton.Material", "ARROW").toUpperCase());
|
||||
guiNextButton = (tmat == null ? CMIMaterial.ARROW : tmat).newItemStack();
|
||||
guiNextButton = (tmat == CMIMaterial.NONE ? CMIMaterial.ARROW : tmat).newItemStack();
|
||||
|
||||
tmat = CMIMaterial.get(c.get("JobsGUI.Filler.Material", "GREEN_STAINED_GLASS_PANE").toUpperCase());
|
||||
guiFiller = (tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE : tmat).newItemStack();
|
||||
guiFiller = (tmat == CMIMaterial.NONE ? CMIMaterial.GREEN_STAINED_GLASS_PANE : tmat).newItemStack();
|
||||
|
||||
c.save();
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -290,12 +289,7 @@ public class NameTranslatorManager {
|
||||
ConfigReader c = new ConfigReader(f);
|
||||
c.copyDefaults(true);
|
||||
|
||||
for (Material one : Material.values()) {
|
||||
CMIMaterial mat = CMIMaterial.get(one);
|
||||
if (mat == CMIMaterial.NONE || mat == null || mat.getMaterial() == null) {
|
||||
mat = CMIMaterial.get(one.getId());
|
||||
}
|
||||
|
||||
for (CMIMaterial mat : CMIMaterial.values()) {
|
||||
if (mat == CMIMaterial.NONE) {
|
||||
continue;
|
||||
}
|
||||
@ -420,31 +414,6 @@ public class NameTranslatorManager {
|
||||
c.get("ColorList.13-green", "&2Green");
|
||||
c.get("ColorList.14-red", "&cRed");
|
||||
c.get("ColorList.15-black", "&0Black");
|
||||
/** for (colorNames cn : colorNames.values()) {
|
||||
if (cn.getName() == null)
|
||||
continue;
|
||||
|
||||
String n = cn.getId() + (cn.getId() == -1 ? "" : ":" + cn.getName());
|
||||
|
||||
String name = null;
|
||||
|
||||
if (c.getC().isConfigurationSection("ColorList." + n)) {
|
||||
name = c.getC().getString("ColorList." + n + ".Name");
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
n = cn.getId() + "-" + cn.toString();
|
||||
if (c.getC().isConfigurationSection("ColorList." + n)) {
|
||||
name = c.getC().getString("ColorList." + n);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
name = cn.getName();
|
||||
}
|
||||
|
||||
c.get("ColorList." + cn.getId() + "-" + cn.toString(), name);
|
||||
}*/
|
||||
|
||||
if (!c.getC().isConfigurationSection("MythicEntityList")) {
|
||||
c.get("MythicEntityList.AngrySludge", "Angry Sludge");
|
||||
|
@ -45,13 +45,11 @@ public class RestrictedBlockManager {
|
||||
cfg.set("blocksTimer." + cm.getCMIType().name(), cfg.getC().getInt("blocksTimer." + one + ".cd"));
|
||||
|
||||
} else {
|
||||
|
||||
int timer = cfg.get("blocksTimer." + one, -99);
|
||||
CMIMaterial mat = CMIMaterial.get(one);
|
||||
|
||||
if (mat == null)
|
||||
if (mat == CMIMaterial.NONE)
|
||||
continue;
|
||||
|
||||
int timer = cfg.get("blocksTimer." + one, -99);
|
||||
if (timer == -99) {
|
||||
cfg.set("blocksTimer." + one, null);
|
||||
continue;
|
||||
|
@ -136,7 +136,7 @@ public class ShopManager {
|
||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||
}
|
||||
|
||||
if (mat == null)
|
||||
if (mat == CMIMaterial.NONE)
|
||||
mat = CMIMaterial.STONE_BUTTON;
|
||||
|
||||
ItemStack guiItem = mat.newItemStack();
|
||||
|
@ -232,11 +232,13 @@ public class BlockOwnerShip {
|
||||
f.getConfigFile().renameTo(new File(Jobs.getFolder(), "blockOwnerShips.yml"));
|
||||
}
|
||||
|
||||
if (blockOwnerShips.isEmpty()) {
|
||||
f = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml");
|
||||
|
||||
if (blockOwnerShips.isEmpty() && f.getConfigFile().length() == 0L) {
|
||||
f.getConfigFile().delete();
|
||||
return;
|
||||
}
|
||||
|
||||
f = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml");
|
||||
if (!f.exists())
|
||||
f.createNewFile();
|
||||
|
||||
|
@ -49,6 +49,12 @@ public class ToggleBarHandling {
|
||||
|
||||
public static void save() {
|
||||
YmlMaker f = new YmlMaker(Jobs.getFolder(), "actionBarBossbar.yml");
|
||||
|
||||
if (f.exists() && f.getConfigFile().length() == 0L && bossBarToggle.isEmpty() && actionBarToggle.isEmpty()) {
|
||||
f.getConfigFile().delete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!f.exists())
|
||||
f.createNewFile();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user