package fr.ethilvan.bukkit.orator;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import fr.aumgn.bukkitutils.command.Command;
import fr.aumgn.bukkitutils.command.Commands;
import fr.aumgn.bukkitutils.command.args.CommandArgs;

public class OratorCommands implements Commands {

    private final OratorPlugin plugin;

    public OratorCommands(OratorPlugin plugin) {
        this.plugin = plugin;
    }

    @Command(name = "orator", flags = "p")
    public void orator(CommandSender sender, CommandArgs args) {
        Player player = args.getPlayer('p')
                .valueWithPermOr("ev.orator.use.other", sender);
        if (plugin.isOrator(player)) {
            plugin.turnOff(player);
        } else {
            plugin.turnOn(player);
        }
    }

    @Command(name = "orator-time", max = 1, flags = "p")
    public void oratorTime(CommandSender sender, CommandArgs args) {
        Player player = args.getPlayer('p')
                .valueWithPermOr("ev.orator.time.other", sender);
        if (args.length() == 0) {
            player.resetPlayerTime();
            player.sendMessage(ChatColor.GREEN + "Temps réinitalisé.");
        } else {
            int time = args.getTime(0).value();
            player.setPlayerTime(time, false);
            player.sendMessage(ChatColor.GREEN + "Le temps a été changé.");
        }
    }
}

@@ -264,26 +264,134 @@
 and.
-args.CommandArgs;%0A
+NestedCommands;%0Aimport fr.aumgn.bukkitutils.command.args.CommandArgs;%0A%0A@NestedCommands(value = %22orator%22, defaultTo = %22toggle%22)
 %0Apub
@@ -585,22 +585,22 @@
 name = %22
-orator
+toggle
 %22, flags
@@ -623,22 +623,22 @@
 ic void 
-orator
+toggle
 (Command
@@ -950,15 +950,8 @@
  = %22
-orator-
 time
@@ -995,15 +995,9 @@
 oid 
-oratorT
+t
 ime(

Fix commands