package fi.gosu.mc.plugins.SleepDemocracy;

import org.bukkit.plugin.java.JavaPlugin;

/**
 * Created by Aikain on 7.5.2016.
 */
public class SleepDemocracy extends JavaPlugin {
}

@@ -37,16 +37,126 @@
 cracy;%0A%0A
+import org.bukkit.command.Command;%0Aimport org.bukkit.command.CommandSender;%0Aimport org.bukkit.event.Listener;%0A
 import o
@@ -283,8 +283,3098 @@
 gin 
-%7B
+implements Listener %7B%0A    private boolean SDEnable;%0A    private int SDPercent;%0A%0A    @Override%0A    public void onEnable() %7B%0A        this.loadConfig();%0A        this.getServer().getPluginManager().registerEvents(this, this);%0A        this.getCommand(%22sdtoggle%22).setExecutor(this);%0A        this.getCommand(%22sdset%22).setExecutor(this);%0A        super.onEnable();%0A    %7D%0A%0A    @Override%0A    public void onDisable() %7B%0A        super.onDisable();%0A    %7D%0A%0A    public void loadConfig() %7B%0A        this.getConfig().options().copyDefaults(true);%0A        this.saveConfig();%0A        this.SDEnable = this.getConfig().getBoolean(%22SDEnable%22);%0A        this.SDPercent = this.getConfig().getInt(%22SDPercent%22);%0A    %7D%0A%0A    @Override%0A    public boolean onCommand(CommandSender sender, Command cmd, String label, String%5B%5D args) %7B%0A        switch (cmd.getName()) %7B%0A            case %22sdtoggle%22:%0A                if (sender.hasPermission(%22sleepdemocracy.sdtoggle%22)) %7B%0A                    if (args.length == 0) %7B%0A                        this.SDEnable = !this.SDEnable;%0A                    %7D else if (args.length == 1) %7B%0A                        if (args%5B0%5D.equals(%22ON%22)) %7B%0A                            this.SDEnable = true;%0A                        %7D else if (args%5B1%5D.equals(%22OFF%22)) %7B%0A                            this.SDEnable = false;%0A                        %7D else %7B%0A                            sender.sendMessage(cmd.getUsage());%0A                            return false;%0A                        %7D%0A                    %7D else %7B%0A                        sender.sendMessage(cmd.getUsage());%0A                        return false;%0A                    %7D%0A                    this.getConfig().set(%22SDEnable%22, Boolean.valueOf(this.SDEnable));%0A                    this.saveConfig();%0A                    sender.sendMessage((this.SDEnable ? %22Enabled%22 : %22Disabled%22) + %22 SleepDemocracy%22);%0A                    return true;%0A                %7D%0A                sender.sendMessage(cmd.getPermissionMessage());%0A                break;%0A            case %22sdset%22:%0A                if (sender.hasPermission(%22sleepdemocracy.sdset%22)) %7B%0A                    if (args.length == 1) %7B%0A                        try %7B%0A                            int a = Integer.parseInt(args%5B0%5D);%0A                            if (a %3C 0 %7C%7C a %3E 100) %7B%0A                                throw new Exception();%0A                            %7D%0A                            this.SDPercent = a;%0A                            this.getConfig().set(%22SDPercent%22, Integer.valueOf(a));%0A                            this.saveConfig();%0A                            sender.sendMessage(%22Set percent to %22 + args%5B0%5D);%0A                            return true;%0A                        %7D catch (Exception e) %7B%0A                            sender.sendMessage(%22Number invalid. Please enter a number 0 - 100.%22);%0A                        %7D%0A                    %7D else %7B%0A                        sender.sendMessage(cmd.getUsage());%0A                    %7D%0A                %7D else %7B%0A                    sender.sendMessage(cmd.getPermissionMessage());%0A                %7D%0A                break;%0A        %7D%0A        return false;%0A    %7D
 %0A%7D%0A

Make config loading/saving, add command functionality