Remove item IDs from Worth

This commit is contained in:
md678685 2018-10-15 13:56:36 +01:00
parent 010981d3c8
commit 0a90d76493
3 changed files with 13 additions and 18 deletions

View File

@ -134,8 +134,11 @@ public interface ISettings extends IConf {
boolean isEcoDisabled();
@Deprecated
boolean isTradeInStacks(int id);
boolean isTradeInStacks(Material type);
List<Material> itemSpawnBlacklist();
List<EssentialsSign> enabledSigns();

View File

@ -649,10 +649,17 @@ public class Settings implements net.ess3.api.ISettings {
// #easteregg
@Override
@Deprecated
public boolean isTradeInStacks(int id) {
return config.getBoolean("trade-in-stacks-" + id, false);
}
// #easteregg
@Override
public boolean isTradeInStacks(Material type) {
return config.getBoolean("trade-in-stacks." + type.toString().toLowerCase().replace("_", ""), false);
}
// #easteregg
private boolean economyDisabled = false;

View File

@ -1,6 +1,7 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import com.earth2me.essentials.utils.EnumUtil;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@ -52,14 +53,6 @@ public class Worth implements IConf {
throw new Exception(tl("itemSellAir"));
}
int id;
try {
id = ess.getItemDb().getLegacyId(is.getType());
} catch (Exception e) {
return 0;
}
int amount = 0;
if (args.length > 1) {
@ -74,7 +67,7 @@ public class Worth implements IConf {
}
boolean stack = args.length > 1 && args[1].endsWith("s");
boolean requireStack = ess.getSettings().isTradeInStacks(id);
boolean requireStack = ess.getSettings().isTradeInStacks(is.getType());
if (requireStack && !stack) {
throw new Exception(tl("itemMustBeStacked"));
@ -118,15 +111,7 @@ public class Worth implements IConf {
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "") + "." + itemStack.getDurability(), price);
}
int itemId;
try {
itemId = ess.getItemDb().getLegacyId(itemStack.getType());
} catch (Exception e) {
return;
}
config.removeProperty("worth-" + itemId);
config.save();
}