Rework compass inventory to highlight current world items

This commit is contained in:
2023-04-30 16:37:01 +02:00
parent 93d48712b5
commit 310b1034ae
5 changed files with 39 additions and 55 deletions

View File

@@ -1,34 +0,0 @@
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;
}
}

View File

@@ -4,8 +4,11 @@ import net.kyori.adventure.text.Component;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
public class BedManager {
public class ItemManager {
public static ItemStack getBedItem() {
return ItemStack.builder(Material.RED_BED).displayName(Component.text("Spawn-Teleporter")).build();
}
public static ItemStack getCompassItem() {
return ItemStack.builder(Material.COMPASS).displayName(Component.text("World-changer")).build();
}
}