package net.engin33r.luaspigot.lua.lib;

import net.engin33r.luaspigot.lua.Library;
import net.engin33r.luaspigot.lua.annotation.LibFunctionDef;
import net.engin33r.luaspigot.lua.type.LuaPlayer;
import org.bukkit.Bukkit;
import org.luaj.vm2.Varargs;

/**
 * Library for interacting with players on and off the server.
 * Mostly deals with creating {@link LuaPlayer} instances.
 * @see LuaPlayer
 */
@SuppressWarnings("unused")
public class PlayerLibrary extends Library {
    @Override
    public String getName() {
        return "player";
    }

    @LibFunctionDef(name = "getByName")
    public Varargs getByName(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(args.checkjstring(1)));
    }
}

@@ -188,16 +188,64 @@
 Player;%0A
+import net.engin33r.luaspigot.lua.type.LuaUUID;%0A
 import o
@@ -756,11 +756,220 @@
 );%0A    %7D
+%0A%0A    @LibFunctionDef(name = %22getByUUID%22)%0A    public Varargs getByUUID(Varargs args) %7B%0A        return new LuaPlayer(Bukkit.getOfflinePlayer(%0A                new LuaUUID(args.checkjstring(1)).getUUID()));%0A    %7D
 %0A%7D%0A

Add getting players by UUIDs