Fix rare item duplication bug with Smoke Bomb (was told that it's just like the Recall duplication bug)

This commit is contained in:
Ben 2016-04-10 16:47:46 +01:00
parent db8ca31567
commit 159a5403ac

View File

@ -24,6 +24,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -55,7 +56,12 @@ public class SmokeBomb extends Skill
public void Use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if (player.getOpenInventory() != null)
{
return;
}
int level = getLevel(player);
if (level == 0) return;
@ -140,7 +146,19 @@ public class SmokeBomb extends Skill
Factory.Condition().EndCondition(event.getPlayer(), null, GetName());
}
@EventHandler
public void closeInv(InventoryCloseEvent event)
{
if (getLevel(event.getPlayer()) == 0)
{
return;
}
event.getPlayer().getInventory().addItem(event.getPlayer().getItemOnCursor());
event.getPlayer().setItemOnCursor(null);
}
@EventHandler
public void Smoke(UpdateEvent event)
{