parent
					
						
							
								b80113b447
							
						
					
				
			
			
				commit
				
					
						2007d3c69f
					
				
			
		
					 1 changed files with 6 additions and 3 deletions
				
			
		|  | @ -473,14 +473,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean hasCooldown(Material material) { |     public boolean hasCooldown(Material material) { | ||||||
|         Preconditions.checkArgument(material != null, "material"); |         Preconditions.checkArgument(material != null, "Material cannot be null"); | ||||||
|  |         Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); | ||||||
| 
 | 
 | ||||||
|         return getHandle().getCooldowns().isOnCooldown(CraftMagicNumbers.getItem(material)); |         return getHandle().getCooldowns().isOnCooldown(CraftMagicNumbers.getItem(material)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public int getCooldown(Material material) { |     public int getCooldown(Material material) { | ||||||
|         Preconditions.checkArgument(material != null, "material"); |         Preconditions.checkArgument(material != null, "Material cannot be null"); | ||||||
|  |         Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); | ||||||
| 
 | 
 | ||||||
|         ItemCooldown.Info cooldown = getHandle().getCooldowns().cooldowns.get(CraftMagicNumbers.getItem(material)); |         ItemCooldown.Info cooldown = getHandle().getCooldowns().cooldowns.get(CraftMagicNumbers.getItem(material)); | ||||||
|         return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldowns().tickCount); |         return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldowns().tickCount); | ||||||
|  | @ -488,7 +490,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void setCooldown(Material material, int ticks) { |     public void setCooldown(Material material, int ticks) { | ||||||
|         Preconditions.checkArgument(material != null, "material"); |         Preconditions.checkArgument(material != null, "Material cannot be null"); | ||||||
|  |         Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); | ||||||
|         Preconditions.checkArgument(ticks >= 0, "Cannot have negative cooldown"); |         Preconditions.checkArgument(ticks >= 0, "Cannot have negative cooldown"); | ||||||
| 
 | 
 | ||||||
|         getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks); |         getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 CraftBukkit/Spigot
				CraftBukkit/Spigot