Releases: SergiFerry/PlayerNPC
PlayerNPC API 2022.7 version
PlayerNPC API 2022.7 version
Before updating your plugin, check if all dependencies are updated with this version.
New features!
- Added support for Spigot 1.19.1
PlayerNPC API 2022.6 version
PlayerNPC API 2022.6 version
Before updating your plugin, check if all dependencies are updated with this version.
New features!
- Added support for Spigot 1.18.x - 1.19
- Added Persistent NPCs
- Added /npclib command
Code changes:
- When your plugin enables you MUST do NPCLib.getInstance().registerPlugin(plugin);
- Added NPCLib.getInstance().getPluginManager(plugin).setSkinUpdateFrequency(new NPCLib.SkinUpdateFrequency(Integer, TimeUnit));
- Changed FollowLookType to GazeTrackingType
- Changed npc.setFollowLookType() to npc.setGazeTrackingType();
- Changed NPCLib.getInstance().setUpdateGazeType(UpdateGazeType) to NPCLib.getInstance(),getPluginManager(plugin).setUpdateGazeType(UpdateGazeType);
- Changed NPCLib.getInstance().setUpdateGazeTicks(ticks) to NPCLib.getInstance(),getPluginManager(plugin).setUpdateGazeTicks(ticks);
- Changed NPCLib.getInstance().setTicksUntilTabListHide(ticks) to NPCLib.getInstance(),getPluginManager(plugin).setTicksUntilTabListHide(ticks);
I hope you enjoy this new update, and leave feedback. Thank you for using PlayerNPC API :)
PlayerNPC API 2022.5 version
PlayerNPC API 2022.5 version
New features!
- Added support for Spigot 1.19
- Removed support from Spigot 1.18-1.18.2
- Added /npcglobal command
- Renamed /npcpersonal command
PlayerNPC API 2022.4 version
PlayerNPC API 2022.4 version
PlayerNPC API 2022.3 version
PlayerNPC API 2022.3 version
Before updating your plugin, check if all dependencies are updated with this version.
New features!
- Added support for Spigot 1.18.2
- Currently supported versions 1.18, 1.18.1, 1.18.2
- To generate an NPC instance now use NPCLib.getInstance().generateNPC(Player, Plugin, String, Location)
- To get an NPC instance now use NPCLib.getInstance().getNPC(Player, Plugin, String);
- Added npc.getEntity();
- Added NPC.Skin.Part enum with CAPE, JACKET, LEFT and RIGHT SLEEVE, LEFT and RIGHT PANTS, HAT
- Added new methods on NPC.Skin.Parts
Code changes (this may produce errors on old plugin dependencies)
- NPC instances now require to specify the Plugin when creating the instance. This will produce that the npc.getCode(); will be "yourPluginName.code". You can also get only the code without the prefix with npc.getSimpleCode();
- Now all NPC methods are voids, no longer returning the NPC instance.
Future updates:
- Global NPCs will be and object to manage a Global NPC object that will manage all the personal NPCs of all the players. This will help to create NPCs visible for all the players, but customizable for each player at the same time (for example, all the players will see the NPC but each will see with their own Skin), and this will redouce server lag. This is a lot requested feature, and will be introduced probably in the next update.
- Persistent NPCs will be the posibility to save all the Global NPC data into a file, and will be saved when the server closes, and loaded when the server starts. With this you will be able to create NPCs that will be persistent forever, until you remove it. Very useful, for example, to create the NPCs of a Lobby for selecting game modes. This feature will be introduced in a few updates ahead.
- NPC command will be more useful, with all this new features. Remmeber that this command is only for experimental purposes, and in the future will be fully usefull with the Persistent and Global NPCs
I hope you enjoy this new update, and leave feedback. Thank you for using PlayerNPC API :)
PlayerNPC API 2022.2 version
This is a BIG update to the API, please read carefully all the changes.
Before updating your plugin, check if all dependencies are updated with this version.
New features!
-
Introducing Movement for the NPCs. This means that now you can move the NPCs around the world (walking, crouching, swimming, etc..) Click here to see an example.
- Added NPC.Move.Speed with (SLOW, NORMAL, SPRINT)
- Added npc.goTo(Location, boolean lookToEnd, NPC.Move.Speed);
- Added npc.goTo(Location);
- Added npc.goTo(Location, boolean lookToEnd);
- Added npc.goTo(Location, NPC.Move.Speed);
- Added npc.cancelMove();
- Added npc.setMoveSpeed(NPC.Move.Speed);
- Added npc.setMoveSpeed(double);
-
Introducing Move Behaviour for the NPCs. This means that NPCs automatically will move following the selected behaviour. There are 4 types of behaviour:
- Follow Player: The NPC will follow the player who see its around the world, and if the target changes the world, the NPC will continue following.
- Added npc.followPlayer();
- Added npc.followPlayer(double minDistance, double maxDistance);
- Follow Player: The NPC will follow the player who see its around the world, and if the target changes the world, the NPC will continue following.
-
Follow Entity: The NPC will follow the selected entity around the world.
- Added npc.follow(Entity);
- Added npc.follow(Entity, double minDistance, double maxDistance);
- Added npc.follow(Entity, double minDistance);
-
Follow NPC: The NPC will follow another NPC around the world. Note: NPC cannot follow himself.
- Added npc.follow(NPC);
- Added npc.follow(NPC, double minDistance, double maxDistance);
-
Custom Path: The NPC will go to the different locations, following the path. The Path have different types
- Repetitive path: The NPC will do the path, and when finish, it will do the path another time, everytime.
- Added npc.setRepetitivePath(Location...);
- Added npc.setRepetitivePath(List);
- Normal path: The NPC will do the path, but when finish it, it will remain at the last location.
- Back to Start path: The NPC will do the path, and when it finish, it will return to the start location.
- Added npc.setPath(Move.Path.Type, List);
- Added npc.setPath(Move.Path.Type, Location...);
- Added npc.cancelMoveBehaviour();
- Repetitive path: The NPC will do the path, and when finish, it will do the path another time, everytime.
-
Introducing Animations, with this feature you will be able to play some animations on the NPC such as (SWING_MAIN_ARM, TAKE_DAMAGE, SWING_OFF_HAND, CRITICAL_EFFECT, MAGICAL_CRITICAL_EFFECT)
- Added npc.playAnimation(NPC.Animation);
- Added npc.hit();
-
You will be able to set the NPC on fire. (Known bug: setting off fire while NPC is glowing won't work, because of a Metadata bug)
- Added npc.setOnFire(boolean);
- Added npc.setFireTicks(Integer);
-
You will be able to Teleport between worlds, you only need to teleport the NPC to a location with a different world.
- Added npc.teleport(World, double x, double y, double z);
- Added npc.teleport(World, double x, double y, double z, float yaw, float pitch);
- Updated npc.teleport(Location); and npc.teleport(Entity);
-
Added New Events to listen on a Listener:
- Added NPC.Events.FinishMove
- Added NPC.Events.Move
- Added NPC.Events.Teleport
- Added NPC.Events.StartMove
-
Added New Custom Click Actions, to add when player interacts at the NPC.
- Send to a Bungee Server
- Added npc.addConnectBungeeServerClickAction(NPC.Interact.ClickType clickType, String server)
- Added npc.addConnectBungeeServerClickAction(String server)
- Send ActionBar message
- Added npc.addActionBarMessageClickAction(NPC.Interact.ClickType clickType, String message);
- Added npc.addActionBarMessageClickAction(String message);
- Send Title and Subtitlte
- Added npc.addTitleMessageClickAction(NPC.Interact.ClickType clickType, String title, String subtitle, int fadeIn, int stay, int fadeOut);
- Added npc.addTitleMessageClickAction(String title, String subtitle, int fadeIn, int stay, int fadeOut);
- Send to a Bungee Server
-
Introducing Skin Parts, whit this new feature, you will be able to customize the parts of the NPC.Skin. Note: when setting the parts of the NPC.Skin, you will need to do npc.setSkin(NPC.Skin); to apply changes to the NPC's skin.
- Added npcSkin.getParts();
- Added npcSkin.getParts().enableAll();
- Added npcSkin.getParts().disableAll();
- Parts of the NPC.Skin (Cape, Jacket, Left Sleeve, Right Sleeve, Left Pants, Right Pants, Hat)
-
Added npc.setGlowingColor(NPC.Color);
-
Added npc.lookAt(float yaw, float pitch);
Code changes (this may produce errors on old plugin dependencies)
With this new update, all the objects previously called NPCObject are now called NPC.Object , and other things are moved into a more organized way.
- NPCSkin is now called NPC.Skin
- All the events are now called different.
- NPCHideEvent is now called NPC.Events.Hide
- NPCShowEvent is now called NPC.Events.Show
- NPCInteractEvent is now called NPC.Events.Interact
- NPCAttributes is now called NPC.Attributes
- NPC.TextOpacity is now called NPC.Hologram.Opacity
- NPCInteractEvent.ClickType is now called NPC.Interact.ClickType
Future updates:
- Global NPCs will be and object to manage a Global NPC object that will manage all the personal NPCs of all the players. This will help to create NPCs visible for all the players, but customizable for each player at the same time (for example, all the players will see the NPC but each will see with their own Skin), and this will redouce server lag. This is a lot requested feature, and will be introduced probably in the next update.
- Persistent NPCs will be the posibility to save all the Global NPC data into a file, and will be saved when the server closes, and loaded when the server starts. With this you will be able to create NPCs that will be persistent forever, until you remove it. Very useful, for example, to create the NPCs of a Lobby for selecting game modes. This feature will be introduced in a few updates ahead.
- NPC command will be more useful, with all this new features. Remmeber that this command is only for experimental purposes, and in the future will be fully usefull with the Persistent and Global NPCs
I hope you enjoy this new update, and leave feadback. Thank you for using PlayerNPC API :)
PlayerNPC API 2022.1 version
This is a BIG update to the API, please read carefully all the changes.
Before updating your plugin, check if all dependencies are updated with this version.
New features!
- Introducing Text Opacity and Line Opacity, with this new feature you can modify the opacity of the text above NPC. Click to see an example. Line Opacity has more priority than Text Opacity, if Line Opacity is not setted, that line will have the Text Opacity. Notice that as a more Opacity, more entities will be send to the Player's client, so this may produce lag, and can produce lag to the Server also.
- Added NPC.TextOpacity with (LOWEST, LOW, MEDIUM, HARD, HARDER, FULL)
- Added npc.setTextOpacity(NPC.TextOpacity);
- Added npc.getTextOpacity();
- Added npc.resetTextOpacity();
- Added npc.setLineOpacity(int, NPC.TextOpacity);
- Added npc.getLineOpacity(int);
- Added npc.resetLineOpacity(int);
- Added /settextopacity (player) (id) (textopacity)
- Added /setlineopacity (player) (id) (line) (lineopacity)
- Any change will need npc.forceUpdateText();
- Introducing Click Actions. This will allow you to set Click Actions for the NPC that are going to be called when a Player interacts with it. By cancelling NPCInteractEvent, this actions won't be executed.
- Added npc.addRunPlayerCommandClickAction(NPCInteractEvent.ClickType, String);
- Added npc.addRunConsoleCommandClickAction(NPCInteractEvent.ClickType, String);
- Added npc.addMessageClickAction(NPCInteractEvent.ClickType, String);
- Added npc.addCustomClickAction(NPCInteractEvent.ClickType, CustomClickAction);
- Added npc.resetClickActions(); and npc.resetClickActions(NPCInteractEvent.ClickType);
- Introducing NPCAttributes. This will allow you to create an abstract copy of some attributes of an NPC, and paste it on another NPC, even if it's not from the same Player. This is a great tool to create "global" NPC attributes. Also this tool allows you to set Default attributes for every NPC thats is created after setting this. Use NPCAttributes.setDefault.... or NPCAttributes.getDefault... or with an instance of an NPCAttributes (like npc.getNPCAttributes()), use npcAttributes.set... or npcAttributes.get... To apply changes, use npcAttributes.applyNPC(NPC); Variables that are supported by NPCAttributes:
- NPCSkin
- Text above NPC
- NPC items
- Collidable
- Hide distance
- Glowing
- Glowing color
- FollowLookType
- Custom Tab List Name
- Show on Tab List
- Interact Cooldown
- Line Spacing
- Text Alignment
- NPC Pose
- Introducing Line Spacing. This will allow you to set the distance between the lines of the text above NPC. By default 0.27
- Added npc.setLineSpacing(double);
- Added npc.resetLineSpacing();
- Added npc.getLineSpacing();
- Added /npc setlinespacing (player) (id) (double/reset)
- Introducing Text Alignment. This will allow you to adjust the NPC Hologram location, respect the NPC location throught a Vector. By default (0, 1.75, 0)
- Added npc.setTextAlignment(Vector);
- Added npc.resetTextAlignment();
- Added npc.getTextAlignment();
- Added /npc settextalignment (player) (id) (vector/reset)
- Now you can set custom interact cooldown in milliseconds for each NPC. By default 200 milliseconds.
- Added npc.setInteractCooldown(long);
- Added npc.resetInteractCooldown();
- Added npc.getInteractCooldown();
- Added new methods to set items on NPC
- Added npc.setHelmet(ItemStack);
- Added npc.setChestplate(ItemStack);
- Added npc.setLeggingsItemStack);
- Added npc.setBoots(ItemStack);
- Added npc.setItemInRightHand(ItemStack);
- Added npc.setItemInLeftHand(ItemStack);
- Now the /npc command is available throught Console
- New NPC interact system, using PacketReader to read the ClickType. Now is 100% accurate.
Code changes (this may produce errors on old plugin dependencies)
- NPCSlot enum is now called NPC.Slot
- NPCPose enum is now called NPC.Pose
- NPCLib.getInstance().setDefaultHideDistance(double) is now Deprecated, use instead NPCAttributes.setDefaultHideDistance(double)
- NPCLib.getInstance().getDefaultHideDistance(double) is now Deprecated, use instead NPCAttributes.getDefaultHideDistance(double)
Bug fixes:
- Fixed bug when automatic update look to player, and the player was in a different dimension as the NPC.
- Fixed correctly NPC interact detection.
- As this update is so big, is probably that bugs can appear. If you find any bug, please contact me.
- Now when cancelling NPCInteractEvent, the Custom actions of the NPC will not be called.
- Minor bug fixes
Happy new year 2022!
PlayerNPC API 2021.5 version
- Added support for Spigot 1.18 and 1.18.1
- Removed support for Spigot 1.17 and 1.17.1, you can still use PlayerNPC v2021.4
- Bug fixes
PlayerNPC API 2021.4 version
- Fixed error PacketPlayOutEntityDestroy on Spigot version 1.17.1
- New methods at NPCLib:
- getNPCs(Player, prefix)
- getNPCs(Player, World)
- More documentation on NPCLib
- Fixed bugs
PlayerNPC API 2021.2 version
- Added NPCPose, now you can set the pose of the NPC as (STANDING, SWIMMING, SLEEPING, CROUCHING). You can set it throught API as npc.setPose(NPCPose); or throught command as /npc setpose (player) (id) (npcpose)
- Added a new automatic move detection, you can choose between PlayerMoveEvent, or a runnable in ticks (5 by default). You can set it with NPCLib.getInstance().setUpdateLookType(UpdateLookType); and you can set the amount of ticks with NPCLib.getInstance().setUpdateLookTicks(int ticks);
- Now NPC will display the skin overlay (cape, etc..)
- Bug fixes