Change the backpack.use permission from alias to real permission to improve reliability

This commit is contained in:
GeorgH93 2017-02-19 18:36:50 +01:00
parent 3d4c2cd2e6
commit 26eb28a37e
3 changed files with 5 additions and 6 deletions

View File

@ -25,10 +25,9 @@ permissions:
backpack.fullpickup: true backpack.fullpickup: true
backpack.use: backpack.use:
description: Allows a player to open the backpack. description: Allows a player to open the backpack.
children: default: false
backpack: true
backpack: backpack:
description: Allows a player to open the backpack. description: Allows a player to open the backpack. This is a fallback permission since some permission plugins have problems with the backpack.use permission.
default: false default: false
backpack.size.1: backpack.size.1:
description: Mini size for a backpack, if the player has backpack permission he will also have at least a backpack with the size 1. description: Mini size for a backpack, if the player has backpack permission he will also have at least a backpack with the size 1.

View File

@ -77,7 +77,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
if(args.length == 0) if(args.length == 0)
{ {
// Open player backpack // Open player backpack
if(player.hasPermission("backpack")) if(player.hasPermission("backpack.use") || player.hasPermission("backpack"))
{ {
if(gameModes.contains(player.getGameMode()) || player.hasPermission("backpack.ignoreGameMode")) if(gameModes.contains(player.getGameMode()) || player.hasPermission("backpack.ignoreGameMode"))
{ {
@ -120,7 +120,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
case "help": // Shows the help for the plugin case "help": // Shows the help for the plugin
case "hilfe": case "hilfe":
case "?": case "?":
if(player.hasPermission("backpack")) if(player.hasPermission("backpack.use") || player.hasPermission("backpack"))
{ {
player.sendMessage(ChatColor.GOLD + "Minepacks Help:"); player.sendMessage(ChatColor.GOLD + "Minepacks Help:");
player.sendMessage(ChatColor.AQUA + "/backpack" + ChatColor.WHITE + " - " + plugin.lang.getTranslated("Commands.Description.Backpack")); player.sendMessage(ChatColor.AQUA + "/backpack" + ChatColor.WHITE + " - " + plugin.lang.getTranslated("Commands.Description.Backpack"));

View File

@ -43,7 +43,7 @@ public void run()
{ {
for(Player player : Bukkit.getServer().getOnlinePlayers()) for(Player player : Bukkit.getServer().getOnlinePlayers())
{ {
if(player.getInventory().firstEmpty() == -1 && player.hasPermission("backpack") && player.hasPermission("backpack.fullpickup")) if(player.getInventory().firstEmpty() == -1 && (player.hasPermission("backpack") || player.hasPermission("backpack.use")) && player.hasPermission("backpack.fullpickup"))
{ {
// Only check loaded backpacks (loading them would take to much time for a repeating task, the backpack will be loaded async soon enough) // Only check loaded backpacks (loading them would take to much time for a repeating task, the backpack will be loaded async soon enough)
Backpack backpack = plugin.getBackpackCachedOnly(player); Backpack backpack = plugin.getBackpackCachedOnly(player);