Add permissions to alter the default state of Any/SilentChest (#76)

This commit is contained in:
Jikoo 2017-11-05 20:00:22 -05:00
parent 2195677651
commit e3d1af010b
3 changed files with 37 additions and 8 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
**/.project
**/.classpath
**/.idea
**/.iml
**/target
**/bin
**/out

View file

@ -271,7 +271,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
@Override
public boolean getPlayerAnyChestStatus(final OfflinePlayer player) {
return this.getConfig().getBoolean("toggles.any-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), false);
boolean defaultState = false;
if (player.isOnline()) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer != null) {
defaultState = onlinePlayer.hasPermission("openinv.anychest.default");
}
}
return this.getConfig().getBoolean("toggles.any-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), defaultState);
}
@Override
@ -281,7 +290,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
@Override
public boolean getPlayerSilentChestStatus(final OfflinePlayer player) {
return this.getConfig().getBoolean("toggles.silent-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), false);
boolean defaultState = false;
if (player.isOnline()) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer != null) {
defaultState = onlinePlayer.hasPermission("openinv.silentchest.default");
}
}
return this.getConfig().getBoolean("toggles.silent-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), defaultState);
}
@Override

View file

@ -5,6 +5,16 @@ author: lishid
authors: [Jikoo, ShadowRanger]
description: >
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
permissions:
openinv:
anychest.default:
description: Permission for AnyContainer to default on prior to toggling.
default: false
silentchest.default:
description: Permission for SilentChest to default on prior to toggling.
default: false
commands:
openinv:
aliases: [oi, inv, open]
@ -31,15 +41,15 @@ commands:
usage: |-
/<command> <item> [MinAmount] - Item is the ID or the Bukkit Material, MinAmount is the minimum amount required
silentchest:
aliases: [sc, silent]
description: Toggle silent chest function, which stops sounds and animations when using containers.
aliases: [sc, silent, silentcontainer]
description: Toggle SilentContainer function, which stops sounds and animations when using containers.
permission: OpenInv.*;OpenInv.silent
usage: |-
/<command> [Check] - Check or toggle silent chest
anychest:
aliases: [ac]
description: Toggle anychest function, which allows opening of blocked chests.
permission: OpenInv.*;OpenInv.anychest
anycontainer:
aliases: [ac, anychest]
description: Toggle AnyContainer function, which allows opening of blocked containers.
permission: OpenInv.*;OpenInv.anychest;OpenInv.anycontainer
usage: |-
/<command> [Check] - Checks or toggle anychest
searchenchant: