geforkt von Mirrors/Paper
Implement Player.setBedSpawnLocation(Location). Thanks md_5
Dieser Commit ist enthalten in:
Ursprung
b22e727cda
Commit
f5f268f939
@ -7,6 +7,7 @@ import net.minecraft.server.EntityPlayer;
|
|||||||
import net.minecraft.server.NBTTagCompound;
|
import net.minecraft.server.NBTTagCompound;
|
||||||
import net.minecraft.server.WorldNBTStorage;
|
import net.minecraft.server.WorldNBTStorage;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
@ -185,4 +186,16 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|||||||
public boolean hasPlayedBefore() {
|
public boolean hasPlayedBefore() {
|
||||||
return getData() != null;
|
return getData() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location getBedSpawnLocation() {
|
||||||
|
NBTTagCompound data = getData();
|
||||||
|
if (data.hasKey("SpawnX") && data.hasKey("SpawnY") && data.hasKey("SpawnZ")) {
|
||||||
|
String spawnWorld = data.getString("SpawnWorld");
|
||||||
|
if (spawnWorld.equals("")) {
|
||||||
|
spawnWorld = server.getWorlds().get(0).getName();
|
||||||
|
}
|
||||||
|
return new Location(server.getWorld(spawnWorld), data.getInt("SpawnX"), data.getInt("SpawnY"), data.getInt("SpawnZ"));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.server.ChunkCoordinates;
|
||||||
import net.minecraft.server.EntityPlayer;
|
import net.minecraft.server.EntityPlayer;
|
||||||
import net.minecraft.server.NBTTagCompound;
|
import net.minecraft.server.NBTTagCompound;
|
||||||
import net.minecraft.server.Packet131ItemData;
|
import net.minecraft.server.Packet131ItemData;
|
||||||
@ -554,9 +555,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
World world = getServer().getWorld(getHandle().spawnWorld);
|
World world = getServer().getWorld(getHandle().spawnWorld);
|
||||||
if ((world != null) && (getHandle().getBed() != null)) {
|
if ((world != null) && (getHandle().getBed() != null)) {
|
||||||
return new Location(world, getHandle().getBed().x, getHandle().getBed().y, getHandle().getBed().z);
|
return new Location(world, getHandle().getBed().x, getHandle().getBed().y, getHandle().getBed().z);
|
||||||
} else {
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBedSpawnLocation(Location location) {
|
||||||
|
getHandle().a(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||||
|
getHandle().spawnWorld = location.getWorld().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren