mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Fix abilities wearing off instantly
This commit is contained in:
		@@ -569,62 +569,46 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) {
 | 
				
			||||||
        BlockState blockState = event.getBlock().getState();
 | 
					            debugStickDump(player, event.getBlock().getState());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        ItemStack heldItem = player.getInventory().getItemInMainHand();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cleanupAbilityTools(player, mcMMOPlayer, blockState, heldItem);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        debugStickDump(player, blockState);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void debugStickDump(Player player, BlockState blockState) {
 | 
					    public void debugStickDump(Player player, BlockState blockState) {
 | 
				
			||||||
        //Profile not loaded
 | 
					
 | 
				
			||||||
        if (UserManager.getPlayer(player) == null) {
 | 
					        if (mcMMO.getPlaceStore().isTrue(blockState))
 | 
				
			||||||
            return;
 | 
					            player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
 | 
				
			||||||
 | 
					            UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) {
 | 
					        if (WorldGuardUtils.isWorldGuardLoaded()) {
 | 
				
			||||||
            if (mcMMO.getPlaceStore().isTrue(blockState))
 | 
					            if (WorldGuardManager.getInstance().hasMainFlag(player))
 | 
				
			||||||
                player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
 | 
					                player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
 | 
				
			||||||
            else {
 | 
					            else
 | 
				
			||||||
                player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
 | 
					                player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
 | 
				
			||||||
                UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (WorldGuardUtils.isWorldGuardLoaded()) {
 | 
					            if (WorldGuardManager.getInstance().hasXPFlag(player))
 | 
				
			||||||
                if (WorldGuardManager.getInstance().hasMainFlag(player))
 | 
					                player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
 | 
					            else
 | 
				
			||||||
                else
 | 
					                player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (WorldGuardManager.getInstance().hasXPFlag(player))
 | 
					 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
 | 
					 | 
				
			||||||
                else
 | 
					 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (blockState instanceof Furnace) {
 | 
					 | 
				
			||||||
                Furnace furnace = (Furnace) blockState;
 | 
					 | 
				
			||||||
                if (furnace.hasMetadata(MetadataConstants.FURNACE_TRACKING_METAKEY)) {
 | 
					 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
 | 
					 | 
				
			||||||
                    Player furnacePlayer = getPlayerFromFurnace(furnace.getBlock());
 | 
					 | 
				
			||||||
                    if (furnacePlayer != null) {
 | 
					 | 
				
			||||||
                        player.sendMessage("[mcMMO DEBUG] This furnace is owned by player " + furnacePlayer.getName());
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                } else
 | 
					 | 
				
			||||||
                    player.sendMessage("[mcMMO DEBUG] This furnace does not have a registered owner");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (mcMMO.getConfigManager().getConfigLeveling().isEnableXPBars())
 | 
					 | 
				
			||||||
                player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void cleanupAbilityTools(Player player, McMMOPlayer mcMMOPlayer, BlockState blockState, ItemStack heldItem) {
 | 
					        if (blockState instanceof Furnace) {
 | 
				
			||||||
        SkillUtils.removeAbilityBuff(heldItem);
 | 
					            Furnace furnace = (Furnace) blockState;
 | 
				
			||||||
        SkillUtils.handleAbilitySpeedDecrease(player);
 | 
					            if (furnace.hasMetadata(MetadataConstants.FURNACE_TRACKING_METAKEY)) {
 | 
				
			||||||
 | 
					                player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
 | 
				
			||||||
 | 
					                Player furnacePlayer = getPlayerFromFurnace(furnace.getBlock());
 | 
				
			||||||
 | 
					                if (furnacePlayer != null) {
 | 
				
			||||||
 | 
					                    player.sendMessage("[mcMMO DEBUG] This furnace is owned by player " + furnacePlayer.getName());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } else
 | 
				
			||||||
 | 
					                player.sendMessage("[mcMMO DEBUG] This furnace does not have a registered owner");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (mcMMO.getConfigManager().getConfigLeveling().isEnableXPBars())
 | 
				
			||||||
 | 
					            player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -168,6 +168,7 @@ public class SkillUtils {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        itemMeta.setLore(itemLore);
 | 
					        itemMeta.setLore(itemLore);
 | 
				
			||||||
        heldItem.setItemMeta(itemMeta);
 | 
					        heldItem.setItemMeta(itemMeta);
 | 
				
			||||||
 | 
					        player.updateInventory();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*else {
 | 
					        /*else {
 | 
				
			||||||
            int duration = 0;
 | 
					            int duration = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user