mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2446
This commit is contained in:
parent
503dbc8367
commit
0b9ab8b6cc
@ -60,6 +60,7 @@
|
|||||||
* Fixed id conflicts for external Enchantment sources (e.g. plugins) for the Magician Talisman settings
|
* Fixed id conflicts for external Enchantment sources (e.g. plugins) for the Magician Talisman settings
|
||||||
* Fixed network visualizers spawning particles for other player heads
|
* Fixed network visualizers spawning particles for other player heads
|
||||||
* Fixed #2418
|
* Fixed #2418
|
||||||
|
* Fixed #2446
|
||||||
|
|
||||||
## Release Candidate 17 (17 Oct 2020)
|
## Release Candidate 17 (17 Oct 2020)
|
||||||
|
|
||||||
|
@ -10,13 +10,14 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.slimefun4.api.items.ItemState;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Listener class responsible for a {@link Player} interacting with an {@link Entity}.
|
* The {@link Listener} responsible for a {@link Player} interacting with an {@link Entity}.
|
||||||
*
|
*
|
||||||
* @author Linox
|
* @author Linox
|
||||||
*
|
*
|
||||||
@ -45,8 +46,17 @@ public class EntityInteractionListener implements Listener {
|
|||||||
|
|
||||||
SlimefunItem sfItem = SlimefunItem.getByItem(itemStack);
|
SlimefunItem sfItem = SlimefunItem.getByItem(itemStack);
|
||||||
|
|
||||||
if (sfItem != null && Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) {
|
if (sfItem != null) {
|
||||||
sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e, itemStack, e.getHand() == EquipmentSlot.OFF_HAND));
|
if (Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) {
|
||||||
|
sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e, itemStack, e.getHand() == EquipmentSlot.OFF_HAND));
|
||||||
|
} else if (sfItem.getState() != ItemState.VANILLA_FALLBACK) {
|
||||||
|
/**
|
||||||
|
* If an Item is disabled, we don't want it to fallback to the vanilla behaviour
|
||||||
|
* unless it is a Vanilla Item of course.
|
||||||
|
* Related to Issue #2446
|
||||||
|
*/
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,7 +67,6 @@ public class SlimefunItemListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
private boolean rightClickItem(PlayerInteractEvent e, PlayerRightClickEvent event, boolean defaultValue) {
|
private boolean rightClickItem(PlayerInteractEvent e, PlayerRightClickEvent event, boolean defaultValue) {
|
||||||
Optional<SlimefunItem> optional = event.getSlimefunItem();
|
Optional<SlimefunItem> optional = event.getSlimefunItem();
|
||||||
|
Loading…
Reference in New Issue
Block a user