diff --git a/README.md b/README.md index 02de36b..2126fe4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,32 @@ # Clear on WorldGuard -This plugin will clear a player's items when they enter or leave one of the configured regions. This is mainly useful -if players are able to go in creative mode in specific WorldGuard regions. This plugin would prevent players from -leaving with all kinds of items. Note that this plugin won't necessarily be useful unless the region has proper +This plugin will clear a player's items when they enter or leave one of the configured regions. This is mainly useful +if players are able to go in creative mode in specific WorldGuard regions. This plugin would prevent players from +leaving with all kinds of items. Note that this plugin won't necessarily be useful unless the region has proper restrictions, like denying item dropping, and denying any sell commands within the region. ## Dependencies -- WorldGuard \ No newline at end of file +- WorldGuard + +## Configuration + +Add the identifier (name or UUID) of the world you want to specify a region for as a sub-key of clearRegions. Make sure +your world identifier is a string list "worldName: []", and add any regions you want to enable inventory clearing for to +the list of the world the region belongs to. + +Example config: + +```yaml +clearRegions: + world: + - "creative_building" + - "clear" +``` + +or + +```yaml +clearRegions: + world: [ "creative_building", "clear" ] +``` \ No newline at end of file diff --git a/src/main/java/net/knarcraft/clearonworldguard/ClearOnWorldGuard.java b/src/main/java/net/knarcraft/clearonworldguard/ClearOnWorldGuard.java index 27aad0e..c25c9a9 100644 --- a/src/main/java/net/knarcraft/clearonworldguard/ClearOnWorldGuard.java +++ b/src/main/java/net/knarcraft/clearonworldguard/ClearOnWorldGuard.java @@ -8,7 +8,7 @@ import java.util.logging.Logger; @SuppressWarnings("unused") public final class ClearOnWorldGuard extends JavaPlugin { - + private static ClearOnWorldGuard instance; @Override @@ -17,18 +17,18 @@ public final class ClearOnWorldGuard extends JavaPlugin { this.saveDefaultConfig(); this.reloadConfig(); FileConfiguration configuration = this.getConfig(); - + // Register the WorldGuard listener Bukkit.getPluginManager().registerEvents(new WorldGuardListener(configuration), this); } /** * Gets the logger used by this plugin - * + * * @return
The logger used by this plugin
*/ public static Logger logger() { return instance.getLogger(); } - + } diff --git a/src/main/java/net/knarcraft/clearonworldguard/WorldGuardListener.java b/src/main/java/net/knarcraft/clearonworldguard/WorldGuardListener.java index 7916fb8..6ba3d82 100644 --- a/src/main/java/net/knarcraft/clearonworldguard/WorldGuardListener.java +++ b/src/main/java/net/knarcraft/clearonworldguard/WorldGuardListener.java @@ -45,7 +45,7 @@ public class WorldGuardListener implements Listener { return; } SetThe world the player is currently in
+ * + * @param playerWorldThe world the player is currently in
* @param playerRegionsThe regions the player is in or will be in
* @returnAll clear regions found in playerRegions
*/ @@ -117,7 +117,7 @@ public class WorldGuardListener implements Listener { result.add(region); } } - + return result; } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 81419e9..cf39f17 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,6 +2,6 @@ clearRegions: # The name or UUID of a world. Add any regions that should force inventory clearing as a comma-separated list inside # the square parentheses. - world: [] - world_nether: [] - world_the_end: [] \ No newline at end of file + world: [ ] + world_nether: [ ] + world_the_end: [ ] \ No newline at end of file