Prevent users from opening a vault if they already have one open.
This commit is contained in:
@@ -34,6 +34,7 @@ public class Commands implements CommandExecutor {
|
||||
if (cmd.getName().equalsIgnoreCase("pv")) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if(PlayerVaults.IN_VAULT.containsKey(p.getName())) return true; // don't let them open another vault.
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (VaultOperations.openOwnVault(p, args[0])) {
|
||||
|
||||
@@ -55,8 +55,6 @@ public class Listeners implements Listener {
|
||||
public void saveVault(Player player) {
|
||||
if (PlayerVaults.IN_VAULT.containsKey(player.getName())) {
|
||||
Inventory inv = player.getOpenInventory().getTopInventory();
|
||||
if(inv.getViewers().contains(player))
|
||||
player.closeInventory();
|
||||
if (inv.getViewers().size() == 1) {
|
||||
VaultViewInfo info = PlayerVaults.IN_VAULT.get(player.getName());
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user