Resolve NPE on /f warp with cooldown

This commit is contained in:
vemacs 2015-09-07 08:00:58 -06:00
parent 6181f08da3
commit 1fa2abcc88

View File

@ -8,10 +8,12 @@ import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.UUID;
public class CmdFWarp extends FCommand {
@ -44,13 +46,15 @@ public class CmdFWarp extends FCommand {
if (!transact(fme)) {
return;
}
final FPlayer fPlayer = fme;
final UUID uuid = fme.getPlayer().getUniqueId();
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, new Runnable() {
@Override
public void run() {
Player player = CmdFWarp.this.fme.getPlayer();
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
player.teleport(CmdFWarp.this.myFaction.getWarp(warpName).getLocation());
CmdFWarp.this.fme.msg(TL.COMMAND_FWARP_WARPED, warpName);
player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
}
}, this.p.getConfig().getLong("warmups.f-warp", 0));