CommandHelper

CommandHelper

46.5k Downloads

Firework meta data incorrectly retrieved and set

LadyCailinBot opened this issue · 3 comments

commented

CMDHELPER-3014 - Reported by kookster

Firework meta data in a inventory appears to be retrieved incorrectly and set incorrectly:
Version:
Spigot 1650
CommandHelper Dropbox Build

before doing set_pinv(pinv()):
Image: http://i.imgur.com/34qdyXk.jpg
firework meta data:
{
colors: {
{b: 151, g: 118, r: 40},
{b: 42, g: 207, r: 222}
},
fade: {
{b: 240, g: 240, r: 240},
{b: 26, g: 81, r: 59}
},
flicker: true,
strength: 0,
trail: true,
type: CREEPER
}

after doing set_pinv(pinv()):
Image: http://i.imgur.com/NG4NvfT.jpg
firework meta data:
{
colors: {
{b: 151, g: 118, r: 40},
{b: 42, g: 207, r: 222},
{b: 240, g: 240, r: 240},
{b: 26, g: 81, r: 59}
},
fade: {},
flicker: true,
strength: 0,
trail: true,
type: CREEPER
}

commented

Comment by PseudoKnight

Ugh. Looks like fixing this will break compatibility with old arrays. The meta should look like this:

firework: array(
  strength: 0, 
  effects: array(
    array(
      colors: array(array(b: 151, g: 118, r: 40), array(b: 42, g: 207, r: 222)),
      fade: array(array(b: 240, g: 240, r: 240), array(b: 26, g: 81, r: 59)),
      flicker: false,
      trail: true,
      type: CREEPER,
    ),
    array(
      colors: array(array(b: 151, g: 118, r: 40), array(b: 42, g: 207, r: 222)),
      fade: array(array(b: 240, g: 240, r: 240), array(b: 26, g: 81, r: 59)),
      flicker: true,
      trail: false,
      type: CREEPER,
    ),
  ),
)

Maybe if "effects" index doesn't exist, we can assume it's one effect and read the effect data from the firework array.

commented

Comment by kookster

¯(°_o)/¯

commented

Comment by PseudoKnight

Fixed in 3134. It shouldn't affect scripts unless you're reading or modifying firework meta returned from functions, since the format changed. The old format is still supported for writing firework meta.