Fixed Players not being given their Gem Hunters rewards for the final time!
This commit is contained in:
parent
8c821af9de
commit
b59e57dfb6
@ -29,6 +29,8 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
@ -479,10 +481,10 @@ public class LootModule extends MiniPlugin
|
||||
handleRewardItem((Player) event.getWhoClicked(), itemStack);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void pickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (event.getItem() == null)
|
||||
if (event.getItem() == null || event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -626,7 +628,7 @@ public class LootModule extends MiniPlugin
|
||||
{
|
||||
LootItemReward reward = iterator.next();
|
||||
|
||||
if (player.equals(reward.getPlayer()) && player.getInventory().contains(reward.getItemStack()))
|
||||
if (reward.getPlayer() != null && player.equals(reward.getPlayer()))
|
||||
{
|
||||
reward.success();
|
||||
iterator.remove();
|
||||
@ -634,6 +636,18 @@ public class LootModule extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
for (LootItemReward reward : _itemRewards)
|
||||
{
|
||||
if (reward.getPlayer().equals(event.getEntity()))
|
||||
{
|
||||
reward.death(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final Set<UUID> getShownPlayers()
|
||||
{
|
||||
return _shownPlayers;
|
||||
|
@ -38,7 +38,7 @@ public abstract class LootItemReward
|
||||
|
||||
public final void collectItem(Player player)
|
||||
{
|
||||
if (player.equals(_player))
|
||||
if (_player != null && player.equals(_player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -73,6 +73,7 @@ public abstract class LootItemReward
|
||||
|
||||
public final void death(PlayerDeathEvent event)
|
||||
{
|
||||
_player = null;
|
||||
}
|
||||
|
||||
public boolean isFirstPickup()
|
||||
|
Loading…
Reference in New Issue
Block a user