Repository navigation
API
Developer API modelled on CoreProtect API v13.
The API follows the structure and method names of the CoreProtect API v13 and lives in the package de.muffin.universalprotect.api.
Important: This is an independent implementation, not a binary drop-in. Plugins written against CoreProtect (package
net.coreprotect) do not work unchanged. Code that targets this API must import the classes fromde.muffin.universalprotect.api. Migrating usually means changing the imports and the way the API object is obtained.
UniversalProtectAPI api = Bukkit.getServicesManager().load(UniversalProtectAPI.class);
if (api == null || !api.isEnabled() || api.APIVersion() < 13) {
return;
}LookupOptions options = LookupOptions.builder()
.user("Steve")
.time(3600) // seconds
.radius(location, 20)
.includeMaterials(List.of(Material.DIAMOND_ORE))
.blockActions(List.of(LookupOptions.BlockAction.BREAK))
.limit(0, 50)
.build();
List<LogResult.BlockResult> results = api.blockLookup(options);| Method | Result |
|---|---|
blockLookup(options) |
BlockResult |
entityLookup(options) |
EntityResult |
containerLookup(options) |
ContainerResult |
itemLookup(options) |
ItemResult |
inventoryLookup(options) |
InventoryResult |
chatLookup(options), commandLookup(options)
|
MessageResult |
signLookup(options) |
SignResult |
sessionLookup(options) |
SessionResult |
usernameLookup(options) |
UsernameResult |
user, users, excludeUsers, time, location, radius, world, limit, includeMaterials, excludeMaterials, includeEntities, excludeEntities, blockActions, entityActions, containerActions, itemActions, inventoryActions, sessionActions, textStartsWithAny, textStartsWithNone.
| Method | Purpose |
|---|---|
logPlacement(user, ...) |
Log a block placement |
logRemoval(user, ...) |
Log a block removal |
logChat(player, message) |
Log a chat message |
logCommand(player, command) |
Log a command |
logContainerTransaction(user, location) |
Log the changes of an open container |
logInteraction(user, location) |
Log an interaction |
hasPlaced(...), hasRemoved(...)
|
Check whether a user placed or removed a block |
Fired asynchronously before an entry is saved. It can be cancelled.
@EventHandler
public void onPreLog(PreLogEvent event) {
if (event.getUser().equals("Notch")) {
event.setCancelled(true);
}
}Warning: The event runs on the database thread. Do not call Bukkit methods that require the main thread inside the handler.
The String[] based methods (blockLookup(Block, int), performLookup, performRollback, performRestore, performPurge, parseResult) are kept for older plugins.
Related pages: Networking · Migrating from CoreProtect
UniversalProtect · Minecraft 26.3 · Paper · Java 25 · API v13
Getting started
Using the plugin
- Commands
- Inspector
- Parameters and Tags
- Actions
- Lookup Examples
- Rollback and Restore
- Investigation and Alerts
- Purge
Administration
Developers
Help