fixed possible exception on player join
This commit is contained in:
parent
62a4da3e66
commit
761550ac89
2 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
package net.tylermurphy.hideAndSeek;
|
package net.tylermurphy.hideAndSeek;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -23,9 +24,9 @@ public class Store {
|
||||||
playerLastLocationList = new HashMap<String,Location>();
|
playerLastLocationList = new HashMap<String,Location>();
|
||||||
|
|
||||||
public static List<String>
|
public static List<String>
|
||||||
Hider,
|
Hider = new ArrayList<String>(),
|
||||||
Seeker,
|
Seeker = new ArrayList<String>(),
|
||||||
Spectator;
|
Spectator = new ArrayList<String>();
|
||||||
|
|
||||||
public static Scoreboard
|
public static Scoreboard
|
||||||
board;
|
board;
|
||||||
|
|
|
@ -58,15 +58,19 @@ public class EventListener implements Listener {
|
||||||
} else if(status.equals("Setup") || status.equals("Standby")) {
|
} else if(status.equals("Setup") || status.equals("Standby")) {
|
||||||
if (lobbyManualJoin) {
|
if (lobbyManualJoin) {
|
||||||
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)){
|
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)){
|
||||||
|
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Hider.add(event.getPlayer().getName());
|
Hider.add(event.getPlayer().getName());
|
||||||
HiderTeam.addEntry(event.getPlayer().getName());
|
HiderTeam.addEntry(event.getPlayer().getName());
|
||||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||||
|
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
playerList.put(event.getPlayer().getName(), event.getPlayer());
|
playerList.put(event.getPlayer().getName(), event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue