SPIGOT-2903: Add Structure API

By: Sander Knauff <sanderknauff@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2021-10-05 11:56:35 +11:00
parent 2d0a775210
commit 188d3b23d0
7 changed files with 436 additions and 0 deletions

View File

@@ -183,6 +183,7 @@ import org.bukkit.craftbukkit.metadata.WorldMetadataStore;
import org.bukkit.craftbukkit.potion.CraftPotionBrewer;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager;
import org.bukkit.craftbukkit.structure.CraftStructureManager;
import org.bukkit.craftbukkit.tag.CraftBlockTag;
import org.bukkit.craftbukkit.tag.CraftEntityTag;
import org.bukkit.craftbukkit.tag.CraftFluidTag;
@@ -238,6 +239,7 @@ import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitWorker;
import org.bukkit.structure.StructureManager;
import org.bukkit.util.StringUtil;
import org.bukkit.util.permissions.DefaultPermissions;
import org.yaml.snakeyaml.Yaml;
@@ -255,6 +257,7 @@ public final class CraftServer implements Server {
private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger();
private final SimplePluginManager pluginManager = new SimplePluginManager(this, commandMap);
private final StructureManager structureManager;
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
@@ -298,6 +301,7 @@ public final class CraftServer implements Server {
}
}));
this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();
this.structureManager = new CraftStructureManager(console.getDefinedStructureManager());
Bukkit.setServer(this);
@@ -2199,6 +2203,11 @@ public final class CraftServer implements Server {
return new ArrayList<>(Lists.transform(nms, (entity) -> entity.getBukkitEntity()));
}
@Override
public StructureManager getStructureManager() {
return structureManager;
}
@Deprecated
@Override
public UnsafeValues getUnsafe() {