mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 19:31:57 +01:00
Add fancy permissions (/mv)
This commit is contained in:
parent
82429ee7de
commit
98e1af0f66
@ -69,10 +69,21 @@ public class CommandManager {
|
|||||||
this.commands.remove(command);
|
this.commands.remove(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public List<BaseCommand> getCommands() {
|
public List<BaseCommand> getCommands() {
|
||||||
return this.commands;
|
return this.commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BaseCommand> getCommands(CommandSender sender) {
|
||||||
|
ArrayList<BaseCommand> playerCommands = new ArrayList<BaseCommand>();
|
||||||
|
for(BaseCommand c : this.commands) {
|
||||||
|
if(this.hasPermission(sender, c.permission, c.isOpRequired())) {
|
||||||
|
playerCommands.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return playerCommands;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines all quoted strings
|
* Combines all quoted strings
|
||||||
*
|
*
|
||||||
@ -134,7 +145,6 @@ public class CommandManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
System.out.print("Checking permissions for " + player.getName());
|
|
||||||
|
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
// If Player is Op we always let them use it.
|
// If Player is Op we always let them use it.
|
||||||
|
@ -42,7 +42,8 @@ public class HelpCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BaseCommand> commands = plugin.getCommandManager().getCommands();
|
// Get only the commands this player has access to
|
||||||
|
List<BaseCommand> commands = plugin.getCommandManager().getCommands(sender);
|
||||||
|
|
||||||
int numPages = commands.size() / CMDS_PER_PAGE;
|
int numPages = commands.size() / CMDS_PER_PAGE;
|
||||||
if (commands.size() % CMDS_PER_PAGE != 0) {
|
if (commands.size() % CMDS_PER_PAGE != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user