mirror of
https://github.com/songoda/EpicEnchants.git
synced 2024-11-14 06:36:41 +01:00
fix applying of enchant books to items after whitelist change
This commit is contained in:
parent
de8c6e69e4
commit
08d2d5c75f
@ -1,6 +1,7 @@
|
||||
package com.songoda.epicenchants.command.commands;
|
||||
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.epicenchants.CommandCommons;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.enums.EnchantResult;
|
||||
@ -61,7 +62,7 @@ public class CommandApply extends AbstractCommand {
|
||||
int level = Integer.parseInt(args[1]);
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!enchant.getItemWhitelist().contains(player.getItemInHand().getType())) {
|
||||
if (!enchant.getItemWhitelist().contains(CompatibleMaterial.getMaterial(player.getItemInHand()))) {
|
||||
System.out.println("List = " + enchant.getItemWhitelist());
|
||||
plugin.getLocale().getMessage("command.apply.invaliditem")
|
||||
.processPlaceholder("enchant", enchant.getIdentifier())
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.epicenchants.listeners.item;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.epicenchants.EpicEnchants;
|
||||
import com.songoda.epicenchants.enums.EnchantResult;
|
||||
import com.songoda.epicenchants.events.EnchantApplyEvent;
|
||||
@ -35,7 +36,7 @@ public class BookListener extends ItemListener {
|
||||
ItemStack toApply = event.getCurrentItem();
|
||||
Enchant enchant = instance.getEnchantManager().getValue(cursor.getString("enchant")).orElseThrow(() -> new IllegalStateException("Book without enchant!"));
|
||||
|
||||
if (!enchant.getItemWhitelist().contains(current.getItem().getType())) {
|
||||
if (!enchant.getItemWhitelist().contains(CompatibleMaterial.getMaterial(current.getItem()))) {
|
||||
return;
|
||||
}
|
||||
// get total amount of enchantments on item
|
||||
|
Loading…
Reference in New Issue
Block a user