PluginHooker is a Bukkit plugin that aims to provide an ultimately simple and better method to hook Bukkit events and ProtocolLib PacketEvents
Discord
QQ群
- Hook events for every player.
- Bukkit events included.
- ProtocolLib events/packets included.
- Hook Netty pipeline(PacketEvents Supported)
- Spigot: 1.8.8/1.19.4
- Netty: 4.0/4.1
- ProtocolLib: 4.8/5.0
- PacketEvents: 1.0/2.0
Add the following repository to your pom.xml:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Then add the following dependency
<dependency>
<groupId>com.github.DionaMC</groupId>
<artifactId>PluginHooker</artifactId>
<version>1.3.1</version>
</dependency>
Add the following repository to your build.gradle:
maven {
url = uri('https://jitpack.io')
}
Then add the following dependency
compileOnly 'com.github.DionaMC:PluginHooker:1.3.1'
Add/remove plugins that need to be hooked
public void hookPlugin() {
PluginHooker.getPluginManager().addPlugin(pluginToHook);
}
public void unHookPlugin() {
PluginHooker.getPluginManager().removePlugin(pluginToHook);
}
Enable/disable the specified plugin for the player
public void enablePluginForPlayer(Player player) {
DionaPlayer dionaPlayer = PluginHooker.getPlayerManager().getDionaPlayer(player);
if (dionaPlayer == null) {
return;
}
dionaPlayer.enablePlugin(pluginToHook);
}
public void disablePluginForPlayer(Player player) {
DionaPlayer dionaPlayer = PluginHooker.getPlayerManager().getDionaPlayer(player);
if (dionaPlayer == null) {
return;
}
dionaPlayer.disablePlugin(pluginToHook);
}
To intercept or perform a custom action when an event is executed, add an event listener
public class ExampleListener implements Listener {
@EventHandler
public void onBukkitEvent(BukkitListenerEvent event) {
// do something
}
@EventHandler
public void onProtocolLibEvent(ProtocolLibPacketEvent event) {
// do something
}
}
- Poke for his help with event hook and event list.