BKCommonLib
BKCommonLib is no longer being updated on dev.bukkit.org.
If you want to use the latest version, use spigot.
Latest version: 1.57
CraftBukkit/SportBukkit/Spigot/MCPC+ build: CB 1.6.4 R1.0 / CB 1.6.4 R2.1 / Spigot 1.7
Older builds available: CB 1.5.2-R1.0 / CB 1.6.2-R1.0
Tekkit: Untested and thus unsupported, some features may not work as expected
Description
This utility library shares all the common code needs for various plugins, and having them in one library heavily reduces the amount of duplicated code. The featured utilities are varied, and whenever something is missing in Bukkit, it is added in BKCommonLib. This is one of the reasons why it has become this large: there are simply a lot of things Bukkit doesn't (want to) offer.
BKCommonLib has versioning on a per-plugin basis, so when a certain plugin needs version 2, and version 1 is installed, the server owner is automatically notified and the plugin is not enabled. This prevents the common mishaps with outdated BKCommonLib versions.
Other than utilities and services, this library offers a wide variety of reflection and user-friendly ways of accessing net.minecraft.server. If your plugin requires the use of the internals, but do not want to risk changing field and method names, you can depend on BKCommonLib to provide them for you. This allows you to remain compatible between CraftBukkit versions automatically, and reduces silent failure hazards.
Reasons for you to depend on this library
- You need to access Minecraft internals in your plugin, and Bukkit has no API for it
- You are tired of re-uploading the same version over again because of the internals changing
- You want to work with Vector/math logic, or need to use other utility classes
- The YAML of Bukkit dislikes you, and you want this to be easier
- You want to easily read and write configuration/data files
- You want easy access to data conversion utilities to convert user input
- You want to work with inventories in an advanced fashion
- You want to work with unique server events
- You want to alter entity behaviour (such as handling block collisions, custom movement, etc.)
- You want plugin messages/permissions to be configurable
- You want to work with (async)tasks without storing IDs
- You want to send and manipulate packets
Features
- General
- PluginBase for easy access to metrics, permissions, localization and more
- Permission defaults for storing the permissions a plugin uses
- Localization for making the messages of a plugin configurable
- Utilities
- General utilities for String, Logic, BlockFace and Math operations
- Block utilities for Block-related operations (states, data, etc.)
- ItemUtil for Inventory, Items and Item Transfer utilities
- RecipeUtil to work with crafting and furnace recipes
- Various Collections for auto-filtering, converting and even interpolation
- Data storage
- Configuration API with nodes, headers and other goodies
- NBT API designed after the configuration API
- (Compressed)DataReader/DataWriter to read and write data from/to file
- Entities
- CommonEntity implementations with added utilities
- EntityController for altering entity behaviour
- EntityNetworkController for altering entity network logic
- Services
- Metrics for keeping track of plugin statistics
- Conversion for conversions between all types of data
- Events and Listeners to keep track of changes on the server
- Packet services and API to keep track of packets
- Task class for easier task scheduling
- Scoreboard services to setup scoreboards without criteria
- Tab View service to alter what is shown when players press tab
Getting started
To start using BKCommonLib, you have two options (after adding BKCommonLib as dependency in the plugin.yml):
Include the jar file as a dependency
Like any dependency, keep the jar file somewhere on your computer and add it to your classpath. Nothing special here.
Make a (new) maven project and include it
Add the following repository:
<repository> <id>dj-tcraft repository</id> <url>http://ci.dj-tcraft.nl/plugin/repository/everything/</url> </repository>
And the following dependency (may need to update version):
<dependency> <groupId>com.bergerkiller.bukkit</groupId> <artifactId>BKCommonLib</artifactId> <version>1.54-SNAPSHOT</version> <scope>provided</scope> </dependency>
Dependencies BKCommonLib uses
BKCommonLib supports various other plugins and projects. Below all of these are listed:
- Vault - for permission plugin support
- ProtocolLib - to avoid packet listening conflicts
- Showcase(Standalone) - to ignore showcased items
- HyperConomy - to ignore shop items
- BleedingMobs - to ignore particles
- CGLib - for generating nms.Entity classes on-the-fly to supply Entity Controllers
- Objenesis - for generating classes without calling constructors (needed for various fixes inside class constructors)
Plugins that require BKCommonLib to be installed:
Disclaimer
This plugin utilises Hidendra's plugin metrics system, which means that the following information is collected and sent to mcstats.org:
- A unique identifier
- The server's version of Java
- Whether the server is in offline or online mode
- The plugin's version
- The server's version
- The OS version/name and architecture
- The core count for the CPU
- The number of players online
- The Metrics version Opting out of this service can be done by editing plugins/Plugin Metrics/config.yml and changing opt-out to true.
License
This library uses an open license. Feel free to use whatever code you need from it, you do not have to ask me either. If you want me to add certain features, that is fine too. Everyone is allowed to use this Library as a dependency. I do recommend extending 'PluginBase' instead of 'JavaPlugin' then, as it allows you to automatically deal with the BKCommonLib versioning checks. See also: BKCommonLib license file
This product includes software developed by the Apache Software Foundation (http://www.apache.org/)
Links:
Compatibility
BKCommonLib supports ProtocolLib when it is enabled, but if it is not, the player connection is replaced resulting in several incompatibilities. To fix these incompatibility issues, install ProtocolLib next to BKCommonLib. This can not be stressed enough. When incompatibility occurs, BKCommonLib will notify you in the console and will disable itself. The following plugins are known to be incompatible when ProtocolLib is NOT installed:
Metrics
This plugin sends server count and dependency statistics to MCStats.org. You can (globally) opt out in the PluginMetrics/config.yml file.
Banner
I use a banner in my depending plugins. This banner is automatically updated when a new version of BKCommonLib is out. It is a quick and efficient way to keep track of updates for this library. This was needed, too, because a lot of people were using outdated BKCommonLib versions, which resulted in bug reports...too many of them. And I do not want to waste your time with invalid reports. You have a plugin that uses BKCommonLib? Feel free to use the banner on your download page.
[[http://dev.bukkit.org/bukkit-plugins/bkcommonlib/|{{http://ci.dj-tcraft.nl/job/BKCommonLib/lastSuccessfulBuild/artifact/target/BKCommonLibVersion.png|Go to the BKCommonLib Dev-bukkit page}}]]







-
View User Profile
-
Send Message
Posted Mar 9, 2013I have some bug with MCPC+ : http://pastebin.com/wY3K2CX9 (include plugins lists)
-
View User Profile
-
Send Message
Posted Mar 7, 2013Well it took some time but...a new official build of BKCommonLib is out. I also updated most other plugins, with the exception of TrainCarts, as it still had some bugs. I guess that you can tell by the changelog why it took a bit longer than usually...
http:dev.bukkit.org/server-mods/bkcommonlib/files/37-v1-50/
-
View User Profile
-
Send Message
Posted Mar 6, 2013@Tombikos @Tombikos Both errors are not caused by BKCommonLib, and neither by NoLagg. The first one is a plugin misbehaving and doing stuff on another thread in Bukkit (onPlayerQuit is async, not safe), report it. The second one is the result of Xauth crashing the server, literally. Report it to them.
http:dev.bukkit.org/server-mods/nolagg/pages/synchronized-code-access-nolagg/
-
View User Profile
-
Send Message
Posted Mar 6, 2013Aaand w/ xAuth, paste here: http://paste.ee/p/CHKzi
-
View User Profile
-
Send Message
Posted Mar 6, 2013Hi, my server crashed due to problems w/ BKCommonlib and Ultrabans. Log here: http://paste.ee/p/EUFMX
-
View User Profile
-
Send Message
Posted Mar 6, 2013@wartaal55
-
View User Profile
-
Send Message
Posted Mar 6, 2013my spout gives some weird errors when i use BKCommonLib (1.48, 1.44 or 1.43) but it only does give the error when i reload my server, not when i start it.
the first time i reload it gives this error: cannot set already-set enchantment and sometimes after 2 or more reloads it gives this error: InvocationTargetException
> nullafter this spout error, BKCommonLib says that i have to update BKCommonLib or my CraftBukkit and after that error NoLagg asks if it is up to date and stops working after the NoLagg error i get this message: [INFO] [SpoutPlugin] Initializing precache for NoLagg, what is very weird because those 2 plugins just crashed this also happens with BKCommonLib: [INFO] [SpoutPlugin] Initializing precache for BKCommonLib after his error. and then the most odd thing that happens, is that i also get the following message after the spout error: [INFO] [SpoutPlugin] Initializing precache for Spout
i do not understand whats happening, but if i remove BKCommonLib out of my plugins everything works just fine
i use the following plugins: BloodMoon v0.23 DisguiseCraft v4.4 Essentials v2.10.1 Factions v1.6.9.4 GroupManager v2.0 <2.10.1> (GroupManager disables the following plugin:) Permissions v3.1.6 Jail v2.3.0 mcMMO v1.4.00-beta4-b1668 NoLagg v1.89.7 (?PluginMetrics?) ProtocolLib (!!!) v2.2.0 Spout(Plugin) v1.4.7 b1432 WorldEdit v5.5.1 Vault v1.2.24-b304 and... BKCommonLib v.1.48
-
View User Profile
-
Send Message
Posted Mar 5, 2013@bergerkiller
Alright I updated all the plugins, tested everything and it all worked as stated. Thanks so much for your excellent work and incredibly speedy service, it's greatly appreciated!
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 All right got it all figured out now. Two things:
n1. Bug in Seasons
n2. Buffered loading not supported, added some detection system for such clashes to solve this in the near future.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@jommeke uuhm I know it is the wrong project page but I'll reply anyway, sort of a quote from earlier:
Update BKCommonLib to the very last development build: http:ci.herocraftonline.com/job/BKCommonLib/151/
Same for NoLagg: http:ci.ecocitycraft.com/job/NoLagg/59/
Then everything should work just fine. If it doesn't, try disabling NoLagg chunks until it is fixed.
-
View User Profile
-
Send Message
Posted Mar 5, 2013Ay don't have any errors just the world isnt loading proper ay do use multiverse
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 Ok I tracked it down to the fact that Seasons uses a ProtocolLib packet listener to listen for chunk packets...and guess which packets I do not let through in chunks? hehe.
I'll try to get it all working with buffering disabled, then I'll include some logic so it will automatically turn off the buffer when something like this is detected.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@bergerkiller
Alright i'll stay posted, good luck in your search! :) And thanks alot for you're time you've been very helpful!
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 Hmm annoying, I'll have to decompile all of Seasons and search the code for 'chunkCoordIntPairQueue' to see where and how it is being used. Hopefully I'll be able to spot the problem.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@bergerkiller
Bad news, with just "useDynamicView" disabled there was no change (rain was rain).
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 Ok now have chunks enabled but disable the 'useDynamicView' in the chunks component. The dynamic view distance involves several internal replacements too.
Kinda hope that is to blame here, otherwise it has something to do with the chunk send queue (contains chunks pending for sending), which is harder to fix...
-
View User Profile
-
Send Message
Posted Mar 5, 2013@bergerkiller
Excellent!
Alright I disbaled the "bufferedLoader" there was no change. Then disabled "chucks" and the rain was snow!
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 Well I wrote that too, so it does :)
Uhm try installing NoLagg, but only disable the 'buffered loading' in the chunks component in config.yml. If this doesn't fix it, disable the entire chunks component to see if it THEN works. Report in what fixed it so I can start looking into it.
NoLagg chunks is the main component that interferes a lot with server/plugin logic, so it is my main suspicion.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@bergerkiller
Its NoLagg (I have version 1.89.8 Build #57 (58+ would not load for me)). Anyways removed NoLagg and kept BkCommonLib (only other BkCommonLib plugin I use is TrainCarts) and the rain was back to snow. My apologies for not testing that! So now, I dont suppose your expertise extends to Nolagg, Does it? :)
-
View User Profile
-
Send Message
Posted Mar 5, 2013@John290 All right I had a quick glimpse into Seasons' source code but I could not find anything that could conflict with things being done in BKCommonLib. I suspected the packet listener to be to blame, but you have ProtocolLib, which means that this is ruled out. There is nothing else 'autonomous' in BKCommonLib that can conflict, it's all on-demand. (utilities...)
So what other plugins do you use that require BKCommonLib? If they are development versions, it's best to also give this dev build number, or at least what time ago you installed it.
If someone knows exactly what seasons does to show snow everywhere (I suspect that it alters chunk biome information on-the-fly) then that could help me in bugtracking it. I am aware that this is not a simple setting you can change, since rain/snowfall toggling is on the client.