Gamemode Inventories

Scripts that are ready to be just dropped-in and used! Exclusively high-quality scripts selected by the Denizen team.
Post Reply
User avatar
bear
Regular
Regular
Posts: 12
Joined: January 26th, 2019, 2:39 pm

Gamemode Inventories

Post by bear » May 12th, 2020, 5:43 pm

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!

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 267
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: Gamemode Inventories

Post by mcmonkey » May 12th, 2020, 10:19 pm

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).
Denizen lead developer. On Discord as mcmonkey#6666.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests