SergiFerry / PlayerNPC

PlayerNPC API for Spigot 1.17+
https://www.spigotmc.org/resources/playernpc.93625/
26 stars 6 forks source link

NPC Create #29

Closed DevSnx closed 1 year ago

DevSnx commented 1 year ago

Hey,

My code is working but, when iam Joining, i have a disconnect and no errors.. please help me ^^

i load all Npcs on Server start

`public void loadNPCS(){ FileConfiguration cfg = Lobby.getServerEntityFile().getConfig();

    ConfigurationSection config = cfg.getConfigurationSection("NPC.");
    Set<String> set = config.getKeys(false);

    int i = 0;

    for (String name : set) {
        NPC.Global npc = NPCLib.getInstance().generateGlobalNPC(Lobby.getInstance(), name, Lobby.getServerEntityFile().getEntityLocation(name));
        npc.setText("§b" + name);
        npc.createAllPlayers();
        i++;
    }
    Bukkit.getServer().getConsoleSender().sendMessage("#          §c" + i + " §7Npcs loaded!           #");
}`
SergiFerry commented 1 year ago

well i think that's not playernpcs problem, maybe it's because cfg.getConfigurationSection("NPC.") must not contain "." so correctly will be cfg.getConfigurationSection("NPC")

El jue, 2 mar 2023 a las 21:52, DevSnx @.***>) escribió:

Hey,

My code is working but, when iam Joining, i have a disconnect and no errors.. please help me ^^ ` public void loadNPCS(){ FileConfiguration cfg = Lobby.getServerEntityFile().getConfig();

ConfigurationSection config = cfg.getConfigurationSection("NPC.");

Set<String> set = config.getKeys(false);

int i = 0;

for (String name : set) {

    NPC.Global npc = NPCLib.getInstance().generateGlobalNPC(Lobby.getInstance(), name, Lobby.getServerEntityFile().getEntityLocation(name));

    npc.setText("§b" + name);

    npc.createAllPlayers();

    i++;

}

Bukkit.getServer().getConsoleSender().sendMessage("#          §c" + i + " §7Npcs loaded!           #");

}`

— Reply to this email directly, view it on GitHub https://github.com/SergiFerry/PlayerNPC/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGYYCRZRK5RIFVBTQHAOFTW2ECARANCNFSM6AAAAAAVN3RINI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DevSnx commented 1 year ago

@SergiFerry npcs from config is loading with no problems, but i dont can join the Server with this loadingNpc() method.

Its working on Paper 1.19.2?

SergiFerry commented 1 year ago

also, by NPC.Global have auto-create, so you can remove npc.createAllPlayers

On Fri, 3 Mar 2023 at 11:37, DevSnx @.***> wrote:

@SergiFerry https://github.com/SergiFerry npcs from config is loading with no problems, but i dont can join the Server with this loadingNpc() method.

Its working on Paper 1.19.2?

— Reply to this email directly, view it on GitHub https://github.com/SergiFerry/PlayerNPC/issues/29#issuecomment-1453318392, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGYYCXMWTE2SIYTXPD5ZOLW2HCXNANCNFSM6AAAAAAVN3RINI . You are receiving this because you were mentioned.Message ID: @.***>

DevSnx commented 1 year ago

also, by NPC.Global have auto-create, so you can remove npc.createAllPlayers On Fri, 3 Mar 2023 at 11:37, DevSnx @.> wrote: @SergiFerry https://github.com/SergiFerry npcs from config is loading with no problems, but i dont can join the Server with this loadingNpc() method. Its working on Paper 1.19.2? — Reply to this email directly, view it on GitHub <#29 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGYYCXMWTE2SIYTXPD5ZOLW2HCXNANCNFSM6AAAAAAVN3RINI . You are receiving this because you were mentioned.Message ID: @.>

no changes

` public void loadNPCS(){ FileConfiguration cfg = Lobby.getServerEntityFile().getConfig();

    ConfigurationSection config = cfg.getConfigurationSection("NPC.");
    Set<String> set = config.getKeys(false);

    int i = 0;

    for (String name : set) {
        NPC.Global npc = NPCLib.getInstance().generateGlobalNPC(Lobby.getInstance(), name, Lobby.getServerEntityFile().getEntityLocation(name));
        npc.setText("§b" + name);
        npc.setSkin("ewogICJ0aW1lc3RhbXAiIDogMTYwMjUxNjAyODgyMSwKICAicHJvZmlsZUlkIiA6ICJlNzkzYjJjYTdhMmY0MTI2YTA5ODA5MmQ3Yzk5NDE3YiIsCiAgInByb2ZpbGVOYW1lIiA6ICJUaGVfSG9zdGVyX01hbiIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMWE2ODE2ZTg3ZTEwNjE3MGU0YmMwODNkY2IzMDFjZjc4MGJjZjRhNGQ4ZmZmYzkwNTIyMmQ4YmNkYzI5ZjdmIgogICAgfQogIH0KfQ==",
                "cYlih9oP64vrnPMqXDWp2Y/6WlO196XKVy9qrVgNF4dlpXmKPrJa9lRRwIZc4Ma2HobXM9uT6gW/NUyKS7FOQEycVUZlUvVvemwiQZmSgCTJNFh1UW9rxUt6g4l+5qF/V0n49e6rN2sgtrV1LwLLS7pdAHpm8LtlwgFFTvVzCq+poiXrZwzPZxVLrZxGCMZeN4VsqzNN99em2taPFXPiI/fLp0e2FG1n84029HgsKfUcubrkHvSYPZK9AoIPygDqLm/tRkBYSlgMvZ82UlNm4D22pwAv33Z7VLLd6mpAek9f+InhrGVjZreA2aZYRT6elnt4AfJn2GKDv0d3HEWqBtK06RRSZxlLJeHoCCxqwnM1NcplVFn7uKywmK9my/35L5tn3A5PSYu+EvHjd/Q+vgGzx/auAo3qqDvajm8tWIf41OmAYWpQMega4rGvzUT2uxtgSJO9e4xnthdXsHUSTQ4UBoe0DemQHcxVbvtHV5q4kzfRxr8+1+DAtpeX4UZmHwi4eIwNGH7oUrZzjIepICNv9NeCVWej+GGvNKI2UXYh+9Q8gjOJqMr+QoIBA1bXUkMev2jqiUF0BGPJZMj7lNRYnDYEGKfT1PDeQK3LqEqQdaRpaOXEZXW/qZLU2C2SL9hL0fNcvwyMCBDC7HPYYcbvzX9pyaPfS5a76NpFuDg=");
        i++;

        Bukkit.getServer().getConsoleSender().sendMessage("INT: " + i + " NPC: " + name + " Location: " + Lobby.getServerEntityFile().getEntityLocation(name));

    }

    Bukkit.getServer().getConsoleSender().sendMessage("§cEs wurden §b" + i + " §cNpcs geladen!");
}`