fixed possible exception on player join

This commit is contained in:
Tyler Murphy 2021-10-11 17:18:37 -04:00
parent 62a4da3e66
commit 761550ac89
2 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
package net.tylermurphy.hideAndSeek;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -23,9 +24,9 @@ public class Store {
playerLastLocationList = new HashMap<String,Location>();
public static List<String>
Hider,
Seeker,
Spectator;
Hider = new ArrayList<String>(),
Seeker = new ArrayList<String>(),
Spectator = new ArrayList<String>();
public static Scoreboard
board;

View file

@ -58,14 +58,18 @@ public class EventListener implements Listener {
} else if(status.equals("Setup") || status.equals("Standby")) {
if (lobbyManualJoin) {
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)){
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
}
return;
}
}
Hider.add(event.getPlayer().getName());
HiderTeam.addEntry(event.getPlayer().getName());
event.getPlayer().setGameMode(GameMode.ADVENTURE);
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
}
}
playerList.put(event.getPlayer().getName(), event.getPlayer());
}