Prevent item pickup when respawning

This commit is contained in:
Sam 2017-11-12 12:26:53 +00:00 committed by Alexander Meech
parent 1a9d46a904
commit 6102b59779
2 changed files with 16 additions and 0 deletions

View File

@ -126,6 +126,7 @@ public class CakeWars extends TeamGame
AnnounceStay = false;
BlockPlace = true;
BlockBreak = true;
DeathTeleport = false;
DeathSpectateSecs = RESPAWN_TIME;
StrictAntiHack = true;
HungerSet = 20;

View File

@ -18,6 +18,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@ -154,6 +155,20 @@ public class CakePlayerModule extends CakeModule
}
}
@EventHandler
public void pickupItem(PlayerPickupItemEvent event)
{
if (!_game.IsLive())
{
return;
}
if (UtilPlayer.isSpectator(event.getPlayer()))
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void saveInventory(UpdateEvent event)
{