[Tool] Compatre (Alpha - Looking for testers)
0.2.1-alphaA library that handles different nms versions for you - without writing any extra code
Compatre is a very small and fast tool to assist with version-dependent Bukkit programming. It makes "version-checkers" and multiple implementations for different versions redundant by replacing the required nms/craftbukkit types at runtime.
I.e. if you were to write a plugin that depends on anything from net.minecraft.server or org.bukkit.craftbukkit, you could simply mark the classes with an annotation and Compatre would replace the version if necessary when the plugin is loaded.
Here's an example of how compatre works: even though this is coded using nms version v1_12_R1 (1.12.2), it will run for any version if Compatre is used.
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.github.johnnyjayjay.compatre.NmsDependent; // the annotation
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; // <-- Version specific - usually wouldn't work on any other version
@NmsDependent // lets Compatre replace v1_12_R1 CraftPlayer with the correct CraftPlayer at runtime
public class VersionIndependentCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
CraftPlayer player = (CraftPlayer) sender;
// do something with it
}
return true;
}
}
This is still in early development, but it does work already. See my presents plugin for a production example.
Feel free to ask questions about details and give feedback in this resource's discussion.
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta