Added void-world for selection
Added loading indicators Added speed modifiers Code cleanup
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package eu.mhsl.craftattack.worldmuseum.items;
|
||||
|
||||
import eu.mhsl.craftattack.worldmuseum.util.MuseumPlayer;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.tag.Tag;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ActionItem {
|
||||
public static Tag<UUID> tag = Tag.UUID("action");
|
||||
public static Map<UUID, Consumer<MuseumPlayer>> actions = new HashMap<>();
|
||||
|
||||
private final ItemStack itemStack;
|
||||
|
||||
public ActionItem(Consumer<MuseumPlayer> action, ItemStack itemStack) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
this.itemStack = itemStack.withTag(tag, uuid);
|
||||
actions.put(uuid, action);
|
||||
}
|
||||
|
||||
public static void run(UUID uuid, Player p) {
|
||||
actions.get(uuid).accept((MuseumPlayer) p);
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package eu.mhsl.craftattack.worldmuseum.items;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package eu.mhsl.craftattack.worldmuseum.items;
|
||||
|
||||
import eu.mhsl.craftattack.worldmuseum.commands.SpawnCommand;
|
||||
import eu.mhsl.craftattack.worldmuseum.util.MuseumPlayer;
|
||||
import eu.mhsl.craftattack.worldmuseum.worlds.VoidWorld;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public enum Items {
|
||||
HUB(
|
||||
ItemStack
|
||||
.of(Material.IRON_DOOR)
|
||||
.withDisplayName(
|
||||
Component
|
||||
.text("Zurück zur Überischt")
|
||||
.color(NamedTextColor.GOLD)
|
||||
),
|
||||
player -> new VoidWorld().movePlayer(player)
|
||||
),
|
||||
|
||||
SPAWN(
|
||||
ItemStack
|
||||
.of(Material.TARGET)
|
||||
.withDisplayName(
|
||||
Component
|
||||
.text("Zum Spawn")
|
||||
.color(NamedTextColor.GOLD)
|
||||
),
|
||||
SpawnCommand::teleportToSpawn
|
||||
),
|
||||
|
||||
MORE_SPEED(
|
||||
ItemStack
|
||||
.of(Material.FEATHER)
|
||||
.withDisplayName(
|
||||
Component
|
||||
.text("Schneller fliegen")
|
||||
.color(NamedTextColor.AQUA)
|
||||
),
|
||||
player -> player.updateFlyingSpeed(0.05f)
|
||||
),
|
||||
|
||||
LESS_SPEED(
|
||||
ItemStack
|
||||
.of(Material.ANVIL)
|
||||
.withDisplayName(
|
||||
Component
|
||||
.text("Langsamer fliegen")
|
||||
.color(NamedTextColor.AQUA)
|
||||
),
|
||||
player -> player.updateFlyingSpeed(-0.05f)
|
||||
);
|
||||
|
||||
|
||||
private final ActionItem item;
|
||||
Items(ItemStack itemStack, Consumer<MuseumPlayer> action) {
|
||||
item = new ActionItem(action, itemStack);
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item.getItemStack();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user