Dico is a small, lightweight library designed for the
Bukkit platform and its frameworks. It provides
compatibility for the Bukkit.getOnlinePlayers() method across
Minecraft versions both below and above 1.7.10.
In Bukkit for Minecraft
1.7.10 and higher, the method Bukkit.getOnlinePlayers() returns a
Collection<Player>. However, in versions prior to 1.7.10, it returns a
Player[] array. This difference creates backward compatibility issues when
developing plugins for multiple Minecraft versions.
Dico solves this issue by allowing developers to maintain full compatibility
with both newer and older versions of Minecraft.
With Dico, you can choose whether Bukkit.getOnlinePlayers() returns a
Collection<Player> or a Player[], depending on your preference and the
Minecraft version you're targeting.
- Provides seamless backward compatibility for
Bukkit.getOnlinePlayers()across Bukkit versions. - Allows developers to specify the preferred return type:
Collection<Player> orPlayer[]. - Easy to integrate and lightweight, adding minimal overhead to existing projects.
- Java: 8 or higher.
The simplest way to install the Dico library is by using JitPack with Gradle. Follow these steps to integrate it into your project:
- Add JitPack Repository
For Groovy (if using settings.gradle), add the
following repository configuration:
dependencyResolutionManagement {
repositories {
maven {
url "https://jitpack.io"
content {
includeGroup "com.github.kvdpxne"
}
}
}
}For Gradle Kotlin DSL,
modify your settings.gradle.kts file:
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://jitpack.io/")
content {
includeGroupAndSubgroups("com.github.kvdpxne")
}
}
}
}- Add Dependencies
For Groovy (if using build.gradle), add the
dependencies for the core and API modules:
dependencies {
// Include all modules of Dico
implementation 'com.github.kvdpxne.dico:core:VERSION'
}For Gradle Kotlin DSL,
modify your build.gradle.kts file:
dependencies {
// Include all modules of Dico
implementation("com.github.kvdpxne.dico:core:VERSION")
}Make sure to replace VERSION with the latest release version of the library.
This approach ensures you have the Dico library installed in the simplest way via Gradle using JitPack.
Using the Dico library is extremely simple. If you need to retrieve a
collection of online players, instead of calling Bukkit.getOnlinePlayers(),
you can use the following methods provided by Dico:
- To get online players as a
Collection<Player>, use:
Dico.getLocalPlayers().asCollection();- To get online players as a
Player[]array, use:
Dico.getLocalPlayers().asArray();This allows you to easily switch between returning a Collection<Player> or
Player[], depending on your needs.
This project is licensed under the MIT License. This means you are free to use, modify, and distribute the code in both private and commercial projects, as long as you include the original license in any substantial portions of the code.
For more details, please refer to the full license text in the LICENSE file.