Minor changes.
Added message boolean on NPCLib instantiation and removed notice from README.
This commit is contained in:
@@ -10,16 +10,15 @@ This is an API made specifically for spigot servers (Minecraft). Current support
|
|||||||
**Thread**: https://www.spigotmc.org/threads/npclib-–-basic-non-player-character-library.314460/
|
**Thread**: https://www.spigotmc.org/threads/npclib-–-basic-non-player-character-library.314460/
|
||||||
**Preview**: https://youtu.be/LqwdqIxPIvE
|
**Preview**: https://youtu.be/LqwdqIxPIvE
|
||||||
|
|
||||||
### Notice
|
|
||||||
If any developer out there knows how to convert this project to Maven, please consider contacting me or creating a pull request. I have yet to come up with a good solution for the (older) NMS code repositories. I would love to add a CI system to this repository for easier collaboration.
|
|
||||||
|
|
||||||
## Donate
|
## Donate
|
||||||
|
|
||||||
[](https://paypal.me/JitseB)
|
[](https://paypal.me/JitseB)
|
||||||
|
|
||||||
Alternatively, you can help the project by starring the repository or telling others about NPCLib :smile:
|
Alternatively, you can help the project by starring the repository or telling others about NPCLib :smile:
|
||||||
|
|
||||||
## Code Example
|
## Usage
|
||||||
|
|
||||||
|
It is recommended to shade NPCLib into your plugin.
|
||||||
|
|
||||||
```Java
|
```Java
|
||||||
// First we define our (global) library variable.
|
// First we define our (global) library variable.
|
||||||
@@ -45,7 +44,7 @@ Alternatively, you can help the project by starring the repository or telling ot
|
|||||||
|
|
||||||
Usable events: `NPCSpawnEvent`, `NPCDestroyEvent` and `NPCInteractEvent`.
|
Usable events: `NPCSpawnEvent`, `NPCDestroyEvent` and `NPCInteractEvent`.
|
||||||
|
|
||||||
## Usage
|
## License and plugins using NPCLib
|
||||||
|
|
||||||
NPCLib is licensed under the [MIT license](https://github.com/JitseB/npclib/blob/master/LICENSE.md).
|
NPCLib is licensed under the [MIT license](https://github.com/JitseB/npclib/blob/master/LICENSE.md).
|
||||||
Developers are free to use NPCLib for both private and commercial use. Though, it would be nice to acknowledge me.
|
Developers are free to use NPCLib for both private and commercial use. Though, it would be nice to acknowledge me.
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class NPCLib {
|
|||||||
private final Class<?> npcClass;
|
private final Class<?> npcClass;
|
||||||
|
|
||||||
public NPCLib(JavaPlugin plugin) {
|
public NPCLib(JavaPlugin plugin) {
|
||||||
|
this(plugin, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NPCLib(JavaPlugin plugin, boolean message) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.server = plugin.getServer();
|
this.server = plugin.getServer();
|
||||||
|
|
||||||
@@ -35,8 +39,8 @@ public class NPCLib {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
npcClass = Class.forName("net.jitse.npclib.nms." + versionName + ".NPC_" + versionName);
|
npcClass = Class.forName("net.jitse.npclib.nms." + versionName + ".NPC_" + versionName);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException exception) {
|
||||||
// Version not supported, error below
|
// Version not supported, error below.
|
||||||
}
|
}
|
||||||
|
|
||||||
this.npcClass = npcClass;
|
this.npcClass = npcClass;
|
||||||
@@ -47,7 +51,9 @@ public class NPCLib {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message) {
|
||||||
server.getConsoleSender().sendMessage(ChatColor.BLUE + "[NPCLib] " + ChatColor.WHITE + "Enabled for version " + versionName + ".");
|
server.getConsoleSender().sendMessage(ChatColor.BLUE + "[NPCLib] " + ChatColor.WHITE + "Enabled for version " + versionName + ".");
|
||||||
|
}
|
||||||
|
|
||||||
registerInternal();
|
registerInternal();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user