mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 17:23:42 +01:00 
			
		
		
		
	proper InventoryClickEvent array index fix
This commit is contained in:
		| @@ -436,15 +436,13 @@ public class InventoryListener implements Listener { | |||||||
|     public void onInventoryClickEvent(InventoryClickEvent event) { |     public void onInventoryClickEvent(InventoryClickEvent event) { | ||||||
|         SkillUtils.removeAbilityBuff(event.getCurrentItem()); |         SkillUtils.removeAbilityBuff(event.getCurrentItem()); | ||||||
|         if (event.getAction() == InventoryAction.HOTBAR_SWAP) { |         if (event.getAction() == InventoryAction.HOTBAR_SWAP) { | ||||||
|  |             if(event.getHotbarButton() == -1) | ||||||
|  |                 return; | ||||||
|  |  | ||||||
|             PlayerInventory playerInventory = event.getWhoClicked().getInventory(); |             PlayerInventory playerInventory = event.getWhoClicked().getInventory(); | ||||||
|  |  | ||||||
|             //TODO: Is this a spigot bug? |             if(playerInventory.getItem(event.getHotbarButton()) != null) | ||||||
|             if(playerInventory.getContents().length > event.getHotbarButton()) |                 SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton())); | ||||||
|             { |  | ||||||
|                 if(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) != null) |  | ||||||
|                     SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton())); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -435,6 +435,9 @@ public final class CombatUtils { | |||||||
|             Projectile arrow = (Projectile) painSource; |             Projectile arrow = (Projectile) painSource; | ||||||
|             ProjectileSource projectileSource = arrow.getShooter(); |             ProjectileSource projectileSource = arrow.getShooter(); | ||||||
|  |  | ||||||
|  |             //Determine if the arrow belongs to a bow or xbow | ||||||
|  |  | ||||||
|  |  | ||||||
|             if (projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) { |             if (projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) { | ||||||
|                 Player player = (Player) projectileSource; |                 Player player = (Player) projectileSource; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50