mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-27 01:11:21 +01:00
Added require-target option to display
This commit is contained in:
parent
cba6784eea
commit
25f9f4e030
@ -78,8 +78,10 @@ public class EnchantDisplay extends DisplayModule {
|
||||
@Override
|
||||
protected void display(@NotNull final ItemStack itemStack,
|
||||
@NotNull final Object... args) {
|
||||
if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
|
||||
return;
|
||||
if (options.isRequireTarget()) {
|
||||
if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
@ -198,8 +200,10 @@ public class EnchantDisplay extends DisplayModule {
|
||||
|
||||
@Override
|
||||
protected void revert(@NotNull final ItemStack itemStack) {
|
||||
if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
|
||||
return;
|
||||
if (options.isRequireTarget()) {
|
||||
if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
|
@ -85,6 +85,12 @@ public class DisplayOptions extends PluginDependent {
|
||||
@Getter
|
||||
private boolean usingForceHideFixer = false;
|
||||
|
||||
/**
|
||||
* If item must be a target.
|
||||
*/
|
||||
@Getter
|
||||
private boolean requireTarget = true;
|
||||
|
||||
/**
|
||||
* Instantiate new display options.
|
||||
*
|
||||
@ -124,6 +130,8 @@ public class DisplayOptions extends PluginDependent {
|
||||
usingAggressiveExperimentalHideFixer = this.getPlugin().getConfigYml().getBool("advanced.hide-fixer.aggressive");
|
||||
usingForceHideFixer = this.getPlugin().getConfigYml().getBool("advanced.hide-fixer.force");
|
||||
|
||||
requireTarget = this.getPlugin().getConfigYml().getBool("lore.require-target");
|
||||
|
||||
boolean byType = this.getPlugin().getConfigYml().getBool("lore.sort-by-type");
|
||||
boolean byLength = this.getPlugin().getConfigYml().getBool("lore.sort-by-length");
|
||||
boolean byRarity = this.getPlugin().getConfigYml().getBool("lore.sort-by-rarity");
|
||||
|
Loading…
Reference in New Issue
Block a user