Fixed being able to get reward without doing the quest
This commit is contained in:
parent
7d9d37f17b
commit
4e2aa4258d
|
|
@ -35,10 +35,16 @@ public class CommandGetReward extends SubCommand {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!dailyQuest.isDone()) {
|
||||
player.sendMiniMessage(MessagesConfig.NOT_FINISHED_QUEST, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dailyQuest.isRewardReceived()) {
|
||||
player.sendMiniMessage(MessagesConfig.REWARD_ALREADY_RECEIVED, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String command : dailyQuest.getRewardCommand())
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("<player>", commandSender.getName()));
|
||||
dailyQuest.setRewardReceived(true);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class MessagesConfig extends AbstractConfig{
|
|||
public static String REWARD_ALREADY_RECEIVED = "<red>You already collected this reward</red>";
|
||||
public static String REWARD_SENT = "<white>[<gold>Mascot</gold>] <light_purple>Scruff</light_purple><gray>:</gray> <green>Thank you for completing the quest! Your reward has been sent!</green></white>";
|
||||
public static String FINISHED_QUEST = "<white>[<gold>Mascot</gold>] <light_purple>Scruff</light_purple><gray>:</gray> <green>You finished your quest! Don't forget to collect your reward at the end of the quest book!</green></white>";
|
||||
public static String NOT_FINISHED_QUEST = "<red>You have not finished this quest yet.</red>";
|
||||
private static void loadMessages() {
|
||||
TOO_FAR_FROM_NPC = config.getString("messages.too-far-from-npc", TOO_FAR_FROM_NPC);
|
||||
DAILY_ALREADY_DONE = config.getString("messages.daily-already-done", DAILY_ALREADY_DONE);
|
||||
|
|
@ -44,6 +45,7 @@ public class MessagesConfig extends AbstractConfig{
|
|||
REWARD_ALREADY_RECEIVED = config.getString("messages.reward-already-received", REWARD_ALREADY_RECEIVED);
|
||||
FINISHED_QUEST = config.getString("messages.finished-quest", FINISHED_QUEST);
|
||||
REWARD_SENT = config.getString("messages.reward-send", REWARD_SENT);
|
||||
NOT_FINISHED_QUEST = config.getString("messages.not-finished-quest", NOT_FINISHED_QUEST);
|
||||
}
|
||||
|
||||
public static String NO_PERMISSION = "<red>You do not have permission to do that.</red>";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user