Initial removal of item IDs.

We do not rely on Bukkit's item ids anymore, though we still support them in commands via a mapping built off of the items.csv.
This commit is contained in:
Trent Hensler 2017-12-12 22:06:25 -08:00
parent dcbc106e62
commit 1a820ad9b7
24 changed files with 225 additions and 141 deletions

View file

@ -10,6 +10,7 @@ import com.earth2me.essentials.utils.NumberUtil;
import net.ess3.api.IEssentials;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.event.EventPriority;
@ -555,15 +556,15 @@ public class Settings implements net.ess3.api.ISettings {
unprotectedSigns = _getUnprotectedSign();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
private List<Material> itemSpawnBl = new ArrayList<Material>();
@Override
public List<Integer> itemSpawnBlacklist() {
public List<Material> itemSpawnBlacklist() {
return itemSpawnBl;
}
private List<Integer> _getItemSpawnBlacklist() {
final List<Integer> epItemSpwn = new ArrayList<Integer>();
private List<Material> _getItemSpawnBlacklist() {
final List<Material> epItemSpwn = new ArrayList<>();
if (ess.getItemDb() == null) {
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
return epItemSpwn;
@ -575,7 +576,7 @@ public class Settings implements net.ess3.api.ISettings {
}
try {
final ItemStack iStack = ess.getItemDb().get(itemName);
epItemSpwn.add(iStack.getTypeId());
epItemSpwn.add(iStack.getType());
} catch (Exception ex) {
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, "item-spawn-blacklist"));
}
@ -685,8 +686,8 @@ public class Settings implements net.ess3.api.ISettings {
}
@Override
public List<Integer> getProtectList(final String configName) {
final List<Integer> list = new ArrayList<Integer>();
public List<Material> getProtectList(final String configName) {
final List<Material> list = new ArrayList<>();
for (String itemName : config.getString(configName, "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
@ -695,7 +696,7 @@ public class Settings implements net.ess3.api.ISettings {
ItemStack itemStack;
try {
itemStack = ess.getItemDb().get(itemName);
list.add(itemStack.getTypeId());
list.add(itemStack.getType());
} catch (Exception ex) {
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, configName));
}