mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
1.13.2 fix round 3.. or 4
This commit is contained in:
parent
7ea9ec5c2f
commit
1feee7f312
@ -383,6 +383,10 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||||
|
if(event.getCurrentItem() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SkillUtils.removeAbilityBuff(event.getCurrentItem());
|
SkillUtils.removeAbilityBuff(event.getCurrentItem());
|
||||||
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
|
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
|
||||||
if(isOutsideWindowClick(event))
|
if(isOutsideWindowClick(event))
|
||||||
@ -391,7 +395,7 @@ public class InventoryListener implements Listener {
|
|||||||
PlayerInventory playerInventory = event.getWhoClicked().getInventory();
|
PlayerInventory playerInventory = event.getWhoClicked().getInventory();
|
||||||
|
|
||||||
if(playerInventory.getItem(event.getHotbarButton()) != null)
|
if(playerInventory.getItem(event.getHotbarButton()) != null)
|
||||||
SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
|
SkillUtils.removeAbilityBuff(playerInventory.getItem(event.getHotbarButton()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public final class ItemUtils {
|
|||||||
return mcMMO.getMaterialMapStore().isBow(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isBow(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasItemInEitherHand(Player player, Material material) {
|
public static boolean hasItemInEitherHand(@NotNull Player player, Material material) {
|
||||||
return player.getInventory().getItemInMainHand().getType() == material || player.getInventory().getItemInOffHand().getType() == material;
|
return player.getInventory().getItemInMainHand().getType() == material || player.getInventory().getItemInOffHand().getType() == material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public final class ItemUtils {
|
|||||||
* @param item Item to check
|
* @param item Item to check
|
||||||
* @return true if the item is a sword, false otherwise
|
* @return true if the item is a sword, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isSword(ItemStack item) {
|
public static boolean isSword(@NotNull ItemStack item) {
|
||||||
return mcMMO.getMaterialMapStore().isSword(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isSword(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public final class ItemUtils {
|
|||||||
* @param item Item to check
|
* @param item Item to check
|
||||||
* @return true if the item is a hoe, false otherwise
|
* @return true if the item is a hoe, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isHoe(ItemStack item) {
|
public static boolean isHoe(@NotNull ItemStack item) {
|
||||||
return mcMMO.getMaterialMapStore().isHoe(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isHoe(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public final class ItemUtils {
|
|||||||
* @param item Item to check
|
* @param item Item to check
|
||||||
* @return true if the item is a shovel, false otherwise
|
* @return true if the item is a shovel, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isShovel(ItemStack item) {
|
public static boolean isShovel(@NotNull ItemStack item) {
|
||||||
return mcMMO.getMaterialMapStore().isShovel(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isShovel(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public final class ItemUtils {
|
|||||||
* @param item Item to check
|
* @param item Item to check
|
||||||
* @return true if the item is an axe, false otherwise
|
* @return true if the item is an axe, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isAxe(ItemStack item) {
|
public static boolean isAxe(@NotNull ItemStack item) {
|
||||||
return mcMMO.getMaterialMapStore().isAxe(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isAxe(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public final class ItemUtils {
|
|||||||
* @param item Item to check
|
* @param item Item to check
|
||||||
* @return true if the item is a pickaxe, false otherwise
|
* @return true if the item is a pickaxe, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isPickaxe(ItemStack item) {
|
public static boolean isPickaxe(@NotNull ItemStack item) {
|
||||||
return mcMMO.getMaterialMapStore().isPickAxe(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isPickAxe(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import org.bukkit.inventory.ShapelessRecipe;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@ -135,6 +136,9 @@ public class SkillUtils {
|
|||||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
if(heldItem == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!ItemUtils.canBeSuperAbilityDigBoosted(heldItem)) {
|
if (!ItemUtils.canBeSuperAbilityDigBoosted(heldItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -200,7 +204,10 @@ public class SkillUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAbilityBuff(@NotNull ItemStack itemStack) {
|
public static void removeAbilityBuff(@Nullable ItemStack itemStack) {
|
||||||
|
if(itemStack == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
if(!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user