mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Added permission
- Added `mcmmo.commands.mmodebug`
This commit is contained in:
parent
90721ee859
commit
98b3ed0746
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.admin;
|
package com.gmail.nossr50.commands.admin;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -14,9 +15,15 @@ public class PlayerDebugCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
|
if (!Permissions.mmodebug(sender)) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -43,6 +43,7 @@ public final class Permissions {
|
|||||||
* COMMANDS
|
* COMMANDS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static boolean mmodebug(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmodebug"); }
|
||||||
public static boolean mmoinfo(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoinfo"); }
|
public static boolean mmoinfo(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoinfo"); }
|
||||||
public static boolean addlevels(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.addlevels"); }
|
public static boolean addlevels(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.addlevels"); }
|
||||||
public static boolean addlevelsOthers(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.addlevels.others"); }
|
public static boolean addlevelsOthers(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.addlevels.others"); }
|
||||||
|
@ -30,6 +30,7 @@ commands:
|
|||||||
mmodebug:
|
mmodebug:
|
||||||
aliases: [mcmmodebugmode]
|
aliases: [mcmmodebugmode]
|
||||||
description: Toggles a debug mode which will print useful information to chat
|
description: Toggles a debug mode which will print useful information to chat
|
||||||
|
permission: mcmmo.commands.mmodebug
|
||||||
mmoinfo:
|
mmoinfo:
|
||||||
aliases: [mcinfo]
|
aliases: [mcinfo]
|
||||||
description: Info pages for mcMMO
|
description: Info pages for mcMMO
|
||||||
@ -796,6 +797,7 @@ permissions:
|
|||||||
mcmmo.commands.defaults:
|
mcmmo.commands.defaults:
|
||||||
description: Implies all default mcmmo.commands permissions.
|
description: Implies all default mcmmo.commands permissions.
|
||||||
children:
|
children:
|
||||||
|
mcmmo.commands.mmodebug: true
|
||||||
mcmmo.commands.mmoinfo: true
|
mcmmo.commands.mmoinfo: true
|
||||||
mcmmo.commands.acrobatics: true
|
mcmmo.commands.acrobatics: true
|
||||||
mcmmo.commands.alchemy: true
|
mcmmo.commands.alchemy: true
|
||||||
|
Loading…
Reference in New Issue
Block a user