Found root cause of why spawn-near-players wasn't working. getOnlinePlayers gets from all worlds; for a server with nether, end, etc. those players can also be selected, but ultimately the player will spawn in the overworld but near the coords of that invisible player in the other world. So, replaced with world.getPlayers to prevent that.

This commit is contained in:
Daniel Boston
2016-05-08 10:11:37 -04:00
parent b03bf28238
commit 24f8ba7578

View File

@@ -91,8 +91,7 @@ public class RandomSpawn extends JavaPlugin{
blacklist = yamlHandler.worlds.getIntegerList(worldName + ".spawnblacklist");
if(yamlHandler.worlds.getBoolean(worldName + ".spawnbyplayer")) {
@SuppressWarnings("unchecked")
List<Player> playersOnline = (List<Player>) Bukkit.getOnlinePlayers();
List<Player> playersOnline = (List<Player>) world.getPlayers();
if(playersOnline.size() > 0) {
Player randomPlayer = playersOnline.get((int)(Math.random() * playersOnline.size()));