Ban Management

Ban Management

193k Downloads

Issue with delay actions

EvilOlaf opened this issue ยท 7 comments

commented
#    '10':
#     - cmd: ban [player] [reason]
# delays are in seconds
#       delay: 10
#     - cmd: mute [player] [reason]

I tried to setup a delay between the warning and the following action. Like in the example I tried this:

warningActions:
  enabled: true
  actions:
    '2':
      delay: 2
    - cmd: 'kick [player] zu vieler Verwarnungen (Letzte: [reason])'

[20:08:01] [Server thread/ERROR]: [BanManager] Invalid yaml file config.yml
[20:08:01] [Server thread/WARN]: org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
 in 'string', line 79, column 5:
        '2':
        ^
expected <block end>, but found BlockEntry
 in 'string', line 81, column 5:
        - cmd: 'kick [player] zu vieler  ... 
        ^

[20:08:01] [Server thread/WARN]:    at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57)
[20:08:01] [Server thread/WARN]:    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226)
[20:08:01] [Server thread/WARN]:    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169)
[20:08:01] [Server thread/WARN]:    at me.confuser.banmanager.bukkitutil.configs.Config.onLoad(Config.java:126)
[20:08:01] [Server thread/WARN]:    at me.confuser.banmanager.bukkitutil.configs.Config.load(Config.java:90)
[20:08:01] [Server thread/WARN]:    at me.confuser.banmanager.commands.ReloadCommand.onCommand(ReloadCommand.java:18)
[20:08:01] [Server thread/WARN]:    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[20:08:01] [Server thread/WARN]:    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
[20:08:01] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)
[20:08:01] [Server thread/WARN]:    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[20:08:01] [Server thread/WARN]:    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:714)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:653)
[20:08:01] [Server thread/WARN]:    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:556)
[20:08:01] [Server thread/WARN]:    at java.lang.Thread.run(Thread.java:745)
[20:08:01] [Server thread/WARN]: Caused by: while parsing a block mapping
 in 'string', line 79, column 5:
        '2':
        ^
expected <block end>, but found BlockEntry
 in 'string', line 81, column 5:
        - cmd: 'kick [player] zu vieler  ... 
        ^

[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:570)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:224)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:229)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:229)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
[20:08:01] [Server thread/WARN]:    at org.yaml.snakeyaml.Yaml.load(Yaml.java:369)
[20:08:01] [Server thread/WARN]:    at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55)
[20:08:01] [Server thread/WARN]:    ... 21 more
[20:08:01] [Server thread/ERROR]: [BanManager] Attempting to load default config.yml

BM5.6.1

commented

Just a wild guess: can you try without the hyphen in front of cmd, like this?

warningActions:
  enabled: true
  actions:
    '2':
      delay: 2
      cmd: 'kick [player] zu vieler Verwarnungen (Letzte: [reason])'

Then it's at least valid yaml, according to http://yaml-online-parser.appspot.com

commented

The - needs to be on the first item, in your case you have delay first,
therefore it should prepend that, and not cmd.
On 3 Sep 2015 20:26, "Jonas Friedmann" [email protected] wrote:

Just a guess in the wild: Can you try without the hyphen in front of cmd
like this?

warningActions:
enabled: true
actions:
'2':
delay: 2
cmd: 'kick [player] zu vieler Verwarnungen (Letzte: [reason])'

Then it's at least valid yaml, according to
http://yaml-online-parser.appspot.com

โ€”
Reply to this email directly or view it on GitHub
#386 (comment)
.

commented

Ugh, I better stop commenting here and go back to my repository... ๐Ÿ™ˆ

commented

Haha it's ok, I appreciate the help :)
On 3 Sep 2015 20:43, "Jonas Friedmann" [email protected] wrote:

Ugh, I better stop commenting here and go back to my repository... [image:
๐Ÿ™ˆ]

โ€”
Reply to this email directly or view it on GitHub
#386 (comment)
.

commented

Didn't find time to test yet. Will do soon. Thanks.

commented

Yep works. Examples are wrong ^^
I'll not try to do a pr with corrected examples as I am not sure how that works when there are mulitple actions with delay or multiple delays on various locations as well as when you use delays at hooks. Maybe you, @confuser , find some time to rework those.

commented

The examples are absolutely fine, this is simply due to a misunderstanding of YAML.

Please validate via http://yaml-online-parser.appspot.com/ as it'll help you find problems in the syntax.