Deny arena joins if unable to teleport
This commit is contained in:
parent
8028d7a340
commit
8daedf2230
@ -96,6 +96,13 @@ public class ArenaHandler {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean canWarp = PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
if (!canWarp) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_teleportFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("[BlockHunt] " + player.getName() + " has joined " + arenaname);
|
||||
arena.playersInArena.add(player);
|
||||
JoinArenaEvent event = new JoinArenaEvent(player, arena);
|
||||
@ -107,7 +114,6 @@ public class ArenaHandler {
|
||||
|
||||
MemoryStorage.pData.put(player, pad);
|
||||
|
||||
PlayerHandler.teleport(player, arena.lobbyWarp);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
for (PotionEffect pe : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(pe.getType());
|
||||
|
@ -104,6 +104,7 @@ public enum ConfigC {
|
||||
"%TAG%EYou need more tokens before you can buy this item.", MemoryStorage.messages), error_shopMaxSeekersReached(
|
||||
"%TAG%ESorry, the maximum amount of seekers has been reached!", MemoryStorage.messages), error_shopMaxHidersReached(
|
||||
"%TAG%ESorry, the maximum amount of hiders has been reached!", MemoryStorage.messages),
|
||||
error_teleportFailed("%TAG%EUnable to teleport you into the arena.", MemoryStorage.messages),
|
||||
error_teleportBlocked("%TAG%EYou cannot teleport while playing!", MemoryStorage.messages);
|
||||
|
||||
public Object value;
|
||||
|
@ -4,8 +4,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerHandler {
|
||||
public static void teleport(Player player, Location location) {
|
||||
public static boolean teleport(Player player, Location location) {
|
||||
MemoryStorage.teleportLoc.put(player, location);
|
||||
player.teleport(location);
|
||||
return player.teleport(location);
|
||||
}
|
||||
}
|
||||
|
@ -88,4 +88,5 @@ error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!'
|
||||
error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.'
|
||||
error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!'
|
||||
error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
||||
|
@ -88,4 +88,5 @@ error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!'
|
||||
error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.'
|
||||
error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!'
|
||||
error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
error-teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
||||
error-teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
||||
|
@ -97,4 +97,5 @@ error:
|
||||
shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.'
|
||||
shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!'
|
||||
shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'
|
||||
teleportFailed: '%TAG%EUnable to teleport you into the arena.'
|
||||
teleportBlocked: '%TAG%EYou cannot teleport while playing!'
|
||||
|
Loading…
Reference in New Issue
Block a user