Page 1 of 1

Gamemode Inventories

Posted: May 12th, 2020, 5:43 pm
by bear
Here's a simple script thrown together and scraped of some other pieces I use for my dEssentials package: Gamemode Inventories!

This concept was one of my first scripts inspired by what I believe was originally marked as a "Premium" plugin at the time. I believe something this simple should be free. When a player changes between gamemodes, their inventories are saved and swapped accordingly to that inventory's saved inventory.

The raw code:
Spoiler!

Code: Select all

Gamemode_Inventories:
  type: world
  debug: false
  events:
    on player changes gamemode:
      - flag player gamemode.inventory.<player.gamemode>:!|:<player.inventory.list_contents>
      - inventory clear
      - if <player.has_flag[gamemode.inventory.<context.gamemode>]>:
        - inventory set d:<player.inventory> o:<player.flag[gamemode.inventory.<context.gamemode>]>
Alternatively, here's the link to the script in a haste: Click me!

Re: Gamemode Inventories

Posted: May 12th, 2020, 10:19 pm
by mcmonkey
Note that this script isn't "secure", ie servers that want to prevent creative items being given to survival players cannot rely on this alone (as obviously a creative player could just drop an item or similar).