InvSee-plus-plus
InvSee-plus-plus copied to clipboard
Inventory access distance
From SpigotMC forum user AntonyMax:
I think this would be best implemented as an addon, which listens to InventoryOpenEvent and cancels it if the opened inventory is a SpectatorInventory, and if the criteria for restricting access are met. One factor to take into account is that InvSee++ currently replies with something among the lines of 'Some other plugin prevented you from accessing the inventory'. This message will need to become customisable. Possibly I have to implement my own event, e.g. SpectatorInventoryOpenEvent which wraps the InventoryOpenEvent (can't directly subclass it because event constructors are not public api). The NotCreatedReason or NotOpenedReason in question needs to have a field for the error message. One other factor to take into account is of course offline players. These have no distance to the accessing player because they have no entity in the world. There should probably be a config option whether to allow or deny these accesses (without doing the range check). Perhaps I can use the logout location of the offline player, but thay may conflicht with spawn plugins, and there is still the possibility that an offline player has not played before on the server. The same goes for players who are online, but in different world from the spectating player.
Personally I think this feature has rather low priority, but it'd be nice to implement at a moment where I don't have much time (when I won't be spending time on MultiVerse-Inventories or MyWorlds support).