Customizable default (no perms) vault size

This commit is contained in:
CmdrKittens
2020-04-09 00:49:34 -04:00
parent 167189c064
commit 9a8538b844
5 changed files with 26 additions and 9 deletions
@@ -96,7 +96,7 @@ public class UUIDVaultManager {
*/
public Inventory loadOwnVault(Player player, int number, int size) {
if (size % 9 != 0) {
size = 54;
size = PlayerVaults.getInstance().getDefaultVaultSize();
}
String title = Lang.VAULT_TITLE.toString().replace("%number", String.valueOf(number)).replace("%p", player.getName());
@@ -137,7 +137,7 @@ public class UUIDVaultManager {
*/
public Inventory loadOtherVault(String holder, int number, int size) {
if (size % 9 != 0) {
size = 54;
size = PlayerVaults.getInstance().getDefaultVaultSize();
}
String title = Lang.VAULT_TITLE.toString().replace("%number", String.valueOf(number)).replace("%p", PlayerVaults.getInstance().getNameIfPlayer(holder));
VaultViewInfo info = new VaultViewInfo(holder, number);
@@ -82,7 +82,7 @@ public class VaultManager {
*/
public Inventory loadOwnVault(Player player, int number, int size) {
if (size % 9 != 0) {
size = 54;
size = PlayerVaults.getInstance().getDefaultVaultSize();
}
String title = Lang.VAULT_TITLE.toString().replace("%number", String.valueOf(number)).replace("%p", player.getName());
@@ -110,7 +110,7 @@ public class VaultManager {
*/
public Inventory loadOtherVault(String name, int number, int size) {
if (size % 9 != 0) {
size = 54;
size = PlayerVaults.getInstance().getDefaultVaultSize();
}
String holder = name;
@@ -89,7 +89,7 @@ public class VaultOperations {
* Get the max size vault a player is allowed to have.
*
* @param name that is having his permissions checked.
* @return max size as integer. If no max size is set then it will default to 54.
* @return max size as integer. If no max size is set then it will default to the configured default.
*/
public static int getMaxVaultSize(String name) {
try {
@@ -99,25 +99,25 @@ public class VaultOperations {
// Not a UUID
}
return 54;
return PlayerVaults.getInstance().getDefaultVaultSize();
}
/**
* Get the max size vault a player is allowed to have.
*
* @param player that is having his permissions checked.
* @return max size as integer. If no max size is set then it will default to 54.
* @return max size as integer. If no max size is set then it will default to the configured default.
*/
public static int getMaxVaultSize(OfflinePlayer player) {
if (player == null || !player.isOnline()) {
return 54;
return PlayerVaults.getInstance().getDefaultVaultSize();
}
for (int i = 6; i != 0; i--) {
if (player.getPlayer().hasPermission("playervaults.size." + i)) {
return i * 9;
}
}
return 54;
return PlayerVaults.getInstance().getDefaultVaultSize();
}
/**