ItemJoin

ItemJoin

157k Downloads

Setting the limit-modes causes the item to not generate at all

czerk89 opened this issue · 3 comments

commented

Server Version

paper-1.20.4-454

Resource Version

6.0.5-RELEASE-b928

Dump Information

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

Describe The Bug

When I add limit-modes: CREATIVE to an item, it no longer triggers; aka no longer shows up in my hot bar.

Expected Behavior

I would expect the item to show only in creative game mode.

Steps To Reproduce

  1. Create a creative world
  2. Create this item:
  gamemode-item:
    id: BEACON
    name: '&eGamemode Switcher'
    limit-modes: CREATIVE
    slot: 7
    lore:
    - '&7Switch to survival mode.'
    interact:
    - 'console: gamemode survival %player%'
    - 'message: &eYou have been set to survival mode.'
    commands-sound: BLOCK_NOTE_BLOCK_PLING
    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.gamemode
    commands-warmup: 1
    enabled-worlds: world
  1. Join the world. The item never appears in slot 7. Run /gamemode 0 and /gamemode 1, and still nothing happens. Theoretically, gamemode-switch trigger should kick in.
  2. Delete the line limit-modes: CREATIVE and change nothing else. Reload the plugin.
  3. Enter the world, and the item appears.

Additional Info

There's an gamemode switch example on the wiki that uses limit-modes: CREATIVE, so I would expect it to work. But let me know if I'm missing something.

Checklist

  • I am running latest version of this resource.
  • I have read the wiki to make sure it's not an issue with configuration.
  • I ticked all of these boxes without actually reading them.
  • I have checked that my bug report is unique and a previous report does not exist.
commented

I also found that gamemode-switch doesn't clear items either and limit-modes works in this case. I have the following item that is using limit-modes: SURVIVAL, ADVENTURE and successfully generates during world-switch. However, it also generates when I switch into a world that's set to CREATIVE. So that shouldn't be happening.

  superhero-item:
    id: FIREWORK_STAR
    charge-color: RED
    name: '&eSuperhero Token'
    slot: 6
    limit-modes: SURVIVAL
    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

But I also created the below item that is a gamemode switcher. But when switching modes, the above item does go away. The above superhero-item should only remain in SURVIVAL and should disappear due to gamemode-switch based on my understanding in the wiki. But when I toggle gamemode-item between CREATIVE and SURVIVAL, item superhero-item remains.

  gamemode-item:
    id: BEACON
    name: '&eGamemode Switcher'
    slot: 7
    lore:
    - '&7Press mine to switch to survival mode.'
    - '&7'
    - '&7Press mine to switch to creative mode.'
    interact-left:
    - 'console: gamemode survival %player%'
    - 'message: &eYou are now in survival mode.'
    - 'player: [close]'
    interact-right:
    - 'console: gamemode creative %player%'
    - 'message: &eYou are now in creative mode.'
    - 'player: [close]'
    commands-sound: BLOCK_NOTE_BLOCK_PLING
    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.gamemode
    commands-warmup: 1
    enabled-worlds: world
commented

Thank you for all the testing you are doing.
There have been some recent changes I made to creative mode handling which may be the reason for these issues.
I am currently working on testing this, I will let you know once I have additional info/a snapshot available.

Everything you stated seems to line up with how I designed limit-modes and the gamemode-switch trigger so there is definitely an issue on my end.

commented

Wow okay, I was wrong, this bug was due to the WorldGuard integration and has existed for well over a year so its quite disappointing that I am just finding out about this.

I have done some tweaks and tested using the item examples you provided.
Everything seems to function properly now.

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

Thanks again for the bug report!
Let me know!~

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