Skip to content

Commit

Permalink
Use Cloud's permission annotation in all places (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: BT (calcastor/mame) <[email protected]>
  • Loading branch information
calcastor authored Jan 19, 2025
1 parent 778dab5 commit a52d229
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static tc.oc.pgm.util.text.TextException.exception;

import co.aikar.commands.annotation.CommandPermission;
import dev.pgm.community.Community;
import dev.pgm.community.CommunityPermissions;
import dev.pgm.community.utils.CommandAudience;
Expand All @@ -11,6 +10,7 @@
import tc.oc.pgm.lib.org.incendo.cloud.annotations.CommandDescription;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Default;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Flag;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Permission;

@Command("matchhistory|mh")
public class MatchHistoryCommand {
Expand All @@ -23,7 +23,7 @@ public MatchHistoryCommand() {

@Command("[page]")
@CommandDescription("Display match history")
@CommandPermission(CommunityPermissions.MATCH_HISTORY)
@Permission(CommunityPermissions.MATCH_HISTORY)
public void sendHistory(
CommandAudience sender,
@Argument("page") @Default("1") int page,
Expand Down
24 changes: 12 additions & 12 deletions core/src/main/java/dev/pgm/community/squads/SquadCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static tc.oc.pgm.util.text.TextException.exception;
import static tc.oc.pgm.util.text.TextFormatter.horizontalLineHeading;

import co.aikar.commands.annotation.CommandPermission;
import com.google.common.collect.ImmutableList;
import dev.pgm.community.Community;
import dev.pgm.community.CommunityPermissions;
Expand All @@ -28,6 +27,7 @@
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Command;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.CommandDescription;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Flag;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Permission;
import tc.oc.pgm.lib.org.incendo.cloud.context.CommandContext;
import tc.oc.pgm.util.Players;
import tc.oc.pgm.util.PrettyPaginatedComponentResults;
Expand All @@ -45,23 +45,23 @@ public SquadCommands() {

@Command("")
@CommandDescription("List party members")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void listDefault(MatchPlayer sender) {
checkEnabled();
list(sender, false);
}

@Command("<player>")
@CommandDescription("Send a squad invitation")
@CommandPermission(CommunityPermissions.SQUAD_CREATE)
@Permission(CommunityPermissions.SQUAD_CREATE)
public void directInvite(MatchPlayer sender, @Argument("player") MatchPlayer invited) {
checkEnabled();
invite(sender, invited);
}

@Command("create")
@CommandDescription("Create a squad")
@CommandPermission(CommunityPermissions.SQUAD_CREATE)
@Permission(CommunityPermissions.SQUAD_CREATE)
public void create(MatchPlayer sender) {
checkEnabled();
manager.createSquad(sender);
Expand All @@ -70,7 +70,7 @@ public void create(MatchPlayer sender) {

@Command("invite <player>")
@CommandDescription("Send a squad invitation")
@CommandPermission(CommunityPermissions.SQUAD_CREATE)
@Permission(CommunityPermissions.SQUAD_CREATE)
public void invite(MatchPlayer sender, @Argument("player") MatchPlayer invited) {
checkEnabled();
manager.createInvite(invited, sender);
Expand All @@ -92,7 +92,7 @@ public void invite(MatchPlayer sender, @Argument("player") MatchPlayer invited)

@Command("accept <player>")
@CommandDescription("Accept a squad invitation")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void accept(MatchPlayer sender, @Argument("player") MatchPlayer leader) {
checkEnabled();
manager.acceptInvite(sender, leader);
Expand All @@ -105,7 +105,7 @@ public void accept(MatchPlayer sender, @Argument("player") MatchPlayer leader) {

@Command("deny <player>")
@CommandDescription("Deny a squad invitation")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void deny(MatchPlayer sender, @Argument("player") MatchPlayer leader) {
checkEnabled();
manager.expireInvite(sender, leader);
Expand All @@ -118,7 +118,7 @@ public void deny(MatchPlayer sender, @Argument("player") MatchPlayer leader) {

@Command("leave")
@CommandDescription("Leave your current party")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void leave(MatchPlayer sender) {
checkEnabled();
manager.leaveSquad(sender);
Expand All @@ -127,7 +127,7 @@ public void leave(MatchPlayer sender) {

@Command("list")
@CommandDescription("List party members")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void list(MatchPlayer sender, @Flag(value = "all", aliases = "a") boolean all) {
checkEnabled();

Expand Down Expand Up @@ -201,7 +201,7 @@ public Component format(UUID player, int index) {

@Command("chat [message]")
@CommandDescription("Sends a message to your party")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void chat(
CommandContext<CommandSender> context,
MatchPlayer sender,
Expand All @@ -216,7 +216,7 @@ public void chat(

@Command("kick <player>")
@CommandDescription("Kick a player from your party")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void kick(MatchPlayer sender, @Argument("player") OfflinePlayer player) {
checkEnabled();
MatchPlayer target = PGM.get().getMatchManager().getPlayer(player.getUniqueId());
Expand All @@ -231,7 +231,7 @@ public void kick(MatchPlayer sender, @Argument("player") OfflinePlayer player) {

@Command("disband")
@CommandDescription("Disband your current party")
@CommandPermission(CommunityPermissions.SQUAD)
@Permission(CommunityPermissions.SQUAD)
public void disband(MatchPlayer sender) {
checkEnabled();
manager.disband(sender);
Expand Down

0 comments on commit a52d229

Please sign in to comment.