✅ [API] PlayerNPC ✅ [1.17-1.18.1] 2022.1

Player NPC via packets API for 1.17 & 1.18

  1. SergiFerry
    Native Minecraft Version:
    1.18
    Tested Minecraft Versions:
    • 1.17
    • 1.18
    Source Code:
    https://github.com/SergiFerry/PlayerNPC
    Contributors:
    https://twitter.com/SergiFerry
    playernpc.png
    asasd.png

    PlayerNPC is a simple NPC API for Spigot, that allows you to create your own NPC per player.
    This plugin was developed by SergiFerry

    The actual plugin version is compatible with Spigot 1.18 - 1.18.1

    Last plugin version compatible with Spigot 1.17 and 1.17.1

    >>> Click to download <<<

    randomtpapi.png

    All JavaDocs are available at:
    https://sergiferry.github.io/PlayerNPC/

    Put the PlayerNPC.jar on your server's /plugins and add the jar to the llibary of your Java Project.

    Step 1, generate the NPC instance
    Code (Java):
    NPC npc = NPCLib.getInstance().generateNPC(player, id, location);
    Step 2, modify the NPC attributes
    Code (Java):
    npc.setSkin(new NPCSkin(texture, signature)); //Use https://mineskin.org/
    npc.setItem(NPC.Slot, ItemStack);
    npc.setText(String...);
    npc.setGlowing(boolean, ChatColor);
    npc.setCollidable(boolean);
    npc.setFollowLookType(NPC.FollowLookType);
    npc.setCustomTabListName(String, boolean);
    npc.setHideDIstance(double);
    npc.setShowOnTabList(boolean);
    npc.setInteractCooldown(long);
    npc.setLineSpacing(double);
    npc.setTextOpacity(NPC.TextOpacity);
    npc.setTextAlignment(Vector);
    npc.setPose(NPC.Pose);
    npc.addCustomClickAction(NPCInteractEvent.ClickType, CustomAction);
    Step 3, create the entity and show it to the player
    Code (Java):
    npc.create();
    npc.show();
    You can listen for player interact with the NPC
    Code (Java):
    @EventHandler
    public void onNPCInteract(NPCInteractEvent event){
        Player player = event.getPlayer();
        NPC npc = event.getNpc();
        NPCInteractEvent.ClickType clickType = event.getClickType();
    }
    You can hide it temporally or destroy it permanent.
    Code (Java):
    npc.hide();
    npc.destroy();
    You can change the NPC skin, even when if it's created and shown.
    Code (Java):
    npc.setSkin(NPCSkin);
    npc.forceUpdate();
    You can change where the NPC looks at
    Code (Java):
    npc.lookAt(location);
    npc.update();
    You can change the NPC location
    Code (Java):
    npc.teleport(location);
    You can change the Text above the NPC
    Code (Java):
    npc.setText(String...);
    npc.setLineOpacity(Integer, NPC.TextOpacity);
    npc.updateText(); //if the text have the same amount of lines
    npc.forceUpdateText(); //if the text have different amount of lines
    npc.setHideText(boolean); //you can also hide the text and then show it later
    Remember that some changes at the NPC instance will not have effect on the player client until you update the npc.
    Code (Java):
    npc.update();
    npc.forceUpdate();

    randomtpcommands.png

    /npc - Let you customize the npcs.
    This command is only available for OPs.
    npcsccommands.gif
    randomtpstats.png
    [​IMG]
    If you want to show your plugin here, contact me throught twitter @SergiFerry
    Optic7409, sr_balbucio and Faun like this.

Recent Reviews

  1. lordvento
    lordvento
    3/5,
    Version: 2022.1
    Yeah I would like to know If there's any plans for making It an official smp plugin to use In regular user servers? Put and use since this Is kind of misrepresented and I was originaly getting this as a regular plugin but the Idea Is very nice and we as a community would really appreciate a good stable and easy to use NPC plugin. ty
    1. SergiFerry
      Author's Response
      Yeah, in the next versions is planned to add the option to create NPCs visible to all players, through commands, and will be stored on a file.
      The original purpose of this was an API for developers, but i know that a lot of people demand a plugin like this.
  2. PixelMania
    PixelMania
    5/5,
    Version: 2021.4
    This is a pretty good API for player NPCs, will be using it later on.

    I'd like to mention that you should remove the "npc.setCustomTabListName(String, boolean)" line from step 2 of the API spoiler, as that will call the "getReplacedCustomName" method which will try to call the "getProfile" method from the "entityPlayer" variable, but it will result in a NullPointerException error as the variable is null until "npc.create()" is called, which is in step 3.
    1. SergiFerry
      Author's Response
      Thanks for reporting this bug, in the 2021.5 version it's fixed.
  3. SquareCode
    SquareCode
    5/5,
    Version: 2021.4
  4. maximeCX
    maximeCX
    5/5,
    Version: 1.0.8
    solid plugin. Easy to use, very customizable and it saved me tons of time making my own. Thank you dev
  5. hugogaymer
    hugogaymer
    5/5,
    Version: 1.0.1
    nice .