Perform a null check for teleport cooldowns to prevent exceptions when players log out before cooldown

This commit is contained in:
vemacs 2015-06-13 16:18:42 -06:00
parent fbbf352120
commit 03cc7f7394

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.Map;
@ -46,8 +47,11 @@ public class CmdFWarp extends FCommand {
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, new Runnable() {
@Override
public void run() {
CmdFWarp.this.fme.getPlayer().teleport(CmdFWarp.this.myFaction.getWarp(warpName).getLocation());
CmdFWarp.this.fme.msg(TL.COMMAND_FWARP_WARPED, warpName);
Player player = CmdFWarp.this.fme.getPlayer();
if (player != null) {
player.teleport(CmdFWarp.this.myFaction.getWarp(warpName).getLocation());
CmdFWarp.this.fme.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
}
}, this.p.getConfig().getLong("warmups.f-warp", 0));
} else {