mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-11-13 05:45:16 +01:00
Added validation to material lists to prevent plugin crashes
This commit is contained in:
parent
38330034f9
commit
9c80f031a2
@ -77,8 +77,8 @@ public class ConfigManager {
|
||||
psuedoMaterials = new ArrayList<>();
|
||||
genbucketGroups = new LinkedHashMap<>();
|
||||
|
||||
ignoredMaterials = InventoryHelper.convertMaterialList(epicBuckets.getConfig().getStringList("IGNORE-MATERIALS"));
|
||||
psuedoMaterials = InventoryHelper.convertMaterialList(epicBuckets.getConfig().getStringList("PSUEDO-MATERIALS"));
|
||||
ignoredMaterials = InventoryHelper.convertMaterialList(epicBuckets.getConfig().getStringList("IGNORE-MATERIALS"), "IGNORE-MATERIALS");
|
||||
psuedoMaterials = InventoryHelper.convertMaterialList(epicBuckets.getConfig().getStringList("PSUEDO-MATERIALS"), "PSUEDO-MATERIALS");
|
||||
supportFactions = epicBuckets.getConfig().getBoolean("FACTIONS-SUPPORT");
|
||||
supportWorldGuard = epicBuckets.getConfig().getBoolean("WORLDGUARD-SUPPORT");
|
||||
supportGriefPrevention = epicBuckets.getConfig().getBoolean("GRIEFPREVENTION-SUPPORT");
|
||||
|
@ -3,8 +3,6 @@ package com.songoda.epicbuckets.util;
|
||||
import com.songoda.epicbuckets.EpicBuckets;
|
||||
import com.songoda.epicbuckets.shop.SubShop;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
@ -14,9 +12,15 @@ import java.util.stream.IntStream;
|
||||
|
||||
public class InventoryHelper {
|
||||
|
||||
public static List<XMaterial> convertMaterialList(List<String> toConvert) {
|
||||
public static List<XMaterial> convertMaterialList(List<String> toConvert, String item) {
|
||||
List<XMaterial> converted = new ArrayList<>();
|
||||
toConvert.forEach(s -> converted.add(XMaterial.valueOf(s.toUpperCase())));
|
||||
for (String s : toConvert) {
|
||||
if (!Validator.isMaterial(s.toUpperCase())) {
|
||||
EpicBuckets.getInstance().getDebugger().sendConsole("Invalid material " + s.toUpperCase() + " in " + item + ", skipping..");
|
||||
continue;
|
||||
}
|
||||
converted.add(XMaterial.valueOf(s.toUpperCase()));
|
||||
}
|
||||
return converted;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@
|
||||
###############################################
|
||||
|
||||
|
||||
# All file file can be found on
|
||||
# https://www.spigotmc.org/resources/ezbucket-1-7-1-12-region-support-gui-horizontal-vertical-and-infused-gens-genbucket.50944/
|
||||
# All default configuration files can be found on
|
||||
# https://www.spigotmc.org/resources/epicbuckets-the-most-powerful-genbucket-plugin.50944/
|
||||
# Please use 1.13+ material names, the plugin auto converts them to your server version
|
||||
|
||||
FACTIONS-SUPPORT: false # MassiveCore and Factions/FactionsUUID/SavageFactions is needed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user