forked from Upstream/mmocore
Added permission associated with every MMOCore command.
This commit is contained in:
parent
8f2da7a865
commit
a54bfc03a0
@ -18,6 +18,9 @@ public class AttributesCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.attributes"))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,6 +25,8 @@ public class FriendsCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.friends"))
|
||||||
|
return false;
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -26,6 +26,8 @@ public class GuildCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.guild"))
|
||||||
|
return false;
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,6 +27,8 @@ public class PartyCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.party"))
|
||||||
|
return false;
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,6 +18,8 @@ public class PlayerStatsCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.profile"))
|
||||||
|
return false;
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,6 +17,8 @@ public class QuestsCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.quests"))
|
||||||
|
return false;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "quests");
|
MMOCommandEvent event = new MMOCommandEvent(data, "quests");
|
||||||
|
@ -19,6 +19,8 @@ public class SkillTreesCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull CommandSender sender, String s, String[] args) {
|
public boolean execute(@NotNull CommandSender sender, String s, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.skilltrees"))
|
||||||
|
return false;
|
||||||
if (!(sender instanceof Player player))
|
if (!(sender instanceof Player player))
|
||||||
return false;
|
return false;
|
||||||
PlayerData data = PlayerData.get(player);
|
PlayerData data = PlayerData.get(player);
|
||||||
|
@ -18,6 +18,8 @@ public class SkillsCommand extends RegisteredCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("mmocore.skills"))
|
||||||
|
return false;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "skills");
|
MMOCommandEvent event = new MMOCommandEvent(data, "skills");
|
||||||
|
@ -32,7 +32,7 @@ public enum ToggleableCommand {
|
|||||||
PARTY("party", "Invite players in a party to split exp", config -> new PartyCommand(config)),
|
PARTY("party", "Invite players in a party to split exp", config -> new PartyCommand(config)),
|
||||||
GUILD("guild", "Show players in current guild", config -> new GuildCommand(config)),
|
GUILD("guild", "Show players in current guild", config -> new GuildCommand(config)),
|
||||||
WITHDRAW("withdraw", "Withdraw money into coins and notes", config -> new WithdrawCommand(config), v -> MMOCore.plugin.hasEconomy() && MMOCore.plugin.economy.isValid(), "w"),
|
WITHDRAW("withdraw", "Withdraw money into coins and notes", config -> new WithdrawCommand(config), v -> MMOCore.plugin.hasEconomy() && MMOCore.plugin.economy.isValid(), "w"),
|
||||||
SKILL_TREES("skiltrees", "Open up the skill tree menu", config -> new SkillTreesCommand(config), "st", "trees", "tree"),
|
SKILL_TREES("skilltrees", "Open up the skill tree menu", config -> new SkillTreesCommand(config), "st", "trees", "tree"),
|
||||||
DEPOSIT("deposit", "Open the currency deposit menu", config -> new DepositCommand(config), "d"),
|
DEPOSIT("deposit", "Open the currency deposit menu", config -> new DepositCommand(config), "d"),
|
||||||
PVP_MODE("pvpmode", "Toggle on/off PVP mode.", config -> new PvpModeCommand(config), "pvp");
|
PVP_MODE("pvpmode", "Toggle on/off PVP mode.", config -> new PvpModeCommand(config), "pvp");
|
||||||
|
|
||||||
|
@ -27,3 +27,27 @@ permissions:
|
|||||||
mmocore.class-select:
|
mmocore.class-select:
|
||||||
description: Access to /class
|
description: Access to /class
|
||||||
default: op
|
default: op
|
||||||
|
mmocore.attributes:
|
||||||
|
description: Access to /attributes
|
||||||
|
default: true
|
||||||
|
mmocore.skills:
|
||||||
|
description: Access to /skills
|
||||||
|
default: true
|
||||||
|
mmocore.profile:
|
||||||
|
description: Access to /profile
|
||||||
|
default: true
|
||||||
|
mmocore.friends:
|
||||||
|
description: Access to /friends
|
||||||
|
default: true
|
||||||
|
mmocore.guild:
|
||||||
|
description: Access to /guild
|
||||||
|
default: true
|
||||||
|
mmocore.party:
|
||||||
|
description: Access to /party
|
||||||
|
default: true
|
||||||
|
mmocore.skilltrees:
|
||||||
|
description: Access to /skilltrees
|
||||||
|
default: true
|
||||||
|
mmocore.quests:
|
||||||
|
description: Access to /quests
|
||||||
|
default: true
|
Loading…
Reference in New Issue
Block a user