KeepInventoryShop | [1.20-1.21.4] icon

KeepInventoryShop | [1.20-1.21.4] -----

Buy Lives, Preserve Loot: KeepInventoryShop



KeepInventoryShop Plugin Patch Notes - Version 1.2
I made several changes to the code today to make it compatible with WorldGuard and to achieve the desired behavior when using this plugin.
  1. Added a new method isWorldGuardEnabled() to check if WorldGuard is enabled on the server.
  2. Added a new method isPlayerInRegion(Player player, String regionId) that takes a player and a region ID as its input. This method checks whether the given player is inside the specified region or not. If the player is inside the region, it returns true, otherwise, it returns false. To do this, it uses the WorldGuard API to get the player's location, the RegionManager, and the ApplicableRegionSet, and iterates through the applicable regions to check if the region ID matches the input region ID.
  3. In the onPlayerDeath event handler, modified the code to first check if the player is inside the "keep_inventory_zone" region using the isPlayerInRegion method. Based on the player's remaining lives and their location (inside or outside the region), and set the appropriate behavior for keeping or dropping the inventory.
Here's a summary of how the plugin should work with WorldGuard now:

  • If a player dies inside the "keep_inventory_zone" region and has remaining lives, their inventory will be kept, and they will lose one life.
  • If a player dies inside the "keep_inventory_zone" region and has no remaining lives, their inventory will be dropped.
  • If a player dies outside the "keep_inventory_zone" region and has remaining lives, their inventory will be kept, and they will lose one life.
  • If a player dies outside the "keep_inventory_zone" region and has no remaining lives, their inventory will be dropped.
The plugin now checks for the player's location using WorldGuard and performs the desired action depending on their position and remaining lives.

I could not replicate the bug a player was having where it would clear a players inventory's in a region, so I could in no way check to see if it works. But hoping adding compatibility with WorldGuard fixes the issue.
----------, Apr 30, 2023
Resource Information
Author:
----------
Total Downloads: 2,176
First Release: Apr 27, 2023
Last Update: Mar 28, 2025
Category: ---------------
All-Time Rating:
8 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings