mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00:00
Remove item IDs from Worth
This commit is contained in:
parent
010981d3c8
commit
0a90d76493
3 changed files with 13 additions and 18 deletions
|
@ -134,8 +134,11 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean isEcoDisabled();
|
boolean isEcoDisabled();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
boolean isTradeInStacks(int id);
|
boolean isTradeInStacks(int id);
|
||||||
|
|
||||||
|
boolean isTradeInStacks(Material type);
|
||||||
|
|
||||||
List<Material> itemSpawnBlacklist();
|
List<Material> itemSpawnBlacklist();
|
||||||
|
|
||||||
List<EssentialsSign> enabledSigns();
|
List<EssentialsSign> enabledSigns();
|
||||||
|
|
|
@ -649,10 +649,17 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
|
|
||||||
// #easteregg
|
// #easteregg
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public boolean isTradeInStacks(int id) {
|
public boolean isTradeInStacks(int id) {
|
||||||
return config.getBoolean("trade-in-stacks-" + id, false);
|
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
|
// #easteregg
|
||||||
private boolean economyDisabled = false;
|
private boolean economyDisabled = false;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
|
import com.earth2me.essentials.utils.EnumUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -52,14 +53,6 @@ public class Worth implements IConf {
|
||||||
throw new Exception(tl("itemSellAir"));
|
throw new Exception(tl("itemSellAir"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int id;
|
|
||||||
|
|
||||||
try {
|
|
||||||
id = ess.getItemDb().getLegacyId(is.getType());
|
|
||||||
} catch (Exception e) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
|
@ -74,7 +67,7 @@ public class Worth implements IConf {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean stack = args.length > 1 && args[1].endsWith("s");
|
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) {
|
if (requireStack && !stack) {
|
||||||
throw new Exception(tl("itemMustBeStacked"));
|
throw new Exception(tl("itemMustBeStacked"));
|
||||||
|
@ -119,14 +112,6 @@ public class Worth implements IConf {
|
||||||
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "") + "." + itemStack.getDurability(), price);
|
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();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue