Minor changes.

Added message boolean on NPCLib instantiation and removed notice from README.
This commit is contained in:
JitseB 2018-05-05 19:34:00 +02:00
parent 1143398b2a
commit d73a4dd5d2
2 changed files with 13 additions and 8 deletions

View File

@ -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/
**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
[![PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://paypal.me/JitseB)
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
// 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`.
## Usage
## License and plugins using NPCLib
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.

View File

@ -26,6 +26,10 @@ public class NPCLib {
private final Class<?> npcClass;
public NPCLib(JavaPlugin plugin) {
this(plugin, true);
}
public NPCLib(JavaPlugin plugin, boolean message) {
this.plugin = plugin;
this.server = plugin.getServer();
@ -35,8 +39,8 @@ public class NPCLib {
try {
npcClass = Class.forName("net.jitse.npclib.nms." + versionName + ".NPC_" + versionName);
} catch (ClassNotFoundException e) {
// Version not supported, error below
} catch (ClassNotFoundException exception) {
// Version not supported, error below.
}
this.npcClass = npcClass;
@ -47,7 +51,9 @@ public class NPCLib {
return;
}
server.getConsoleSender().sendMessage(ChatColor.BLUE + "[NPCLib] " + ChatColor.WHITE + "Enabled for version " + versionName + ".");
if (message) {
server.getConsoleSender().sendMessage(ChatColor.BLUE + "[NPCLib] " + ChatColor.WHITE + "Enabled for version " + versionName + ".");
}
registerInternal();
}