Giter Site home page Giter Site logo

phoenix616 / hook Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 43 KB

Library to simplify hooking into other plugins.

Home Page: https://wiki.phoenix616.dev/library:hook:

License: GNU General Public License v3.0

Java 100.00%
bukkit spigot bungee minecraft library hook

hook's Introduction

Hook

Library to simplify hooking into other plugins.

Currently (directly) supports Bukkit, Bungee and Velocity, adding your own is easily possible though by simply implementing the AbstractHookManager.

How to use it

Depend on one of the adapters or implement the AbstrackHookManager for your platform. Then shade it in and (ideally) relocate it in your own package.

Now just create classes extending de.themoep.hook.core.Hook named after your plugin in the package you defined in the constructor of your HookManager. If you specified that each hook should have its own package then the manager will search for hook classes in packages named after the plugin.

Besides simple plugin names the manager will also search for hook classes matching the plugin's version. That way hooking into multiple versions of the same plugin becomes possible.

See the Javadocs for code specifications.

Examples

Example classes that are checked starting from the provided hookPackage root without specifying per-hook package mode and the default "Hook" suffix:

Plugin Version Checked class paths
Factions 1.6.9.5-U0.2.1-SNAPSHOT Factions1_6_9_U0_2_1_SNAPSHOTHook.class
Factions1_6_9_U0_2Hook.class
Factions1_6_9Hook.class
Factions1_6Hook.class
Factions1Hook.class
FactionsHook.class
Factions 2.12.0 FactionsHook2_12_0.class
FactionsHook2_12.class
FactionsHook2.class
FactionsHook.class
WorldGuard 6.1.1-SNAPSHOT WorldGuard6_1Hook.class
WorldGuard6Hook.class
WorldGuard 7.2.0-SNAPSHOT WorldGuard7_2Hook.class
WorldGuard7Hook.class
WorldGuardHook.class

It will basically replace all non-word characters (\W regex) with underscores to make legal path and package names. Of course the table does not list all possible combinations.

The same logic will be used in per-hook package mode. In that mode the package name will have the dynamic path including the version string (plugin name and version will be lowercase in the path). The actual class name should there be PluginNameHook.class (with the default "Hook" suffix).

E.g. for WorldGuard 7.2.0-SNAPSHOT a possible hook path would be your.hook.package.root.worldguard7_2.WorldGuardHook.class.

Maven information

Repository:

<repository>
    <id>hook-repo</id>
    <url>https://repo.minebench.de/</url>
</repository>

Bukkit adapter:

<dependency>
    <groupId>de.themoep.hook</groupId>
    <artifactId>hook-bukkit</artifactId>
    <version>1.0-SNAPSHOT<version>
    <scope>compile</scope>
</dependency>

Bungee adapter:

<dependency>
    <groupId>de.themoep.hook</groupId>
    <artifactId>hook-bungee</artifactId>
    <version>1.0-SNAPSHOT<version>
    <scope>compile</scope>
</dependency>

Velocity adapter:

<dependency>
    <groupId>de.themoep.hook</groupId>
    <artifactId>hook-velocity</artifactId>
    <version>1.0-SNAPSHOT<version>
    <scope>compile</scope>
</dependency>

Core for implementing AbstractHookManager:

<dependency>
    <groupId>de.themoep.hook</groupId>
    <artifactId>hook-core</artifactId>
    <version>1.0-SNAPSHOT<version>
    <scope>compile</scope>
</dependency>

License

hook - library to manage hooking into other plugins
Copyright (c) 2020 Max Lee aka Phoenix616 ([email protected])

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

hook's People

Contributors

phoenix616 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.