mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13: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) {
|
if (matId != null) {
|
||||||
material = CMIMaterial.get(matId);
|
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("Job " + jobName + " " + actionType.getName() + " is using ID: " + myKey + "!");
|
||||||
Jobs.getPluginLogger().warning("Please use the Material name instead: " + material.toString() + "!");
|
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))
|
if (actionType == ActionType.STRIPLOGS && Version.isCurrentLower(Version.v1_13_R1))
|
||||||
return null;
|
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 + ")");
|
Jobs.getPluginLogger().warning("Job " + jobName + " " + actionType.getName() + " can't recognize material! (" + myKey + ")");
|
||||||
return null;
|
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());
|
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
|
// Need to include those ones and count as regular blocks
|
||||||
switch (myKey.replace("_", "").toLowerCase()) {
|
switch (myKey.replace("_", "").toLowerCase()) {
|
||||||
case "itemframe":
|
case "itemframe":
|
||||||
@ -901,10 +901,10 @@ public class ConfigManager {
|
|||||||
|
|
||||||
CMIMaterial material = CMIMaterial.get(item + (subType));
|
CMIMaterial material = CMIMaterial.get(item + (subType));
|
||||||
|
|
||||||
if (material == null)
|
if (material == CMIMaterial.NONE)
|
||||||
material = CMIMaterial.get(item.replace(' ', '_').toUpperCase());
|
material = CMIMaterial.get(item.replace(' ', '_').toUpperCase());
|
||||||
|
|
||||||
if (material == null) {
|
if (material == CMIMaterial.NONE) {
|
||||||
// try integer method
|
// try integer method
|
||||||
Integer matId = null;
|
Integer matId = null;
|
||||||
try {
|
try {
|
||||||
|
@ -957,13 +957,13 @@ public class GeneralConfigManager {
|
|||||||
jobsInfoOpensBrowse = c.get("Commands.JobsInfo.open-browse", false);
|
jobsInfoOpensBrowse = c.get("Commands.JobsInfo.open-browse", false);
|
||||||
|
|
||||||
CMIMaterial tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN").toUpperCase());
|
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());
|
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());
|
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();
|
c.save();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -290,12 +289,7 @@ public class NameTranslatorManager {
|
|||||||
ConfigReader c = new ConfigReader(f);
|
ConfigReader c = new ConfigReader(f);
|
||||||
c.copyDefaults(true);
|
c.copyDefaults(true);
|
||||||
|
|
||||||
for (Material one : Material.values()) {
|
for (CMIMaterial mat : CMIMaterial.values()) {
|
||||||
CMIMaterial mat = CMIMaterial.get(one);
|
|
||||||
if (mat == CMIMaterial.NONE || mat == null || mat.getMaterial() == null) {
|
|
||||||
mat = CMIMaterial.get(one.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mat == CMIMaterial.NONE) {
|
if (mat == CMIMaterial.NONE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -420,31 +414,6 @@ public class NameTranslatorManager {
|
|||||||
c.get("ColorList.13-green", "&2Green");
|
c.get("ColorList.13-green", "&2Green");
|
||||||
c.get("ColorList.14-red", "&cRed");
|
c.get("ColorList.14-red", "&cRed");
|
||||||
c.get("ColorList.15-black", "&0Black");
|
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")) {
|
if (!c.getC().isConfigurationSection("MythicEntityList")) {
|
||||||
c.get("MythicEntityList.AngrySludge", "Angry Sludge");
|
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"));
|
cfg.set("blocksTimer." + cm.getCMIType().name(), cfg.getC().getInt("blocksTimer." + one + ".cd"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int timer = cfg.get("blocksTimer." + one, -99);
|
|
||||||
CMIMaterial mat = CMIMaterial.get(one);
|
CMIMaterial mat = CMIMaterial.get(one);
|
||||||
|
if (mat == CMIMaterial.NONE)
|
||||||
if (mat == null)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
int timer = cfg.get("blocksTimer." + one, -99);
|
||||||
if (timer == -99) {
|
if (timer == -99) {
|
||||||
cfg.set("blocksTimer." + one, null);
|
cfg.set("blocksTimer." + one, null);
|
||||||
continue;
|
continue;
|
||||||
|
@ -136,7 +136,7 @@ public class ShopManager {
|
|||||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat == null)
|
if (mat == CMIMaterial.NONE)
|
||||||
mat = CMIMaterial.STONE_BUTTON;
|
mat = CMIMaterial.STONE_BUTTON;
|
||||||
|
|
||||||
ItemStack guiItem = mat.newItemStack();
|
ItemStack guiItem = mat.newItemStack();
|
||||||
|
@ -232,11 +232,13 @@ public class BlockOwnerShip {
|
|||||||
f.getConfigFile().renameTo(new File(Jobs.getFolder(), "blockOwnerShips.yml"));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml");
|
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
|
|
||||||
|
@ -49,6 +49,12 @@ public class ToggleBarHandling {
|
|||||||
|
|
||||||
public static void save() {
|
public static void save() {
|
||||||
YmlMaker f = new YmlMaker(Jobs.getFolder(), "actionBarBossbar.yml");
|
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())
|
if (!f.exists())
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user