Drain is a well-documented library for Spigot and Bukkit plugins that helps you to develop your plugins faster and easier. It includes many functionalities to make your development life easier.
Spoiler: For Server Owners (Installation)
If one of your plugins needs Drain, just put the JAR into your plugins directory.
Don't use the ratings for bug reports, consider opening an issue on GitHub!
Features
- Useful annotations (e.g. @Cancel to cancel an event directly)
- Useful utility classes
- A command builder to create commands fast and easy
- An ItemFactory to create custom items faster
- And more!
The Difference
The code for a simple /heal command looks like this - if you don't use Drain:
Code (Java):
public
class HealCommand
implements CommandExecutor
{
public boolean onCommand (CommandSender commandSender, Command command, String s, String [ ] strings ) {
if (commandSender instanceof Player ) {
Player player = (Player ) sender ;
if (player. hasPermission ( "command.heal" ) ) {
player. setHealth ( 20 ) ;
return true ;
} else {
player. sendMessage ( "§cYou are not allowed to do this!" ) ;
return false ;
}
} else {
commandSender. sendMessage ( "§cThis command is player-only!" ) ;
return false ;
}
}
}
public boolean onCommand (CommandSender commandSender, Command command, String s, String [ ] strings ) {
if (commandSender instanceof Player ) {
Player player = (Player ) sender ;
if (player. hasPermission ( "command.heal" ) ) {
player. setHealth ( 20 ) ;
return true ;
} else {
player. sendMessage ( "§cYou are not allowed to do this!" ) ;
return false ;
}
} else {
commandSender. sendMessage ( "§cThis command is player-only!" ) ;
return false ;
}
}
}
A /heal command with Drain:
Code (Java):
new DynamicCommandBuilder
(
"heal",
this
)
. setPlayerOnly ( true )
. setPermission ( "command.heal" )
. setPermissionErrorMessage ( "§cYou are not allowed to do this!" )
. setExecutor (data -> ( (Player ) data. getSender ( ) ). setHealth ( 20 ) )
. build ( ) ;
. setPlayerOnly ( true )
. setPermission ( "command.heal" )
. setPermissionErrorMessage ( "§cYou are not allowed to do this!" )
. setExecutor (data -> ( (Player ) data. getSender ( ) ). setHealth ( 20 ) )
. build ( ) ;
Feel free to test it out! The source code is available over on GitHub. If you need help, join
our Discord server and create a ticket.
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft version listed: 1.8
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Drain is a free Minecraft Java mod. Compatible with Minecraft 1.8. Downloaded 232 times (via Spigot). Download it and open it directly in the game.