mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 06:38:56 +00:00
Fixed the MMOItems Error #253
This commit is contained in:
@@ -13,8 +13,8 @@ import com.dre.brewery.integration.item.MMOItemsPluginItem;
|
||||
import com.dre.brewery.recipe.BCauldronRecipe;
|
||||
import com.dre.brewery.recipe.RecipeItem;
|
||||
import com.dre.brewery.utility.LegacyUtil;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -219,7 +219,7 @@ public class IntegrationListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
// Cancel the Interact Event early, so MMOItems does not act before us and consume the item when trying to add item to Cauldron
|
||||
// Catch the Interact Event early, so MMOItems does not act before us and cancel the event while we try to add it to the Cauldron
|
||||
if (!P.use1_9) return;
|
||||
if (BConfig.hasMMOItems == null) {
|
||||
BConfig.hasMMOItems = P.p.getServer().getPluginManager().isPluginEnabled("MMOItems");
|
||||
@@ -228,7 +228,7 @@ public class IntegrationListener implements Listener {
|
||||
try {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.hasItem() && event.getHand() == EquipmentSlot.HAND) {
|
||||
if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CAULDRON) {
|
||||
NBTItem item = MMOItems.plugin.getNMS().getNBTItem(event.getItem());
|
||||
NBTItem item = MMOLib.plugin.getNMS().getNBTItem(event.getItem());
|
||||
if (item.hasType()) {
|
||||
for (RecipeItem rItem : BCauldronRecipe.acceptedCustom) {
|
||||
if (rItem instanceof MMOItemsPluginItem) {
|
||||
@@ -246,6 +246,7 @@ public class IntegrationListener implements Listener {
|
||||
} catch (Throwable e) {
|
||||
P.p.errorLog("Could not check MMOItems for Item");
|
||||
e.printStackTrace();
|
||||
BConfig.hasMMOItems = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.dre.brewery.integration.item;
|
||||
import com.dre.brewery.P;
|
||||
import com.dre.brewery.filedata.BConfig;
|
||||
import com.dre.brewery.recipe.PluginItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MMOItemsPluginItem extends PluginItem {
|
||||
@@ -21,11 +21,12 @@ public class MMOItemsPluginItem extends PluginItem {
|
||||
if (!BConfig.hasMMOItems) return false;
|
||||
|
||||
try {
|
||||
NBTItem nbtItem = MMOItems.plugin.getNMS().getNBTItem(item);
|
||||
NBTItem nbtItem = MMOLib.plugin.getNMS().getNBTItem(item);
|
||||
return nbtItem.hasType() && nbtItem.getString("MMOITEMS_ITEM_ID").equalsIgnoreCase(getItemId());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
P.p.errorLog("Could not check MMOItems for Item ID");
|
||||
BConfig.hasMMOItems = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class SlimefunPluginItem extends PluginItem {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
P.p.errorLog("Could not check Slimefun for Item ID");
|
||||
BConfig.hasSlimefun = false;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user