Skip to content

Instantly share code, notes, and snippets.

@Geolykt
Created May 15, 2021 14:24
Show Gist options
  • Save Geolykt/44886cfe0f0c6e15559fc4e6d30e6149 to your computer and use it in GitHub Desktop.
Save Geolykt/44886cfe0f0c6e15559fc4e6d30e6149 to your computer and use it in GitHub Desktop.
public class DIJavaPlugin extends JavaPlugin {
public void onEnable() {
getServer().getPluginManager().registerEvents(new Child(this), this);
}
} class Child implements Listener {
private final JavaPlugin parentPlugin;
public Child(JavaPlugin pl) {
parentPlugin = pl;
}
public void onEvent(Event e) {
Bukkit.getServer().getScheduler().runTaskLater(parentPlugin, () -> {
// Your code
}, delayInTicks);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment