Added a catch for if a player is caged and kicked. Resolves #1789 (#2041)

This commit is contained in:
Ryan 2017-06-30 08:47:31 +01:00 committed by Jerom van der Sar
parent 26c83ff585
commit 98f0fdb620
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerKickEvent;
public class Cager extends FreedomService
{
@ -95,6 +96,18 @@ public class Cager extends FreedomService
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent event)
{
FPlayer player = plugin.pl.getPlayer(event.getPlayer());
CageData cage = player.getCageData();
if (cage.isCaged())
{
cage.playerQuit();
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event)
{

View File

@ -21,6 +21,7 @@ public class Command_gtfo extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;