diff options
| author | fatpigsarefat <fatpigsarefat@outlook.com> | 2019-06-22 16:31:38 +0100 |
|---|---|---|
| committer | fatpigsarefat <fatpigsarefat@outlook.com> | 2019-06-22 16:31:38 +0100 |
| commit | 2ddfbb5a0da6c3606ad3602d13942a7ca5a5dc0e (patch) | |
| tree | 0a0bf880d0f492dca65562505c7c88aa6b91f3ca /src/main/java | |
| parent | 36cb577b6fb5c6f8f529627879eeebf6d05061a6 (diff) | |
Quest category commands fixed
- They no longer pass null into the incorrect method.
- Permissons added to the other method.
Diffstat (limited to 'src/main/java')
4 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java b/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java index f27f30fa..deea2e94 100644 --- a/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java +++ b/src/main/java/com/leonardobishop/quests/commands/CommandQuests.java @@ -166,7 +166,7 @@ public class CommandQuests implements CommandExecutor { if (player != null) { QPlayer qPlayer = Quests.getPlayerManager().getPlayer(player.getUniqueId()); if (qPlayer != null) { - if (qPlayer.openCategory(category, null) == 0) { + if (qPlayer.openCategory(category, null, false) == 0) { sender.sendMessage(Messages.COMMAND_QUEST_OPENCATEGORY_ADMIN_SUCCESS.getMessage().replace("{player}", player.getName()) .replace("{category}", category.getId())); } else { @@ -289,7 +289,7 @@ public class CommandQuests implements CommandExecutor { sender.sendMessage(Messages.COMMAND_CATEGORY_OPEN_DOESNTEXIST.getMessage().replace("{category}", args[1])); } else { QPlayer qPlayer = Quests.getPlayerManager().getPlayer(player.getUniqueId()); - qPlayer.openCategory(category, null); + qPlayer.openCategory(category, null, false); return true; } return true; diff --git a/src/main/java/com/leonardobishop/quests/obj/misc/QMenuCategory.java b/src/main/java/com/leonardobishop/quests/obj/misc/QMenuCategory.java index dddd5fc2..66a572e4 100644 --- a/src/main/java/com/leonardobishop/quests/obj/misc/QMenuCategory.java +++ b/src/main/java/com/leonardobishop/quests/obj/misc/QMenuCategory.java @@ -12,6 +12,9 @@ import org.bukkit.inventory.ItemStack; import java.util.HashMap; import java.util.List; +/** + * Menu list of categories. + */ public class QMenuCategory implements QMenu { private final int pageSize = 45; diff --git a/src/main/java/com/leonardobishop/quests/obj/misc/QMenuQuest.java b/src/main/java/com/leonardobishop/quests/obj/misc/QMenuQuest.java index 30672c45..6aabfe6e 100644 --- a/src/main/java/com/leonardobishop/quests/obj/misc/QMenuQuest.java +++ b/src/main/java/com/leonardobishop/quests/obj/misc/QMenuQuest.java @@ -17,6 +17,9 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +/** + * Menu for a specific category. + */ public class QMenuQuest implements QMenu { private HashMap<Integer, String> slotsToQuestIds = new HashMap<>(); diff --git a/src/main/java/com/leonardobishop/quests/player/QPlayer.java b/src/main/java/com/leonardobishop/quests/player/QPlayer.java index 51675cea..f7d1c11c 100644 --- a/src/main/java/com/leonardobishop/quests/player/QPlayer.java +++ b/src/main/java/com/leonardobishop/quests/player/QPlayer.java @@ -50,6 +50,10 @@ public class QPlayer { return 3; } + if (category.isPermissionRequired() && !player.hasPermission("quests.category." + category.getId())) { + return 1; + } + QMenuQuest qMenuQuest = new QMenuQuest(Quests.getPlayerManager().getPlayer(player.getUniqueId()), category.getId(), superMenu); List<Quest> quests = new ArrayList<>(); for (String questid : category.getRegisteredQuestIds()) { |
