package net.techcable.techutils;

import net.techcable.techutils.entity.TechPlayer;
import net.techcable.techutils.entity.PlayerManager;

import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * A plugin using techutils
 * 
 */
public abstract class TechPlugin<T extends TechPlayer> extends JavaPlugin {
    
    private final PlayerManager<T> playerManager;
    
    /**
     * Startup techutils
     * 
     * Put your plugin's startup code in the startup method
     * 
     */
    public final void onEnable() {
        this.playerManager = new PlayerManager<>(this);
        startup();
    }
    
    /**
     * Cleanup techutils
     * 
     * Put your plugin's cleanup code in the shutdown method
     * 
     */
    public final void onDisable() {
        shutdown();
        playerManager.onShutdown();
    }
    
    /**
     * Get the TechPlayer with the given uuid
     * 
     * @return the player with the given uuid
     */
    public T getPlayer(UUID id) {
        return playerManager.getPlayer(id);
    }
    
    public T getPlayer(Player id) {
        return playerManager.getPlayer(player);
    }
    
    /**
     * Create a player with the given uuid
     * 
     * Plugins adding custom players must overide this method
     * 
     * @throws ClassCastException if you add custom players and don't overide this method
     */
    public T createPlayer(UUID id) {
        assert !playerManager.isKnown(id) : "This player has already been created!";
        return (T) new TechPlayer(id, this);
    }
    
    /**
     * Startup this plugin
     * 
     */
    protected abstract void startup();
    
    /**
     * Shutdown this plugin
     */
    protected abstract void shutdown();
    
    /**
     * Regestiers the specified listener
     * 
     * @param listener the listener to register
     */
    public void registerListener(Listener listener) {
        getServer().getPluginManager().registerEvents(listener, this);
    }
}

@@ -1976,10 +1976,545 @@
 ;%0A    %7D%0A
+    %0A    //Logging%0A    %0A    public void severe(String format, Object... args) %7B%0A        Bukkit.getLogger().severe(getPrefix() + String.format(format, args));%0A    %7D%0A    %0A    public void warning(String format, Object... args) %7B%0A        Bukkit.getLogger().warning(getPrefix() + String.format(format, args));%0A    %7D%0A    %0A    public void info(String format, Object... args) %7B%0A        Bukkit.getLogger().info(getPrefix() + String.format(format, args));%0A    %7D%0A    %0A    private String getPrefix() %7B%0A        return %22%5B%22 + getName() + %22%5D %22;%0A    %7D%0A
 %7D%0A

Add Logging to TechUtils