Error creating WorldGuard region for Bedrock/Floodgate players
Technoguyfication opened this issue · 4 comments
Describe the bug
As per the default Floodgate config, Bedrock players have their usernames prefixed with a period .
character. This causes issues when they create a TARDIS, since worldguard region names cannot contain a period character.
An easy fix would be to just strip the period character from region names or replace it with another character to prevent region name collisions, but I was wondering if it might make more sense to just name regions by the TARDIS ID instead. For example, instead of tardis_tknoguyfication
, the region names would be tardis_2
, renderer_2
, etc. Since the junk TARDIS also has a numerical ID, this would remove the need for extra logic in naming the junk TARDIS region.
I'd be open to trying to fix this bug myself, but wanted to get your opinions on transitioning to naming regions by ID rather than username first!
To Reproduce
Steps to reproduce the behaviour:
- Install TARDIS, Geyser, and Floodgate 2.0
- Have a Bedrock/Floodgate player create a TARDIS
- Multiple errors from WorldGuard about the region name being invalid (ex.
tardis_.xalili
) - Region is never actually created, errors continue every tick until server restarts
Log files
I'd post the log file, but it's about 20MB in size after an hour of this happening. Here's a single of of the errors instead:
java.lang.IllegalArgumentException: Invalid region ID: TARDIS_.sapphire652997
at com.sk89q.worldguard.protection.regions.ProtectedRegion.<init>(ProtectedRegion.java:82) ~[?:?]
at com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion.<init>(ProtectedCuboidRegion.java:63) ~[?:?]
at com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion.<init>(ProtectedCuboidRegion.java:51) ~[?:?]
at me.eccentric_nz.TARDIS.utility.TARDISWorldGuardUtils.addWGProtection(TARDISWorldGuardUtils.java:174) ~[?:?]
at me.eccentric_nz.TARDIS.builders.TARDISBuilderInner.run(TARDISBuilderInner.java:289) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-752]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1427) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1342) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1130) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-752]
at java.lang.Thread.run(Thread.java:831) [?:?]
/tardis version
output
This is my own fork with many recent changes backported to 1.16.5, so the version numbers don't really mean much:
[10:41:47 INFO]: [TARDIS] Server version: git-Paper-752 (MC: 1.16.5)
[10:41:47 INFO]: [TARDIS] TARDIS version: 4.7.0-b19.06.21-20:25
[10:41:47 INFO]: [TARDIS] TARDISChunkGenerator version: 4.6.4
[10:41:47 INFO]: [TARDIS] PlaceholderAPI version: 2.10.9
[10:41:47 INFO]: [TARDIS] dynmap version: 3.2-beta-1-470
[10:41:47 INFO]: [TARDIS] Essentials version: 2.18.2.0
[10:41:47 INFO]: [TARDIS] WorldGuard version: 7.0.4+f7ff984
[10:41:47 INFO]: [TARDIS] Multiverse-Core version: 4.2.2-b812
[10:41:47 INFO]: [TARDIS] GriefPrevention version: 16.17.1-2b69191
[10:41:47 INFO]: [TARDIS] CoreProtect version: 19.5
If regions are named with ids (or sanitised bedrock player names), will WorldGuard accept a player name with a period when adding them as owners of the region?
If regions are named with ids (or sanitised bedrock player names), will WorldGuard accept a player name with a period when adding them as owners of the region?
Yes, they will. I believe worldguard uses spigot's username lookup api and saves the members by uuid. It's only angry about the period in the region name itself.
I removed the deprecated use of adding owners by name in the above fix anyway :)