mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Reworked abilityDurabilityLoss() to take an int as dmg dealt
This commit is contained in:
		@@ -173,7 +173,7 @@ public class Excavation
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public static void gigaDrillBreaker(Player player, Block block)
 | 
						public static void gigaDrillBreaker(Player player, Block block)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Skills.abilityDurabilityLoss(player.getItemInHand());
 | 
							Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
 | 
				
			||||||
		if(block.getData() != (byte)5)
 | 
							if(block.getData() != (byte)5)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
								PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -177,10 +177,15 @@ public class Mining
 | 
				
			|||||||
    public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
 | 
					    public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    	PlayerProfile PP = Users.getProfile(player);
 | 
					    	PlayerProfile PP = Users.getProfile(player);
 | 
				
			||||||
		Skills.abilityDurabilityLoss(player.getItemInHand());
 | 
					    	Material type = block.getType();
 | 
				
			||||||
 | 
					    	
 | 
				
			||||||
 | 
					    	//Obsidian needs to do more damage than normal
 | 
				
			||||||
 | 
					    	if(type != Material.OBSIDIAN)
 | 
				
			||||||
 | 
					    	    Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
 | 
				
			||||||
 | 
					    	else
 | 
				
			||||||
 | 
					    	    Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss*5);
 | 
				
			||||||
    	
 | 
					    	
 | 
				
			||||||
    	//Pre-processing
 | 
					    	//Pre-processing
 | 
				
			||||||
    	Material type = block.getType();
 | 
					 | 
				
			||||||
    	int xp = 0;
 | 
					    	int xp = 0;
 | 
				
			||||||
		PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
							PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -271,15 +271,13 @@ public class Skills
 | 
				
			|||||||
    		return false;
 | 
					    		return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static void abilityDurabilityLoss(ItemStack inhand)
 | 
					    public static void abilityDurabilityLoss(ItemStack inhand, int durabilityLoss)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    	if(LoadProperties.toolsLoseDurabilityFromAbilities)
 | 
					    	if(LoadProperties.toolsLoseDurabilityFromAbilities)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if(!inhand.containsEnchantment(Enchantment.DURABILITY))
 | 
					            if(!inhand.containsEnchantment(Enchantment.DURABILITY))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                short durability = inhand.getDurability();
 | 
					                inhand.setDurability((short)(inhand.getDurability()+durabilityLoss));
 | 
				
			||||||
                durability += (LoadProperties.abilityDurabilityLoss);
 | 
					 | 
				
			||||||
                inhand.setDurability(durability);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,7 +160,6 @@ public class WoodCutting
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
 | 
					        PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
 | 
				
			||||||
        Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
 | 
					        Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
 | 
				
			||||||
		Skills.abilityDurabilityLoss(player.getItemInHand());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    private static boolean treeFellerCompatible(Block block)
 | 
					    private static boolean treeFellerCompatible(Block block)
 | 
				
			||||||
@@ -265,7 +264,7 @@ public class WoodCutting
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
    	PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
					    	PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
 | 
				
			||||||
    	Bukkit.getPluginManager().callEvent(armswing);
 | 
					    	Bukkit.getPluginManager().callEvent(armswing);
 | 
				
			||||||
		Skills.abilityDurabilityLoss(player.getItemInHand());
 | 
							Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
 | 
				
			||||||
		if(LoadProperties.spoutEnabled)
 | 
							if(LoadProperties.spoutEnabled)
 | 
				
			||||||
			SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
 | 
								SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user