mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 04:21:31 +02:00
No need for that CraftBukkit hack anymore
This commit is contained in:
@@ -1,51 +0,0 @@
|
|||||||
package com.earth2me.essentials.craftbukkit;
|
|
||||||
|
|
||||||
import com.earth2me.essentials.api.IEssentials;
|
|
||||||
import com.earth2me.essentials.storage.Location;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.server.NBTTagCompound;
|
|
||||||
import net.minecraft.server.WorldNBTStorage;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
|
|
||||||
|
|
||||||
public class OfflineBedLocation
|
|
||||||
{
|
|
||||||
public static Location getBedLocation(final String playername, final IEssentials ess)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final CraftServer cserver = (CraftServer)ess.getServer();
|
|
||||||
if (cserver == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final WorldNBTStorage wnbtStorage = (WorldNBTStorage)cserver.getHandle().playerFileData;
|
|
||||||
if (wnbtStorage == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final NBTTagCompound playerStorage = wnbtStorage.getPlayerData(playername);
|
|
||||||
if (playerStorage == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerStorage.hasKey("SpawnX") && playerStorage.hasKey("SpawnY") && playerStorage.hasKey("SpawnZ"))
|
|
||||||
{
|
|
||||||
String spawnWorld = playerStorage.getString("SpawnWorld");
|
|
||||||
if ("".equals(spawnWorld))
|
|
||||||
{
|
|
||||||
spawnWorld = cserver.getWorlds().get(0).getName();
|
|
||||||
}
|
|
||||||
return new Location(spawnWorld, playerStorage.getInt("SpawnX"), playerStorage.getInt("SpawnY"), playerStorage.getInt("SpawnZ"));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (Throwable ex)
|
|
||||||
{
|
|
||||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -120,14 +120,7 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
return ess.getServer().getOfflinePlayer(base.getName()).getBedSpawnLocation();
|
||||||
{
|
|
||||||
return OfflineBedLocation.getBedLocation(base.getName(), ess).getBukkitLocation();
|
|
||||||
}
|
|
||||||
catch (WorldNotLoadedException ex)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user