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