mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Add missing party chat permission check to the party chat command
This commit is contained in:
parent
ca93dc02df
commit
4bac586253
@ -11,6 +11,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/*
|
||||
@ -32,6 +33,11 @@ public class CommandManager {
|
||||
registerCommands();
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
||||
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
||||
}
|
||||
|
||||
public void registerConditions() {
|
||||
// Method or Class based - Can only be used on methods
|
||||
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
||||
@ -56,13 +62,15 @@ public class CommandManager {
|
||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
||||
validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
||||
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
||||
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
|
||||
if(!permissible.hasPermission(permissionNode)) {
|
||||
throw new ConditionFailedException("You do not have the appropriate permission to use this command.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user