package com.lenis0012.bukkit.ls.commands;

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

import com.lenis0012.bukkit.ls.LoginSecurity;
import com.lenis0012.bukkit.ls.data.Converter;

public class AdminCommand implements CommandExecutor {
	
	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		LoginSecurity plugin = LoginSecurity.instance;
		if(!sender.hasPermission("ls.admin")) {
			sender.sendMessage(ChatColor.RED + "You do not have permission!");
			return true;
		}
		
		if(args.length == 0) {
			sender.sendMessage("&7============-{ &4&lL&aoginSecurity &4&lA&admin &4&lC&aommand &7}-============".replaceAll("&", String.valueOf(ChatColor.COLOR_CHAR)));
			sender.sendMessage(ChatColor.GREEN + "/lac rmpass <user>");
			sender.sendMessage(ChatColor.GREEN + "/lac reload");
		} else if(args.length >= 2 && args[0].equalsIgnoreCase("rmpass")) {
			String user = args[1].toLowerCase();
			String uuid = Converter.getUUIDByUsername(user);
			if(uuid != null && !uuid.isEmpty() && plugin.data.isRegistered(uuid)) {
				plugin.data.removeUser(uuid);
				sender.sendMessage(ChatColor.GREEN + "Removed user from accounts database!");
			} else
				sender.sendMessage(ChatColor.RED + "Invalid username");
		} else if(args.length >= 1 && args[0].equalsIgnoreCase("reload")) {
			plugin.reloadConfig();
			sender.sendMessage(ChatColor.GREEN + "Plugin config reloaded!");
		}
		return true;
	}
}
@@ -36,16 +36,66 @@
 mands;%0A%0A
+import java.util.UUID;%0A%0Aimport org.bukkit.Bukkit;%0A
 import o
@@ -111,24 +111,24 @@
 .ChatColor;%0A
-
 import org.b
@@ -235,16 +235,56 @@
 ender;%0A%0A
+import com.google.common.base.Charsets;%0A
 import c
@@ -357,23 +357,25 @@
 ls.data.
-Convert
+UUIDFetch
 er;%0A%0Apub
@@ -715,16 +715,25 @@
 %0A%09%09%7D%0A%09%09%0A
+%09%09try %7B%0A%09
 %09%09if(arg
@@ -748,24 +748,25 @@
  == 0) %7B%0A%09%09%09
+%09
 sender.sendM
@@ -909,24 +909,25 @@
 CHAR)));%0A%09%09%09
+%09
 sender.sendM
@@ -973,24 +973,25 @@
 user%3E%22);%0A%09%09%09
+%09
 sender.sendM
@@ -1027,24 +1027,25 @@
 c reload%22);%0A
+%09
 %09%09%7D else if(
@@ -1101,24 +1101,25 @@
 ass%22)) %7B%0A%09%09%09
+%09
 String user 
@@ -1146,16 +1146,17 @@
 e();%0A%09%09%09
+%09
 String u
@@ -1165,43 +1165,202 @@
 d = 
-Converter.getUUIDByUsername(user
+Bukkit.getOnlineMode() ? UUID.nameUUIDFromBytes((%22OfflinePlayer:%22 + user).getBytes(Charsets.UTF_8)).toString().replaceAll(%22-%22, %22%22) : UUIDFetcher.getUUIDOf(user).toString().replaceAll(%22-%22, %22%22
 );%0A
+%09
 %09%09%09i
@@ -1434,16 +1434,17 @@
 ) %7B%0A%09%09%09%09
+%09
 plugin.d
@@ -1465,16 +1465,17 @@
 (uuid);%0A
+%09
 %09%09%09%09send
@@ -1555,15 +1555,17 @@
 %0A%09%09%09
+%09
 %7D else%0A
+%09
 %09%09%09%09
@@ -1622,16 +1622,17 @@
 me%22);%0A%09%09
+%09
 %7D else i
@@ -1691,16 +1691,17 @@
 ad%22)) %7B%0A
+%09
 %09%09%09plugi
@@ -1717,24 +1717,25 @@
 onfig();%0A%09%09%09
+%09
 sender.sendM
@@ -1789,18 +1789,24 @@
 d!%22);%0A%09%09
+%09
 %7D%0A
+%09%09%09%0A%09
 %09%09return
@@ -1812,12 +1812,81 @@
 n true;%0A
+%09%09%7D catch(Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09return true;%0A%09%09%7D%0A
 %09%7D%0A%7D

fix compile error