Resolve NPE on /f warp with cooldown
This commit is contained in:
parent
6181f08da3
commit
1fa2abcc88
@ -8,10 +8,12 @@ import com.massivecraft.factions.util.LazyLocation;
|
|||||||
import com.massivecraft.factions.util.WarmUpUtil;
|
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.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class CmdFWarp extends FCommand {
|
public class CmdFWarp extends FCommand {
|
||||||
|
|
||||||
@ -44,13 +46,15 @@ public class CmdFWarp extends FCommand {
|
|||||||
if (!transact(fme)) {
|
if (!transact(fme)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final FPlayer fPlayer = fme;
|
||||||
|
final UUID uuid = fme.getPlayer().getUniqueId();
|
||||||
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() {
|
||||||
Player player = CmdFWarp.this.fme.getPlayer();
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.teleport(CmdFWarp.this.myFaction.getWarp(warpName).getLocation());
|
player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
|
||||||
CmdFWarp.this.fme.msg(TL.COMMAND_FWARP_WARPED, warpName);
|
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, this.p.getConfig().getLong("warmups.f-warp", 0));
|
}, this.p.getConfig().getLong("warmups.f-warp", 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user