RockinChaos / ItemJoin

Get custom items on join.
https://www.craftationgaming.com/
GNU Lesser General Public License v3.0
141 stars 36 forks source link

Setting limit-modes: SURVIVAL, ADVENTURE causes item to not respect mode #587

Closed czerk89 closed 5 months ago

czerk89 commented 7 months ago

Server Version

paper-1.20.4-454

Resource Version

6.0.6-SNAPSHOT-b978

Dump Information

https://ci.craftationgaming.com/dump?id=utiyorutim

Describe The Bug

Using limit-modes: SURVIVAL, ADVENTURE causes the item to generate in a CREATIVE world on world-switch. But using limit-modes: SURVIVAL does not cause the item to generate in a CREATIVE world on world-switch.

Expected Behavior

The item shouldn't generate in a CREATIVE world when limit-modes: SURVIVAL, ADVENTURE is set.

Steps To Reproduce

  1. Create a CREATIVE world
  2. Create this item
  superhero-item:
    id: FIREWORK_STAR
    charge-color: RED
    name: '&eSuperhero Token'
    slot: 6
    limit-modes: SURVIVAL, ADVENTURE
    lore:
    - '&7Press mine to turn on superhero mode.'
    - '&7'
    - '&7Press place to turn off superhero mode.'
    interact-left:
    - 'console: heal %player%'
    - 'console: god %player%'
    - 'console: fly %player% on'
    - 'message: &eYou can fly and no longer be hurt.'
    - 'player: [close]'
    interact-right:
    - 'console: heal %player%'
    - 'console: ungod %player%'
    - 'console: fly %player% off'
    - 'message: &eYou can no longer fly and can be hurt again.'
    - 'player: [close]'
    commands-sound: BLOCK_NOTE_BLOCK_PLING
    commands-cooldown: 1
    itemflags: inventory-modify, hide-flags, death-drops, self-drops, unbreakable, item-store, overwrite, cancel-events, inventory-close, move-next, death-keep, placement, death-drops
    triggers: join, respawn, gamemode-switch, world-switch
    permission-node: itemjoin.dragonhub
    enabled-worlds: world
  1. /mvtp into the creative world. You'll have the superhero-item when you shouldn't.

But if you change limit-modes to limit-modes: SURVIVAL, then it works. Using both SURVIVAL & ADVENTURE causes it not to work. But only SURVIVAL works.

Additional Info

No response

Checklist

RockinChaos commented 7 months ago

Okay, so this issue was specific to Multiverse. Turns out the LIMIT-SWITCH was triggering before WORLD-SWITCH and the world-switching was using the previously cached gamemode at the time of entering the creative world. This was due to the items-Delay defined in the items.yml.

I have made it so only the limit-switch trigger passes the gamemode while others like (respawn, world-switch, join, etc) check at the time of giving the item instead of using a cached instance.

Link; https://ci.craftationgaming.com/downloads Remember to remove your old ItemJoin.jar file

Seems to be working well now. Let me know!~

EDIT: Offical release is now available; Link; https://www.spigotmc.org/resources/itemjoin.12661/download?version=542784