McJtyMods / InControl

Be In Control of Mob Spawns and others
MIT License
46 stars 18 forks source link

"phase" condition can only have 1 string #458

Closed Mornedil closed 4 days ago

Mornedil commented 6 days ago

Here's a simple example for spawn.json:

{
    "phase": ["phaseA", "phaseB"],
    "when": "onjoin",
    "result": "deny"
}

It will give the following error: (Array must have size 1, but has size 2)

Wiki mentions being able to write a list of multiple phases to check against, but it's only possible to check a single string.

McJty commented 6 days ago

Can you show me exact error as well as your log? Multiple phases should work

Mornedil commented 6 days ago

Here is the log. The entire log is 13000 lines so I'm pasting only the part where incontrol is reloading.

I wrote "Testing now" in the chat, and then "/incontrol reload"

[10:30:31] [Render thread/INFO]: [CHAT] <Mornedil> Testing now:
[10:30:33] [Server thread/INFO]: Reading rules from areas.json
[10:30:33] [Server thread/INFO]: Reading rules from spawn.json
[10:30:33] [Server thread/ERROR]: JSON error in 'spawn.json': check log for details (Array must have size 1, but has size 2)
[10:30:33] [Server thread/ERROR]: Error parsing 'spawn.json'
java.lang.IllegalStateException: Array must have size 1, but has size 2
    at com.google.gson.JsonArray.getAsSingleElement(JsonArray.java:236) ~[gson-2.10.jar%23107!/:?]
    at com.google.gson.JsonArray.getAsString(JsonArray.java:262) ~[gson-2.10.jar%23107!/:?]
    at mcjty.incontrol.tools.typed.GenericAttributeMapFactory.parse(GenericAttributeMapFactory.java:110) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.SpawnRule.parse(SpawnRule.java:384) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.RulesManager.readRules(RulesManager.java:221) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.RulesManager.lambda$readAllRules$9(RulesManager.java:193) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.RulesManager.safeCall(RulesManager.java:207) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.RulesManager.readAllRules(RulesManager.java:193) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.rules.RulesManager.reloadRules(RulesManager.java:64) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at mcjty.incontrol.commands.CmdReload.run(CmdReload.java:37) ~[incontrol-1.20-9.2.9.jar%23245!/:1.20-9.2.9]
    at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[brigadier-1.1.8.jar%23113!/:?]
    at net.minecraft.commands.Commands.m_242674_(Commands.java:257) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.m_246958_(ServerGamePacketListenerImpl.java:1246) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.m_244885_(ServerGamePacketListenerImpl.java:1223) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.util.thread.BlockableEventLoop.m_18693_(BlockableEventLoop.java:67) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:156) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:770) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:161) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:130) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:753) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:747) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:139) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:733) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:665) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%23280!/:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
[10:30:33] [Server thread/INFO]: Reading rules from summonaid.json
[10:30:33] [Render thread/INFO]: [System] [CHAT] Reloaded InControl rules
[10:30:33] [Server thread/INFO]: Reading rules from loot.json
[10:30:33] [Render thread/INFO]: [System] [CHAT] §cInControl Error: §6JSON error in 'spawn.json': check log for details (Array must have size 1, but has size 2)
[10:30:33] [Server thread/INFO]: Reading rules from experience.json
[10:30:33] [Server thread/INFO]: Reading rules from phases.json
[10:30:33] [Server thread/INFO]: Reading rules from effects.json
[10:30:33] [Server thread/INFO]: Reading rules from breakevents.json
[10:30:33] [Server thread/INFO]: Reading rules from placeevents.json
[10:30:33] [Server thread/INFO]: Reading rules from rightclicks.json
[10:30:33] [Server thread/INFO]: Reading rules from leftclicks.json
[10:30:33] [Server thread/INFO]: Reading rules from spawner.json
[10:30:33] [Server thread/INFO]: Reading rules from events.json
[10:30:35] [Server thread/INFO]: Saving and pausing game...
McJty commented 4 days ago

Fixed in the next release