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 Apr 2, 2013I get this...
2013-04-02 15:38:56 [SEVERE] Error occurred while enabling BKCommonLib v1.5 (Is it up to date?)
Any ideas?
-
View User Profile
-
Send Message
Posted Apr 2, 2013@gordonfreemanq I did fix this issue in the latest development builds, but those are for CB 1.5.1, not CB 1.4.7. If what you are having is still happening on the latest development builds for CraftBukkit 1.5.1 (see link above), let us know, perhaps something is still wrong.
-
View User Profile
-
Send Message
Posted Apr 1, 2013TNT explosions are throwing exceptions for me. I'm keep updating to the latest builds of bukkit, BK, and NoLagg, but it doesn't change. Any advice?
http://pastebin.com/sY8dCDqq
-
View User Profile
-
Send Message
Posted Mar 26, 2013@Simonsigge
Does not seem like it is BKCommonLib.
Verry strange error though
-
View User Profile
-
Send Message
Posted Mar 26, 2013@Just4Gamezzz
Instead of being so rude, why not read the last comments? Get a dev build, it works fine on 1.5.1
-
View User Profile
-
Send Message
Posted Mar 26, 2013Can you PLEASE update??
-
View User Profile
-
Send Message
Posted Mar 25, 2013Hey! Sometimes my players are randomly dying. Here is an error: http://pastie.org/7114950
-
View User Profile
-
Send Message
Posted Mar 23, 2013@PureineServer above the comments section it says... "Development Builds"
since you are running a dev build of bukkit, I see no reason why you couldn't run a dev build of some plugins that supports 1.5.1
You can fallow the link above and download his latest dev build, but i'll make it simple. Here is a link to his build. Build #29
-
View User Profile
-
Send Message
Posted Mar 23, 2013Hi. I wana update to 1.5.1
I would really apprecaite if you could update asap!
-
View User Profile
-
Send Message
Posted Mar 23, 2013-
View User Profile
-
Send Message
Posted Mar 22, 2013@elemental115
Ye I also have that problem :P I thought lets use a snapshot protocol so all plugins work and 1.5 clients can join, but now I wanna update to 1.5.1 and only 3 of the 24 plugins work :S
-
View User Profile
-
Send Message
Posted Mar 22, 2013I think, with the last release being on March 8, that we are currently still within a reasonable time-frame for developing the next release.
It is minecraft that released a double-whammy on us with 1.5 that worked with a lot of plugins and then 1.5.1 that suddenly doesnt work with nearly any plugins, yet our need for instant progress remains as if the developer is a business with a duty to uphold customer service, this is wrong.
Lets just say, that since this plugin is such a popular and well used one, that the developer has literally thousands of supporters ready to test *any* updates that get passed out.
You bring 'em, and we'll tell you what they behave like for us.
-
View User Profile
-
Send Message
Posted Mar 22, 2013When is this updating to 1.5 or is there a file that is already? Can someone link me to the page plz? Since I can't find it in the gitHub! Oh and people are saying stuff about spigot that its not working... What you guys mean? It is working and without any bugs in the console... (Do you need this if you do not have orebfuscator but you do use the one that spigot gives you?)
-
View User Profile
-
Send Message
Posted Mar 22, 2013Hi bergerkiller, i have there a Problem with the dev-build of BKCommonlib. When i start the Server it posts:
2013-03-22 23:56:07 [SEVERE] org/bukkit/craftbukkit/v1_5_R2/inventory/CraftItemS tack initializing BKCommonLib v1.51 (Is it up to date?) java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_5_R2/inventory/CraftIt emStack at com.bergerkiller.bukkit.common.conversion.type.WrapperConverter.<clin it>(WrapperConverter.java:214) at com.bergerkiller.bukkit.common.conversion.type.ConversionTypes.<clini t>(ConversionTypes.java:88) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.bergerkiller.bukkit.common.Common.loadClasses(Common.java:100) at com.bergerkiller.bukkit.common.internal.CommonClasses.init(CommonClas ses.java:13) at com.bergerkiller.bukkit.common.internal.CommonPlugin.onLoad(CommonPlu gin.java:332) at org.bukkit.craftbukkit.v1_5_R1.CraftServer.loadPlugins(CraftServer.ja va:244) at org.bukkit.craftbukkit.v1_5_R1.CraftServer.<init>(CraftServer.java:21 7) at net.minecraft.server.v1_5_R1.PlayerList.<init>(PlayerList.java:56) at net.minecraft.server.v1_5_R1.DedicatedPlayerList.<init>(SourceFile:11 ) at net.minecraft.server.v1_5_R1.DedicatedServer.init(DedicatedServer.jav a:105) at net.minecraft.server.v1_5_R1.MinecraftServer.run(MinecraftServer.java :381) at net.minecraft.server.v1_5_R1.ThreadServerApplication.run(SourceFile:5 73) Caused by: java.lang.ClassNotFoundException: org.bukkit.craftbukkit.v1_5_R2.inve ntory.CraftItemStack at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader .java:70) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:53) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 14 more
and then:
2013-03-22 23:56:07 [SEVERE] org/bukkit/craftbukkit/v1_5_R2/inventory/CraftItemS tack initializing BKCommonLib v1.51 (Is it up to date?) java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_5_R2/inventory/CraftIt emStack at com.bergerkiller.bukkit.common.conversion.type.WrapperConverter.<clin it>(WrapperConverter.java:214) at com.bergerkiller.bukkit.common.conversion.type.ConversionTypes.<clini t>(ConversionTypes.java:88) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.bergerkiller.bukkit.common.Common.loadClasses(Common.java:100) at com.bergerkiller.bukkit.common.internal.CommonClasses.init(CommonClas ses.java:13) at com.bergerkiller.bukkit.common.internal.CommonPlugin.onLoad(CommonPlu gin.java:332) at org.bukkit.craftbukkit.v1_5_R1.CraftServer.loadPlugins(CraftServer.ja va:244) at org.bukkit.craftbukkit.v1_5_R1.CraftServer.<init>(CraftServer.java:21 7) at net.minecraft.server.v1_5_R1.PlayerList.<init>(PlayerList.java:56) at net.minecraft.server.v1_5_R1.DedicatedPlayerList.<init>(SourceFile:11 ) at net.minecraft.server.v1_5_R1.DedicatedServer.init(DedicatedServer.jav a:105) at net.minecraft.server.v1_5_R1.MinecraftServer.run(MinecraftServer.java :381) at net.minecraft.server.v1_5_R1.ThreadServerApplication.run(SourceFile:5 73) Caused by: java.lang.ClassNotFoundException: org.bukkit.craftbukkit.v1_5_R2.inve ntory.CraftItemStack at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader .java:70) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:53) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 14 more
So what may it be?
-
View User Profile
-
Send Message
Posted Mar 22, 2013@lenis0012
hey dude thank for the advice to "fix my problem"
I just got a different error and you nearly wiped out my server files! I use My-Worlds, which relies on this plugin, and the world fiels werent available when I updated to #2700 or any 1.5.1 build, I had to go back to 1.5 just so my server files would get corrupted.
Please get your "stuff" together, or dont have other plugins rely on you if you cant update your plugins. Im starting to regret using protocollib, bkcommonlib, and my-worlds.
-
View User Profile
-
Send Message
Posted Mar 22, 2013CB - 1.5.1-R0.1 (Build #02700)
BKC L - Build #24
22:08:57 [INFO] [BKCommonLib] Enabling BKCommonLib v1.51
22:08:57 [INFO] [BKCommonLib] BKCommonLib is running on Minecraft v1_5_R2 22:08:57 [INFO] [BKCommonLib] For all the haters out there: BKCommonLib at least tries! 22:08:57 [SEVERE] [BKCommonLib] An error occurred while enabling, the plugin will be disabled 22:08:57 [SEVERE] [BKCommonLib] You may have to update BKCommonLib or look for a newer CraftBukkit build. 22:08:57 [SEVERE] java.lang.IllegalStateException: Can not initialize a new EntityMap when BKCommonLib is not yet enabled! 22:08:57 [SEVERE] at com.bergerkiller.bukkit.common.collections.EntityMap.register(EntityMap.java:35) 22:08:57 [SEVERE] at com.bergerkiller.bukkit.common.collections.EntityMap.<init>(EntityMap.java:19) 22:08:57 [SEVERE] at com.bergerkiller.bukkit.common.internal.CommonPlugin.enable(CommonPlugin.java:390) 22:08:57 [SEVERE] at com.bergerkiller.bukkit.common.PluginBase.onEnable(PluginBase.java:649) 22:08:57 [SEVERE] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) 22:08:57 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457) 22:08:57 [SEVERE] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) 22:08:57 [SEVERE] at net.skycraftmc.PluginManager.PluginManagerPlugin.onCommand(PluginManagerPlugin.java:276) 22:08:57 [SEVERE] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) 22:08:57 [SEVERE] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:187) 22:08:57 [SEVERE] at org.bukkit.craftbukkit.v1_5_R2.CraftServer.dispatchCommand(CraftServer.java:523) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.PlayerConnection.handleCommand(PlayerConnection.java:967) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.PlayerConnection.chat(PlayerConnection.java:885) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.PlayerConnection.a(PlayerConnection.java:840) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.Packet3Chat.handle(Packet3Chat.java:44) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.NetworkManager.b(NetworkManager.java:292) 22:08:57 [SEVERE] at net.minecraft.server.v1_5_R2.PlayerConnection.d(PlayerConnection.java:113) 22:08:57 [SEVERE] ...7 more 22:08:57 [INFO] [BKCommonLib] Disabling BKCommonLib v1.51
-
View User Profile
-
Send Message
Posted Mar 22, 2013People are randomly dying. Here is a error: 2013-03-21 21:33:03 [WARNING] Failed to handle packet for emildenstore2/90.231.54.235: java.lang.IndexOutOfBoundsException: Index: 49, Size: 45 java.lang.IndexOutOfBoundsException: Index: 49, Size: 45 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at net.minecraft.server.v1_5_R1.Container.clickItem(Container.java:209) at net.minecraft.server.v1_5_R1.PlayerConnection.a(PlayerConnection.java:1185) at com.bergerkiller.bukkit.common.internal.CommonPacketListener.a(CommonPacketListener.java:124) at net.minecraft.server.v1_5_R1.Packet102WindowClick.handle(SourceFile:31) at net.minecraft.server.v1_5_R1.NetworkManager.b(NetworkManager.java:292) at net.minecraft.server.v1_5_R1.PlayerConnection.d(PlayerConnection.java:113) at net.minecraft.server.v1_5_R1.ServerConnection.b(SourceFile:35) at net.minecraft.server.v1_5_R1.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_5_R1.MinecraftServer.r(MinecraftServer.java:580) at net.minecraft.server.v1_5_R1.DedicatedServer.r(DedicatedServer.java:225) at net.minecraft.server.v1_5_R1.MinecraftServer.q(MinecraftServer.java:476) at net.minecraft.server.v1_5_R1.MinecraftServer.run(MinecraftServer.java:409) at net.minecraft.server.v1_5_R1.ThreadServerApplication.run(SourceFile:573)
-
View User Profile
-
Send Message
Posted Mar 21, 2013@PuremineServer
You are not runnign the latest craftbukkit build
There is a new 1.5.1-R0.1 build out already for CraftBukkit
Wich has the path: net.minecraft.server.v1_5_R2
-
View User Profile
-
Send Message
Posted Mar 21, 2013I get this error with 1.51 development build and latest cb build
http://pastebin.com/k66baAyd
-
View User Profile
-
Send Message
Posted Mar 20, 2013New dev build being uploaded now :D http://ci.dj-tcraft.nl/job/BKCommonLib/16/