mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-09 09:01:20 +01:00
Update method of permission checking, fixes #1313
This commit is contained in:
parent
a5251dd8ce
commit
44f9373e5b
@ -26,7 +26,6 @@ import java.net.URLClassLoader;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -68,7 +67,7 @@ import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@ -3508,25 +3507,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
* @return {@code true} if entity is a Player that has permission
|
||||
*/
|
||||
public boolean canUseQuests(UUID uuid) {
|
||||
if (!(Bukkit.getPlayer(uuid) instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p.isOp()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
for (PermissionAttachmentInfo pm : p.getEffectivePermissions()) {
|
||||
if (pm.getPermission().startsWith("quests")
|
||||
|| pm.getPermission().equals("*")
|
||||
|| pm.getPermission().equals("*.*")) {
|
||||
if (p != null) {
|
||||
for (Permission perm : getDescription().getPermissions()) {
|
||||
if (p.hasPermission(perm.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException ne) {
|
||||
// User has no permissions
|
||||
} catch (ConcurrentModificationException cme) {
|
||||
// Bummer. Not much we can do about it
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -8,130 +8,191 @@ dev-url: https://github.com/PikaMug/Quests
|
||||
author: PikaMug
|
||||
softdepend: [Citizens, CitizensBooks, Denizen, DungeonsXL, GPS, Heroes, mcMMO, Parties, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
|
||||
permissions:
|
||||
quests.quest:
|
||||
description: View current quest objectives
|
||||
default: true
|
||||
quests.questinfo:
|
||||
description: View information about a quest
|
||||
default: true
|
||||
quests.quests:
|
||||
description: Display plugin help
|
||||
default: true
|
||||
quests.list:
|
||||
description: List available quests
|
||||
default: true
|
||||
quests.take:
|
||||
description: Accept a quest via command
|
||||
default: true
|
||||
quests.quit:
|
||||
description: Quit a current quest
|
||||
default: true
|
||||
quests.stats:
|
||||
description: View quest statistics
|
||||
default: true
|
||||
quests.top:
|
||||
description: View plugin leaderboards
|
||||
default: true
|
||||
quests.info:
|
||||
description: View plugin information
|
||||
default: true
|
||||
quests.journal:
|
||||
description: Toggle the Quest Journal
|
||||
default: true
|
||||
quests.compass:
|
||||
description: Use a Compass to target quests
|
||||
default: true
|
||||
quests.admin:
|
||||
description: Display administrator help
|
||||
default: op
|
||||
quests.admin.stats:
|
||||
description: View quest statistics of a player
|
||||
default: op
|
||||
quests.admin.give:
|
||||
description: Force a player to take a quest
|
||||
default: op
|
||||
quests.admin.quit:
|
||||
description: Force a player to quit a quest
|
||||
default: op
|
||||
quests.admin.points:
|
||||
description: Set a player's Quest Points
|
||||
default: op
|
||||
quests.admin.takepoints:
|
||||
description: Take away a player's Quest Points
|
||||
default: op
|
||||
quests.admin.givepoints:
|
||||
description: Add to a player's Quest Points
|
||||
default: op
|
||||
quests.admin.pointsall:
|
||||
description: Set ALL players' Quest Points
|
||||
default: op
|
||||
quests.admin.finish:
|
||||
description: Force a player to complete a quest
|
||||
default: op
|
||||
quests.admin.nextstage:
|
||||
description: Force a player to complete current stage
|
||||
default: op
|
||||
quests.admin.setstage:
|
||||
description: Set the current stage for a player
|
||||
default: op
|
||||
quests.admin.reset:
|
||||
description: Clear all Quests data of a player
|
||||
default: op
|
||||
quests.admin.remove:
|
||||
description: Remove a completed quest from a player
|
||||
default: op
|
||||
quests.admin.reload:
|
||||
description: Safely reload the plugin
|
||||
default: op
|
||||
quests.admin.drop:
|
||||
description: Ability to drop the Quests Journal
|
||||
default: op
|
||||
quests.editor.editor:
|
||||
description: Ability to open Quests Editor
|
||||
default: op
|
||||
quests.editor.create:
|
||||
description: Ability to create new quests
|
||||
default: op
|
||||
quests.editor.edit:
|
||||
description: Ability to edit existing quests
|
||||
default: op
|
||||
quests.editor.delete:
|
||||
description: Ability to delete existing quests
|
||||
default: op
|
||||
quests.events.editor:
|
||||
description: LEGACY - Ability to open Actions Editor
|
||||
default: op
|
||||
quests.events.create:
|
||||
description: LEGACY - Ability to create new actions
|
||||
default: op
|
||||
quests.events.edit:
|
||||
description: LEGACY - Ability to edit existing actions
|
||||
default: op
|
||||
quests.events.delete:
|
||||
description: LEGACY - Ability to delete existing actions
|
||||
default: op
|
||||
quests.actions.editor:
|
||||
description: Ability to open Actions Editor
|
||||
default: op
|
||||
quests.actions.create:
|
||||
description: Ability to create new actions
|
||||
default: op
|
||||
quests.actions.edit:
|
||||
description: Ability to edit existing actions
|
||||
default: op
|
||||
quests.actions.delete:
|
||||
description: Ability to delete existing actions
|
||||
default: op
|
||||
quests.*:
|
||||
description: Access ALL Quests functionality
|
||||
default: op
|
||||
children:
|
||||
quests.quest: true
|
||||
quests.questinfo: true
|
||||
quests.quests: true
|
||||
quests.list: true
|
||||
quests.take: true
|
||||
quests.quit: true
|
||||
quests.stats: true
|
||||
quests.top: true
|
||||
quests.info: true
|
||||
quests.journal: true
|
||||
quests.compass: true
|
||||
quests.admin.*: true
|
||||
quests.editor.*: true
|
||||
quests.events.*: true
|
||||
quests.actions.*: true
|
||||
quests.quest:
|
||||
description: View current quest objectives
|
||||
default: true
|
||||
quests.questinfo:
|
||||
description: View information about a quest
|
||||
default: true
|
||||
quests.quests:
|
||||
description: Display plugin help
|
||||
default: true
|
||||
quests.list:
|
||||
description: List available quests
|
||||
default: true
|
||||
quests.take:
|
||||
description: Accept a quest via command
|
||||
default: true
|
||||
quests.quit:
|
||||
description: Quit a current quest
|
||||
default: true
|
||||
quests.stats:
|
||||
description: View quest statistics
|
||||
default: true
|
||||
quests.top:
|
||||
description: View plugin leaderboards
|
||||
default: true
|
||||
quests.info:
|
||||
description: View plugin information
|
||||
default: true
|
||||
quests.journal:
|
||||
description: Toggle the Quest Journal
|
||||
default: true
|
||||
quests.compass:
|
||||
description: Use a Compass to target quests
|
||||
default: true
|
||||
quests.admin.*:
|
||||
description: Access all Questadmin functionality
|
||||
default: op
|
||||
children:
|
||||
quests.admin: true
|
||||
quests.admin.stats: true
|
||||
quests.admin.give: true
|
||||
quests.admin.quit: true
|
||||
quests.admin.points: true
|
||||
quests.admin.takepoints: true
|
||||
quests.admin.givepoints: true
|
||||
quests.admin.finish: true
|
||||
quests.admin.nextstage: true
|
||||
quests.admin.setstage: true
|
||||
quests.admin.reset: true
|
||||
quests.admin.remove: true
|
||||
quests.admin.reload: true
|
||||
quests.admin.drop: true
|
||||
quests.admin:
|
||||
description: Display administrator help
|
||||
default: op
|
||||
quests.admin.stats:
|
||||
description: View quest statistics of a player
|
||||
default: op
|
||||
quests.admin.give:
|
||||
description: Force a player to take a quest
|
||||
default: op
|
||||
quests.admin.quit:
|
||||
description: Force a player to quit a quest
|
||||
default: op
|
||||
quests.admin.points:
|
||||
description: Set a player's Quest Points
|
||||
default: op
|
||||
quests.admin.takepoints:
|
||||
description: Take away a player's Quest Points
|
||||
default: op
|
||||
quests.admin.givepoints:
|
||||
description: Add to a player's Quest Points
|
||||
default: op
|
||||
quests.admin.pointsall:
|
||||
description: Set ALL players' Quest Points
|
||||
default: op
|
||||
quests.admin.finish:
|
||||
description: Force a player to complete a quest
|
||||
default: op
|
||||
quests.admin.nextstage:
|
||||
description: Force a player to complete current stage
|
||||
default: op
|
||||
quests.admin.setstage:
|
||||
description: Set the current stage for a player
|
||||
default: op
|
||||
quests.admin.reset:
|
||||
description: Clear all Quests data of a player
|
||||
default: op
|
||||
quests.admin.remove:
|
||||
description: Remove a completed quest from a player
|
||||
default: op
|
||||
quests.admin.reload:
|
||||
description: Safely reload the plugin
|
||||
default: op
|
||||
quests.admin.drop:
|
||||
description: Ability to drop the Quests Journal
|
||||
default: op
|
||||
quests.editor.*:
|
||||
description: Access all Quests Editor functionality
|
||||
default: op
|
||||
children:
|
||||
quests.editor.editor: true
|
||||
quests.editor.create: true
|
||||
quests.editor.edit: true
|
||||
quests.editor.delete: true
|
||||
quests.editor.editor:
|
||||
description: Ability to open Quests Editor
|
||||
default: op
|
||||
quests.editor.create:
|
||||
description: Ability to create new quests
|
||||
default: op
|
||||
quests.editor.edit:
|
||||
description: Ability to edit existing quests
|
||||
default: op
|
||||
quests.editor.delete:
|
||||
description: Ability to delete existing quests
|
||||
default: op
|
||||
quests.events.*:
|
||||
description: LEGACY - Access all Actions Editor functionality
|
||||
default: op
|
||||
children:
|
||||
quests.events.editor: true
|
||||
quests.events.create: true
|
||||
quests.events.edit: true
|
||||
quests.events.delete: true
|
||||
quests.events.editor:
|
||||
description: LEGACY - Ability to open Actions Editor
|
||||
default: op
|
||||
quests.events.create:
|
||||
description: LEGACY - Ability to create new actions
|
||||
default: op
|
||||
quests.events.edit:
|
||||
description: LEGACY - Ability to edit existing actions
|
||||
default: op
|
||||
quests.events.delete:
|
||||
description: LEGACY - Ability to delete existing actions
|
||||
default: op
|
||||
quests.actions.*:
|
||||
description: Access all Actions Editor functionality
|
||||
default: op
|
||||
children:
|
||||
quests.actions.editor: true
|
||||
quests.actions.create: true
|
||||
quests.actions.edit: true
|
||||
quests.actions.delete: true
|
||||
quests.actions.editor:
|
||||
description: Ability to open Actions Editor
|
||||
default: op
|
||||
quests.actions.create:
|
||||
description: Ability to create new actions
|
||||
default: op
|
||||
quests.actions.edit:
|
||||
description: Ability to edit existing actions
|
||||
default: op
|
||||
quests.actions.delete:
|
||||
description: Ability to delete existing actions
|
||||
default: op
|
||||
commands:
|
||||
quests:
|
||||
description: Quests command
|
||||
permission: quests.quests
|
||||
aliases: qs
|
||||
questadmin:
|
||||
description: Quests admin command
|
||||
permission: quests.admin
|
||||
aliases: [questsadmin, qa]
|
||||
quest:
|
||||
description: Quest command
|
||||
permission: quests.quest
|
||||
aliases: q
|
||||
quests:
|
||||
description: Quests command
|
||||
permission: quests.quests
|
||||
aliases: qs
|
||||
questadmin:
|
||||
description: Quests admin command
|
||||
permission: quests.admin
|
||||
aliases: [questsadmin, qa]
|
||||
quest:
|
||||
description: Quest command
|
||||
permission: quests.quest
|
||||
aliases: q
|
Loading…
Reference in New Issue
Block a user