Skip to content

Commit 1e45b1b

Browse files
committed
Fix player subcommand syntax
1 parent 37fb0bf commit 1e45b1b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Spigot/src/main/java/me/innectic/permissify/spigot/commands/permissify/PlayerCommand.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
*/
4747
public class PlayerCommand {
4848

49-
// TODO: All of these should be unified to the same format:
50-
// [player] [args...]
51-
5249
public CommandResponse handleAddPlayerToGroup(CommandSender sender, String[] args) {
5350
PermissifyMain plugin = PermissifyMain.getInstance();
5451
if (!plugin.getPermissifyAPI().getDatabaseHandler().isPresent())
@@ -115,13 +112,13 @@ public CommandResponse handleAddPermission(CommandSender sender, String[] args)
115112
if (!PermissionUtil.hasPermissionOrSuperAdmin((Player) sender, PermissifyConstants.PERMISSIFY_PLAYER_PERMISSION_ADD))
116113
return new CommandResponse(PermissifyConstants.INSUFFICIENT_PERMISSIONS, false);
117114
if (args.length < 2) return new CommandResponse(PermissifyConstants.NOT_ENOUGH_ARGUMENTS_PLAYER_ADD_PERMISSION, false);
118-
OfflinePlayer targetPlayer = Bukkit.getPlayer(args[1]);
115+
OfflinePlayer targetPlayer = Bukkit.getPlayer(args[0]);
119116
if (targetPlayer == null || !targetPlayer.hasPlayedBefore()) return new CommandResponse(PermissifyConstants.INVALID_PLAYER, false);
120-
plugin.getPermissifyAPI().getDatabaseHandler().get().addPermission(targetPlayer.getUniqueId(), args[0]);
121-
if (targetPlayer.isOnline()) targetPlayer.getPlayer().addAttachment(plugin, args[0], true);
117+
plugin.getPermissifyAPI().getDatabaseHandler().get().addPermission(targetPlayer.getUniqueId(), args[1]);
118+
if (targetPlayer.isOnline()) targetPlayer.getPlayer().addAttachment(plugin, args[1], true);
122119
plugin.getPermissifyAPI().getDatabaseHandler().get().updateCache(targetPlayer.getUniqueId());
123120
return new CommandResponse(PermissifyConstants.PERMISSION_ADDED_PLAYER
124-
.replace("<PLAYER>", targetPlayer.getName()).replace("<PERMISSION>", args[0]), true);
121+
.replace("<PLAYER>", targetPlayer.getName()).replace("<PERMISSION>", args[1]), true);
125122
}
126123

127124
public CommandResponse handleRemovePermission(CommandSender sender, String[] args) {
@@ -131,13 +128,13 @@ public CommandResponse handleRemovePermission(CommandSender sender, String[] arg
131128
if (!PermissionUtil.hasPermissionOrSuperAdmin((Player) sender, PermissifyConstants.PERMISSIFY_PLAYER_PERMISSION_REMOVE))
132129
return new CommandResponse(PermissifyConstants.INSUFFICIENT_PERMISSIONS, false);
133130
if (args.length < 2) return new CommandResponse(PermissifyConstants.NOT_ENOUGH_ARGUMENTS_PLAYER_REMOVE_PERMISSION, false);
134-
OfflinePlayer targetPlayer = Bukkit.getPlayer(args[1]);
131+
OfflinePlayer targetPlayer = Bukkit.getPlayer(args[0]);
135132
if (targetPlayer == null || !targetPlayer.hasPlayedBefore()) return new CommandResponse(PermissifyConstants.INVALID_PLAYER, false);
136-
plugin.getPermissifyAPI().getDatabaseHandler().get().removePermission(targetPlayer.getUniqueId(), args[0]);
137-
if (targetPlayer.isOnline()) targetPlayer.getPlayer().addAttachment(plugin, args[0], false);
133+
plugin.getPermissifyAPI().getDatabaseHandler().get().removePermission(targetPlayer.getUniqueId(), args[1]);
134+
if (targetPlayer.isOnline()) targetPlayer.getPlayer().addAttachment(plugin, args[1], false);
138135
plugin.getPermissifyAPI().getDatabaseHandler().get().updateCache(targetPlayer.getUniqueId());
139136
return new CommandResponse(PermissifyConstants.PERMISSION_REMOVED_PLAYER
140-
.replace("<PLAYER>", targetPlayer.getName()).replace("<PERMISSION>", args[0]), true);
137+
.replace("<PLAYER>", targetPlayer.getName()).replace("<PERMISSION>", args[1]), true);
141138
}
142139

143140
public CommandResponse handleListGroups(CommandSender sender, String[] args) {

0 commit comments

Comments
 (0)