Developers
DeadboltListener
Registering your plugin with Deadbolt to bridge functionality is a simple affair.
Simple extend DeadboltListener and override any of the methods as needed.
public class DeadboltListener implements ListenerInterface { @Override public void load(final Deadbolt plugin) { //This method is called when all dependencies have finished loading } @Override public List<String> getDependencies() { //This method is called when Deadbolt first loads the Listener. Just return a simple list of any required plugins return new ArrayList<String>(); } @Override public boolean canEntityInteract(Deadbolted db, EntityInteractEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canEntityExplode(Deadbolted db, EntityExplodeEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canEndermanPickup(Deadbolted db, EndermanPickupEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canRedstoneChange(Deadbolted db, BlockRedstoneEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canPistonExtend(Deadbolted db, BlockPistonExtendEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canPistonRetract(Deadbolted db, BlockPistonRetractEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canBlockBreak(Deadbolted db, BlockBreakEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canPlayerInteract(Deadbolted db, PlayerInteractEvent event) { return false; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canSignChange(Deadbolted db, SignChangeEvent event) { return true; //CHANGE TO OVERRIDE NORMAL ACTION } @Override public boolean canSignChangeQuick(Deadbolted db, PlayerInteractEvent event) { return true; //CHANGE TO OVERRIDE NORMAL ACTION } }
Your listener does not need to implement all of the above functions, only the ones as you require.
Deadbolt API
/** * Check if <player> or [Everyone] is on any of the [Private] or [More Users] signs associated with <block> * @param player Player to be checked * @param block Block to be checked * @return If <name> is authorized to use <block> */ public static boolean isAuthorized(Player player, Block block) {} /** * Check if <block> is protected by <name> or not * @param name Name to be checked * @param block Block to be checked * @return If <name> owns <block> */ public static boolean isOwner(Player player, Block block) {} /** * Retrieves all names authorized to interact with <block> * @param block Block to be checked * @return A List<String> containing everything on any [Private] or [More Users] signs associated with <block> */ public static List<String> getAllNames(Block block) {} /** * Retrieves owner of <block> * @param block Block to be checked * @return The text on the line below [Private] on the sign associated with <block>. null if unprotected */ public static String getOwnerName(Block block) {} /** * Check if <block> is protected or not * @param block The block to be checked * @return If <block> is owned */ public static boolean isProtected(Block block) {}
Source Code
Feel free to browse the source at GitHub