Thank you for considering contributing! This document outlines the project structure, patterns, and guidelines to help you submit clean, mergeable PRs.
The project has two Maven modules:
WG/ — WorldGuard / WorldEdit integration (flag declarations, session handlers)
Paper/ — Bukkit server module (config, listeners, plugin lifecycle)
- Flag declarations go in
WG/src/main/java/dev/tins/worldguardextraflagsplus/flags/Flags.java - Custom flag types go in
WG/src/main/java/dev/tins/worldguardextraflagsplus/flags/helpers/ - Session handlers go in
WG/src/main/java/dev/tins/worldguardextraflagsplus/wg/handlers/ - Bukkit event listeners go in
Paper/src/main/java/dev/tins/worldguardextraflagsplus/listeners/ - Config is managed via ConfigLib:
PluginConfig.java+Config.java - Plugin lifecycle (flag registration, listener registration) is in
WorldGuardExtraFlagsPlusPlugin.java
Follow this checklist in order:
Pick the correct type:
| Type | When to use | Example |
|---|---|---|
StateFlag |
On/off per region (allow / deny) | GODMODE, FLY, FROSTWALKER |
BooleanFlag |
True/false per region | KEEP_INVENTORY, DISABLE_COLLISION |
StringFlag |
Free-form text value | CHAT_PREFIX, CHAT_SUFFIX |
SetFlag<...> |
List of values per region | ALLOW_BLOCK_BREAK, DISABLE_COMPLETELY |
DoubleFlag |
Decimal number | WALK_SPEED, FLY_SPEED |
IntegerFlag |
Whole number | PLAYER_COUNT_LIMIT |
LocationFlag |
World coordinate | TELEPORT_ON_ENTRY, JOIN_LOCATION |
Example:
public final static StateFlag YOUR_FLAG = new StateFlag("your-flag", true);The second argument is the default state (true = allow / false = deny).
If your flag needs special validation or serialization, create a new class in flags/helpers/ extending the appropriate base type (e.g., BlockableItemFlag, ThrowableItemFlag, MaterialFlag).
In the AllFlagsControl inner class, add a new private boolean field with an optional @Comment:
@Comment({
"your-flag flag",
"Description of what it does.",
"Usage: /rg flag your-flag deny",
"Default: true"
})
private boolean yourFlag = true;In the isFlagEnabled() method:
case "your-flag": return flags.isYourFlag();The method name is automatically generated by Lombok's @Getter from the field name (converting camelCase to is-prefixed).
In WorldGuardExtraFlagsPlusPlugin.java, inside the try-block:
if (Config.isFlagEnabled("your-flag")) flagRegistry.register(Flags.YOUR_FLAG);If your flag requires per-player session tracking (e.g., fly, godmode, effects), create a handler in wg/handlers/ extending the appropriate base class and register it in onEnable():
if (Config.isFlagEnabled("your-flag"))
this.sessionManager.registerHandler(YourFlagHandler.FACTORY, null);If your flag responds to Bukkit events, create a listener class implementing Listener:
package dev.tins.worldguardextraflagsplus.listeners;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.flags.StateFlag.State;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.session.SessionManager;
import dev.tins.worldguardextraflagsplus.flags.Flags;
import dev.tins.worldguardextraflagsplus.wg.WorldGuardUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class YourFlagListener implements Listener
{
private final WorldGuardPlugin worldGuardPlugin;
private final RegionContainer regionContainer;
private final SessionManager sessionManager;
public YourFlagListener(WorldGuardPlugin worldGuardPlugin,
RegionContainer regionContainer,
SessionManager sessionManager)
{
this.worldGuardPlugin = worldGuardPlugin;
this.regionContainer = regionContainer;
this.sessionManager = sessionManager;
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEvent(EntityDamageEvent event)
{
if (!(event.getEntity() instanceof Player player))
return;
LocalPlayer localPlayer = this.worldGuardPlugin.wrapPlayer(player);
// Folia/Canvas + FAWE: never use localPlayer.getWorld() on the event thread (blocks via FAWE).
if (WorldGuardUtils.hasBypass(this.sessionManager, localPlayer, player))
return;
State state = this.regionContainer.createQuery().queryState(
BukkitAdapter.adapt(player.getLocation()),
localPlayer,
Flags.YOUR_FLAG);
if (state == State.DENY)
event.setCancelled(true);
}
}if (Config.isFlagEnabled("your-flag"))
{
this.getServer().getPluginManager().registerEvents(
new YourFlagListener(
this.worldGuardPlugin, this.regionContainer, this.sessionManager), this);
}Use the short class name — the wildcard import dev.tins.worldguardextraflagsplus.listeners.* is already at the top of the file.
Every flag must have a human-readable entry in Paper/src/main/java/dev/tins/worldguardextraflagsplus/api/FlagDescriptions.java.
Add a line in the static initialiser block:
ALL.put("your-flag", new FlagMeta(
"Short description of what the flag does.",
"Accepted value types (e.g. allow/deny, true/false, material names)",
"/rg flag <region> your-flag example-value"));This metadata is used by the plugin's own commands and by external GUI plugins (e.g. WG-GUI) to display flag tooltips.
This plugin supports Folia. Follow these rules:
- DO NOT use
Bukkit.getScheduler(),BukkitRunnable, or any deprecated Bukkit scheduling API - Use
WorldGuardUtils.getScheduler()for all scheduling needs - Entity-specific code must run on the entity's owning thread (safe inside Bukkit event handlers)
- Do not perform cross-world chunk loading or world operations outside proper scheduling
- Use
runNextTick()andrunAtLocation()from the FoliaLib scheduler
- Indentation: tabs (not spaces)
- Opening brace on the same line for class/method signatures, next line for control flow
@Overrideon separate line above method signature- No trailing whitespace
- Use
finalfields where possible in listener/handler classes
-
One commit per feature or fix. Squash your changes before opening the PR.
-
Target the correct branch:
master— stable features and fixes ready for releasedev-point— experimental or in-progress work
-
Commit messages: Write descriptive commit messages explaining the why:
feat: add lightning-damage region flag New StateFlag that allows lightning strikes to appear visually in a region while preventing damage to players. Useful for PvP arenas wanting the visual effect without environmental damage. Usage: /rg flag <region> lightning-damage deny -
No personal attributions, watermarks, or trademarks in new files. Clean code only.
-
Test that it compiles before submitting:
mvn clean package -DskipTests
-
If the PR touches multiple unrelated features, split into separate PRs.
- Version numbers — Do not bump
versioninpom.xml,plugin.yml, or README release lines. Maintainers set versions when cutting a release. - GitHub release text — Do not edit published release notes or maintainer-only drafts in
.local-docs/. Describe the change in the PR title and body instead. - README — Keep the in-repo README as a short overview; link to the tinsware Wiki for detailed flag docs unless a maintainer asks for a README update.
- Branding / startup art — Do not add or change plugin logo or console branding in feature PRs.
Maintainers may cherry-pick or re-implement accepted ideas on their own timeline and credit contributors in release notes.
mvn clean packageThe output jar will be in Paper/target/worldguard-extraflagsplus-{version}.jar.
| Dependency | Required | Notes |
|---|---|---|
| WorldGuard | Yes | |
| WorldEdit | Yes | |
| PacketEvents | No (optional) | Disable-completely spear Lunge protection |
| ProtocolLib | No (optional) | Fallback for PacketEvents |
- Open an issue on GitHub for bugs or feature requests
- Join our Discord for questions