mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-16 20:41:20 +01:00
Add restrictive trial mode with permission
This commit is contained in:
parent
198204dc73
commit
cbccaf91c7
@ -56,6 +56,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
||||
import org.bukkit.conversations.ConversationAbandonedListener;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
@ -4143,6 +4144,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if conversable is player in trial mode
|
||||
*
|
||||
* @param conversable the editor user to be checked
|
||||
* @return {@code true} if user is a Player with quests.admin.trial permission
|
||||
*/
|
||||
public boolean hasLimitedAccess(final Conversable conversable) {
|
||||
if (!(conversable instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
return ((Player)conversable).hasPermission("quests.admin.trial");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Quest by ID
|
||||
|
@ -205,7 +205,12 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
case 6:
|
||||
return new ActionMobListPrompt(context);
|
||||
case 7:
|
||||
return new ActionDenizenPrompt(context);
|
||||
if (!plugin.hasLimitedAccess(context.getForWhom())) {
|
||||
return new ActionDenizenPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new ActionMainPrompt(context);
|
||||
}
|
||||
case 8:
|
||||
final String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
|
@ -249,7 +249,12 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
return new PlayerPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
return new PlayerCommandsPrompt(context);
|
||||
if (!plugin.hasLimitedAccess(context.getForWhom())) {
|
||||
return new PlayerCommandsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new PlayerPrompt(context);
|
||||
}
|
||||
case 10:
|
||||
return new ActionMainPrompt(context);
|
||||
default:
|
||||
|
@ -411,9 +411,19 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 4:
|
||||
return new RewardsExperiencePrompt(context);
|
||||
case 5:
|
||||
return new RewardsCommandsPrompt(context);
|
||||
if (!plugin.hasLimitedAccess(context.getForWhom())) {
|
||||
return new RewardsCommandsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 6:
|
||||
return new RewardsPermissionsListPrompt(context);
|
||||
if (!plugin.hasLimitedAccess(context.getForWhom())) {
|
||||
return new RewardsPermissionsListPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 7:
|
||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||
return new RewardsMcMMOListPrompt(context);
|
||||
|
@ -124,6 +124,9 @@ permissions:
|
||||
quests.admin.drop:
|
||||
description: Ability to drop the Quests Journal
|
||||
default: op
|
||||
quests.admin.trial:
|
||||
description: Limit access to sensitive editor prompts
|
||||
default: false
|
||||
quests.editor.*:
|
||||
description: Access all Quests Editor functionality
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user