Custom Flags
1. Creating a Custom Flag
public class CustomFlag extends Flag {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
// Check if the block's location belongs to a claimed land
getLand(event.getBlock().getLocation()).ifPresent(land -> {
// If the flag is enabled, notify the player
if (hasEnabled(land)) {
event.getPlayer().sendMessage("Breaking " + event.getBlock().getType().name());
}
});
}
@Override
public String getFlagName() {
// Define a unique name for your custom flag
return "EXAMPLE_CUSTOM_FLAG";
}
}2. Registering a Custom Flag
Last updated