mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Check Protect/AntiBuild config materials against Material enum (#2431)
This commit is contained in:
parent
9e73c29b40
commit
f214696664
@ -6,6 +6,7 @@ import com.earth2me.essentials.signs.EssentialsSign;
|
|||||||
import com.earth2me.essentials.signs.Signs;
|
import com.earth2me.essentials.signs.Signs;
|
||||||
import com.earth2me.essentials.textreader.IText;
|
import com.earth2me.essentials.textreader.IText;
|
||||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||||
|
import com.earth2me.essentials.utils.EnumUtil;
|
||||||
import com.earth2me.essentials.utils.FormatUtil;
|
import com.earth2me.essentials.utils.FormatUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
|
|
||||||
@ -691,12 +692,20 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ItemStack itemStack;
|
|
||||||
try {
|
Material mat = EnumUtil.getMaterial(itemName.toUpperCase());
|
||||||
itemStack = ess.getItemDb().get(itemName);
|
|
||||||
list.add(itemStack.getType());
|
if (mat == null) {
|
||||||
} catch (Exception ex) {
|
try {
|
||||||
|
ItemStack itemStack = ess.getItemDb().get(itemName);
|
||||||
|
mat = itemStack.getType();
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mat == null) {
|
||||||
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, configName));
|
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, configName));
|
||||||
|
} else {
|
||||||
|
list.add(mat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -12,7 +12,7 @@ public class EnumUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the field matching the first provided enum name that exists within the given
|
* Returns the field matching the first provided enum name that exists within the given
|
||||||
* enum class.
|
* enum class. If no field is found, this method returns null.
|
||||||
*
|
*
|
||||||
* @param enumClass The class to search through
|
* @param enumClass The class to search through
|
||||||
* @param names The names of the fields to search for
|
* @param names The names of the fields to search for
|
||||||
|
Loading…
Reference in New Issue
Block a user