diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java index e958c907..f8657d6d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java @@ -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)); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java new file mode 100644 index 00000000..a7297d4f --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java @@ -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; + } +}