Add option to disable netherite chestplate drop

- Added option to toggle whether netherite armored elytras are dropped as chestplates or not.
This commit is contained in:
Pim van der Loos 2021-03-02 07:59:01 +01:00
parent b49f24dae4
commit a4347e52e2
No known key found for this signature in database
GPG Key ID: 673281775FDE01CD
2 changed files with 17 additions and 1 deletions

View File

@ -107,7 +107,9 @@ public class ArmoredElytra extends JavaPlugin implements Listener
final Listener creationListener = config.craftingInSmithingTable() ?
new SmithingTableHandler(this) : new AnvilHandler(this);
Bukkit.getPluginManager().registerEvents(creationListener, this);
Bukkit.getPluginManager().registerEvents(new ItemDropListener(this), this);
if (config.dropNetheriteAsChestplate())
Bukkit.getPluginManager().registerEvents(new ItemDropListener(this), this);
// Log all allowed enchantments.
myLogger(Level.INFO, ("Allowed enchantments:"));

View File

@ -31,6 +31,7 @@ public class ConfigLoader
private int DIAMONDS_TO_FULL;
private int NETHERITE_TO_FULL;
private boolean noFlightDurability;
private boolean dropNetheriteAsChestplate;
private LinkedHashSet<Enchantment> allowedEnchantments;
private boolean allowMultipleProtectionEnchantments;
private boolean craftingInSmithingTable;
@ -77,6 +78,12 @@ public class ConfigLoader
"If you install additional enchantment plugins, you can add their enchantments as well.",
"Just add their 'NamespacedKey'. Ask the enchantment plugin dev for more info if you need it."
};
String[] dropNetheriteAsChestplateComment =
{
"Whether to drop Netherite Armored Elytras as netherite chestplates when they are dropped",
"This means that they won't burn in lava etc.",
"When you pick them up, they will turn into Netherite Armored Elytras again."
};
String[] updateComment =
{
"Allow this plugin to check for updates on startup. It will not download new versions on its own!"
@ -178,6 +185,8 @@ public class ConfigLoader
allowMultipleProtectionEnchantments = addNewConfigOption(config, "allowMultipleProtectionEnchantments", false,
allowMultipleProtectionEnchantmentsComment);
allowRenaming = addNewConfigOption(config, "allowRenaming", true, allowRenamingComment);
dropNetheriteAsChestplate = addNewConfigOption(config, "dropNetheriteAsChestplate", true,
dropNetheriteAsChestplateComment);
checkForUpdates = addNewConfigOption(config, "checkForUpdates", true, updateComment);
allowStats = addNewConfigOption(config, "allowStats", true, bStatsComment);
@ -314,6 +323,11 @@ public class ConfigLoader
return noFlightDurability;
}
public boolean dropNetheriteAsChestplate()
{
return dropNetheriteAsChestplate;
}
public LinkedHashSet<Enchantment> allowedEnchantments()
{
return allowedEnchantments;