package me.anxuiz.settings.bukkit.plugin;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class ToggleCommand implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        // TODO
        return false;
    }
}

@@ -36,16 +36,210 @@
 lugin;%0A%0A
+import me.anxuiz.settings.Setting;%0Aimport me.anxuiz.settings.SettingManager;%0Aimport me.anxuiz.settings.Toggleable;%0Aimport me.anxuiz.settings.bukkit.PlayerSettings;%0A%0Aimport org.bukkit.ChatColor;%0A
 import o
@@ -265,16 +265,16 @@
 ommand;%0A
-
 import o
@@ -348,16 +348,49 @@
 dSender;
+%0Aimport org.bukkit.entity.Player;
 %0A%0Apublic
@@ -550,35 +550,1009 @@
     
-// TODO%0A        return fals
+if(!(sender instanceof Player)) %7B%0A            sender.sendMessage(Commands.PLAYERS_ONLY);%0A            return true;%0A        %7D%0A%0A        if(args.length %3C 1) %7B%0A            return false;%0A        %7D%0A%0A        Player player = (Player) sender;%0A%0A        Setting setting = PlayerSettings.getRegistry().get(args%5B0%5D, true);%0A%0A        if(setting != null) %7B%0A            if(setting.getType() instanceof Toggleable) %7B%0A                SettingManager manager = PlayerSettings.getManager(player);%0A                Object newValue = ((Toggleable) setting.getType()).getNextState(manager.getValue(setting));%0A                manager.setValue(setting, newValue);%0A                sender.sendMessage(ChatColor.GREEN + %22Toggled %22 + setting.getName() + %22 to %22 + setting.getType().print(newValue));%0A            %7D else %7B%0A                sender.sendMessage(ChatColor.RED + setting.getName() + %22 is not toggleable%22);%0A            %7D%0A        %7D else %7B%0A            sender.sendMessage(Commands.SETTING_NOT_FOUND);%0A        %7D%0A%0A        return tru
 e;%0A 

Implement the toggle command.