forked from Upstream/mmocore
Added the 'hideab' command to 'rpg admin'
This commit is contained in:
parent
bd4d889c62
commit
83466f92f9
@ -8,6 +8,7 @@ public class AdminCommandMap extends CommandMap {
|
||||
public AdminCommandMap(CommandMap parent) {
|
||||
super(parent, "admin");
|
||||
|
||||
addFloor(new HideActionBarCommandMap(this));
|
||||
addFloor(new NoCooldownCommandMap(this));
|
||||
addFloor(new ResetCommandMap(this));
|
||||
addFloor(new InfoCommandMap(this));
|
||||
|
@ -0,0 +1,43 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.command.api.CommandEnd;
|
||||
import net.Indyuce.mmocore.command.api.CommandMap;
|
||||
import net.Indyuce.mmocore.command.api.Parameter;
|
||||
|
||||
public class HideActionBarCommandMap extends CommandEnd {
|
||||
public HideActionBarCommandMap(CommandMap parent) {
|
||||
super(parent, "hideab");
|
||||
|
||||
addParameter(Parameter.PLAYER);
|
||||
addParameter(Parameter.AMOUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
Player player = Bukkit.getPlayer(args[2]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find the player called " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
int amount = 0;
|
||||
try {
|
||||
amount = Integer.parseInt(args[3]);
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + args[3] + " is not a valid number.");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
MMOCore.plugin.pauseDefaultActionBar(player.getUniqueId(), amount);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user