package org.sweetiebelle.mcprofiler.bukkit;

import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;

import net.milkbowl.vault.chat.Chat;

/**
 * This class will allow for multiple Permissions Plugins to be easily
 * supported.
 *
 */
class PermissionsController {
    private Chat chat;

    PermissionsController() {

        RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
        this.chat = rsp.getProvider();

    }

    /**
     * Worker class for getting a prefix from a permissions plugin.
     * 
     * @param uuid player UUID
     * @return the prefix, or b if no prefix providing plugin was found.
     */
    public String getPrefix(final UUID uuid) {

        if (chat != null) {
            Player player = Bukkit.getServer().getPlayer(uuid);
            String pref = chat.getPlayerPrefix(player);
            return pref.replace('&', ChatColor.COLOR_CHAR);
        }
        return "b";
    }
}

@@ -139,15 +139,15 @@
 kit.
-entity.
+Offline
 Play
@@ -670,10 +670,9 @@
    *
- 
 %0A
+
     
@@ -728,16 +728,17 @@
 fix, or 
+&
 b if no 
@@ -868,16 +868,23 @@
         
+Offline
 Player p
@@ -909,24 +909,31 @@
 Server().get
+Offline
 Player(uuid)
@@ -981,16 +981,31 @@
 rPrefix(
+(String) null, 
 player);
@@ -1094,10 +1094,26 @@
 urn 
+ChatColor.AQUA + 
 %22
-b
 %22;%0A 
@@ -1117,10 +1117,9 @@
 ;%0A    %7D%0A
+
 %7D
-%0A

Fix not being able to /status offline players