Skip to content

External API Wrappers

darksoldier1404 edited this page Jan 28, 2026 · 1 revision

For a full list of wiki pages, see the Home page.

External API Wrappers

DPP-Core provides convenient wrapper classes for several popular Bukkit plugins. These wrappers simplify interaction by providing static methods that handle null checks and boilerplate code, ensuring that your plugin doesn't break if a dependency is missing.

DPP-Core automatically detects if these plugins are present on the server. You can check if a dependency was loaded using PluginUtil.isDependPluginLoaded(DependPlugin).

PlaceholderAPI

  • Utility Class: com.darksoldier1404.dppc.api.placeholder.PlaceholderUtils
  • Dependency Enum: DependPlugin.PlaceholderAPI

This wrapper allows you to safely apply placeholders to strings.

Methods

  • PlaceholderUtils.applyPlaceholder(Player p, String text): Parses all placeholders in the given text. If PlaceholderAPI is not present, it returns the original text unmodified.

PlaceholderBuilder

DPP-Core also includes a PlaceholderBuilder to easily register your own custom placeholders.

Example:

// In your onEnable method
new PlaceholderBuilder.Builder(this)
    .identifier('myplugin') // The identifier for your placeholders (e.g., %myplugin_level%)
    .author('YourName')
    .version('1.0')
    .onRequest((player, params) -> {
        if(player == null) return "";
        if(params.equalsIgnoreCase('level')){
            return String.valueOf(getPlayerLevel(player)); // Your logic to get player level
        }
        if(params.equalsIgnoreCase('balance')){
            return String.valueOf(getPlayerBalance(player)); // Your logic
        }
        return null; // Let PlaceholderAPI handle it or return an empty string
    })
    .build();

Essentials

  • Utility Class: com.darksoldier1404.dppc.api.essentials.MoneyAPI
  • Dependency Enum: DependPlugin.Essentials

Provides a simple interface for interacting with the Essentials economy system.

Methods

  • MoneyAPI.hasEnoughMoney(Player p, double amount): Checks if a player has a certain amount of money.
  • MoneyAPI.getMoney(Player p): Returns the player's balance as a BigDecimal.
  • MoneyAPI.addMoney(Player p, double amount): Gives money to a player.
  • MoneyAPI.takeMoney(Player p, double amount): Takes money from a player.

LuckPerms

  • Utility Classes:
    • com.darksoldier1404.dppc.api.luckperms.PermissionAPI
    • com.darksoldier1404.dppc.api.luckperms.LuckpermAPI
  • Dependency Enum: DependPlugin.LuckPerms

These classes provide helpers for managing player permissions, prefixes, and suffixes.

PermissionAPI Methods

  • PermissionAPI.addPermission(UUID uuid, String permission): Adds a permission node to a user.
  • PermissionAPI.delPermission(UUID uuid, String permission): Removes a permission node from a user.
  • PermissionAPI.isPlayerInGroup(Player player, String group): Checks if a player is in a specific group.

LuckpermAPI Methods

  • LuckpermAPI.setPrefix(OfflinePlayer p, String prefix, int priority): Sets a player's prefix.
  • LuckpermAPI.setSuffix(OfflinePlayer p, String suffix, int priority): Sets a player's suffix.
  • LuckpermAPI.delPrefix(...) / delSuffix(...): Removes prefixes or suffixes.

WorldGuard

  • Utility Class: com.darksoldier1404.dppc.api.worldguard.WorldGuardAPI
  • Dependency Enum: DependPlugin.WorldGuard

A comprehensive wrapper for the WorldGuard API.

Methods

  • WorldGuardAPI.isPlayerInRegion(Player player, String regionName): Checks if a player is currently inside a region with the specified name.
  • WorldGuardAPI.getPlayersInRegion(World world, String regionName): Returns a list of all players inside a specific region.
  • WorldGuardAPI.isRegion(World world, String regionName): Checks if a region with the given name exists in a world.
  • WorldGuardAPI.isPlayerRegionOwner(...) / isPlayerRegionMember(...): Checks a player's role within a region.

Clone this wiki locally