EssentialsX

EssentialsX

2M Downloads

Certain values generated by the /createkit command are seen as invalid

Andre601 opened this issue ยท 17 comments

commented

When creating a new kit with the /createkit command are certain values set, which EssentialsX sees as "invalid".
In my example does EssentialsX set the color(s) of firework as Color:[rgb:0x<hex code>] which the plugin doesn't support in commands like /kit

Infos

Used Spigot version: git-spigot-3fb9445-6e3cec8 (MC: 1.11.2) (Also didn't work on 1.13 [Link])

Used EssentialsX: 2.0.1-b481 (Also didn't work with Build 784 [Link])

How to reproduce:

  1. Craft a firework with multiple colors. The recipe I used can be found here.
  2. Hold the firework in your inventory and type /createkit [name] [delay]
    • I set the kit with the name "Special" (Second test as "Example") with delay 0.
  3. Copy the given text into the config. (On second test did EssentialsX add it directly)
    I used this text here and added it to the config like so:
kits:
  # ...
  # The other kits (tools, dtools, ...)
  firework:
    delay: 6000
    items:
      - 401 1 name:Angry_Creeper color:red fade:green type:creeper power:1
      - 401 1 name:Starry_Night color:yellow,orange fade:blue type:star effect:trail,twinkle power:1
      - 401 2 name:Solar_Wind color:yellow,orange fade:red shape:large effect:twinkle color:yellow,orange fade:red shape:ball effect:trail color:red,purple fade:pink shape:star effect:trail power:1
  special: # The new added kit
    delay: 0
    items: # "power: 3" was on the next line. I placed it on the same line.
    - 'FIREWORK 3 color:Color:[rgb0xB3312C],Color:[rgb0xEB8844] shape: STAR fade:Color:[rgb0xDECF2A],Color:[rgb0x41CD34] power:3'
    - POTION 1
  1. Reload the plugin.
  2. Use the /kit command.
  3. Now you get the message: "That kit is improperly defined. Contact an administrator." and the console will give the following Error:
    [Essentials] the option color:[rgb0x<hex code>],Color:[rgb0x<hex code>] is not a valid value for color.
commented

@Andre601 Did you ever resolve this, or does it still occur?

commented

I checked it and it still doesn't work.

How I tested it:

  1. I crafted firework like shown here: https://imgur.com/p4YZwQA
  2. I hold it in my inventory.
  3. I run the command /createkit Example 0 to make the kit Example with 0 delay.
    The Kit is saved in the kits.yml and also listed when running /kits
  4. I run /kit Example

The same error happens like mentioned in the first comment of this issue:
[13:49:56 WARN]: [Essentials] The option Color:[rgb0x287697],Color:[rgb0xABABAB] is not a valid value for color.

My settings:
Server type: PaperSpigot
Version: git-paper-509 (MC 1.13.2 Implementing API version 1.13.2-R0.1-SNAPSHOT. Currently 55 versions behind)
Essentials: 2.16.1.0 (Latest release from Spigot page)

commented

I didn't check if the latest version has fixed that...
Will do that later this day and provide feedback.

commented

Just wanted to ask, if this is still worked on.
I tried it with latest dev version as of this moment (Build 784)

Still doesn't work.
I tried again with the following steps

  1. Crafted a firework star with 1 gunpowder, 1 red dye, 1 blue dye, 1 diamond and 1 gold nugget
  2. Added orange and white colour to it.
  3. Crafted a firework with the firework star, 1 paper and 2 gunpowder.
  4. Used command /createkit special 0
  5. Get the kit with /kit special

I want to point out that this happens with a clean and fresh install of EssentialsX on a 1.14.4 PaperMC server.

commented

Does this happen without /createkit? The command currently doesn't support as much as you can do from within the file.

commented

I was just wondering if you were able to create the firework through the config.yml file segment on kits. Or is the problem that fireworks are compeletely unsupported right now?

commented

Does this happen without /createkit? The command currently doesn't support as much as you can do from within the file.

What do you mean?
The issue IS about /createkit so why should I check if it happens without it? And how should I even check it?

commented

The issue I reported is generally not about firework being not supported, as the firework kit, that is there by default works without issues.
I reported, that the createkit command sets invalid values (in this case colors) for items (in this case firework).

commented

OK thanks for the clarification ๐Ÿ‘

Was mostly asking because this issue is still marked as unconfirmed / not enough info, and it would be nice to verify it soon. I am cleaning through issues and trying to determine which ones need attention.

commented

I did update the title and also the first issue to (hopefully) make it a bit more clear.

commented

I used the following version to test:

[03:35:44 INFO]: CONSOLE issued server command: /ess version
[03:35:44 INFO]: Server version: 1.15.2-R0.1-SNAPSHOT git-Paper-90 (MC: 1.15.2)
[03:35:44 INFO]: EssentialsX version: 2.17.1.53
[03:35:44 INFO]: LuckPerms version: 5.0.72
[03:35:44 INFO]: Vault version: 1.7.2-b107
[03:35:44 INFO]: EssentialsXProtect version: 2.17.1.53
[03:35:44 INFO]: EssentialsXChat version: 2.17.1.53
[03:35:44 INFO]: EssentialsXGeoIP version: 2.17.1.53
[03:35:44 INFO]: EssentialsXAntiBuild version: 2.17.1.53
[03:35:44 INFO]: EssentialsXSpawn version: 2.17.1.53

I started with the following commands (based on @Andre601's supposed output from /createkit, and a "fixed" version of that). Used the /essentials:give command instead since the EssentialsX item meta should be handled the same way.

[03:24:19 INFO]: CONSOLE issued server command: /essentials:give pop4959 firework_rocket 3 color:Color:[rgb0xB3312C],Color:[rgb0xEB8844] shape: STAR fade:Color:[rgb0xDECF2A],Color:[rgb0x41CD34] power:3
[03:24:19 INFO]: Error: The option Color:[rgb0xB3312C],Color:[rgb0xEB8844] is not a valid value for color.
[03:33:35 INFO]: CONSOLE issued server command: /essentials:give pop4959 firework_rocket 3 color:yellow,green shape:star fade:purple,blue power:3
[03:33:35 INFO]: Giving 3 of firework rocket to Owner pop4959.

Sure enough, we see the same error message.

Notice I gave myself firework rockets successfully using the item meta tags. Since it was created successfully, we should also in theory be able to save the same firework with /createkit.

[03:36:38 INFO]: pop4959 issued server command: /createkit test 0
[03:36:39 INFO]: pop4959 issued server command: /kit test
[03:36:39 WARN]: [Essentials] The option Color:[rgb0xDECF2A],Color:[rgb0x3B511A] is not a valid value for color.

Nope. It says it is not a valid color, even when the colors used were extremely standard. Definitely a bug.

commented

@pop4959 I made a PR that fixes this issue.

commented

@chuckthemole Thanks for looking into it ๐Ÿ˜‰

commented

I'd like to look into this issue and present a solution if I find the bug.

commented

@pop4959 I've looked into this issue. The exception is being called on line 327 of MetaItemStack.java in the addFireworkMeta method.

           for (final String color : colors) {
                    if (colorMap.containsKey(color.toUpperCase())) {
                        validFirework = true;
                        primaryColors.add(colorMap.get(color.toUpperCase()).getFireworkColor());
                    } else {
                        throw new Exception(tl("invalidFireworkFormat", split[1], split[0]));
                    }
                }
          }

color is a rbg hex value when called with /kit test, from your example above. color should be an enum for this if statement to work.
When making this call to give rockets
[03:33:35 INFO]: CONSOLE issued server command: /essentials:give pop4959 firework_rocket 3 color:yellow,green shape:star fade:purple,blue power:3
the call walks through the same block of code. On this call the if statement works and this is where the rbg hex value is stored, into primaryColors.
I have a few ideas moving forward. I just wanted to make an update and get any thoughts, if any, before moving forward.

commented

It should be the same way as other meta (see for example "shape:star") is done, to work correctly.

I have not worked with item meta much, so it may be better if @mdcfe gives their opinion on this.