various fixes, better worldhandling

This commit is contained in:
2023-04-27 21:37:05 +02:00
parent 38d46dccf8
commit 431f002521
8 changed files with 138 additions and 34 deletions

View File

@@ -0,0 +1,34 @@
package eu.mhsl.craftattack.worldmuseum.items;
import eu.mhsl.craftattack.worldmuseum.worlds.World;
import eu.mhsl.craftattack.worldmuseum.worlds.WorldManager;
import net.kyori.adventure.text.Component;
import net.minestom.server.inventory.Inventory;
import net.minestom.server.inventory.InventoryType;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
public class CompassManager {
static CompassManager instance;
ItemStack compass;
Inventory inventory;
public static CompassManager getInstance() {
if (instance == null) instance = new CompassManager();
return instance;
}
public void loadCommpassManager() {
compass = ItemStack.builder(Material.COMPASS).displayName(Component.text("World-changer")).build();
inventory = new Inventory(InventoryType.CHEST_1_ROW, Component.text("World-changer"));
for (World w : WorldManager.getInstance().getWorlds()) {
inventory.addItemStack(w.getItem());
}
}
public ItemStack getCompass() {
return compass;
}
public Inventory getInventory() {
return inventory;
}
}