mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-01-31 22:41:28 +01:00
Register custom structures
This commit is contained in:
parent
7047565dca
commit
e4e7106613
1
src/.gitignore
vendored
Normal file
1
src/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/.DS_Store
|
@ -1,9 +1,7 @@
|
|||||||
package world.bentobox.boxed.listeners;
|
package world.bentobox.boxed.listeners;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -108,7 +106,8 @@ public class NewAreaListener implements Listener {
|
|||||||
addon.saveResource("structures/" + js + ".nbt", false);
|
addon.saveResource("structures/" + js + ".nbt", false);
|
||||||
File structureFile = new File(addon.getDataFolder(), "structures/" + js + ".nbt");
|
File structureFile = new File(addon.getDataFolder(), "structures/" + js + ".nbt");
|
||||||
try {
|
try {
|
||||||
Bukkit.getStructureManager().loadStructure(structureFile);
|
Structure s = Bukkit.getStructureManager().loadStructure(structureFile);
|
||||||
|
Bukkit.getStructureManager().registerStructure(NamespacedKey.fromString("minecraft:boxed/" + js), s);
|
||||||
addon.log("Loaded " + js + ".nbt");
|
addon.log("Loaded " + js + ".nbt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
addon.logError("Error trying to load " + structureFile.getAbsolutePath());
|
addon.logError("Error trying to load " + structureFile.getAbsolutePath());
|
||||||
|
Loading…
Reference in New Issue
Block a user