forked from SteamWar/SteamWar
make world identifier valid by hex encoding them
This commit is contained in:
@@ -27,6 +27,9 @@ import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HexFormat;
|
||||
|
||||
@Linked
|
||||
public class WorldIdentifier {
|
||||
|
||||
@@ -36,6 +39,10 @@ public class WorldIdentifier {
|
||||
resourceKey = new ResourceKey<>(new ResourceLocation("minecraft", "dimension"), new ResourceLocation("steamwar", name));
|
||||
}
|
||||
|
||||
public static void setArena(String map) {
|
||||
set("arena/" + Core.getVersion() + "/" + HexFormat.of().formatHex(map.getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
public WorldIdentifier() {
|
||||
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, packet) -> {
|
||||
if (resourceKey == null) return packet;
|
||||
|
||||
Reference in New Issue
Block a user