mirror of https://github.com/LOOHP/Limbo.git
Use Adventure Key replacing NamespacedKey
This commit is contained in:
parent
9193d907d1
commit
081776e4fe
2
pom.xml
2
pom.xml
|
|
@ -24,7 +24,7 @@
|
|||
<groupId>com.loohp</groupId>
|
||||
<artifactId>Limbo</artifactId>
|
||||
<name>Limbo</name>
|
||||
<version>0.6.20-ALPHA</version>
|
||||
<version>0.6.21-ALPHA</version>
|
||||
|
||||
<description>Standalone Limbo Minecraft Server.</description>
|
||||
<url>https://github.com/LOOHP/Limbo</url>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,35 @@
|
|||
|
||||
package com.loohp.limbo;
|
||||
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.consolegui.ConsoleTextOutput;
|
||||
import com.loohp.limbo.utils.CustomStringUtils;
|
||||
import jline.console.ConsoleReader;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.inventory.Book;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.sound.Sound.Emitter;
|
||||
import net.kyori.adventure.sound.SoundStop;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.kyori.adventure.title.TitlePart;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.fusesource.jansi.Ansi.Attribute;
|
||||
import org.jline.reader.Candidate;
|
||||
import org.jline.reader.Completer;
|
||||
import org.jline.reader.EndOfFileException;
|
||||
import org.jline.reader.LineReader;
|
||||
import org.jline.reader.LineReader.SuggestionType;
|
||||
import org.jline.reader.LineReaderBuilder;
|
||||
import org.jline.reader.ParsedLine;
|
||||
import org.jline.reader.UserInterruptException;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -35,37 +64,6 @@ import java.util.Map.Entry;
|
|||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.fusesource.jansi.Ansi.Attribute;
|
||||
import org.jline.reader.Candidate;
|
||||
import org.jline.reader.Completer;
|
||||
import org.jline.reader.EndOfFileException;
|
||||
import org.jline.reader.LineReader;
|
||||
import org.jline.reader.LineReader.SuggestionType;
|
||||
import org.jline.reader.LineReaderBuilder;
|
||||
import org.jline.reader.ParsedLine;
|
||||
import org.jline.reader.UserInterruptException;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.consolegui.ConsoleTextOutput;
|
||||
import com.loohp.limbo.utils.CustomStringUtils;
|
||||
|
||||
import jline.console.ConsoleReader;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.inventory.Book;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.sound.Sound.Emitter;
|
||||
import net.kyori.adventure.sound.SoundStop;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.kyori.adventure.title.TitlePart;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
public class Console implements CommandSender {
|
||||
|
||||
protected static final Map<ChatColor, String> REPLACEMENTS = new HashMap<>();
|
||||
|
|
@ -136,7 +134,7 @@ public class Console implements CommandSender {
|
|||
public String getName() {
|
||||
return CONSOLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return Limbo.getInstance().getPermissionsManager().hasPermission(this, permission);
|
||||
|
|
@ -170,7 +168,7 @@ public class Console implements CommandSender {
|
|||
public void sendMessage(BaseComponent[] component) {
|
||||
sendMessage(String.join("", Arrays.asList(component).stream().map(each -> each.toLegacyText()).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMessage(Identity source, Component message, MessageType type) {
|
||||
sendMessage(PlainTextComponentSerializer.plainText().serialize(message));
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ import com.loohp.limbo.scheduler.LimboScheduler;
|
|||
import com.loohp.limbo.scheduler.Tick;
|
||||
import com.loohp.limbo.utils.CustomStringUtils;
|
||||
import com.loohp.limbo.utils.ImageUtils;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.utils.NetworkUtils;
|
||||
import com.loohp.limbo.world.DimensionRegistry;
|
||||
import com.loohp.limbo.world.Environment;
|
||||
import com.loohp.limbo.world.Schematic;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
|
@ -146,7 +146,7 @@ public final class Limbo {
|
|||
private final List<World> worlds = new CopyOnWriteArrayList<>();
|
||||
final Map<String, Player> playersByName = new ConcurrentHashMap<>();
|
||||
final Map<UUID, Player> playersByUUID = new ConcurrentHashMap<>();
|
||||
private final Map<NamespacedKey, KeyedBossBar> bossBars = new ConcurrentHashMap<>();
|
||||
private final Map<Key, KeyedBossBar> bossBars = new ConcurrentHashMap<>();
|
||||
|
||||
private final ServerProperties properties;
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ public final class Limbo {
|
|||
|
||||
worlds.add(loadDefaultWorld());
|
||||
Location spawn = properties.getWorldSpawn();
|
||||
properties.setWorldSpawn(new Location(getWorld(properties.getLevelName().getKey()), spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getYaw(), spawn.getPitch()));
|
||||
properties.setWorldSpawn(new Location(getWorld(properties.getLevelName().value()), spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getYaw(), spawn.getPitch()));
|
||||
|
||||
if (!NetworkUtils.available(properties.getServerPort())) {
|
||||
console.sendMessage("");
|
||||
|
|
@ -401,7 +401,7 @@ public final class Limbo {
|
|||
}
|
||||
|
||||
try {
|
||||
World world = Schematic.toWorld(properties.getLevelName().getKey(), Environment.fromNamespacedKey(properties.getLevelDimension()), (CompoundTag) NBTUtil.read(schem).getTag());
|
||||
World world = Schematic.toWorld(properties.getLevelName().value(), Environment.fromKey(properties.getLevelDimension()), (CompoundTag) NBTUtil.read(schem).getTag());
|
||||
console.sendMessage("Loaded world " + properties.getLevelName() + "!");
|
||||
return world;
|
||||
} catch (Throwable e) {
|
||||
|
|
@ -434,14 +434,14 @@ public final class Limbo {
|
|||
}
|
||||
}
|
||||
|
||||
public KeyedBossBar createBossBar(NamespacedKey namespacedKey, Component name, float progress, BossBar.Color color, BossBar.Overlay overlay, BossBar.Flag... flags) {
|
||||
KeyedBossBar keyedBossBar = new KeyedBossBar(namespacedKey, BossBar.bossBar(name, progress, color, overlay, new HashSet<>(Arrays.asList(flags))));
|
||||
bossBars.put(namespacedKey, keyedBossBar);
|
||||
public KeyedBossBar createBossBar(Key Key, Component name, float progress, BossBar.Color color, BossBar.Overlay overlay, BossBar.Flag... flags) {
|
||||
KeyedBossBar keyedBossBar = new KeyedBossBar(Key, BossBar.bossBar(name, progress, color, overlay, new HashSet<>(Arrays.asList(flags))));
|
||||
bossBars.put(Key, keyedBossBar);
|
||||
return keyedBossBar;
|
||||
}
|
||||
|
||||
public void removeBossBar(NamespacedKey namespacedKey) {
|
||||
KeyedBossBar keyedBossBar = bossBars.remove(namespacedKey);
|
||||
public void removeBossBar(Key Key) {
|
||||
KeyedBossBar keyedBossBar = bossBars.remove(Key);
|
||||
keyedBossBar.getProperties().removeListener(keyedBossBar.getUnsafe().getLimboListener());
|
||||
keyedBossBar.getUnsafe().invalidate();
|
||||
PacketPlayOutBoss packetPlayOutBoss = new PacketPlayOutBoss(keyedBossBar, PacketPlayOutBoss.BossBarAction.REMOVE);
|
||||
|
|
@ -454,7 +454,7 @@ public final class Limbo {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<NamespacedKey, KeyedBossBar> getBossBars() {
|
||||
public Map<Key, KeyedBossBar> getBossBars() {
|
||||
return Collections.unmodifiableMap(bossBars);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package com.loohp.limbo;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import com.loohp.limbo.entity.DataWatcher;
|
||||
import com.loohp.limbo.entity.Entity;
|
||||
import com.loohp.limbo.location.Location;
|
||||
|
|
@ -28,6 +26,8 @@ import com.loohp.limbo.player.Player;
|
|||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Deprecated
|
||||
public class Unsafe {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ package com.loohp.limbo.bossbar;
|
|||
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutBoss;
|
||||
import com.loohp.limbo.player.Player;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
public class KeyedBossBar {
|
||||
|
||||
private final UUID uuid;
|
||||
private final NamespacedKey key;
|
||||
private final Key key;
|
||||
private final BossBar properties;
|
||||
private final Set<Player> players;
|
||||
protected final LimboBossBarHandler listener;
|
||||
|
|
@ -45,7 +45,7 @@ public class KeyedBossBar {
|
|||
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Deprecated
|
||||
public KeyedBossBar(NamespacedKey key, BossBar properties) {
|
||||
public KeyedBossBar(Key key, BossBar properties) {
|
||||
this.uuid = UUID.randomUUID();
|
||||
this.key = key;
|
||||
this.properties = properties;
|
||||
|
|
@ -60,7 +60,7 @@ public class KeyedBossBar {
|
|||
return uuid;
|
||||
}
|
||||
|
||||
public NamespacedKey getKey() {
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
|
|
@ -32,6 +30,8 @@ import net.kyori.adventure.text.Component;
|
|||
import net.kyori.adventure.title.TitlePart;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface CommandSender extends Audience {
|
||||
|
||||
void sendMessage(BaseComponent[] component, UUID uuid);
|
||||
|
|
|
|||
|
|
@ -19,19 +19,18 @@
|
|||
|
||||
package com.loohp.limbo.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.loohp.limbo.Console;
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.player.Player;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultCommands implements CommandExecutor, TabCompletor {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,6 +19,18 @@
|
|||
|
||||
package com.loohp.limbo.consolegui;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
|
@ -32,19 +44,6 @@ import java.awt.event.WindowEvent;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GUI extends JFrame {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.consolegui;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
public class SystemInfo {
|
||||
|
||||
public static void printInfo() {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableField;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObjectType;
|
||||
|
|
@ -28,6 +26,8 @@ import com.loohp.limbo.location.Location;
|
|||
import com.loohp.limbo.utils.Rotation3f;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ArmorStand extends LivingEntity {
|
||||
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
|
|
|
|||
|
|
@ -19,20 +19,19 @@
|
|||
|
||||
package com.loohp.limbo.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableField;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObjectType;
|
||||
import com.loohp.limbo.location.Location;
|
||||
import com.loohp.limbo.utils.BungeecordAdventureConversionUtils;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class Entity implements Sound.Emitter {
|
||||
|
||||
@WatchableField(MetadataIndex = 0, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.entity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.loohp.limbo.location.Location;
|
||||
import com.loohp.limbo.player.Player;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum EntityType {
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ public enum EntityType {
|
|||
private final short typeId;
|
||||
private final boolean independent;
|
||||
private final boolean living;
|
||||
private final NamespacedKey key;
|
||||
private final Key key;
|
||||
|
||||
private static final Map<String, EntityType> NAME_MAP = new HashMap<>();
|
||||
private static final Map<Short, EntityType> ID_MAP = new HashMap<>();
|
||||
|
|
@ -337,7 +337,7 @@ public enum EntityType {
|
|||
this.typeId = (short) typeId;
|
||||
this.independent = independent;
|
||||
this.living = clazz != null && LivingEntity.class.isAssignableFrom(clazz);
|
||||
this.key = (name == null) ? null : NamespacedKey.minecraft(name);
|
||||
this.key = (name == null) ? null : Key.key(Key.MINECRAFT_NAMESPACE, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -351,7 +351,7 @@ public enum EntityType {
|
|||
return name;
|
||||
}
|
||||
|
||||
public NamespacedKey getKey() {
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableField;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObjectType;
|
||||
|
|
@ -29,6 +27,8 @@ import com.loohp.limbo.location.Location;
|
|||
import com.loohp.limbo.world.BlockPosition;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class LivingEntity extends Entity {
|
||||
|
||||
@WatchableField(MetadataIndex = 8, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.loohp.limbo.events;
|
||||
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -26,8 +28,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
public class EventsManager {
|
||||
|
||||
private List<ListenerPair> listeners;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.loohp.limbo.events;
|
||||
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -26,8 +28,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
public class RegisteredCachedListener {
|
||||
|
||||
private LimboPlugin plugin;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package com.loohp.limbo.events.player;
|
|||
import com.loohp.limbo.events.Cancellable;
|
||||
import com.loohp.limbo.events.Event;
|
||||
import com.loohp.limbo.network.ClientConnection;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
public class PlayerLoginEvent extends Event implements Cancellable {
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.events.status;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import com.loohp.limbo.events.Event;
|
||||
import com.loohp.limbo.network.ClientConnection;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class StatusPingEvent extends Event {
|
||||
|
||||
private ClientConnection connection;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
package com.loohp.limbo.file;
|
||||
|
||||
import com.loohp.limbo.utils.YamlOrder;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.representer.Representer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
|
@ -34,12 +39,6 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.representer.Representer;
|
||||
|
||||
import com.loohp.limbo.utils.YamlOrder;
|
||||
|
||||
public class FileConfiguration {
|
||||
|
||||
private Map<String, Object> mapping;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import com.loohp.limbo.Console;
|
|||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.location.Location;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import org.json.simple.JSONArray;
|
||||
|
|
@ -57,9 +57,9 @@ public class ServerProperties {
|
|||
private int maxPlayers;
|
||||
private int serverPort;
|
||||
private String serverIp;
|
||||
private NamespacedKey levelName;
|
||||
private Key levelName;
|
||||
private String schemFileName;
|
||||
private NamespacedKey levelDimension;
|
||||
private Key levelDimension;
|
||||
private GameMode defaultGamemode;
|
||||
private Location worldSpawn;
|
||||
private boolean reducedDebugInfo;
|
||||
|
|
@ -117,10 +117,10 @@ public class ServerProperties {
|
|||
serverPort = Integer.parseInt(prop.getProperty("server-port"));
|
||||
serverIp = prop.getProperty("server-ip");
|
||||
String[] level = prop.getProperty("level-name").split(";");
|
||||
levelName = new NamespacedKey(level[0]);
|
||||
levelName = Key.key(level[0]);
|
||||
schemFileName = level[1];
|
||||
levelDimension = new NamespacedKey(prop.getProperty("level-dimension"));
|
||||
defaultGamemode = GameMode.fromName(new NamespacedKey(prop.getProperty("default-gamemode")).getKey());
|
||||
levelDimension = Key.key(prop.getProperty("level-dimension"));
|
||||
defaultGamemode = GameMode.fromName(Key.key(prop.getProperty("default-gamemode")).value());
|
||||
String[] locStr = prop.getProperty("world-spawn").split(";");
|
||||
World world = Limbo.getInstance().getWorld(locStr[0]);
|
||||
double x = Double.parseDouble(locStr[1]);
|
||||
|
|
@ -290,7 +290,7 @@ public class ServerProperties {
|
|||
return serverIp;
|
||||
}
|
||||
|
||||
public NamespacedKey getLevelName() {
|
||||
public Key getLevelName() {
|
||||
return levelName;
|
||||
}
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ public class ServerProperties {
|
|||
return schemFileName;
|
||||
}
|
||||
|
||||
public NamespacedKey getLevelDimension() {
|
||||
public Key getLevelDimension() {
|
||||
return levelDimension;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.location;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.primitives.Doubles;
|
||||
import com.loohp.limbo.utils.NumberConversions;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Represents a mutable vector. Because the components of Vectors are mutable,
|
||||
* storing Vectors long term may be dangerous if passing code modifies the
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.metrics;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
|
|
@ -35,14 +41,6 @@ import java.util.UUID;
|
|||
import java.util.concurrent.Callable;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
|
||||
/**
|
||||
* bStats collects some data for plugin authors.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ package com.loohp.limbo.network;
|
|||
import com.loohp.limbo.network.protocol.packets.PacketIn;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketOut;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.utils.Pair;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
|
@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
public class Channel implements AutoCloseable {
|
||||
|
||||
private final List<Pair<NamespacedKey, ChannelPacketHandler>> handlers;
|
||||
private final List<Pair<Key, ChannelPacketHandler>> handlers;
|
||||
private final AtomicBoolean valid;
|
||||
protected final DataInputStream input;
|
||||
protected final DataOutputStream output;
|
||||
|
|
@ -52,15 +52,15 @@ public class Channel implements AutoCloseable {
|
|||
}
|
||||
}
|
||||
|
||||
public void addHandlerBefore(NamespacedKey key, ChannelPacketHandler handler) {
|
||||
public void addHandlerBefore(Key key, ChannelPacketHandler handler) {
|
||||
handlers.add(0, new Pair<>(key, handler));
|
||||
}
|
||||
|
||||
public void addHandlerAfter(NamespacedKey key, ChannelPacketHandler handler) {
|
||||
public void addHandlerAfter(Key key, ChannelPacketHandler handler) {
|
||||
handlers.add(new Pair<>(key, handler));
|
||||
}
|
||||
|
||||
public void removeHandler(NamespacedKey key) {
|
||||
public void removeHandler(Key key) {
|
||||
handlers.removeIf(each -> each.getFirst().equals(key));
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ public class Channel implements AutoCloseable {
|
|||
size = size < 0 ? DataTypeIO.readVarInt(input) : size;
|
||||
int packetId = DataTypeIO.readVarInt(input);
|
||||
ChannelPacketRead read = new ChannelPacketRead(size, packetId, input);
|
||||
for (Pair<NamespacedKey, ChannelPacketHandler> pair : handlers) {
|
||||
for (Pair<Key, ChannelPacketHandler> pair : handlers) {
|
||||
read = pair.getSecond().read(read);
|
||||
if (read == null) {
|
||||
packet = null;
|
||||
|
|
@ -91,7 +91,7 @@ public class Channel implements AutoCloseable {
|
|||
protected boolean writePacket(PacketOut packet) throws IOException {
|
||||
ensureOpen();
|
||||
ChannelPacketWrite write = new ChannelPacketWrite(packet);
|
||||
for (Pair<NamespacedKey, ChannelPacketHandler> pair : handlers) {
|
||||
for (Pair<Key, ChannelPacketHandler> pair : handlers) {
|
||||
write = pair.getSecond().write(write);
|
||||
if (write == null) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ import com.loohp.limbo.utils.ForwardingUtils;
|
|||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.utils.MojangAPIUtils;
|
||||
import com.loohp.limbo.utils.MojangAPIUtils.SkinResponse;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
|
@ -126,8 +126,8 @@ import java.util.stream.Stream;
|
|||
|
||||
public class ClientConnection extends Thread {
|
||||
|
||||
private static final NamespacedKey DEFAULT_HANDLER_NAMESPACE = new NamespacedKey("default");
|
||||
private static final String BRAND_ANNOUNCE_CHANNEL = new NamespacedKey("brand").toString();
|
||||
private static final Key DEFAULT_HANDLER_NAMESPACE = Key.key("default");
|
||||
private static final String BRAND_ANNOUNCE_CHANNEL = Key.key("brand").toString();
|
||||
|
||||
private final Random random = new Random();
|
||||
private final Socket clientSocket;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.loohp.limbo.network;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
|
|
@ -26,8 +28,6 @@ import java.net.Socket;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
public class ServerConnection extends Thread {
|
||||
|
||||
private ServerSocket serverSocket;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ package com.loohp.limbo.network.protocol.packets;
|
|||
import com.loohp.limbo.registry.Registry;
|
||||
import com.loohp.limbo.utils.BitsUtils;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.Environment;
|
||||
import com.loohp.limbo.world.GeneratedBlockDataMappings;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.querz.mca.Chunk;
|
||||
import net.querz.mca.Section;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
|
@ -253,7 +253,7 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
|
|||
int z = each.getInt("z") % 16;
|
||||
output.writeByte(((x & 15) << 4) | (z & 15));
|
||||
output.writeShort(y);
|
||||
Integer id = Registry.BLOCK_ENTITY_TYPE.getId(new NamespacedKey(chunk.getBlockStateAt(x, y, z).getString("Name")));
|
||||
Integer id = Registry.BLOCK_ENTITY_TYPE.getId(Key.key(chunk.getBlockStateAt(x, y, z).getString("Name")));
|
||||
DataTypeIO.writeVarInt(output, id == null ? -1 : id);
|
||||
DataTypeIO.writeCompoundTag(output, each);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class ClientboundSetSubtitleTextPacket extends PacketOut {
|
||||
|
||||
private Component subTitle;
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class ClientboundSetTitleTextPacket extends PacketOut {
|
||||
|
||||
private Component titleText;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketHandshakingIn extends PacketIn {
|
||||
|
||||
public enum HandshakeType {
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketLoginInLoginStart extends PacketIn {
|
||||
|
||||
private String username;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketLoginInPluginMessaging extends PacketIn {
|
||||
|
||||
private int messageId;
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketLoginOutDisconnect extends PacketOut {
|
||||
|
||||
private Component reason;
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketLoginOutLoginSuccess extends PacketOut {
|
||||
|
||||
private UUID uuid;
|
||||
|
|
|
|||
|
|
@ -19,25 +19,25 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
|
||||
public class PacketLoginOutPluginMessaging extends PacketOut {
|
||||
|
||||
private int messageId;
|
||||
private NamespacedKey channel;
|
||||
private Key channel;
|
||||
private byte[] data;
|
||||
|
||||
public PacketLoginOutPluginMessaging(int messageId, NamespacedKey channel) {
|
||||
public PacketLoginOutPluginMessaging(int messageId, Key channel) {
|
||||
this(messageId, channel, null);
|
||||
}
|
||||
|
||||
public PacketLoginOutPluginMessaging(int messageId, NamespacedKey channel, byte[] data) {
|
||||
public PacketLoginOutPluginMessaging(int messageId, Key channel, byte[] data) {
|
||||
this.messageId = messageId;
|
||||
this.channel = channel;
|
||||
this.data = data;
|
||||
|
|
@ -47,7 +47,7 @@ public class PacketLoginOutPluginMessaging extends PacketOut {
|
|||
return messageId;
|
||||
}
|
||||
|
||||
public NamespacedKey getChannel() {
|
||||
public Key getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.LastSeenMessages;
|
||||
import com.loohp.limbo.utils.MessageSignature;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.LastSeenMessages;
|
||||
import com.loohp.limbo.utils.MessageSignature;
|
||||
|
||||
public class PacketPlayInChat extends PacketIn {
|
||||
|
||||
private String message;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayInResourcePackStatus extends PacketIn {
|
||||
|
||||
public static enum EnumResourcePackStatus {
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayInTabComplete extends PacketIn {
|
||||
|
||||
private int id;
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketPlayOutDisconnect extends PacketOut {
|
||||
|
||||
private Component reason;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayOutEntityDestroy extends PacketOut {
|
||||
|
||||
private int[] entityIds;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObject;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObjectType;
|
||||
import com.loohp.limbo.entity.Entity;
|
||||
import com.loohp.limbo.entity.Pose;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.Rotation3f;
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -32,17 +42,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObject;
|
||||
import com.loohp.limbo.entity.DataWatcher.WatchableObjectType;
|
||||
import com.loohp.limbo.entity.Entity;
|
||||
import com.loohp.limbo.entity.Pose;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.Rotation3f;
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketPlayOutEntityMetadata extends PacketOut {
|
||||
|
||||
public static final int END_OFF_METADATA = 0xff;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ package com.loohp.limbo.network.protocol.packets;
|
|||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.Environment;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -140,11 +140,11 @@ public class PacketPlayOutLogin extends PacketOut {
|
|||
output.writeByte(-1);
|
||||
DataTypeIO.writeVarInt(output, worlds.size());
|
||||
for (World world : worlds) {
|
||||
DataTypeIO.writeString(output, new NamespacedKey(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||
}
|
||||
DataTypeIO.writeCompoundTag(output, dimensionCodec);
|
||||
DataTypeIO.writeString(output, world.getEnvironment().getNamespacedKey().toString(), StandardCharsets.UTF_8);
|
||||
DataTypeIO.writeString(output, new NamespacedKey(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||
DataTypeIO.writeString(output, world.getEnvironment().getKey().toString(), StandardCharsets.UTF_8);
|
||||
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||
output.writeLong(hashedSeed);
|
||||
DataTypeIO.writeVarInt(output, maxPlayers);
|
||||
DataTypeIO.writeVarInt(output, viewDistance);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutPlayerInfo.PlayerInfoData.PlayerInfoDataAddPlayer;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -27,10 +31,6 @@ import java.util.EnumSet;
|
|||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutPlayerInfo.PlayerInfoData.PlayerInfoDataAddPlayer;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
|
||||
public class PacketPlayOutPlayerInfo extends PacketOut {
|
||||
|
||||
public enum PlayerInfoAction {
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketPlayOutPlayerListHeaderFooter extends PacketOut{
|
||||
|
||||
private Component header;
|
||||
|
|
|
|||
|
|
@ -19,15 +19,14 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayOutPositionAndLook extends PacketOut {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketPlayOutResourcePackSend extends PacketOut {
|
||||
|
||||
public static final int MAX_HASH_LENGTH = 40;
|
||||
|
|
|
|||
|
|
@ -19,20 +19,19 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.world.Environment;
|
||||
import com.loohp.limbo.world.World;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.ListTag;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import com.loohp.limbo.world.Environment;
|
||||
import com.loohp.limbo.world.World;
|
||||
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.ListTag;
|
||||
|
||||
public class PacketPlayOutRespawn extends PacketOut {
|
||||
|
||||
private Environment dimension;
|
||||
|
|
@ -47,7 +46,7 @@ public class PacketPlayOutRespawn extends PacketOut {
|
|||
public PacketPlayOutRespawn(World world, CompoundTag dimensionCodec, long hashedSeed, GameMode gamemode, boolean isDebug, boolean isFlat, boolean copyMetaData) {
|
||||
this.dimension = world.getEnvironment();
|
||||
this.dimensionCodec = dimensionCodec;
|
||||
this.worldName = new NamespacedKey(world.getName()).toString();
|
||||
this.worldName = Key.key(world.getName()).toString();
|
||||
this.hashedSeed = hashedSeed;
|
||||
this.gamemode = gamemode;
|
||||
this.isDebug = isDebug;
|
||||
|
|
@ -96,7 +95,7 @@ public class PacketPlayOutRespawn extends PacketOut {
|
|||
CompoundTag tag = null;
|
||||
ListTag<CompoundTag> list = dimensionCodec.getCompoundTag("minecraft:dimension_type").getListTag("value").asCompoundTagList();
|
||||
for (CompoundTag each : list) {
|
||||
if (each.getString("name").equals(dimension.getNamespacedKey().toString())) {
|
||||
if (each.getString("name").equals(dimension.getKey().toString())) {
|
||||
tag = each.getCompoundTag("element");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.entity.EntityType;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.entity.EntityType;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayOutSpawnEntity extends PacketOut {
|
||||
|
||||
private int entityId;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
|
||||
public class PacketPlayOutSpawnPosition extends PacketOut {
|
||||
|
||||
private BlockPosition position;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -30,15 +30,15 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
public class PacketPlayOutStopSound extends PacketOut {
|
||||
|
||||
private NamespacedKey sound;
|
||||
private Key sound;
|
||||
private Sound.Source source;
|
||||
|
||||
public PacketPlayOutStopSound(NamespacedKey sound, Sound.Source source) {
|
||||
public PacketPlayOutStopSound(Key sound, Sound.Source source) {
|
||||
this.sound = sound;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public NamespacedKey getSound() {
|
||||
public Key getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,17 +19,16 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class PacketPlayOutTabComplete extends PacketOut {
|
||||
|
||||
private int id;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketPlayOutUpdateViewPosition extends PacketOut {
|
||||
|
||||
private int chunkX;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
public class PacketStatusOutResponse extends PacketOut {
|
||||
|
||||
private String json;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
package com.loohp.limbo.permissions;
|
||||
|
||||
import com.loohp.limbo.Console;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
import com.loohp.limbo.player.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -26,11 +31,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.loohp.limbo.Console;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
import com.loohp.limbo.player.Player;
|
||||
|
||||
public class PermissionsManager {
|
||||
|
||||
private Map<String, List<String>> users;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ import com.loohp.limbo.sounds.SoundEffect;
|
|||
import com.loohp.limbo.utils.BungeecordAdventureConversionUtils;
|
||||
import com.loohp.limbo.utils.GameMode;
|
||||
import com.loohp.limbo.utils.MessageSignature;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
|
|
@ -241,7 +240,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
super.teleport(location);
|
||||
}
|
||||
|
||||
public void sendPluginMessage(NamespacedKey channel, byte[] data) throws IOException {
|
||||
public void sendPluginMessage(Key channel, byte[] data) throws IOException {
|
||||
sendPluginMessage(channel.toString(), data);
|
||||
}
|
||||
|
||||
|
|
@ -454,8 +453,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
|
||||
@Override
|
||||
public void stopSound(SoundStop stop) {
|
||||
Key sound = stop.sound();
|
||||
PacketPlayOutStopSound stopSound = new PacketPlayOutStopSound(sound == null ? null : NamespacedKey.fromKey(sound), stop.source());
|
||||
PacketPlayOutStopSound stopSound = new PacketPlayOutStopSound(stop.sound(), stop.source());
|
||||
try {
|
||||
clientConnection.sendPacket(stopSound);
|
||||
} catch (IOException e) {
|
||||
|
|
@ -471,7 +469,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
@Override
|
||||
public void playSound(Sound sound, double x, double y, double z) {
|
||||
PacketPlayOutNamedSoundEffect namedSoundEffect = new PacketPlayOutNamedSoundEffect(
|
||||
SoundEffect.createVariableRangeEvent(NamespacedKey.fromKey(sound.name())),
|
||||
SoundEffect.createVariableRangeEvent(sound.name()),
|
||||
sound.source(), x, y, z, sound.volume(), sound.pitch(), sound.seed().orElse(ThreadLocalRandom.current().nextLong())
|
||||
);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
package com.loohp.limbo.plugins;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class LimboPlugin {
|
||||
|
||||
private String name;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.plugins;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.commands.CommandExecutor;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.commands.DefaultCommands;
|
||||
import com.loohp.limbo.commands.TabCompletor;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URL;
|
||||
|
|
@ -31,13 +38,6 @@ import java.util.Optional;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.commands.CommandExecutor;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.commands.DefaultCommands;
|
||||
import com.loohp.limbo.commands.TabCompletor;
|
||||
import com.loohp.limbo.file.FileConfiguration;
|
||||
|
||||
public class PluginManager {
|
||||
|
||||
private Map<String, LimboPlugin> plugins;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.registry;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -32,13 +38,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
|
||||
public class Registry {
|
||||
|
||||
public static final BlockEntityRegistry BLOCK_ENTITY_TYPE;
|
||||
|
|
@ -54,7 +53,7 @@ public class Registry {
|
|||
}
|
||||
}
|
||||
|
||||
Map<NamespacedKey, Integer> blockEntityType = new HashMap<>();
|
||||
Map<Key, Integer> blockEntityType = new HashMap<>();
|
||||
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)) {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(reader);
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ public class Registry {
|
|||
for (Object obj : blockEntityJson.keySet()) {
|
||||
String key = obj.toString();
|
||||
int id = (int) (long) ((JSONObject) blockEntityJson.get(key)).get("protocol_id");
|
||||
blockEntityType.put(new NamespacedKey(key), id);
|
||||
blockEntityType.put(Key.key(key), id);
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -72,26 +71,26 @@ public class Registry {
|
|||
|
||||
public static class BlockEntityRegistry {
|
||||
|
||||
private Map<NamespacedKey, Integer> blockEntityType;
|
||||
private Map<Key, Integer> blockEntityType;
|
||||
|
||||
private BlockEntityRegistry(Map<NamespacedKey, Integer> blockEntityType) {
|
||||
private BlockEntityRegistry(Map<Key, Integer> blockEntityType) {
|
||||
this.blockEntityType = blockEntityType;
|
||||
}
|
||||
|
||||
public int getId(NamespacedKey key) {
|
||||
public int getId(Key key) {
|
||||
Integer exact = blockEntityType.get(key);
|
||||
if (exact != null) {
|
||||
return exact;
|
||||
}
|
||||
List<String> toTest = new LinkedList<>();
|
||||
toTest.add(key.getKey());
|
||||
if (key.getKey().contains("head")) {
|
||||
toTest.add(key.value());
|
||||
if (key.value().contains("head")) {
|
||||
toTest.add("skull");
|
||||
}
|
||||
for (Entry<NamespacedKey, Integer> entry : blockEntityType.entrySet()) {
|
||||
NamespacedKey namespacedKey = entry.getKey();
|
||||
for (Entry<Key, Integer> entry : blockEntityType.entrySet()) {
|
||||
Key Key = entry.getKey();
|
||||
for (String each : toTest) {
|
||||
if (namespacedKey.getNamespace().equals(key.getNamespace()) && (each.contains(namespacedKey.getKey()) || namespacedKey.getKey().contains(each))) {
|
||||
if (Key.namespace().equals(key.namespace()) && (each.contains(Key.value()) || Key.value().contains(each))) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.loohp.limbo.scheduler;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
|
@ -28,9 +31,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
|
||||
public class LimboScheduler {
|
||||
|
||||
private AtomicInteger idProvider = new AtomicInteger(0);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
package com.loohp.limbo.scheduler;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.scheduler.LimboScheduler.CurrentSchedulerTask;
|
||||
import com.loohp.limbo.scheduler.LimboScheduler.LimboSchedulerTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -27,10 +31,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.scheduler.LimboScheduler.CurrentSchedulerTask;
|
||||
import com.loohp.limbo.scheduler.LimboScheduler.LimboSchedulerTask;
|
||||
|
||||
public class Tick {
|
||||
|
||||
private int tickingInterval;
|
||||
|
|
|
|||
|
|
@ -19,31 +19,31 @@
|
|||
|
||||
package com.loohp.limbo.sounds;
|
||||
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class SoundEffect {
|
||||
|
||||
public static SoundEffect createVariableRangeEvent(NamespacedKey namespacedKey) {
|
||||
return new SoundEffect(namespacedKey, 16.0F, false);
|
||||
public static SoundEffect createVariableRangeEvent(Key key) {
|
||||
return new SoundEffect(key, 16.0F, false);
|
||||
}
|
||||
|
||||
public static SoundEffect createFixedRangeEvent(NamespacedKey namespacedKey, float range) {
|
||||
return new SoundEffect(namespacedKey, range, true);
|
||||
public static SoundEffect createFixedRangeEvent(Key key, float range) {
|
||||
return new SoundEffect(key, range, true);
|
||||
}
|
||||
|
||||
private final NamespacedKey sound;
|
||||
private final Key sound;
|
||||
private final float range;
|
||||
private final boolean newSystem;
|
||||
|
||||
private SoundEffect(NamespacedKey sound, float range, boolean newSystem) {
|
||||
private SoundEffect(Key sound, float range, boolean newSystem) {
|
||||
this.sound = sound;
|
||||
this.range = range;
|
||||
this.newSystem = newSystem;
|
||||
}
|
||||
|
||||
public NamespacedKey getSound() {
|
||||
public Key getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,20 +19,21 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutPluginMessaging;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutPluginMessaging;
|
||||
|
||||
public class BungeeLoginMessageUtils {
|
||||
|
||||
public static final String BUNGEECORD_MAIN = new NamespacedKey("bungeecord", "main").toString();
|
||||
public static final String BUNGEECORD_MAIN = Key.key("bungeecord", "main").toString();
|
||||
|
||||
public static void sendUUIDRequest(DataOutputStream output) throws IOException {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import net.querz.nbt.tag.ByteArrayTag;
|
||||
import net.querz.nbt.tag.ByteTag;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
|
@ -35,6 +32,8 @@ import net.querz.nbt.tag.LongTag;
|
|||
import net.querz.nbt.tag.ShortTag;
|
||||
import net.querz.nbt.tag.StringTag;
|
||||
import net.querz.nbt.tag.Tag;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class CustomNBTUtils {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
import net.querz.nbt.io.NBTOutputStream;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.Tag;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
|
@ -29,12 +34,6 @@ import java.util.BitSet;
|
|||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.loohp.limbo.world.BlockPosition;
|
||||
|
||||
import net.querz.nbt.io.NBTOutputStream;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.Tag;
|
||||
|
||||
public class DataTypeIO {
|
||||
|
||||
public static <E extends Enum<E>> void writeEnumSet(DataOutputStream out, EnumSet<E> enumset, Class<E> oclass) throws IOException {
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutDeclareCommands;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.commands.CommandSender;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutDeclareCommands;
|
||||
|
||||
public class DeclareCommands {
|
||||
|
||||
public static PacketPlayOutDeclareCommands getDeclareCommandsPacket(CommandSender sender) throws IOException {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -28,15 +34,9 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
public class ForwardingUtils {
|
||||
|
||||
public static final NamespacedKey VELOCITY_FORWARDING_CHANNEL = new NamespacedKey("velocity", "player_info");
|
||||
public static final Key VELOCITY_FORWARDING_CHANNEL = Key.key("velocity", "player_info");
|
||||
|
||||
public static boolean validateVelocityModernResponse(byte[] data) throws IOException {
|
||||
ByteArrayInputStream byteIn = new ByteArrayInputStream(data);
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class ImageUtils {
|
||||
|
||||
public static String imgToBase64String(final RenderedImage img, String formatName) throws IOException {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -26,8 +27,6 @@ import java.net.URL;
|
|||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
public class MojangAPIUtils {
|
||||
|
||||
public static class SkinResponse {
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* This file is part of Limbo.
|
||||
*
|
||||
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com>
|
||||
* Copyright (C) 2022. Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import com.loohp.limbo.plugins.LimboPlugin;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NamespacedKey {
|
||||
|
||||
public static final String MINECRAFT_KEY = "minecraft";
|
||||
|
||||
public static NamespacedKey minecraft(String key) {
|
||||
return new NamespacedKey(MINECRAFT_KEY, key);
|
||||
}
|
||||
|
||||
public static NamespacedKey fromKey(Key key) {
|
||||
return new NamespacedKey(key.namespace(), key.value());
|
||||
}
|
||||
|
||||
private final String namespace;
|
||||
private final String key;
|
||||
|
||||
public NamespacedKey(String namespacedKey) {
|
||||
int index = namespacedKey.indexOf(":");
|
||||
if (index >= 0) {
|
||||
this.namespace = namespacedKey.substring(0, index);
|
||||
this.key = namespacedKey.substring(index + 1);
|
||||
} else {
|
||||
this.namespace = MINECRAFT_KEY;
|
||||
this.key = namespacedKey;
|
||||
}
|
||||
}
|
||||
|
||||
public NamespacedKey(LimboPlugin plugin, String key) {
|
||||
this(plugin.getName().toLowerCase().replace(" ", "_"), key);
|
||||
}
|
||||
|
||||
public NamespacedKey(String namespace, String key) {
|
||||
this.namespace = namespace;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public Key toKey() {
|
||||
return Key.key(namespace, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return namespace + ":" + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
NamespacedKey that = (NamespacedKey) o;
|
||||
return namespace.equals(that.namespace) && key.equals(that.key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(namespace, key);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,9 +19,10 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
||||
public class SchematicConvertionUtils {
|
||||
public class SchematicConversionUtils {
|
||||
|
||||
public static CompoundTag toTileEntityTag(CompoundTag tag) {
|
||||
int[] pos = tag.getIntArray("Pos");
|
||||
|
|
@ -37,11 +38,11 @@ public class SchematicConvertionUtils {
|
|||
int index = input.indexOf("[");
|
||||
CompoundTag tag = new CompoundTag();
|
||||
if (index < 0) {
|
||||
tag.putString("Name", new NamespacedKey(input).toString());
|
||||
tag.putString("Name", Key.key(input).toString());
|
||||
return tag;
|
||||
}
|
||||
|
||||
tag.putString("Name", new NamespacedKey(input.substring(0, index)).toString());
|
||||
tag.putString("Name", Key.key(input.substring(0, index)).toString());
|
||||
|
||||
String[] states = input.substring(index + 1, input.lastIndexOf("]")).replace(" ", "").split(",");
|
||||
|
||||
|
|
@ -19,6 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.utils;
|
||||
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
import org.yaml.snakeyaml.introspector.BeanAccess;
|
||||
import org.yaml.snakeyaml.introspector.FieldProperty;
|
||||
import org.yaml.snakeyaml.introspector.MethodProperty;
|
||||
import org.yaml.snakeyaml.introspector.MissingProperty;
|
||||
import org.yaml.snakeyaml.introspector.Property;
|
||||
import org.yaml.snakeyaml.introspector.PropertyUtils;
|
||||
import org.yaml.snakeyaml.util.PlatformFeatureDetector;
|
||||
|
||||
import java.beans.FeatureDescriptor;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
|
|
@ -33,15 +42,6 @@ import java.util.LinkedHashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
import org.yaml.snakeyaml.introspector.BeanAccess;
|
||||
import org.yaml.snakeyaml.introspector.FieldProperty;
|
||||
import org.yaml.snakeyaml.introspector.MethodProperty;
|
||||
import org.yaml.snakeyaml.introspector.MissingProperty;
|
||||
import org.yaml.snakeyaml.introspector.Property;
|
||||
import org.yaml.snakeyaml.introspector.PropertyUtils;
|
||||
import org.yaml.snakeyaml.util.PlatformFeatureDetector;
|
||||
|
||||
public class YamlOrder extends PropertyUtils {
|
||||
|
||||
private final Map<Class<?>, Map<String, Property>> propertiesCache = new HashMap<Class<?>, Map<String, Property>>();
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.StringTag;
|
||||
import net.querz.nbt.tag.Tag;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class BlockState {
|
||||
|
||||
private CompoundTag tag;
|
||||
|
|
@ -41,12 +40,12 @@ public class BlockState {
|
|||
return tag;
|
||||
}
|
||||
|
||||
public NamespacedKey getType() {
|
||||
return new NamespacedKey(tag.getString("Name"));
|
||||
public Key getType() {
|
||||
return Key.key(tag.getString("Name"));
|
||||
}
|
||||
|
||||
public void setType(NamespacedKey namespacedKey) {
|
||||
tag.putString("Name", namespacedKey.toString());
|
||||
public void setType(Key Key) {
|
||||
tag.putString("Name", Key.toString());
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
package com.loohp.limbo.world;
|
||||
|
||||
import com.loohp.limbo.location.Location;
|
||||
|
||||
import net.querz.mca.Chunk;
|
||||
|
||||
public class ChunkPosition {
|
||||
|
|
|
|||
|
|
@ -19,23 +19,20 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.utils.CustomNBTUtils;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.utils.CustomNBTUtils;
|
||||
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
||||
public class DimensionRegistry {
|
||||
|
||||
private CompoundTag defaultTag;
|
||||
|
|
|
|||
|
|
@ -19,57 +19,57 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.loohp.limbo.utils.NamespacedKey;
|
||||
|
||||
public class Environment {
|
||||
|
||||
public static final Environment NORMAL = new Environment(new NamespacedKey("minecraft:overworld"), true);
|
||||
public static final Environment NETHER = new Environment(new NamespacedKey("minecraft:the_nether"), false);
|
||||
public static final Environment END = new Environment(new NamespacedKey("minecraft:the_end"), false);
|
||||
public static final Environment NORMAL = new Environment(Key.key("minecraft:overworld"), true);
|
||||
public static final Environment NETHER = new Environment(Key.key("minecraft:the_nether"), false);
|
||||
public static final Environment END = new Environment(Key.key("minecraft:the_end"), false);
|
||||
|
||||
public static final Set<Environment> REGISTERED_ENVIRONMENTS = new HashSet<>();
|
||||
|
||||
public static Environment fromNamespacedKey(NamespacedKey key) {
|
||||
if (key.equals(NORMAL.getNamespacedKey())) {
|
||||
public static Environment fromKey(Key key) {
|
||||
if (key.equals(NORMAL.getKey())) {
|
||||
return NORMAL;
|
||||
} else if (key.equals(NETHER.getNamespacedKey())) {
|
||||
} else if (key.equals(NETHER.getKey())) {
|
||||
return NETHER;
|
||||
} else if (key.equals(END.getNamespacedKey())) {
|
||||
} else if (key.equals(END.getKey())) {
|
||||
return END;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Environment createCustom(NamespacedKey key) {
|
||||
public static Environment createCustom(Key key) {
|
||||
return createCustom(key, true);
|
||||
}
|
||||
|
||||
public static Environment createCustom(NamespacedKey key, boolean hasSkyLight) {
|
||||
if (REGISTERED_ENVIRONMENTS.stream().anyMatch(each -> each.getNamespacedKey().equals(key))) {
|
||||
throw new IllegalArgumentException("An Environment is already created with this NamespacedKey");
|
||||
public static Environment createCustom(Key key, boolean hasSkyLight) {
|
||||
if (REGISTERED_ENVIRONMENTS.stream().anyMatch(each -> each.getKey().equals(key))) {
|
||||
throw new IllegalArgumentException("An Environment is already created with this Key");
|
||||
}
|
||||
return new Environment(key, hasSkyLight);
|
||||
}
|
||||
|
||||
public static Environment getCustom(NamespacedKey key) {
|
||||
return REGISTERED_ENVIRONMENTS.stream().filter(each -> each.getNamespacedKey().equals(key)).findFirst().orElse(null);
|
||||
public static Environment getCustom(Key key) {
|
||||
return REGISTERED_ENVIRONMENTS.stream().filter(each -> each.getKey().equals(key)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
//=========================
|
||||
|
||||
private NamespacedKey key;
|
||||
private Key key;
|
||||
private boolean hasSkyLight;
|
||||
|
||||
private Environment(NamespacedKey key, boolean hasSkyLight) {
|
||||
private Environment(Key key, boolean hasSkyLight) {
|
||||
this.key = key;
|
||||
this.hasSkyLight = hasSkyLight;
|
||||
}
|
||||
|
||||
public NamespacedKey getNamespacedKey() {
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
|
@ -28,15 +35,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
|
||||
public class GeneratedBlockDataMappings {
|
||||
|
||||
private static JSONObject globalPalette = new JSONObject();
|
||||
|
|
|
|||
|
|
@ -19,16 +19,15 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.loohp.limbo.utils.SchematicConvertionUtils;
|
||||
|
||||
import com.loohp.limbo.utils.SchematicConversionUtils;
|
||||
import net.querz.mca.Chunk;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.ListTag;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class Schematic {
|
||||
|
||||
|
|
@ -81,7 +80,7 @@ public class Schematic {
|
|||
|
||||
if (pos[0] == x && pos[1] == y && pos[2] == z) {
|
||||
ListTag<CompoundTag> newTag = chunk.getTileEntities();
|
||||
newTag.add(SchematicConvertionUtils.toTileEntityTag(tag));
|
||||
newTag.add(SchematicConversionUtils.toTileEntityTag(tag));
|
||||
chunk.setTileEntities(newTag);
|
||||
itr.remove();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -19,16 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.world;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.loohp.limbo.Limbo;
|
||||
import com.loohp.limbo.entity.ArmorStand;
|
||||
import com.loohp.limbo.entity.DataWatcher;
|
||||
|
|
@ -39,12 +29,21 @@ import com.loohp.limbo.location.Location;
|
|||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityDestroy;
|
||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityMetadata;
|
||||
import com.loohp.limbo.player.Player;
|
||||
import com.loohp.limbo.utils.SchematicConvertionUtils;
|
||||
|
||||
import com.loohp.limbo.utils.SchematicConversionUtils;
|
||||
import net.querz.mca.Chunk;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.ListTag;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class World {
|
||||
|
||||
public static final CompoundTag HEIGHT_MAP = new CompoundTag();
|
||||
|
|
@ -122,7 +121,7 @@ public class World {
|
|||
chunk = Chunk.newChunk();
|
||||
this.chunks[(x >> 4)][(z >> 4)] = chunk;
|
||||
}
|
||||
CompoundTag block = SchematicConvertionUtils.toBlockTag(blockdata);
|
||||
CompoundTag block = SchematicConversionUtils.toBlockTag(blockdata);
|
||||
chunk.setBlockStateAt(x, y, z, block, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue