It's good now
This commit is contained in:
DNx5 2016-02-22 22:48:02 +07:00
parent 5e330398d3
commit 5943537c26

View File

@ -74,10 +74,9 @@ public class Spawn extends CustomConfiguration {
public Location getSpawn() { public Location getSpawn() {
try { try {
String worldName; String worldName = getString("spawn.world");
World world; World world = Bukkit.getWorld(worldName);
if (StringUtils.isEmpty(worldName = getString("spawn.world")) || if (StringUtils.isEmpty(worldName) || world == null) {
(world = Bukkit.getWorld(worldName)) == null) {
return null; return null;
} }
return new Location(world, getDouble("spawn.x"), getDouble("spawn.y"), getDouble("spawn.z"), return new Location(world, getDouble("spawn.x"), getDouble("spawn.y"), getDouble("spawn.z"),
@ -107,11 +106,11 @@ public class Spawn extends CustomConfiguration {
// Return the spawn location of a player // Return the spawn location of a player
public Location getSpawnLocation(Player player) { public Location getSpawnLocation(Player player) {
AuthMe plugin = AuthMe.getInstance(); AuthMe plugin = AuthMe.getInstance();
World world; if (plugin == null || player == null || player.getWorld() == null) {
if (plugin == null || player == null || (world = player.getWorld()) == null) {
return null; return null;
} }
World world = player.getWorld();
Location spawnLoc = null; Location spawnLoc = null;
for (String priority : spawnPriority) { for (String priority : spawnPriority) {
switch (priority.toLowerCase()) { switch (priority.toLowerCase()) {