Compare commits

...
Author SHA1 Message Date
Wyatt Childers c95f52a303 Allow set flags to be manipulate via keywords
This adds support for updating an existing region, so that
if you have a long list of items in a set flag, such as
`deny-spawn` you can add or remove items, rather than overwrite.

Example:
```
/rg flag test deny-spawn add creeper
/rg flag test deny-spawn remove zombie
```
2020-01-14 22:56:04 -05:00
wizjany b835ee39d5 Check water/lava placement from dispensers on edge of region.
Fixes WORLDGUARD-4161.
2020-01-03 23:11:56 -05:00
Pieter12345 4a7552e6be Prevent pushing pistons across region borders
Pistons are classified as not pushable regardless of their state, causing WorldGuard to not protect against them moving. This commit fixes that.
2020-01-01 13:53:09 -05:00
Joo200 c6c0fc9d74 Fixed failed checkstyle gradle task 2020-01-01 13:53:01 -05:00
wizjany f43a4eaad8 Add spawn-protection overlap check when defining regions.
Update cached username on login.
Bump WorldEdit dep version.
2019-12-19 15:42:34 -05:00
JOO200 abfa5cb6a5 bee nests can be modified by right click (like beehives) 2019-12-16 14:08:04 -05:00
JOO200 05f7d68705 Use Paper-API 1.15 as Dependency 2019-12-16 14:08:04 -05:00
wizjany 9adac4f239 Initial 1.15 stuff.
Materials is not really cross-version compatible. Really could do with
some rewriting at some point.
2019-12-10 23:48:50 -05:00
wizjany c5355adb4b Back to snapshot. 2019-11-22 23:51:25 -05:00
wizjany fb37342b3c Release 7.0.1. 2019-11-22 23:43:05 -05:00
wizjany 1fd94a3655 Switch blacklist to drilldown since bstats doesn't support bar charts.
See https://github.com/Bastian/bStats/issues/67

Also update blacklist example txt with correct names.
2019-11-17 18:13:45 -05:00
wizjany c413cf4123 Remove pointless iterable. 2019-11-17 18:13:45 -05:00
wizjany 87162acf11 Switch blacklist stat to entry counts. 2019-11-17 18:13:45 -05:00
wizjany 2c14acc28c Add some custom charts to bStats.
Should give a good view of feature usage, especially some badly
supported features like SQL and chest protection.
2019-11-17 18:13:45 -05:00
wizjany 26477406f1 Fix pistons flag not applying to sticky pistons pulling. 2019-10-11 22:12:03 -04:00
wizjany 121b34ecb9 Add applicable regions section to /wg report. 2019-10-06 13:09:08 -04:00
wizjany 3ebaaf9c8b Add /rg toggle-bypass command to turn off region bypass temporarily.
Makes it easier to test things without op/de-op, switching ranks, etc
all the time.
2019-10-06 12:17:07 -04:00
wizjany 4c9812db04 Fix exit-deny-message using wrong region set on enderpearl/chorus-fruit. 2019-10-06 12:17:07 -04:00
wizjany e792dd6f98 Workaround colors on newlines of string flags issue in text lib.
Also fix newline lookbehind replacement, and only replace color macros
in string flags.
2019-10-06 12:17:07 -04:00
wizjany d410e1f84e Re-arrange messages in (re)define commands.
Only send messages after successful add.
2019-10-06 12:17:07 -04:00
wizjany d07f95952d Causes only track blocks, not locations. 2019-09-26 20:24:11 -04:00
wizjany cb9ab3a7b2 Check creeper-explosion flag for all entity damage, not just players. 2019-09-26 10:38:02 -04:00
wizjany 1c3cf02ebd BlockMultiPlace has an immutable state list.
Fixes WORLDGUARD-4143.
2019-09-22 15:16:57 -04:00
wizjany fc0f7acab5 Fix infinite loop in addowner checks.
Fixes WORLDGUARD-4138.
2019-09-22 14:28:38 -04:00
wizjany 20db92541b Make use of BlockFertilizeEvent, various BlockState lists.
Only mostly tested to work. BlockFertilize unfortunately doesn't let
us cancel the preceding stuff like StructureGrow and item use.

Also workaround Bukkit sending 2 events for trampling.
2019-09-18 15:43:36 -04:00
wizjany 5fca3b3c3d Track causes when players ignite creepers.
Fixes WORLDGUARD-4136.
2019-09-13 17:34:37 -04:00
wizjany c633a2d070 Cover some more plants as crop-growth.
Note that spigot doesn't throw events for bamboo yet, so this only
applies to sugar canes and cacti at the moment. Should work if spigot
implements BlockGrowEvent for cacti though.

Fixes WORLDGUARD-4137.
2019-09-13 17:20:51 -04:00
wizjany effbd62e68 Ignore hopper minecarts with the ignore hopper setting. 2019-09-13 16:43:27 -04:00
wizjany 056eaa6587 Teleport async on Paper. 2019-09-13 16:42:35 -04:00
wizjany cb2c0870ec List is not a valid cause. Each element is its own cause.
Fixes WORLDGUARD-4140.

Specifically, fixes not being able to break lilypads while in a boat,
even through the player would normally be able to.

Note that slowdown is client-side and getting stuck is due to Spigot
not updating the client when the break is cancelled, which are unrelated
to this issue (and not fixable by us).
2019-09-13 16:32:28 -04:00
wizjany 179c324c80 Apparently world names are allowed to have spaces. 2019-08-18 23:43:57 -04:00
wizjany 96d15d6dbf Only store existing per-player time/weather in handlers.
Fixes WORLDGUARD-4124.

This will fix various issues with logging in to regions with these flags
set and then moving out of them, or when moving between two adjacent
regions with the flags set and then moving out.
2019-08-18 12:00:50 -04:00
wizjany 120d2e223d Extract/half-fix addowner checks.
Max-region-count-for-player is super bork.

Fixes WORLDGUARD-4129.
2019-08-18 10:39:56 -04:00
wizjany 70ea6bad6e Some cleanup for flag command. 2019-08-18 10:38:07 -04:00
wizjany e59d61e1cf Extract NumberFlag for suggestions, make FlagHelper prettier in console. 2019-08-06 23:08:10 -04:00
wizjany bbed280f62 Update docs links to point to enginehub.
Also don't allow block-place/block-break setting from flag helper.
2019-08-06 21:50:05 -04:00
wizjany f165ae3d95 Back to snapshot. 2019-08-06 00:12:41 -04:00
wizjany 124898ec91 7.0.1 RC 2. 2019-08-06 00:12:26 -04:00
wizjany ba32d24363 Merge pull request #414 from EngineHub/feature/paper
Add some Paper-specific features
2019-08-05 23:49:04 -04:00
wizjany 0bba822295 Link ender crystal entity <-> material. 2019-08-03 18:10:54 -04:00
wizjany 7538af2686 TippedArrow again. 2019-08-02 16:34:26 -04:00
wizjany 48922118b1 Fix fireworks, protect by default (this is a behavioral change).
Add regions.use-paper-entity-origin setting, false by default because
it can have some weird implications.
2019-08-01 23:47:27 -04:00
wizjany 14fe2d0e79 Use Paper player profiles if available.
Also fall back to caching to memory if SQLite can't be linked.
This is a common issue with (bad) server hosts who mount /tmp as noexec,
which causes sqlite's native binaries to fail to link.
2019-08-01 20:24:34 -04:00
wizjany 11a1ac6742 User paper firework tracking. 2019-08-01 20:24:33 -04:00
wizjany c5bfdcb0e6 Use PaperLib for some performance enhancements. 2019-08-01 20:24:32 -04:00
wizjany 93dae282b2 Apparently some plugins do weird things with falling blocks. 2019-08-01 20:12:58 -04:00
wizjany 3468e3d47e Handful of small fixes.
* Fix material loading from config requiring minecraft: namespace.
* Fix disallowed-lightning blocks. Lightning entities are weird.
* Fix /wg reload overwriting config changes.
* General around thread usage/naming/shutdown. If anyone was actually
  making their own managers/indices you deserve to break.
2019-07-31 22:53:20 -04:00
wizjany b7ad0257b7 Remove legacy potion code. 2019-07-30 18:44:24 -04:00
wizjany 070f6e005f Merge pull request #415 from EngineHub/kotlin-dsl
Migrate gradle to kotlin dsl.
2019-07-30 16:56:46 -04:00
wizjany cc3f4d4d44 Relocate squirrelid in source, fix flyway shading. 2019-07-30 09:44:19 -04:00
wizjany 21e65be110 Fix poms, remove bukkit lib project since it's currently unused. 2019-07-29 23:41:38 -04:00
wizjany 61494fd76e Migrate gradle to kotlin dsl. 2019-07-29 23:25:13 -04:00
wizjany 556b638d04 Switch build badge to TC.
And remove dead wiki links.
2019-07-29 11:34:18 -04:00
wizjany 825b3a3f36 Save defaults to config file. 2019-07-27 22:40:03 -04:00
wizjany afe042ef4d Add option for resetting fall distance when void falling teleport is on.
reset-fall-on-void-teleport, defaults to false. (I can't remember if
old WG 6 behavior was to do this or not...?)
2019-07-27 21:57:49 -04:00
wizjany 4044e2b122 Ender crystal explosions can't be cause tracked. 2019-07-26 22:51:19 -04:00
wizjany aa4137822f Fix sleep flag. 2019-07-24 14:35:42 -04:00
wizjany f37acd3de6 Whitelist player->player interacts.
As noted before, any more specific events should still be blocked (such
as potion use).
2019-07-23 20:13:12 -04:00
wizjany b0e4cf148b ItemElytra extends ItemArmor... 2019-07-19 20:45:16 -04:00
wizjany 248ffd0ba8 Maybe fix travis. 2019-07-18 14:54:13 -04:00
wizjany 3272759f25 Check waterlogged blocks when emptying buckets.
Fixes WORLDGUARD-4119.
2019-07-17 07:45:31 -04:00
wizjany 456a16591b Handle UseEntity player->player events as PvP.
Fixes WORLDGUARD-4118.
Tell me if this breaks other intended behaviors somehow.
2019-07-16 18:48:57 -04:00
wizjany 79f6635b8a Make /wg profile text more clear.
This patch dedicated to @phoenix616.
2019-07-16 18:42:48 -04:00
wizjany 1f362bef59 Minecarts spawn in the clicked (rail) block. 2019-07-09 07:47:54 -04:00
wizjany 63209d1174 Null-check for last commit. 2019-07-07 01:22:04 -04:00
wizjany f546700189 Allow interact-whitelist for entities with matching item types. 2019-07-06 11:02:36 -04:00
wizjany 35e0db36d3 Workaround for sign dying issue.
Signs still get dyed even if you deny using dye.
2019-07-03 09:53:11 -04:00
wizjany ab7751e046 Unfix WORLDGUARD-3360.
There's a reason this wasn't done before. This is fundamentally broken.
2019-07-02 23:08:50 -04:00
wizjany a9cd23c6ef Don't replace in comments and strings when you refactor... 2019-07-02 17:39:21 -04:00
wizjany 8ca01b37a4 Add config to disable villagers getting zapped to witches.
"weather.disable-villager-witchification"
2019-06-30 19:58:10 -04:00
wizjany aa8997aeca Add TP button to /rg list where applicable. 2019-06-30 11:37:50 -04:00
wizjany b757fcc88b Send CUI changes when using /rg select. 2019-06-27 08:06:09 -04:00
wizjany 7593e1a01c Initial update to 1.14. 2019-06-25 22:12:18 -04:00
wizjany af3eb85962 Add on-equip blacklist event.
Note that due to deficiencies in the Bukkit API, the event will attempt
to be overprotective and cancel some events that may not actually result
in the player equipping an item. Maintainable PRs welcome. (i.e. would
rather not have to have a list of slot numbers for various inventories
and match them to items :upside_down:)
2019-06-25 22:11:33 -04:00
wizjany aabb0b2345 Treat damaged anvils like regular anvils. 2019-06-24 12:16:19 -04:00
wizjany 6d25513739 Don't allow setting build + passthrough in the flag helper.
It masks the warning message and too many people mess this up.
2019-06-22 14:15:21 -04:00
wizjany 96b61743b9 Fix lava fire being off by default.
No clue how this was never brought up before.

Also add system property to disable the ClassSourceValidator.
2019-06-19 23:50:18 -04:00
wizjany ff7209a58b Only check ride flag for pigs with saddles. 2019-06-19 23:22:21 -04:00
wizjany fe4f0cfc49 Bump dependencies.
Also remove intake. Unsure when that was ever used.
2019-06-13 09:17:20 -04:00
wizjany 9cf1e02506 Bump to 7.0.1-SNAPSHOT 2019-06-11 22:43:26 -04:00
wizjany b0f8852198 Bump to 7.0.0. Rename -legacy to -bukkit. 2019-06-11 22:32:04 -04:00
wizjany cce9c39e01 Changelog for 7.0.0. 2019-06-11 22:32:03 -04:00
wizjany 11c95861f9 More compat for 1.14. 2019-06-11 20:16:16 -04:00
KisaragiEffective 75bb0adbe6 Update README.md
fix syntax
2019-06-08 19:22:30 -04:00
Wyatt Childers 32ec74aed7 Fixed execute bit on gradlew 2019-06-08 15:54:50 -04:00
wizjany b152cdc4ec Tweak some event handling.
Fixes WORLDGUARD-4097, WORLDGUARD-3360.
2019-06-06 19:23:46 -04:00
Matthew Miller d019e43a81 Back to SNAPSHOT for continued development 2019-06-05 22:09:42 +10:00
Matthew Miller 8c778ed861 Update to RC2 2019-06-05 22:02:51 +10:00
wizjany 1b842204e9 Update readme links. 2019-06-04 18:31:19 -04:00
wizjany 8aa4c25186 Seeds don't modify blocks.
They already throw place events.
2019-06-04 17:20:42 -04:00
wizjany 026361ae0b Exclude some transitive deps. 2019-06-04 00:00:12 -04:00
wizjany 426a709e43 Fire off block place for items that modify blocks. 2019-06-02 19:33:42 -04:00
wizjany 903a831248 Fix dispenser workaround. 2019-06-02 12:12:57 -04:00
wizjany 1792bcb18a Fail (slightly) faster. 2019-05-31 14:08:45 -04:00
wizjany 23ab79c999 Wrap and unwrap.
Exceptions are fun.
2019-05-29 21:38:31 -04:00
wizjany a29afe8cc1 Also apply crop-growth to fully grown stems creating "fruit". 2019-05-27 20:51:28 -04:00
wizjany 029f867a41 Add crop-growth flag/config option.
Fixes WORLDGUARD-4088.
2019-05-27 20:42:17 -04:00
wizjany ce35798f67 Fix issues with sometimes-loaded worlds in location flags. 2019-05-26 02:19:33 -04:00
wizjany 0f989fc1b4 Small config cleanup. 2019-05-25 09:59:52 -04:00
wizjany 4871752f49 Switch to useInteractedBlock/useItemInHand for PlayerInteractEvent.
Bukkit has very odd behavior regarding cancelling this event.

Fixes WORLDGUARD-4090.
2019-05-22 18:21:37 -04:00
wizjany c4b31cf085 Allow newlines in blacklist messages with \n.
Fixes WORLDGUARD-4089.
2019-05-22 08:16:16 -04:00
wizjany 6e30f98322 Fix unknown group flag unmarshalling.
i.e. don't.
2019-05-21 19:44:53 -04:00
wizjany 4b320ab733 Workaround CraftBukkit bug causing BlockSpreadEvent to report air. 2019-05-21 19:42:56 -04:00
wizjany f516999087 Fix error when group flag existed for non-existent flag.
Probably caused by bad API usage /shrug.
2019-05-21 16:31:42 -04:00
wizjany 2b854f0d72 Use isTagged instead of getValues.
The implementation of getValues is quite atrocious for this purpose.
2019-05-20 23:56:37 -04:00
wizjany 36d25c08c6 Specify materials explicitly. 2019-05-17 23:52:21 -04:00
wizjany 3e899a70c4 Fix /rg claim. 2019-05-15 19:24:23 -04:00
wizjany d6c2504bbf Make CPU profiling interval configurable.
Also lower the default to something more sensible.

Also cleanup unused imports.
2019-05-14 19:01:47 -04:00
wizjany f2d2f47394 Don't fail hard in 1.14. (#409)
Prevent lots of console spam and lack of protection.
2019-05-14 12:33:56 -04:00
Matthew Miller aefebf32c2 Back to SNAPSHOT for continued development 2019-05-14 20:34:56 +10:00
Matthew Miller 7102f6204c WorldGuard 7.0.0 Release Candidate 1 2019-05-14 20:23:05 +10:00
wizjany d542ba78ff Remove AsyncCommandHelper for new AsyncCommandBuilder.
Helper suffers from race conditions for short-lived tasks, leading to
some poor UX conditions such as errors not propagating to the user
(because the exception handler wasn't attached to the future yet), or
lack of success messages.

This commit replaces that system by a Builder which takes a callable to
begin, and then takes supervisor, delay message, and the success and
failure messages and handlers as parts of the builder. The success and
failure handlers wrap the callable itself before submitting to the
executor so they will always be run. The supervisor and delay are added
as listeners to the future since they aren't required if the task is
sufficiently short-lived (and to maintain compatibility with the classes
which are now in WorldEdit).

The builder also supports Components for success and failure messages,
as well as consumers of the callable's result or exception for better
customization of output, instead of having to rely on adding a callback
to the future.

The future is still returned for certain special usages.
2019-05-12 14:40:09 -04:00
wizjany e7ef6af012 Handle BlockExplodeEvent as other explosion.
Also misc cleanup.
Closes #407, WORLDGUARD-3843.
2019-05-12 00:17:34 -04:00
isokissa3 1ffa4b48b8 Enderpearl & chorus-teleport flags should be checked before handlers
Before every handler would have been called, making them believe that the entry was successful
2019-05-11 14:36:15 -04:00
wizjany d4c49a7539 Clean up task monitoring, cancelling, exception handling etc.
Fixes a few issues such as /wg stopprofile leaving a pseudo-cancelled
task in the supervisor, delaying server shutdowns until profiles finish,
not forwarding exceptions that occur during tasks running correctly, etc.
2019-05-11 14:23:45 -04:00
wizjany 2e2be7092d Ensure un-marshalled registry flags are always lowercase.
Possibly old region files still had uppercase entries?

Fixes WORLDGUARD-3949 regression.
2019-05-11 11:30:46 -04:00
wizjany ec4c53da77 Minor cleanup. 2019-05-11 11:30:45 -04:00
Pietje 024a51549d Fix gitignore (#406)
Using Github Desktop on Windows, file paths with a leading slash do not seem to match anything. This commit changes the gitignore entries to a more widely supported format.
2019-05-09 22:41:36 +10:00
Matthew Miller 8c345cb64b Updated for Text3 2019-05-06 16:49:33 +10:00
wizjany 461f3e1faf Merge pull request #404 from TheMolkaPL/stoplag-fix
Fix activityHaltToggle in /stoplag
2019-05-05 17:10:37 -04:00
wizjany 6fd7190ff2 Ensure session handler order. 2019-05-05 16:55:27 -04:00
wizjany 5180673878 Treat inventory minecarts under chest-access.
Fixes WORLDGUARD-3585.
2019-05-05 16:14:35 -04:00
wizjany c57dd20f24 Brace. 2019-05-05 15:48:42 -04:00
TheMolkaPL 71df9c0011 Fix activityHaltToggle in /stoplag 2019-05-05 16:25:21 +02:00
wizjany b27f18788c Wrap /rg flags in a task. 2019-05-05 00:02:24 -04:00
wizjany 18365bbe42 Formatting fixes. 2019-05-04 23:21:19 -04:00
wizjany 82451595cb Add greeting-title and farewell-title flags.
Totally didn't accidentally include the flags in last commit.
Closes WORLDGUARD-4008.
2019-05-04 22:56:55 -04:00
wizjany c516eb2174 Add frosted-ice-melt flag, and frosted-ice-form flag.
Frosted-ice-form is checked with build, meaning it can be set to allow
for non-members to use frost walker, deny for members to not be able to
use frost walker, or none to respect membership.

Reverts behavior of ice-melt flag to pre-7.x behavior.
Apparently this wasn't covered before.

Fixes WORLDGUARD-4077.
Closes #364.
2019-05-04 20:52:28 -04:00
wizjany 7199b8e70f Add /rg flags command.
Provides an overview of all flags set on a region, including inherited
values, and allows the user to set or unset flags with a single click.
2019-05-04 20:52:13 -04:00
wizjany fc4c67ff29 Merge pull request #403 from EngineHub/feature/we-piston-commands-compat
WE Piston Compat
2019-05-01 00:34:50 -04:00
wizjany d9bb321f83 Add more fancy texts and pagination.
Also some general cleanup.
2019-04-30 19:53:19 -04:00
Kenzie Togami 7692e30721 Switch to new Exception stuff from WE 2019-04-30 15:24:15 -07:00
Kenzie Togami 5f88bef5ac Correct print(TextComponent) method 2019-04-30 13:34:45 -07:00
wizjany 5b0bfd50d3 Fix build. 2019-04-28 21:06:12 -04:00
wizjany 5c0be800ae Brace. 2019-04-28 20:43:01 -04:00
TheMolkaPL ac505f0064 Warn about consequences and add /stoplag confirm 2019-04-28 20:41:20 -04:00
wizjany 2aee42cbf2 Clean up gradle dependencies. Tell me if this breaks downstream builds.
Either I broke something, or you were using WG's jar for some dep that we
don't consider to be API.
2019-04-28 20:36:28 -04:00
wizjany 5c8b6d3f95 Lots of fancy texts. 2019-04-28 20:21:38 -04:00
wizjany eab7b5c47f Remove artifactory resolve block 2019-04-27 16:43:32 -04:00
wizjany 36eba9c9dd That's not supposed to be there. 2019-04-26 15:07:36 -04:00
wizjany 3b8b67da84 Add logo to source, remove outdated notes. 2019-04-26 15:06:47 -04:00
wizjany d9b09ab7f1 Damage is already handled and entering is handled via interact.
This method is redundant.
2019-04-25 11:13:30 -04:00
Matthew Miller 50e62bd0e7 Update text for WorldEdit changes (#401)
* Update for text in WE

* Properly write the legacy converter

* Made the text less thicc

* Update for new text API in WE
2019-04-25 19:40:01 +10:00
Matthew Miller abfe3a2eb9 Fixed chipped and damaged anvils not being protected from use/interact 2019-04-23 12:36:20 +10:00
wizjany e94af1d77e Treat kelp as vines for vine-growth.
Closes WORLDGUARD-4068.
2019-04-19 23:25:26 -04:00
wizjany 1dbd25d15e Add block-trampling flag.
Applies to turtle eggs and farmland.

Closes WORLDGUARD-4067, WORLDGUARD-3666.

Also do some misc cleanup.
2019-04-19 23:14:14 -04:00
wizjany c3675a10a2 Force eject players from vehicles if the get too far.
Fixes WORLDGUARD-3936.
2019-04-17 21:24:10 -04:00
wizjany ef2783f30a Add snowman-trails flag.
Closes WORLDGUARD-3566, #378.

Also clean up some listeners, and the flag listing.
2019-04-17 21:23:29 -04:00
wizjany 2c2b475513 Track AreaEffectCloud cause.
Also a bit of cleanup in EventAbstractionListener.

Fixes WORLDGUARD-3776.
2019-04-17 20:16:38 -04:00
wizjany 0ebb4e0ffa Formatting fix. 2019-04-14 11:34:54 -04:00
KisaragiEffective 47fb9bd30d Remove redudant type parameters. 2019-04-08 22:04:02 +09:00
KisaragiEffective 5ffade9787 Update CONTRIBUTING.md (#399)
fix broken link to Oracle Conventions
2019-04-07 23:12:13 +10:00
wizjany ca92464cca Revert "Load before worlds do."
This reverts commit 397a71a602.

Apparently this doesn't actually fix the issue. Some things
just straight up happen without sending events to plugins and there's
nothing we can do about it.
2019-04-06 17:33:56 -04:00
wizjany 453740b56a Don't whitelist droppers and hoppers.
By the time this code is called, the performance hit happened already.
There's a separate way to whitelist these that still allows keeping
the protections active.
2019-04-06 14:27:55 -04:00
wizjany 397a71a602 Load before worlds do.
When worlds first load, events start happening before plugins normally
(POSTWORLD) enable. This means that regions and other protections won't
be active when these events are called.

This shouldn't break anything that depends on us, e.g. custom flags,
since our API contract already states that should be done on load,
and all plugins are loaded on startup (just not enabled).
2019-04-05 22:03:29 -04:00
wizjany 44c4e5816f Move log message about loading regions to proper location. 2019-04-02 17:18:44 -04:00
wizjany 41268ca443 Don't break completely if regions fail to load. 2019-04-02 17:13:24 -04:00
Matthew Miller c7ed49388c Make 'invincibility-removes-mobs' affect projectile shooting entities. 2019-03-31 21:14:29 +10:00
wizjany 874e429779 Make input more lenient. Allow specifying TZ other than UTC.
Also remove 'none' and cleanup LocationFlag.
2019-03-30 20:07:35 -04:00
JOO200 9c5eee90da Changed to java 8 time api 2019-03-30 18:41:42 -04:00
JOO200 4f088e5bf0 Added TimestampFlag 2019-03-30 18:41:42 -04:00
wizjany c2f96c9587 Checkstyle pls.
That was the auto-folder's fault.
2019-03-30 18:39:55 -04:00
wizjany c181a86fd1 Better wrapped player usage. Requires latest WorldEdit build. 2019-03-30 18:09:27 -04:00
wizjany e2ffab5ee8 Cleanup last commit. 2019-03-28 23:07:48 -04:00
wizjany 8a3f066023 Turtle eggs throw PIE when being broken. 2019-03-28 23:02:28 -04:00
wizjany c53ed56b3a Check flag change handlers when world changes.
Global regions aren't actually part of the ApplicableRegionSet,
so the set difference will be empty even if the global region has changed.
2019-03-23 12:29:12 -04:00
wizjany 6144ca82ac Fix removing regions from manager with the REMOVE_CHILDREN strategy. (#397)
* Added test for removing regions from manager.

* Fix removing regions with REMOVE_CHILDREN strategy.
2019-03-22 14:20:32 -04:00
wizjany d091cb578f Don't check spaces that won't get moved into by pistons.
Fixes WORLDGUARD-4064.
2019-03-20 21:50:00 -04:00
wizjany b2fe4c9c71 Move tests to core.
(None of them are implementation-specific)
2019-03-20 17:50:12 -04:00
wizjany ea47e93323 Really remove deprecated flags. 2019-03-14 18:10:56 -04:00
wizjany 10100bd194 Remove deprecated flags. Make sure we register our flags first.
Also make enderpearl + chorus fruit flags respect entry/exit deny message flags.
2019-03-14 18:07:41 -04:00
wizjany 91687dc204 Only check for flag changes when regions change.
This functionally reverts e5b76a5, though individual classes can change
this behavior on an individual basis by overriding the method.

Also, make time-lock and weather-lock restore only initial values,
which should be more intuitive behavior when multiple regions overlap
with different flag values.
2019-03-12 18:45:08 -04:00
wizjany e091a59063 Remove ender-chest protection.
Enderchests are not modified on use. In fact, they don't even
have inventories, so they are not modified at all. To deny usage,
the interact flag must be denied, since they most closely fit in
a category with other interact-covered blocks (and not use-covered
blocks, since using them does not change the region in any way).

This commit reverts f7d36b and ea4f4c0.
2019-03-10 19:09:36 -04:00
wizjany ee7dc27283 Actually report game rule values.
Was just "<Recursive>" before, which is pretty useless.
2019-03-07 17:44:20 -05:00
wizjany 54c3cdad77 Bukkit does this apparently. 2019-03-06 19:43:59 -05:00
wizjany ff37cc7935 Add item-frame-rotation flag.
When set to allow, allows players to rotate item in item frames even if
they wouldn't normally have permissions to modify the item frame.

Fixes WORLDGUARD-3588.
2019-03-06 19:05:36 -05:00
wizjany b6e2bca5bc Make chat + command flag handing more sane.
* Send/receive chat and allowed/blocked cmd flags now respect deny-message flag.
* Added `regions.cancel-chat-without-recipients` option to disable the default behavior.
2019-03-04 18:53:26 -05:00
Nonsence 1f85a53117 Update README.md: Fix broken markup (#396) 2019-03-04 08:21:26 -05:00
wizjany bd4726f887 Update links in readme. 2019-03-02 15:46:22 -05:00
wizjany 9ea2312751 Apparently some people see red flag and think those are broken.
This has unfortunately happened more than 2 times.
2019-03-02 13:14:01 -05:00
wizjany cc988c0b5a Minor typo. 2019-03-02 12:43:58 -05:00
wizjany af93530dbe Fix region equality across multiple region managers. (#395)
It is possible, for example when teleporting between two worlds, that
regions in two different managers are compared. If the regions in each
world have the same name, they would return equal. Removing the equals
override will prevent two different regions from seeming equal even if
they are not.
2019-03-01 21:42:07 -05:00
wizjany 43d8cf8cba Bye Java 6. 2019-02-26 12:14:38 -05:00
wizjany 090a00d6d8 Fire UseItemEvent when fishing rod is cast.
This apparently no longer throws an interact.

Fixes WORLDGUARD-4018.
2019-02-25 23:47:24 -05:00
wizjany a233be1df8 Sponge simulation now also clears waterlogged blocks.
Fixes WORLDGUARD-4011.
2019-02-15 16:00:30 -05:00
wizjany f9339e144e CSV support was removed 8 years ago.
Even the migrator is long gone.

056f8a57c7
2019-02-13 23:30:40 -05:00
wizjany 1f1e6eedf6 Cleanup session loading.
Apparently the spigot server stores time-lock between logout and login,
but not weather-lock. This should work around any such issues by
re-applying handlers on login.
2019-02-12 14:56:03 -05:00
wizjany 96e7c43f56 Fix newline parsing in StringFlag.
This was committed broken 7 years ago and no one told us til today.
2019-02-11 22:22:41 -05:00
wizjany f8e129f33e Add debug listener for DamageEntityEvent. 2019-02-11 16:57:15 -05:00
wizjany 144c31645c Use fake player build override for NPCs in SessionManager too. 2019-02-08 22:29:00 -05:00
Wizjany d24157e693 Allow NPCs to bypass region protections. (#393) 2019-02-04 18:50:09 +10:00
wizjany d5dddba8bc Prevent exception with legacy materials.
Not sure what this legacy material layer is doing here, but it can
potentially throw exceptions when we add one to our material flags.
2019-02-03 19:28:59 -05:00
Wizjany 72a392aca2 Moved SquirrelID relocation to core project. (#394)
This allows projects depending on core to properly use the ProfileService and ProfileResolver without themselves relocating the package.
2019-01-27 19:47:08 -05:00
wizjany c6442e6669 Re-enabled checkstyle, do some cleanup. 2019-01-27 16:13:58 -05:00
Wizjany 0102dbb9bc Move MapFlag to core. (#392)
Original PR was made before API stuff was moved to core, so when the PR was pulled it ended up back in legacy.
2019-01-27 13:54:30 -05:00
Wizjany 3f7a9f9bc8 Change CI link to enginehub 2019-01-23 17:19:46 -05:00
Matthew Miller ae51d74afb Back to SNAPSHOT for continued development 2019-01-22 22:17:22 +10:00
Matthew Miller e51a22032e Bumped to Beta 3 2019-01-22 22:13:46 +10:00
Matthew Miller 84017bffc4 Added macro and colour support to deny-message 2019-01-19 21:51:52 +10:00
Matthew Miller 60731f9836 cleanup block listener 2019-01-12 18:12:06 +10:00
Matthew Miller 3ea7c9fc08 Added GLIDE and SWIM MoveTypes, and made Horses use RIDE 2019-01-02 17:24:49 +10:00
Matthew Miller 9804c69044 Added an option to block conduit effects 2019-01-02 14:25:43 +10:00
Mark Vogel cd39387e7f Add MapFlag (#375)
* Add MapFlag

Signed-off-by: Mark <33119mark@gmail.com>

* Remove apache import

Signed-off-by: Mark <33119mark@gmail.com>

* Add copyright

Signed-off-by: Mark <33119mark@gmail.com>
2018-12-30 17:20:12 +10:00
Matthew Miller b48e145508 Move StringMatcher to before other things 2018-12-29 12:38:45 +10:00
Matthew Miller 405b210fb5 Cleanup usage of BukkitWorldConfiguration 2018-12-26 15:19:23 +10:00
Matthew Miller d4d7601125 Fixed broken merge 2018-12-26 14:34:18 +10:00
Matthew Miller fdd9064170 Abstracted the commands away from the Bukkit platform (#391)
* Start work on abstracting commands out of worldedit-legacy

* A lot more work towards abstract commands

* Move a lot of code to WorldEdit

* Setup the exception converter

* Use WorldEdit styling and move more of the RegionContainer across.

* Abstract away the debug commands and a few other things - Only the matcher to go.

* It compiles

* It now seems to run fine

* Fixed version typo
2018-12-26 14:32:35 +10:00
Matthew Miller 803c2055c3 Update SquirrelID for JAXB removal. 2018-12-23 12:47:23 +10:00
Matthew Miller 344c6cf814 Minor cleanup of blacklists 2018-12-21 22:33:43 +10:00
Matthew Miller 863f6cc13b Switched to heirarchy object report 2018-12-18 18:13:06 +10:00
Matthew Miller 3dd35dabec Remove some files that were listed in the gitignore but still in the repo 2018-12-18 16:52:31 +10:00
Matthew Miller 80aec378d8 Fixed the wrong cache directory being used. 2018-12-10 11:39:03 +10:00
Matthew Miller 6dbd731c92 Added bonemeal to the list of items that modifies blocks. 2018-12-09 16:44:51 +10:00
Matthew Miller aea129889c Update bStats (Didn't realise I forgot to do this) 2018-12-02 21:49:19 +10:00
Matthew Miller 2757a001c0 Gradle 5 2018-12-02 21:40:46 +10:00
Matthew Miller 693314c7f7 Also block /deop 2018-12-02 15:47:45 +10:00
Matthew Miller db35c908ba Switch back to SNAPSHOT for continued development 2018-11-28 20:39:47 +10:00
Matthew Miller 14ce7d1be2 Bump to beta 2 2018-11-28 20:37:39 +10:00
Matthew Miller 015f192193 Added toString to LazyLocation to fix /rg info with the teleport flag. 2018-11-17 16:33:30 +10:00
Matthew Miller 83b375b6e1 Sponges now destroy kelp and seagrass, similar to vanilla behaviour. 2018-11-17 10:15:48 +10:00
Matthew Miller 91696533cf Update to the new Vector system 2018-11-04 16:57:59 +10:00
Matthew Miller 0dc5781326 Can't compileOnly and shadow, gotta find another solution for the bStats repo issue. 2018-10-10 23:24:16 +10:00
Matthew Miller 5ad21521be IvnentoruClickEvent sometimes passes null inventories or inventories with null holders 2018-10-10 20:33:32 +10:00
Matthew Miller e0b91e9529 Merge pull request #389 from Brokkonaut/fix-npe-BukkitOfflinePlayer
Fix NPE in WorldGuardPlugin.wrapOfflinePlayer()
2018-10-08 23:20:11 +10:00
Matthew Miller 7e0ff24c57 Block minecraft:op as well 2018-10-07 23:14:37 +10:00
Brokkonaut be426e92df Fix NPE in WorldGuardPlugin.wrapOfflinePlayer()
The constructor of BukkitOfflinePlayer calls the constructor of BukkitPlayer with a null player. So without this fix it is not possible to create any BukkitOfflinePlayer.
2018-10-05 23:51:08 +02:00
Matthew Miller a6261b9071 Added an option to disable particle effects on deny 2018-09-28 12:16:22 +10:00
Matthew Miller f235e870a7 Back to SNAPSHOT for continued development 2018-09-28 12:16:21 +10:00
Matthew Miller a26eb87603 Release WorldGuard 7 Beta 1 2018-09-28 12:16:21 +10:00
Matthew Miller 7fb7d59856 Merge pull request #388 from PseudoKnight/master
Fix protections for potted plants and undyed shulker boxes
2018-09-26 15:45:20 +10:00
Matthew Miller 01dfebe531 Fixed blockCreatureSpawn not working. 2018-09-26 15:03:30 +10:00
Matthew Miller 87e5770405 Fixed WorldGuard's player not inheriting properly from WorldEdit. 2018-09-26 14:01:25 +10:00
PseudoKnight d3c4681c49 Fix protections for potted plants and undyed shulker boxes 2018-09-22 21:31:00 -07:00
Matthew Miller e43daa726a Added bStats 2018-09-20 23:35:55 +10:00
Matthew Miller 8e819f7a82 Merge pull request #386 from Librazy/master
Delay ProcessPlayerEvent by one tick on bukkit onEnable
2018-09-03 21:25:39 +10:00
Librazy ee4259b88d Delay ProcessPlayerEvent by one tick, allowing other plugin to register their Handlers when /reload 2018-08-30 18:27:40 +08:00
Niklas Linz 8771173146 Update sql-v1
Set value higher to prevent errors with new entitytypes in database.

Example for flag denyspawn with some 1.13 EntityTypes: 

['minecraft:polar_bear', 'minecraft:skeleton', 'minecraft:giant', 'minecraft:witch',
  'minecraft:zombie_pigman', 'minecraft:wither_skull', 'minecraft:husk', 'minecraft:ender_dragon',
  'minecraft:cave_spider', 'minecraft:guardian', 'minecraft:silverfish', 'minecraft:stray',
  'minecraft:vindicator', 'minecraft:endermite', 'minecraft:magma_cube', 'minecraft:spider',
  'minecraft:vex', 'minecraft:zombie', 'minecraft:creeper', 'minecraft:wither', 'minecraft:zombie_villager',
  'minecraft:evoker']

Its to big for 256 chars.

Error:


[19:17:28 WARN]: [WorldGuard] Failed to save the region data for 'akania' during a periodical save
com.sk89q.worldguard.protection.managers.storage.StorageException: Failed to save the region data to the database
        at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:270) ~[worldguard-legacy-7.0.0-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldguard.protection.managers.RegionManager.saveChanges(RegionManager.java:135) ~[worldguard-legacy-7.0.0-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldguard.protection.managers.RegionContainerImpl$BackgroundSaver.run(RegionContainerImpl.java:228) [worldguard-legacy-7.0.0-SNAPSHOT-dist.jar:?]
        at java.util.TimerThread.mainLoop(Timer.java:556) [?:?]
        at java.util.TimerThread.run(Timer.java:506) [?:?]
Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'value' at row 1
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:488) ~[?:?]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1163) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1778) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1262) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.sk89q.worldguard.protection.managers.storage.sql.StatementBatch.executeRemaining(StatementBatch.java:50) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.RegionUpdater.replaceFlags(RegionUpdater.java:170) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.RegionUpdater.apply(RegionUpdater.java:331) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.executeSave(DataUpdater.java:130) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.saveChanges(DataUpdater.java:73) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:268) ~[?:?]
        ... 4 more
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'value' at row 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3974) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1756) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1262) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970) ~[spigot-latest.jar:git-Spigot-fe3ab0d-bfb9131]
        at com.sk89q.worldguard.protection.managers.storage.sql.StatementBatch.executeRemaining(StatementBatch.java:50) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.RegionUpdater.replaceFlags(RegionUpdater.java:170) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.RegionUpdater.apply(RegionUpdater.java:331) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.executeSave(DataUpdater.java:130) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.DataUpdater.saveChanges(DataUpdater.java:73) ~[?:?]
        at com.sk89q.worldguard.protection.managers.storage.sql.SQLRegionDatabase.saveChanges(SQLRegionDatabase.java:268) ~[?:?]
        ... 4 more
2018-08-30 14:10:52 +10:00
Matthew Miller d28a31f255 Merge pull request #379 from sk89q/string-ids
Update WorldGuard to 1.13 and move parts to Core
2018-08-30 14:07:59 +10:00
Matthew Miller b4bda6bfaf NEEDS LATEST WORLDEDIT - Moved report framework to WorldEdit, and made most config values be accessible without the BukkitWorldGuardWorldConfiguration 2018-08-15 12:49:25 +10:00
Matthew Miller 44e3f720de Fixed an EntityType bug and removed more deprecated code. 2018-08-13 22:46:36 +10:00
Matthew Miller 7f47e31686 Fixed UUID migrations sometimes failing. 2018-08-13 22:20:27 +10:00
Matthew Miller b2e64498a8 Move some more code to core. 2018-08-13 22:20:27 +10:00
Matthew Miller e31fa306ab Fixed weather flag 2018-08-13 22:20:27 +10:00
Matthew Miller 1123270a07 Fixed an issue with Bukkit being terrible. 2018-08-13 22:20:27 +10:00
Matthew Miller b850b5caf8 Cleanup some more Bukkit specific code. 2018-08-13 22:20:27 +10:00
Matthew Miller ba61919168 Added block support to the matchers 2018-08-13 22:20:27 +10:00
Matthew Miller 34efb6e40e Modify the target creation methods. 2018-08-13 22:20:27 +10:00
Matthew Miller 3203a81710 Use BlockTarget for blocks. 2018-08-13 22:20:27 +10:00
Matthew Miller d8dba47c0f Fixed bugs in the gamemode marshaller. 2018-08-13 22:20:27 +10:00
Matthew Miller a6cfe7d0c9 Move the lowercase unmarshalling entity code. 2018-08-13 22:20:27 +10:00
Matthew Miller f19d2ee73d Fixed an error with Chest Protection 2018-08-13 22:20:27 +10:00
Matthew Miller bd89bd9d2f Fixed a few more migration issues 2018-08-13 22:20:27 +10:00
Matthew Miller 66eb8fa553 Remove the "/" adding code from EntityTypeFlag. 2018-08-13 22:20:27 +10:00
Matthew Miller dcdd0497d8 Fixed a few permission errors. 2018-08-13 22:20:27 +10:00
Matthew Miller 8ac5f8f6f2 Fixed file permissions 2018-08-13 22:20:26 +10:00
Matthew Miller 45a4e59965 Fixed matching with blocks vs items 2018-08-13 22:20:26 +10:00
Matthew Miller 43ed630034 Fixed Spawn Eggs being awful 2018-08-13 22:20:26 +10:00
Matthew Miller 3189b1ac13 Fixed another error. 2018-08-13 22:20:26 +10:00
Matthew Miller e94083045f Fixed profile migrations happening too early. 2018-08-13 22:20:26 +10:00
Matthew Miller acce59edd4 Fixed an error with chest protection listener. 2018-08-13 22:20:26 +10:00
Matthew Miller bb29883fe0 Switch to real 1.13 release 2018-08-13 22:20:26 +10:00
Matthew Miller e7ff99ae96 Fixed an issue with flags getting double registered. 2018-08-13 22:20:26 +10:00
Matthew Miller b10cf6adbc It now runs 2018-08-13 22:20:26 +10:00
Matthew Miller 2e8d14c995 It compiles. 2018-08-13 22:20:26 +10:00
Matthew Miller 89db0d9fee Further compat work. 2018-08-13 22:20:26 +10:00
Matthew Miller 6c5319f355 Major work towards 1.13 compat 2018-08-13 22:20:01 +10:00
Matthew Miller 8eeab682db Merge pull request #381 from Blamo27/fix/npc-issue
Can't hit NPCs (Sentinel #249)
2018-08-04 10:12:47 +10:00
Dr_Blamo 2ae6f39a09 Fix Sentinel #249 issue (Can't hit NPCs)
https://github.com/mcmonkey4eva/Sentinel/issues/249
=> Can't hit NPCs
2018-08-01 06:35:36 +02:00
wizjany d2c52f7c1b Make send- and receive- chat flags respect group flags. 2018-02-24 09:39:25 -05:00
Wizjany 3a332fd87d Fix off-by-one in area calculation.
Even the volume calculation had it correct.
Also fix code style in contains.
2018-01-21 00:31:47 -05:00
Mitchell Cook 0f72811bfc Added UUID support with player name as secondary. (#374) 2018-01-21 00:29:16 -05:00
wizjany 95b88ea64b Added config option to ignore hoppers moving items.
Defaults to old behavior (false).
2017-10-14 14:41:58 -04:00
wizjany f76259df82 Make the full jump to 1.12.
Warning: this really really really does not work with previous MC versions.
2017-09-16 16:48:38 -04:00
wizjany 3a8e3e84b8 Add missing disabled region support check.
Fixes WORLDGUARD-3839.
2017-06-20 22:04:38 -04:00
wizjany 84bc322de7 Push 6.2.1 and bump. 2017-06-08 12:35:52 -04:00
Benedikt Hruschka 129bbd8ea1 Make flag list more readble 2017-06-08 12:35:51 -04:00
wizjany 4dc6e27660 Backport guava's concurrent package to remain compatible between <= MC 1.11 and >= MC 1.12.
Fixes WORLDGUARD-3820.
2017-06-08 12:35:50 -04:00
wizjany 4cb29796c1 Fix error spamming when hoppers are attached to invalid multichests (triple+).
The extra chests might be unprotected, but this shouldn't be possible in vanilla.
2017-05-22 13:56:46 -04:00
wizjany 85693b91b3 Protect armor stands from all non-Player entities, not just living ones.
Fixes WORLDGUARD-3796.
2017-01-25 19:39:53 -05:00
wizjany 1c29e85f19 Prefer Material enum over ItemType lookup when parsing TargetMatchers.
This will make Bukkit's names take priority when trying to identify a block or item,
since ItemType lookup will return, e.g. "birch_door_item" for "birch_door", even though
there's a block with the name "birch_door".

Note that using int ids is always preferable when possible since there's no confusion there.

Fixes WORLDGUARD-3790.
2017-01-12 14:11:57 -05:00
wizjany e019890f1d Add a flag that blocks the damage from withers.
Doesn't cover the skull projectiles, just body damage.
Fixes WORLDGUARD-3787.
2017-01-08 15:47:38 -05:00
wizjany fb90b1446f Move fireworks to their own flag ("firework-damage"). 2017-01-08 14:22:20 -05:00
wizjany 22ef224a81 Include fireworks in other-explosion flag.
Unfortunately, since fireworks neither have a "shooter" entity nor fire an EntityExplode,
the only way to mitigate damage is a complete on/off for any damage they cause.

Fortunately (probably), this should not interfere with elytra boosting, since the
acceleration is applied directly to the player upon use, not from the firework "explosion".

Fixes WORLDGUARD-3786.
2017-01-04 16:33:19 -05:00
wizjany c0f3171a33 Add mobs.block-armor-stand-destroy config option.
Same as the -painting- and -item-frame- ones.
Fixes WORLDGUARD-3781.
2016-12-22 23:38:28 -05:00
wizjany 67ece5c5d7 Add option to allow Forge clients through host keys.
Setting "security.host-keys-allow-forge-clients" will accept the "\0FML\0" identifier that Forge clients add to their host name when connecting to a server.
Fixes WORLDGUARD-3537, WORLDGUARD-3596.
2016-12-22 19:42:43 -05:00
wizjany 46cca2b950 Fix HealFlag missing.
Meanwhile people were getting fed twice as fast.
Fixes WORLDGUARD-3785.
2016-12-15 21:49:42 -05:00
wizjany 6e56763a7f Protect plants in flower pots via build, not just interact.
Fixes WORLDGUARD-3773.
2016-12-03 13:51:34 -05:00
wizjany f147402d30 Release 6.2 and bump. 2016-11-30 14:12:18 -05:00
wizjany 8e35db0f35 Retain backwards compatibility for the LingeringPotion event listener. 2016-11-29 01:35:21 -05:00
wizjany 9b2eff0a71 Really remove construct flag. 2016-11-27 20:04:43 -05:00
wizjany 104cdc023d Add a method to unregister handlers. 2016-11-27 20:00:46 -05:00
wizjany deb283c44b Remove construct flag.
It's been deprecated for ages and is a strict subset of build flag functionality.
Also deprecate unused flags. They can be re-added by plugins that need them now.
2016-11-27 18:42:22 -05:00
wizjany 324e90c68a Add 1.11 materials. 2016-11-23 22:17:26 -05:00
wizjany c60502ffd8 Fix entity combustion in regions always getting cancelled.
Note that this technically might lead to some inaccuracies if
entity is on a region boundary, but requires server fix.
Fixes WORLDGUARD-3758, WORLDGUARD-3770.
2016-11-20 02:32:42 -05:00
wizjany 26e59955ed Handle LingeringPotions as their own event.
potion-splash flag should now filter them when denied.
Fixes WORLDGUARD-3765.
2016-11-15 21:21:23 -05:00
filoghost 4746e95249 Fix Materials.ARMOR_STAND being null in 1.8. (#356)
In 1.8 Materials.ARMOR_STAND is null because END_CRYSTAL throws NoSuchFieldError and in the catch block ARMOR_STAND is set to null. This causes side effects such as players being able to place armor stands in protected regions.
2016-11-10 23:32:25 -05:00
wizjany 9cafb07e4d Protect entities from endercrystal explosions using explosionFlagCancellation setting.
Should be more consistent with other explosion flags (tnt, creepers) now.
Improves fix for WORLDGUARD-2620.
2016-08-24 18:22:43 -04:00
wizjany b2b0fe65c6 Revert "Add frosted ice to ice-melt flag."
Re-Un-Fixes WORLDGUARD-3745 because apparently this isn't what was
requested.
2016-08-18 03:50:31 -04:00
wizjany 06e6ce589b Add frosted ice to ice-melt flag.
Fixes WORLDGUARD-3745.
2016-08-13 16:57:26 -04:00
wizjany 12fc1438c2 Add explicit ender crystal protection.
Fixes WORLDGUARD-2620.
2016-08-08 10:39:40 -04:00
wizjany e5e1f71a2a Birch boats are also vehicles.
Fixes WORLDGUARD-3740.
2016-07-29 13:32:51 -04:00
wizjany 2aaa14261b Actually add 1.10 blocks. 2016-07-05 19:22:32 -04:00
wizjany f006a9584c Fix Location flag bounding.
Fixes WORLDGUARD-3716.
2016-06-22 14:52:19 -04:00
wizjany 03cf9a668b Actually fix unmarshalling of region group flags. 2016-06-15 23:47:59 -04:00
Weasel_Squeezer db70e6f346 Add transientRegion property to ProtectedRegion as a flag to only be stored in memory and not saved (#355) 2016-06-13 22:31:10 -04:00
wizjany e0df194ff2 Fix unmarshalling of region group flags.
Fixes WORLDGUARD-3708.
2016-06-13 22:31:09 -04:00
wizjany ab55137f59 Allow FlagContext to be added to by plugins. 2016-06-13 22:31:09 -04:00
ZephireNZ bbb79526b2 Make RegionPrintoutBuilder use the FlagRegistry to print flags 2016-06-13 22:31:08 -04:00
wizjany cde9a403f7 Allow plugins to register session handlers. 2016-06-13 22:31:08 -04:00
wizjany 43a9228304 Add config setting to allow clamping of location flags.
Prevents players from setting locations (teleport, spawn) to point outside of the region.
The permission to override this is "worldguard.region.locationoverride.(own/member/.)regionid".
Also prevents location flags from being set to under the map or over the max world height.
Fixes WORLDGUARD-2775, WORLDGUARD-3370.
2016-06-13 22:31:07 -04:00
wizjany c1b8d12d05 Add FlagContext. 2016-06-13 22:31:00 -04:00
sk89q a25674e9a5 Add preliminary custom flags support. 2016-06-13 22:27:53 -04:00
wizjany 778ec404ff Prevent fishing rod PvP.
Fixes WORLDGUARD-3707.
2016-06-13 21:29:26 -04:00
wizjany 4ab38e5b89 Bump version to 6.1.3-SNAPSHOT for development. 2016-06-11 12:38:45 -04:00
wizjany 8b842e3a0d Release 6.1.2 for MC 1.9/1.10 2016-06-11 12:38:01 -04:00
Max Lee e38d98da00 Do not allow teleport inside of regions with the chorus-fruit-teleport deny flag set 2016-06-11 11:45:48 -04:00
wizjany 5c9ba2e22e Fix MC 1.7 compatibility to pistons. 2016-06-11 11:39:58 -04:00
wizjany e9ecb6d2a8 Treat elytra wall impact as fall damage.
Fixes WORLDGUARD-3654.
2016-06-11 11:29:01 -04:00
wizjany f5a554f4a4 block-potion-effects now blocks effects from arrows too.
Fixes WORLDGUARD-3692.
2016-06-11 10:44:50 -04:00
wizjany 53aadca45b Make fire-spread actually prevent spreading instead of just burning.
Same with lava-fire.
Fixes WORLDGUARD-3699.
2016-06-11 02:29:20 -04:00
wizjany 6c3dd4234d Protect against fishing rod usage in regions.
Fixes WORLDGUARD-3696.
Also be more explicit with some dependencies so IntelliJ stops complaining.
2016-06-11 01:22:40 -04:00
wizjany 5bd2125963 Doot doot.
Fixes WORLDGUARD-3695.
2016-05-26 02:52:43 -04:00
wizjany 8765bbb192 Last one?
Fixes WORLDGUARD-3694.
2016-05-25 21:09:43 -04:00
wizjany 53e8b780bc More backwards compat.
(Lots of people still on 1.8 it seems...)
Fixes WORLDGUARD-3693.
2016-05-25 13:29:55 -04:00
wizjany 0e252e41b2 Wrong error caught for backcompat. 2016-05-23 09:47:12 -04:00
wizjany 15a9c50ea4 Fix double output with region wand.
Also a bit of code cleanup.
2016-05-21 19:53:37 -04:00
wizjany d3acbdf382 Fix syntax error in last commit. 2016-05-21 15:08:33 -04:00
wizjany 4239bdc96d Fix issue with loading flags on non-existing regions from SQL.
No idea if this actually works or what the issue was ¯\_(ツ)_/¯
Thanks to EONABloodrayne for the updated statement (if it works)
and also blame them if it doesn't.
Fixes WORLDGUARD-3355.
2016-05-20 17:02:37 -04:00
wizjany 43a5bf1638 Handle BlockMultiPlaceEvent separately.
Unsure how much this is used but...
2016-05-20 16:48:44 -04:00
wizjany a8591e536a Add "chorus-fruit-teleport" flag to prevent teleporting with chorus fruits.
Fixes WORLDGUARD-3645.
2016-05-20 16:06:22 -04:00
wizjany 38dcdff0b6 Update/fixes for MC 1.9.
Fixes WORLDGUARD-3664, WORLDGUARD-3652, WORLDGUARD-3679, WORLDGUARD-3657, WORLDGUARD-3668.
2016-05-20 16:06:21 -04:00
wizjany 65e48d17d4 Fix another instace of chest casting exception. 2016-03-25 18:31:12 -04:00
wizjany c9b8e9f6a2 Target Java 7 for source compilation.
Also remove old pom file, since we don't use maven anymore.
Fixes WORLDGUARD-3642.
2016-03-02 15:59:31 -05:00
wizjany 93d454c675 Work around odd class casting with odder class casting.
Despite the API guaranteeing a block for chests, they are not actually BlockStates.
Fixes WORLDGUARD-3607. Probably.
2016-02-20 12:40:16 -05:00
wizjany ca4bb7a53d Update shadow plugin.
Fixes WORLDGUARD-3635.
2016-02-17 22:16:42 -05:00
wizjany c2054615db Use full class name for Grgit.
Because it apparently sometimes fails otherwise.
2016-01-16 23:19:43 -05:00
wizjany 6db2df4e29 Expand version in plugin.yml during gradle build. 2016-01-11 01:05:19 -05:00
Wizjany 536132a250 Merge pull request #350 from kosakriszi/master
Reset player saturation and exhaustion for heal command
2016-01-09 19:48:09 -05:00
kosakriszi 7c3b1ad20f Reset player saturation and exhaustion for heal command 2016-01-07 03:12:05 +01:00
wizjany 729f66afdf Should fix travis builds. 2016-01-06 00:23:15 -05:00
wizjany a7c2026414 Fireballs are now treated as projectiles.
Apparently this has existed for a few years now. Don't even ask.
Fixes WORLDGUARD-3611, WORLDGUARD-3476.
Potentially fixes lots of other issues with fireballs as well.
Other settings and so on seemed to have covered a lot though.
2016-01-05 01:09:57 -05:00
wizjany 9222b3d364 Doc file tweaks. 2015-11-13 20:51:05 -05:00
wizjany adcc41413d Clean up a few files. 2015-11-13 20:39:50 -05:00
wizjany ec08d7d73a Fix checkstyle for legacy module. 2015-11-13 20:04:51 -05:00
wizjany 3d5ee7b571 Gradle-ize. Prep for Sponge.
Old Bukkit code can still be found in the worldguard-legacy folder
and built with `gradle worldguard-legacy:build`. Hopefully nothing
got lost in the gradle-ization.
2015-11-13 19:12:55 -05:00
wizjany 32341393fe Armor stands no longer get removed by /stoplag.
Also restored MC1.7 compatibility to pistons.
2015-09-27 20:40:56 -04:00
Wizjany 0fcd42fdd5 Workbenches can now be used by default.
Since it was a source of common confusion.
Things like enderchests and anvils should be added to the interaction whitelist in config if you wish to unprotect them.
2015-08-30 16:04:27 -04:00
Wizjany e28b236a52 Add some missing 1.8 blocks. 2015-08-18 01:52:49 -04:00
wizjany 96e0ffd293 Regions now protect against pistons with slime blocks.
Fixes WORLDGUARD-3493.
2015-08-02 17:00:06 -04:00
wizjany 0ddc011a3c Fix wibbly wobbly timey wimey stuff.
Fixes WORLDGUARD-3527.
2015-08-02 16:05:47 -04:00
wizjany d320356045 Add tile entities to performance report. 2015-07-31 12:58:24 -04:00
wizjany 95bf6bc9b2 Be overly protective for creeper and enderdragon explosions.
Fixes WORLDGUARD-3522.
2015-07-06 01:39:39 -04:00
wizjany 1c4c213ed7 Switched order of greeting and farewell flags.
When going between two regions, the farewell flag of the region you're leaving should show up before the greeting flag of the region you're entering.
Fixes WORLDGUARD-3511
2015-07-06 00:23:46 -04:00
Wizjany c9eaec0ae8 Prevent NPE in portal code.
Fixes WORLDGUARD-3516
2015-06-27 00:42:08 -04:00
Wizjany fc0be7db09 Fix case-sensitivity when checking membership.
Probably.
2015-06-26 14:50:09 -04:00
wizjany dbbc31a4f4 Fix some consistency issues with both spawners and bonemeal. 2015-06-19 19:06:34 -04:00
wizjany 0f3e893aaf Force region claiming to use UUIDs.
Also remove owner params from the command, they were
ignored anyway. Claim only adds the player using the command.
Fixes WORLDGUARD-3504.
2015-06-19 18:08:20 -04:00
wizjany aa668916e4 Fix a typo in config node from last commit. 2015-06-19 17:49:14 -04:00
wizjany a426d2a42c Check correct bucket while milking cows.
Fixes WORLDGUARD-3508.
2015-06-19 17:02:09 -04:00
wizjany 5ff8b37ae8 Create a config option to enable portal protection.
Protection is off by default. Third-party portal plugins such as MV-NP
may interfere with portal protection and cause problems.
Fixes WORLDGUARD-3498.
2015-06-19 17:01:30 -04:00
wizjany 2d28e8db6d Make portal protection slightly less overprotective.
Fixes end portal usage.
Fixes WORLDGUARD-3497.
2015-06-08 15:08:46 -07:00
wizjany 463a356020 Overprotective nether portal protection.
Blocks any portal travel that might lead to portal creation in a protected area.
Fixes WORLDGUARD-3479.
2015-06-08 15:08:46 -07:00
sk89q 21d13cc72c Set version to 6.1.1-SNAPSHOT. 2015-06-08 15:08:28 -07:00
sk89q 9cf85caf3c Set version to 6.1. 2015-06-08 15:04:59 -07:00
sk89q 2f1343f408 Updated changelog for v6.1. 2015-06-08 15:04:52 -07:00
wizjany 3cb6c4e46f Check both attacker and defender locations for PvP.
Fixes WORLDGUARD-3494.
2015-06-08 14:37:32 -07:00
sk89q 7f9b850288 Always generate Javadocs and sources .jar. 2015-06-08 14:37:32 -07:00
sk89q e8d4f2fd84 Turn off doclint. 2015-06-08 14:37:32 -07:00
sk89q f3891aaaf9 Add a workaround for incorrect piston retract information. 2015-06-03 23:46:24 -07:00
wizjany ea75549a29 Clean up Heal and Feed flags.
Allow the flags to increase values for players who are invincible (or in creative mode),
but not decrease them.
Fixes WORLDGUARD-3492.
2015-06-04 02:02:53 -04:00
wizjany fbd8206038 Check for connected chests.
Fixes WORLDGUARD-3021.
2015-05-29 03:56:14 -04:00
wizjany 522ac459db Fix weather lock flag.
Probably. Maybe.
Fixes WORLDGUARD-3452.
2015-05-29 02:26:32 -04:00
wizjany 255dd2d41a Add support for Spigot's BlockExplodeEvent.
Also update Bukkit dependency and guava version quirks.
Fixes WORLDGUARD-3484.
2015-05-29 01:49:20 -04:00
wizjany cf1716ff37 Separate vehicles and animals from INTERACT flag.
Destroying vehicles now checks only the vehicle-destroy flag.
Damaging animals checks the new damage-animals flag.
These are both allowed for members by default, like other build-dependent flags.

Fixes WORLDGUARD-3427 and WORLDGUARD-3358.
2015-05-28 17:21:58 -04:00
sk89q a277e69e9c Get the session during the gamemode event lazily. 2015-05-28 11:28:02 -07:00
sk89q ec5bb32510 Add -s to show stack traces with the event debugging command. 2015-05-27 22:18:30 -07:00
Wizjany 8ddb7d4b99 Don't add a period for custom blacklist messages.
Fixes WORLDGUARD-3472
2015-05-02 22:38:42 -04:00
Wizjany 3258bff2d1 Fix CommandFilter matching emoticons etc.
Fixes WORLDGUARD-3461.
2015-04-18 12:01:21 -04:00
Wizjany 8d7d32a2d2 Check event cancellation before playing deny effect for bucket events. 2015-04-05 15:44:43 -04:00
Wizjany a907eb2348 Move repeaters/comparators from use to build.
This should mirror the protection given in WG 5.9.
2015-03-13 23:34:22 -04:00
wizjany 32132b5b0a Protect against spawn egg usage.
Fixes WORLDGUARD-3347.
2015-03-11 01:46:55 -04:00
wizjany c0c7c3215e Mark Player/Group Domains as dirty in a few missing places.
Fixes WORLDGUARD-3404.
2015-03-11 00:44:41 -04:00
Wizjany ddf0f41061 Actually register WorldRulesListener for events.
Fixes WORLDGUARD-3406.
2015-03-03 13:09:50 -05:00
Wizjany d3ecbcb18a Protect switching inverted daylight detectors too. 2015-02-28 18:39:54 -05:00
wizjany b7f4262978 Add comparators to USE too for consistency. 2015-02-19 21:21:17 -05:00
wizjany 60e6f92c64 Have repeaters be covered by the USE flag. 2015-02-19 21:17:45 -05:00
wizjany 98af7966cd Added weather-lock flag.
Valid values are clear or downfall. Unset to restore to normal world weather.
2015-02-18 02:24:31 -05:00
wizjany 99d042d260 Added time-lock flag.
Valid values are 0 to 24000 for absolute time, or +- any number for relative time.
Closes WORLDGUARD-3379.
2015-02-18 01:59:30 -05:00
wizjany c9d6166fcb Check for null task fields.
Fixes WORLDGUARD-3372.
2015-02-17 16:51:02 -05:00
sk89q 752ccec150 Don't call initialize() on non-cancellable movements.
Fixes WORLDGUARD-3362.
2015-02-11 17:12:10 -08:00
sk89q 91ccb95672 Add classloader override to the build POM. 2015-02-11 17:09:10 -08:00
wizjany 4caff457d3 Add Citizens NPCs to NPC detection for region whitelisting.
Fixes WORLDGUARD-3356.
2015-02-04 17:03:01 -05:00
wizjany a1a6ee7107 Fixed blocks (e.g. sugar canes) adjacent to physics blocks (e.g. sand) not updating.
Fixes WORLDGUARD-3367. This change MAY have breaking unintended consequences,
but the physics configs seem to still be working.
2015-02-04 03:33:37 -05:00
sk89q af157b88bd Handle empty sets in SetFlag. 2015-01-30 00:03:25 -08:00
sk89q ea4f4c088b Have enderchests be covered by the USE flag.
Fixes WORLDGUARD-3336.
2015-01-28 01:36:07 -08:00
sk89q 6559ed5c1a Have tripwire be covered by the USE flag.
Fixes WORLDGUARD-3351.
2015-01-28 01:35:17 -08:00
sk89q deddcf8dd2 Handle null block attacker.
Fixes WORLDGUARD-3350.
2015-01-28 01:26:50 -08:00
sk89q dfe536a2d2 Fix issues with MC 1.7 compatibility. 2015-01-28 01:11:36 -08:00
sk89q 5bfb348354 Add a fall-damage flag.
Closes WORLDGUARD-2279.
2015-01-28 01:01:43 -08:00
sk89q afcf93b7b1 Reset handler caches when a move type is non-cancellable. 2015-01-27 15:21:56 -08:00
sk89q e1843624bb Add exit-via-teleport flag (default allow). 2015-01-27 15:01:01 -08:00
wizjany 0f4e7b5061 Creeper explosions with a player target cause should no longer be ignored.
Also fixed primed tnt being checked twice for tnt flags. TNT Minecarts are not included, as was prior behavior.
Fixes WORLDGUARD-3344
2015-01-24 23:00:19 -05:00
wizjany 869ead63bc Fix armor stands to behave more like item frames.
Placing and modifying them respects permissions, and  they are no longer blocked by mob-spawning deny.
2015-01-24 17:02:55 -05:00
sk89q 6a6de7802b Fix missing material data for 1.8 items.
Fixes WORLDGUARD-3306.
2015-01-22 21:42:53 -08:00
sk89q b50302d9d0 Set version back to 6.0.0-SNAPSHOT. 2015-01-20 19:28:22 -08:00
sk89q c841d74aaf Set version to 6.0.0-beta-05. 2015-01-20 19:26:39 -08:00
sk89q 09cce39aff Update changelog for 6.0 beta 5. 2015-01-20 19:25:34 -08:00
sk89q e5b76a571b Always call boundary crossing handlers. 2015-01-20 19:24:55 -08:00
sk89q 7c58fa4be6 Add BukkitUtil.toRegion(Chunk).
Closes WORLDGUARD-3292.
2015-01-19 23:19:44 -08:00
sk89q f150a41d72 Ensure that region properties are immutable. 2015-01-19 23:11:28 -08:00
sk89q bca1c2bdb3 Fix region intersection tests involving polygons.
Fixes WORLDGUARD-3216.
2015-01-19 22:56:16 -08:00
sk89q 47a8bcc442 Floor components in getApplicableRegions(Location).
Fixes WORLDGUARD-3288.
2015-01-19 19:22:15 -08:00
sk89q 83cad75916 Fix /wg flushstates not doing anything. 2015-01-19 19:04:49 -08:00
sk89q 6b5a12105e Group together invincibility listeners.
Fixes WORLDGUARD-3315.
2015-01-19 19:03:54 -08:00
sk89q 451b679323 Track cause through targets.
Fixes WORLDGUARD-3314.
2015-01-19 18:28:41 -08:00
sk89q 66a8bfd5b1 Fix typo in region gamemode change log message. 2015-01-19 14:12:04 -08:00
sk89q 2a2b2f6f64 Limit the cause chain to 40 items. 2015-01-19 14:08:53 -08:00
sk89q 73dea11de2 Restore game mode flag logic to pre-refactor version.
Fixes WORLDGUARD-3320.
2015-01-19 13:23:23 -08:00
wizjany 9998a6c930 Restore Java 6 compatibility. 2015-01-19 15:01:43 -05:00
wizjany 5111d40aaf Add colorification to entry and exit messages as well. 2015-01-19 14:23:04 -05:00
sk89q 972ccaed7e Rename InteropUtil -> InteropUtils. 2015-01-19 11:20:53 -08:00
sk89q f7d36bc1f3 Protect enderchests as well. 2015-01-19 11:20:23 -08:00
sk89q 8073945af0 Fix color codes in greeting/farewell messages.
Fixes WORLDGUARD-3319.
2015-01-19 11:17:06 -08:00
sk89q 91353d6b01 Improve fake player detection. 2015-01-19 03:23:52 -08:00
sk89q bfbcc8dcf8 Fix a typo in the class source warning message. 2015-01-19 01:55:56 -08:00
sk89q 8f65798141 Check when plugins shade WorldGuard inappropriately. 2015-01-19 01:54:23 -08:00
sk89q fdddb17d2f TypeToken is not available on old Guava. 2015-01-17 19:26:33 -08:00
sk89q 520f9e3fcf Check movement with vehicle enter. 2015-01-17 19:25:15 -08:00
sk89q a3d2a1b127 Don't call boundary crossing handlers unless a boundary was crossed. 2015-01-17 19:17:17 -08:00
sk89q 7ecf73165b Handle entry flag only on boundary crossing. 2015-01-17 19:17:02 -08:00
sk89q e90a7ed075 Add new exit-override flag instead of fiddling with default exit flag values. 2015-01-17 19:13:25 -08:00
sk89q aae521b727 Rewrite session and movement flag code.
Also adds entry-deny-message and exit-deny-message.

Fixes WORLDGUARD-3086, WORLDGUARD-2542, WORLDGUARD-2731.
2015-01-17 18:54:10 -08:00
sk89q 643345b459 Add Locations.isDifferentBlock(). 2015-01-17 15:04:42 -08:00
sk89q a62d9f5617 Reuse set in RegionResultSet for getRegions(). 2015-01-17 14:29:14 -08:00
sk89q 2f3f76c8cf Funnel pre-allowed events too.
Fixes WORLDGUARD-3308.
2015-01-16 15:43:13 -08:00
sk89q a03aaa45b1 Revert "Have the PvP flag apply to self-attack."
This reverts commit d8dd86dfe8.

Fixes WORLDGUARD-3312.
2015-01-16 14:22:46 -08:00
sk89q 372155b5c3 Don't check player inventories for protection.
Fixes WORLDGUARD-3309, WORLDGUARD-3310.
2015-01-16 14:20:01 -08:00
sk89q 159de771bf Fix build perms item use event not working correctly. 2015-01-15 18:42:26 -08:00
sk89q 41d922cb27 Add special case for global regions in RegionOverlapAssociation too. 2015-01-15 16:49:07 -08:00
sk89q 6a4fac63e8 Change version back to 6.0.0-SNAPSHOT. 2015-01-13 12:44:17 -08:00
sk89q 3daf8db113 Bump to 6.0.0 beta 04. 2015-01-13 12:42:11 -08:00
sk89q 9c62a35e07 Update CHANGELOG for 6.0 beta 4. 2015-01-13 12:29:43 -08:00
sk89q 931f438b14 Add material flags for MC 1.8.
Fixes WORLDGUARD-3306.
2015-01-13 12:19:53 -08:00
sk89q 3109612c1b Expand the USE flag to cover 1.8 doors and gates.
Fixes WORLDGUARD-3304.
2015-01-13 12:12:12 -08:00
sk89q e4d63ffbcc Permit org.json.simple package usage. 2015-01-13 03:24:00 -08:00
sk89q 866a554d30 Shade JSON simple. 2015-01-13 03:23:49 -08:00
sk89q ab2811ed2d Remove boot class / library path report values. 2015-01-13 03:19:47 -08:00
sk89q 8cc7bcc849 Improve report output. 2015-01-13 02:44:58 -08:00
sk89q 547e89b85d Add CPU profiling with WarmRoast "lite." 2015-01-13 01:49:59 -08:00
sk89q 477f1188df Use EH pastebin and remove debug code. 2015-01-12 22:19:49 -08:00
sk89q d9e4b27cd2 Handle PlayerInteractAtEntityEvent again.
Fixes WORLDGUARD-3291.
2015-01-11 02:34:12 -08:00
sk89q 37f39eaf66 Use a less coarse can-interact-on-click check.
Fixes WORLDGUARD-3303.
2015-01-11 02:05:31 -08:00
sk89q 223d22e79f Fire UseEntityEvent for InventoryOpenEvent for entities. 2015-01-11 00:10:52 -08:00
sk89q 04214a96eb Ignore unknown cause entity damage.
Fixes WORLDGUARD-3293.
2015-01-11 00:08:41 -08:00
sk89q f40cb69f38 Ignore unknown cause hanging breaks.
Fixes WORLDGUARD-3301.
2015-01-11 00:05:07 -08:00
sk89q 6c1489d434 Make NormativeOrders non-instantiable. 2015-01-10 23:44:31 -08:00
sk89q 6fe63838f5 testState(relevant flags) == DENY on whitelist cases.
Fixes WORLDGUARD-3294.
2015-01-10 23:31:24 -08:00
sk89q d883c22d64 Document flag classes and make BUILD slightly less magic. 2015-01-10 23:15:32 -08:00
sk89q 3bd1c869f1 Sort applicable regions by inheritance too. 2015-01-10 22:45:15 -08:00
sk89q e7273aaf6f ALLOW on a child region should override DENY on a parent. 2015-01-10 18:37:28 -08:00
zml 6e02f80f6c Pass Player objects during WEPIF permission checks 2015-01-10 16:14:17 -08:00
sk89q 01276dfc62 Fix incorrect region group inheritance and broken flag override in children. 2015-01-09 13:21:17 -08:00
sk89q f516fd5e54 Have on-acquire also check inventory transfers.
Fixes WORLDGUARD-2752.
2015-01-08 15:43:02 -08:00
sk89q 79612915a7 Fix NPE caused by flag value permissions. 2015-01-08 14:29:06 -08:00
sk89q f04f9093bc Add &r as a reset color code.
Closes WORLDGUARD-3286.
2015-01-08 13:40:57 -08:00
sk89q 9dac950faf Fix a little typo in the UPGRADE document. 2015-01-08 11:58:20 -08:00
sk89q f2a8ff3f64 Add missing wood plate to USE flag. 2015-01-08 11:25:19 -08:00
sk89q b78317dd42 Add color code support to the blacklist.
Fixes WORLDGUARD-3284.
2015-01-08 11:24:22 -08:00
sk89q 048dd25099 Remove outdated information in the upgrade document. 2015-01-08 01:14:12 -08:00
sk89q 0900289437 Add permissions for individual flag values.
Closes WORLDGUARD-3103.
2015-01-08 01:04:36 -08:00
sk89q d8dd86dfe8 Have the PvP flag apply to self-attack.
Closes WORLDGUARD-3278.
2015-01-08 00:35:30 -08:00
sk89q 9a569d7ed8 Don't throw internal DamageEntityEvents for unknown cause entity combusts.
Fixes WORLDGUARD-3277.
2015-01-08 00:32:57 -08:00
sk89q 53132ce83a Add support for slightly older versions of Bukkit 1.7.9. 2015-01-08 00:25:07 -08:00
sk89q c3bdc33215 Set version to 6.0.0-SNAPSHOT. 2015-01-07 18:51:07 -08:00
sk89q c6bf8ceb5c Bump version to 6.0.0-beta-03. 2015-01-07 18:49:34 -08:00
sk89q 792d041078 Update CHANGELOG. 2015-01-07 18:48:58 -08:00
sk89q cb965c9bf9 Update the UPGRADE document. 2015-01-07 18:42:57 -08:00
sk89q f33889b88f Support both MC 1.7.10 and 1.8. 2015-01-07 18:07:30 -08:00
sk89q e747e3a3fa Bump Bukkit dependency to 1.7.9-R0.3-SNAPSHOT. 2015-01-07 16:28:26 -08:00
sk89q fd460337f4 Don't apply the region override permission to PvP. 2015-01-06 15:14:30 -08:00
sk89q 38c9479385 Fix incorrect detection of hostile and ambient creatures. 2015-01-06 15:01:07 -08:00
sk89q da032cb04e Fix the splash potion flag not working with the other flags.
Fixes WORLDGUARD-3274.
2015-01-06 15:00:54 -08:00
sk89q 37a80338f5 Adjust USE flag material filter to include the proper items. 2015-01-05 13:31:14 -08:00
sk89q 8a5f233e84 Use an interact event for non-damaging splash potions.
Fixes WORLDGUARD-3184.
2015-01-04 19:54:34 -08:00
sk89q e3a9131929 Fix potion blocking.
Fixes WORLDGUARD-3207
2015-01-04 19:43:55 -08:00
sk89q bab98d5463 Fix broken recursive dump in DataReport. 2015-01-04 19:19:53 -08:00
sk89q 4333b39377 Consider enchantment table + workbench MODIFIED_ON_CLICK. 2015-01-04 19:13:07 -08:00
sk89q 8bd427a6ab Make PASSTHROUGH=DENY useful on __global__. 2015-01-04 18:58:00 -08:00
sk89q d3493a3361 Fix missing __global__ constant. 2015-01-04 18:51:32 -08:00
sk89q 51982cda28 Do a better check of the global region. 2015-01-04 18:51:18 -08:00
sk89q a2e14bc76a Fix issues caused by adding members to __global__.
Fixes WORLDGUARD-3195.
2015-01-04 18:44:57 -08:00
sk89q c050d274f5 Make the EXP_DROPS flag a build-compat flag and set its deny message.
Fixes WORLDGUARD-3231.
2015-01-04 18:26:11 -08:00
sk89q bdff22cbac Give the player back his/her XP bottle if it was blocked. 2015-01-04 18:20:33 -08:00
sk89q 7da10198e3 Expand interaction whitelist to "physical" events.
Closes WORLDGUARD-3238.
2015-01-04 18:05:50 -08:00
sk89q b11e2b3d11 Catch command prefixes in the filter.
Fixes WORLDGUARD-3196.
2015-01-04 17:56:00 -08:00
sk89q c95b619974 Add a RIDE flag for vehicles. 2015-01-04 17:52:32 -08:00
sk89q e61b2e18c1 Also permit hoppers. 2015-01-04 16:09:57 -08:00
sk89q e9d64dbf03 Check for names in addition to UUIDs with /rg list. 2015-01-04 14:25:04 -08:00
sk89q 3c8121d088 Whitelist hoppers and let them cross regions regardless of permissions. 2015-01-04 13:57:03 -08:00
sk89q 93ced5ca7a Revert USE flag's functionality to 5.x, add new INTERACT flag. 2015-01-04 13:50:48 -08:00
sk89q 7580583fbf Fix spawn egg blocking.
Closes WORLDGUARD-3254.
2014-12-31 02:30:58 -08:00
sk89q 41c68664d7 Fix failed detection of incorrect blacklist names. 2014-12-31 02:30:31 -08:00
sk89q c8393cdcec Fix bypass with the block op configuration. 2014-12-31 02:13:35 -08:00
sk89q 42d12e4fa8 Reorganize some packages. 2014-12-31 02:05:47 -08:00
sk89q bed9bd77a6 Merge pull request #336 from ST-DDT/configLoadExceptions
Show more details in error log which world the error belongs to.
2014-12-31 01:59:57 -08:00
sk89q f3c2390fbb Attempt to clean up the move listener. 2014-12-31 01:41:41 -08:00
sk89q 83a7ed58a5 Cache bypass permission checks in the move listener.
Some permission plugins are slow.
2014-12-31 01:39:11 -08:00
sk89q ddc1f77825 Move move listener to a new class. 2014-12-31 01:31:30 -08:00
sk89q 88169236cb Rewrite and update report generation. 2014-12-31 01:18:23 -08:00
sk89q 0cb36b3b8b Remove ArrayReader and FatalConfigurationLoadingException. 2014-12-30 22:37:54 -08:00
sk89q ce169461a3 Add event cancellation debug commands. 2014-12-30 20:05:42 -08:00
sk89q 18ec3db1bb Modernize pastebin code. 2014-12-30 17:41:56 -08:00
sk89q 53fdff1d9b Add hack to make Location flags work with unloaded worlds. 2014-12-29 16:35:22 -08:00
ST-DDT 9a91336958 Show more details in error log which world the error belongs to. 2014-12-19 13:55:18 +01:00
sk89q 7bd69bebf4 Add missing color codes when parsing input. 2014-11-14 12:57:38 -08:00
sk89q 57b6f04b79 Let players use NPCs always.
Fixes WORLDGUARD-3190.
2014-11-11 00:32:42 -08:00
sk89q c7442c2a9e Fix [WorldGuard] in log messages stacking on reloads.
Fixes WORLDGUARD-3192.
2014-11-11 00:29:25 -08:00
sk89q df985013eb Handle null EntityTypes from SpawnEggs.
Fixes WORLDGUARD-3179.
2014-11-11 00:02:54 -08:00
sk89q 41f520845a Better handle empty group / player names due to bad region data.
Fixes WORLDGUARD-3182.
2014-11-10 23:59:57 -08:00
sk89q dac09c64c8 Fix players being invincible with BUILD = deny.
Fixes WORLDGUARD-3201.
2014-11-10 23:56:11 -08:00
sk89q a2defe5971 Fix certain entities not being damaged in protected regions. 2014-11-10 23:52:53 -08:00
sk89q ba4e5d6ea9 Improve entity detection in Entities utility class, add Entities.isNonPlayerCreature(). 2014-11-10 23:52:53 -08:00
sk89q 25f12e9733 Remove CraftBukkit runtime dependency in pom.xml. 2014-09-18 20:32:59 -07:00
sk89q ca37dc0fc6 Merge pull request #328 from zreed/master
Add missing SQL table prefix in statement selecting world names.
2014-09-02 23:30:26 -07:00
zreed 7d41835794 Add missing SQL table prefix in statement selecting world names. 2014-09-02 17:05:28 -04:00
sk89q b37014463f Reset version back to 6.0.0-SNAPSHOT. 2014-08-31 20:04:04 -07:00
sk89q 2b94883e70 Bump version to 6.0.0-beta-02. 2014-08-31 19:58:10 -07:00
sk89q 5c7468ffb5 Remove "multiple categories" point about related flags handling. 2014-08-31 19:55:32 -07:00
sk89q 343632cbf2 Update changelog for 6.0 beta 2. 2014-08-31 19:54:27 -07:00
sk89q 2a3ccec429 Fix boat placement not being properly prevented.
Fixes WORLDGUARD-3174.
2014-08-31 19:36:39 -07:00
sk89q d6f12804ea Don't show a deny message if it's an empty string. 2014-08-31 19:35:13 -07:00
sk89q f858c175f9 Add -e flag to /rg flag to set a flag to an empty value.
Closes WORLDGUARD-3161.
2014-08-31 19:34:55 -07:00
sk89q cdab004505 Add option to consider use of an item as a block use at the player's feet.
Closes WORLDGUARD-3151.
2014-08-31 19:30:14 -07:00
sk89q 59bd11e742 Don't use deny effects for entities because they look bad. 2014-08-31 19:18:32 -07:00
sk89q 2e6faff8c1 Add option to whiteist some blocks / items so they can always be used.
Closes WORLDGUARD-3159.
2014-08-31 19:17:05 -07:00
sk89q 722cc2e38c Block polygonal regions for claiming for now.
volume() returns 0.
2014-08-31 19:05:59 -07:00
sk89q 669c0e9651 Add more deny effects.
Closes WORLDGUARD-3158.
2014-08-31 19:00:45 -07:00
sk89q d2252c6142 Warn about claim volume setting being too high. 2014-08-31 18:42:43 -07:00
sk89q eab4101d1c Consider XP drops under ITEM_PICKUP.
Fixes WORLDGUARD-3171.
2014-08-31 18:38:04 -07:00
sk89q db31c35d8e Don't consider vehicles a known cause.
Fixes WORLDGUARD-3170.
2014-08-31 18:33:14 -07:00
sk89q 125595e6b9 Fix mobs not being able to attack players regardless of permission.
Fixes WORLDGUARD-3172.
2014-08-31 18:28:50 -07:00
sk89q 6d5d9934cc Fix Enums.findFuzzyByValue() not handling _ correctly. 2014-08-31 18:21:58 -07:00
sk89q bd2a8daad3 Fix sapling + bonemeal considered as usage rather than building.
Fixes WORLDGUARD-3169.
2014-08-31 18:21:22 -07:00
sk89q c4b3c1d033 Destroy sapling if some of its blocks could be placed.
Fixes WORLDGUARD-3168.
2014-08-31 18:08:13 -07:00
sk89q eb051bc194 Set MODIFIES_BLOCKS flag on ink dye.
Fixes WORLDGUARD-3167.
2014-08-31 18:03:52 -07:00
sk89q 1a12faf5ab Fix trees not growing naturally in protected regions.
Fixes WORLDGUARD-3166.
2014-08-31 17:52:03 -07:00
sk89q 73fe9cd62f Debounce piston events and add a deny effect.
Fixes WORLDGUARD-3157.
2014-08-31 17:39:01 -07:00
sk89q 7ab4a283fe Document the delegate events.
Fixes WORLDGUARD-3164.
2014-08-31 16:10:11 -07:00
sk89q 46138c9abe Merge pull request #304 from stuntguy3000/master
Add silent (s) and information (i) flags to /stoplag.
2014-08-31 16:06:25 -07:00
sk89q 841cc8e033 Don't apply USE to hanging entities. 2014-08-29 21:51:55 -07:00
sk89q cb0844c64d Ignore _ when fuzzy searching enums. 2014-08-29 12:38:43 -07:00
sk89q 6e8e59aee5 Check Material in TargetMatcherParser. 2014-08-29 12:38:27 -07:00
sk89q 358eebf96b Mention Spigot issue with settings.global-api-cache. 2014-08-29 12:32:33 -07:00
sk89q 01892b609f Have other flags override BUILD but not the other way like in WG 5. 2014-08-29 12:18:01 -07:00
sk89q 096981bd27 Fix condition error in handling of PVP flag. 2014-08-29 12:18:01 -07:00
sk89q 0852fc0d65 Have membership override BUILD=DENY like in WG 5. 2014-08-29 12:18:00 -07:00
sk89q 40ceb3d0b8 Fix NPE when handling PlayerFishEvent.
Fixes WORLDGUARD-3149.
2014-08-25 14:18:26 -07:00
sk89q b52a6bd6d6 Ignore sneaking when checking the events. 2014-08-25 00:29:37 -07:00
sk89q 992e53856d Add some deny effects. 2014-08-25 00:28:26 -07:00
sk89q f776d15e03 Allow right clicking hostile mobs in protected regions too.
Fixes WORLDGUARD-3144.
2014-08-25 00:09:29 -07:00
sk89q 438bc59fbc Silence spam from not being able to walk on crops.
Fixes WORLDGUARD-3143.
2014-08-25 00:05:44 -07:00
sk89q 453f253e77 Remove outdated line in UPGRADE about flags and BUILD. 2014-08-24 18:52:02 -07:00
sk89q 550df20f18 Set version back to 6.0.0-SNAPSHOT. 2014-08-24 18:44:01 -07:00
sk89q e8ee0a8c5b Bump version to 6.0.0-beta-01. 2014-08-24 18:42:39 -07:00
sk89q 5fcd7ddf7a Handle multiple related flags more like in WG 5. 2014-08-24 18:34:14 -07:00
sk89q b11d416035 Revert the default region groups of the entry/exit flags back to WG 5. 2014-08-24 18:11:25 -07:00
sk89q f7e216ba84 Mention how to report bugs in the UPGRADE document. 2014-08-24 18:03:52 -07:00
sk89q f6406b668c Silence messages about touching Redstone ore. 2014-08-24 17:56:15 -07:00
sk89q 7cd4a1d411 Update CHANGELOG and UPGRADE documents. 2014-08-24 17:15:36 -07:00
sk89q bd558bb527 Change .interact to .use for item use permission. 2014-08-24 17:14:34 -07:00
sk89q 8d29f6971a Allow hitting hostile mobs in protected regions. 2014-08-24 17:13:27 -07:00
sk89q 300f69597f Don't cause item loss when the hopper is destroyed. 2014-08-24 17:06:13 -07:00
sk89q 8e320b6dbe Add helper ProtectionQuery class for other plugins. 2014-08-24 17:01:52 -07:00
sk89q fa422bef32 Update UPGRADE document with more information. 2014-08-24 16:38:31 -07:00
sk89q e8cd1cc253 Block spawn eggs properly. 2014-08-24 16:26:15 -07:00
sk89q 5e9ffe9e29 Better describe issue regarding flags being evaluated together. 2014-08-24 15:58:34 -07:00
sk89q edebb0efc9 Be more lax with entity spawns. 2014-08-24 15:53:45 -07:00
sk89q 913d5d64ae Break denied hoppers. 2014-08-24 15:40:00 -07:00
sk89q 6da8fabb1f Debounce the inventory move item event better. 2014-08-24 15:36:38 -07:00
sk89q ee022d7cd7 Handle inventory move event for protection. 2014-08-24 15:24:52 -07:00
sk89q c126a0ac38 Change potion splash to damage event. 2014-08-24 14:46:55 -07:00
sk89q 4a3dac0aa4 Ignore cancelled events in event abstraction. 2014-08-24 14:39:44 -07:00
sk89q f4700ded12 Don't block self-damage if PVP is denied. 2014-08-24 14:33:29 -07:00
sk89q 8570921049 Mention incompatible plugins in the upgrading document. 2014-08-24 14:22:29 -07:00
sk89q 612b953b63 Don't use empty names when loading the YAML regions file. 2014-08-24 14:13:12 -07:00
sk89q 02777c370d Mention use on-place and water / lava buckets. 2014-08-24 14:02:38 -07:00
sk89q 7a8ab1df99 Fire a use item event on placed blocks. 2014-08-24 13:45:39 -07:00
sk89q 182c5f6a17 Clamp cuboid volume to Integer.MAX_VALUE and handle overflow. 2014-08-24 12:55:44 -07:00
sk89q 7c7673af20 Debounce entity break block events. 2014-08-24 12:36:17 -07:00
sk89q 9282fc25de Fix fire handling in the event abstraction listener. 2014-08-24 12:25:29 -07:00
sk89q f66e47c01f If the cause is unknown, use NON_MEMBER as the association. 2014-08-24 02:56:23 -07:00
sk89q f00d73d60e Cause.isKnown() now returns false if it only contains objects that do not properly constitute a cause. 2014-08-24 02:55:57 -07:00
sk89q c5b08781f7 Build the cause list order correctly. 2014-08-24 02:49:58 -07:00
sk89q 4b80c4e4e6 Clean up EventAbstactionListener. 2014-08-24 02:35:09 -07:00
sk89q 7da3cc224b Fix buckets not being checked properly. 2014-08-24 02:26:09 -07:00
sk89q 0659a5263a Fix typos in readme files. 2014-08-24 02:20:51 -07:00
sk89q 0f8614519f Fix /wg reload sometimes not applying new changes right away. 2014-08-24 02:14:15 -07:00
sk89q 541f828db4 Add optional build permission nodes. 2014-08-24 02:03:38 -07:00
sk89q 70aedb4a84 Mention the need to re-check the upgrade document. 2014-08-24 01:19:46 -07:00
sk89q 4f24f2631e Automatic invincibility / no-drowning groups have to be enabled now. 2014-08-24 01:13:59 -07:00
sk89q ddb910e2ea Update the README. 2014-08-23 22:15:10 -07:00
sk89q b5c4eb3587 Move build related files to config/. 2014-08-23 22:05:41 -07:00
sk89q a0553bfa34 Have people read CHANGELOG for the rest of the changes. 2014-08-23 22:02:46 -07:00
sk89q 241f053b8a Fix error in CHANGELOG.md. 2014-08-23 21:57:52 -07:00
sk89q 6174c9e486 Updated changelog and added upgrade information. 2014-08-23 21:55:49 -07:00
sk89q d7629acb61 Use original .jar filename in the .zip. 2014-08-23 20:25:30 -07:00
sk89q 8169b6f650 Use Markdown for changelog + distributed README. 2014-08-23 20:24:25 -07:00
sk89q 7b174683ba WorldGuard 6. See http://forum.enginehub.org/threads/15666/ 2014-08-22 20:54:59 -07:00
sk89q 88e7327af6 Merge branch 'master' into feature/region-api-update 2014-08-22 20:48:34 -07:00
sk89q b7d8562ece Use a region deny message indicating region data load failure. 2014-08-22 20:43:03 -07:00
sk89q 439826ddc6 Bump to version 6.0.0. 2014-08-22 19:52:16 -07:00
sk89q b94641f1b5 Wooden doors are interact-able. 2014-08-22 19:47:37 -07:00
sk89q 0ddf56f7f6 Add -g to /rg (re)define to create a global region. 2014-08-22 19:37:13 -07:00
sk89q 74e64d0641 Fix region bypass permission and support fake players. 2014-08-22 19:32:03 -07:00
sk89q 858b0b2c1c Update Javadocs in RegionQuery. 2014-08-22 19:19:35 -07:00
sk89q 54237c0038 Fix potential NPE in FlagValueCalculator. 2014-08-22 19:17:46 -07:00
sk89q 0edb948a40 Don't let players disembark if they can't back on. 2014-08-22 19:17:36 -07:00
sk89q f85aeecde7 Fix deny flags not applying when you are on an animal.
Fixes WORLDGUARD-2518.
2014-08-22 18:23:59 -07:00
sk89q 69a0f26a52 Handle OfflinePlayer causes. 2014-08-22 18:04:01 -07:00
sk89q 8bb28b5ef1 Update Bukkit dependency on 1.7.9-R0.2. 2014-08-22 18:03:48 -07:00
sk89q a6118c3aa4 Unify debouncing method. 2014-08-22 17:30:18 -07:00
sk89q 59494233e3 Debounce interact events. 2014-08-22 17:21:49 -07:00
sk89q d0ff1815aa Made EventDebounce more reusable. 2014-08-22 16:52:34 -07:00
sk89q 9b7970475a Fix the SLEEP flag not checking the right bed material. 2014-08-22 16:26:43 -07:00
sk89q 88c0bdfffb Better handle disabling of the regions feature. 2014-08-22 16:18:05 -07:00
sk89q b43bc4a57a Debounce events for 10 seconds. 2014-08-22 16:10:22 -07:00
sk89q bd8e1a35f6 Add block place, block break flags. 2014-08-22 16:08:31 -07:00
sk89q 722dabcf1a Add item pickup flag and implement item drop flag through event abstraction. 2014-08-22 16:02:21 -07:00
sk89q 09207367c0 Use specific messages for denied item drop / pick up. 2014-08-22 15:45:05 -07:00
sk89q 3336b73536 Don't send too many "can't do this" messages at a time. 2014-08-22 15:43:03 -07:00
sk89q 0d7e3ad2de Add friendlier region deny messages. 2014-08-22 15:36:21 -07:00
sk89q 95d1bd8ee0 Debounce item pickup event. 2014-08-22 13:54:59 -07:00
sk89q 6c97e04c7c Use event abstraction for blacklist item pickup. 2014-08-22 13:45:55 -07:00
sk89q 24f72cb07f Make liquid flow checking for regions optional. 2014-08-22 13:37:02 -07:00
sk89q ef56a32f00 Implement PVP flag through abstraction. 2014-08-22 12:47:06 -07:00
sk89q d8da89703b Handle the TNT flag better in the new system.
Now the build flag works in tandem with the TNT flag.
2014-08-22 11:27:23 -07:00
sk89q e47c563ced Handle null flag values in the flag set command correctly. 2014-08-22 11:09:09 -07:00
sk89q bd0917d34b Add deny-message flag to adjust the region "don't have permission" message.
Also add color code parsing for the flag set command.
2014-08-22 03:37:33 -07:00
sk89q 8098211d01 Add Flag.getDefault(). Breaks StateFlag.getDefault() calls. 2014-08-22 02:19:31 -07:00
sk89q 83c95bbb8c Clear dirty flag if RegionManager.save() is used. 2014-08-22 02:08:59 -07:00
sk89q 4d4e1c6c26 Handle region data load / save failure more gracefully.
Also remove use of BoneCP and reorganize the classes.
2014-08-22 02:08:37 -07:00
sk89q 3045dc0293 Better handle failure conditions for background region saving. 2014-08-21 23:36:15 -07:00
sk89q e649973318 Revert "Don't use the region chunk has table until a threshold."
This reverts commit f57afb2944.
2014-08-21 22:49:53 -07:00
sk89q 2d147bb7e1 Change PriorityRTreeIndex to use the R-tree for intersection queries. 2014-08-21 22:47:46 -07:00
sk89q f57afb2944 Don't use the region chunk has table until a threshold. 2014-08-21 22:39:32 -07:00
sk89q 95052546a5 Remove use of Bukkit logger. 2014-08-21 22:22:28 -07:00
sk89q 768532cb8b Re-implemented region data migration. 2014-08-21 22:00:27 -07:00
sk89q 6b7e1286f2 Merge pull request #326 from parryjacob/master
Remove zml-repo from pom.xml as it longer resolves.
2014-08-19 20:11:17 -07:00
parryjacob 577cfd0954 Remove zml-repo from pom.xml as it failed to resolve anymore, causing Maven builds to have to wait for extended periods of time 2014-08-19 20:54:00 -04:00
sk89q 06df4585c2 Cleanup formatting of RegionProtectionListener. 2014-08-19 00:10:40 -07:00
sk89q 416006dbde Route XP drops through the event abstraction. 2014-08-18 23:56:39 -07:00
sk89q 5ff9f5c175 Reduce the number of internal events for EXPERIENCE_ORB. 2014-08-18 23:33:45 -07:00
sk89q fa14184eb4 Move PISTONS flag to RegionFlagsListener. 2014-08-18 23:32:37 -07:00
sk89q d29f66563b Add region support check in RegionProtectionListener. 2014-08-18 23:31:52 -07:00
sk89q 53957e7b26 Add Cause.getFirstBlock(). 2014-08-18 23:31:19 -07:00
sk89q 2c81cb2f84 Add isRegionSupportEnabled(World) to AbstractListener. 2014-08-18 23:31:09 -07:00
sk89q 711fe7ad2f Add Materials.isPistonBlock(). 2014-08-18 23:30:36 -07:00
sk89q f6f94571ea Handle pistons in the event abstraction. 2014-08-18 21:37:41 -07:00
sk89q 985629c196 Create RegionFlagsListener and rename some methods. 2014-08-18 19:15:40 -07:00
sk89q bb64079d17 Raise SpawnEntityEvent for BlockExpEvent. 2014-08-18 18:56:07 -07:00
sk89q c3363f0d70 Disable sponge simulation by default.
Vanilla Minecraft will have sponges again, plus it is uses up CPU time even if players can't get sponges.
2014-08-18 12:32:28 -07:00
sk89q 937a5758f7 Don't perform spatial queries for location->location checks until needed. 2014-08-18 11:26:02 -07:00
sk89q bb1826bdb1 Cache the set made in ApplicableRegionSet. 2014-08-18 11:04:36 -07:00
sk89q 1a781fc5b0 Try last ChunkState accessed in ChunkHashTable. 2014-08-18 10:57:02 -07:00
sk89q 039d174477 Reduce the number of BlockFromTo events handled. 2014-08-18 10:40:09 -07:00
sk89q 929f9e99cd Catch FileNotFoundException in YamlFileStore. 2014-08-18 10:39:53 -07:00
sk89q ae8bf63c86 Remove use of ObjectArrays.concat() in ApplicableRegionSet. 2014-08-18 03:05:06 -07:00
sk89q 3eb5c65a3d Throw IllegalArgumentException if trackParentCause() is given a Block. 2014-08-18 02:35:41 -07:00
sk89q 095f2aa67e Don't check region group if the flag value is null. 2014-08-18 02:32:05 -07:00
sk89q 0f10e89f7c Add getConfig() to AbstractListener. 2014-08-18 02:23:33 -07:00
sk89q 3a2b453e3f Change some collections and cache player names. 2014-08-17 20:17:52 -07:00
sk89q c43a24d78f Abandon TreeSet in ApplicableRegionSet for performance reasons. 2014-08-17 19:18:21 -07:00
sk89q d43eb3bc34 Optimize the query cache a bit. 2014-08-17 19:08:20 -07:00
sk89q 3ca147e405 Don't check metadata on Blocks in Cause.
We don't track causes on Blocks. There's no need for the performance hit.
2014-08-17 15:23:34 -07:00
sk89q 41fb8a0722 Implement Associables to handle non-player region membership checks. 2014-08-17 13:16:45 -07:00
sk89q ff3fa759d1 Don't throw an internal block break event when lighting TNT. 2014-08-17 00:49:50 -07:00
sk89q cab42af53b Reimplemented the quirks of the old flag code. 2014-08-17 00:49:32 -07:00
sk89q d9d665ab14 Add some extra tests to ApplicableRegionSetTest. 2014-08-16 21:09:12 -07:00
sk89q fac6ebef40 Implement new methods for accessing flags. 2014-08-16 21:09:01 -07:00
sk89q a4fd29c30c Switch SquirrelID version to 0.1.0. 2014-08-16 21:08:18 -07:00
sk89q 59c7197229 Fix Maven accessing dead repositories. 2014-08-16 21:08:17 -07:00
sk89q e7c9703ced Fix checkstyle issues. 2014-08-16 21:08:17 -07:00
sk89q 5a63115fb2 Don't make membership always override the BUILD flag anymore. 2014-08-16 21:08:17 -07:00
sk89q 4597849466 Allow __global__ BUILD to be set to DENY. 2014-08-16 13:55:54 -07:00
sk89q a35aaf9659 Force __global__ BUILD flag to NONE.
This is due to the legacy reason of the global region having not
been previously processed as a regular region.
2014-08-16 13:54:04 -07:00
sk89q bfb3f9e840 Change state flag defaults to true. 2014-08-16 13:45:16 -07:00
sk89q 91e34601ec Add supervisor/task library in. 2014-08-16 13:42:14 -07:00
sk89q 7481acba8c Updated FlagValueCalculator to treat global regions a lowest priority region. 2014-08-16 13:30:58 -07:00
sk89q 4d43ef5305 Change flags to use ALL as their region group. 2014-08-16 13:08:09 -07:00
sk89q b1fb143fd4 Add a new (unused for now) flag value implementation.
It supports region groups and fixes inconsistency issues.
2014-08-16 02:42:02 -07:00
sk89q d07e81288a Make the state flag test use a Predicate for membership testing. 2014-08-15 14:16:05 -07:00
sk89q c0d4ba5c6c Swap the if() in the state flag test to make it more readable. 2014-08-15 13:54:33 -07:00
sk89q 8a11752253 Fix a typo in ApplicableRegionSet and improve docs. 2014-08-15 12:41:28 -07:00
sk89q 1d24be8c34 Rewrite state calculation in ApplicableRegionSet to be easier to read. 2014-08-15 12:30:37 -07:00
sk89q d3f3489c7e Fix child regions not inheriting parent flags.
This also fixes a unit test.
2014-08-15 03:48:25 -07:00
sk89q 3f16fef57e Fix and improve protection handlers. 2014-08-15 01:43:37 -07:00
sk89q 608d782321 Activate debugging listener of the property "worldguard.debug.listener" is true. 2014-08-14 22:23:47 -07:00
sk89q 5d6dad4c6d Don't remove child regions without warning.
Also add some missing files.

Fixes WORLDGUARD-2311.
2014-08-14 21:41:44 -07:00
sk89q 28c538e981 Refactor region commands and make the necessary ones run in the background. 2014-08-14 21:24:32 -07:00
sk89q a35cb9277e Handle CommandException in WorldGuardPlugin.convertThrowable(). 2014-08-14 21:24:02 -07:00
sk89q e43ce420a3 Make UUID detection in DomainInputResolver reusable. 2014-08-14 21:23:26 -07:00
sk89q 501a7aa77a Add ProtectedRegion.copyFrom(). 2014-08-14 21:22:39 -07:00
sk89q 76f7ac8d8e Remove deprecation on getRegion() in RegionManager. 2014-08-14 21:22:15 -07:00
sk89q 518d5958c9 Update some region commands to run in the background. 2014-08-14 16:21:10 -07:00
sk89q 7e25de38da Update Javadocs in RegionContainer. 2014-08-14 15:20:08 -07:00
sk89q bf8ef39871 Handle null players in shim method of GlobalRegionManager. 2014-08-14 15:17:00 -07:00
sk89q cd62af698b Change listeners to use the region query cache. 2014-08-14 14:52:11 -07:00
sk89q 709ce9eb08 Fix a typo in some Javadocs. 2014-08-14 02:46:19 -07:00
sk89q e24d7ccb10 Change "don't have permission" message for regions. 2014-08-14 02:44:42 -07:00
sk89q 98bbd900cb Rename RegionQuery.testEnabled() -> testState(). 2014-08-14 02:39:42 -07:00
sk89q 19b87b628a Remove use of GlobalRegionManager in RegionProtectionListener. 2014-08-14 02:39:12 -07:00
sk89q dc2652f87b Implement an ApplicableRegionSet cache. 2014-08-14 02:33:57 -07:00
sk89q 99660920d7 Refactor region API with new RegionContainer object. 2014-08-14 01:24:38 -07:00
sk89q ad1c10a3e9 Reorganize Bukkit portion of the region API. 2014-08-13 14:06:37 -07:00
sk89q 5b685e71d3 Add ChunkHashTable.awaitCompletion(). 2014-08-13 07:51:13 -07:00
sk89q 5ddc4b9251 Properly convert chunk coordinates in ChunkHashTable. 2014-08-13 01:02:55 -07:00
sk89q 38587a1c61 Add a hash table index for regions that hashes on chunk coordinates. 2014-08-13 00:34:36 -07:00
sk89q eb23e28c16 Handle Tameable as a cause. 2014-08-12 23:17:36 -07:00
sk89q 4379c7e989 Handle Vehicle.getPassenger() as a parent cause. 2014-08-12 23:15:47 -07:00
sk89q 989ce82c5d Merge branch 'feature/event-abstraction' into feature/region-api-update 2014-08-12 19:49:52 -07:00
sk89q f92e55e061 Simplfy Cause objects. 2014-08-12 19:48:20 -07:00
sk89q 0fc3d21b90 Add abstracted event debugging listener. 2014-08-11 20:08:56 -07:00
sk89q 26d3645f86 Improve level of event listening. 2014-08-11 20:08:38 -07:00
sk89q 110aa2e56b Clean up docs / code for utility classes. 2014-08-11 17:54:55 -07:00
sk89q 05369b69b6 Reorganize classes into different packages. 2014-08-11 17:51:00 -07:00
sk89q 4a501a49db Abstract events for regions and blacklists further. 2014-08-11 17:48:40 -07:00
sk89q 2a69d1c7c9 Merge pull request #324 from Torm/master
Fix heal command for players with more health than 20
2014-08-10 21:03:28 -07:00
Torm 573204caad Fix heal command for players with more health than 20 2014-08-11 00:02:26 +02:00
sk89q 7a01168781 Rewrite region API. Migrations need to be re-implemented.
This commit, however, adds:

* Better support for background saves and loads.
* Periodical writes of region changes rather than explicit save() calls.
* Rewrite of the MySQL region code.
* Support for partial saves when using MySQL.
* Decoupling of region index implementations and RegionManager.

What still needs to be done includes:

* Background region modification operations (addmember, etc.).
* Unit tests to verify correctness of the partial saving.
* Migration support (to be re-added).
* Better handling when regions are failing to save.
* Testing of the /rg load and /rg save commands.
* Verification of how server shutdown / world unload is handled.
* Verification that thread-unsafe concurrent saves of data is not happening.
2014-08-08 20:28:49 -07:00
sk89q b5dfed9e01 Update for dependency package rename. 2014-08-02 23:35:12 -07:00
sk89q 29f804b9f0 Save YAML regions database to a temporary file before renaming. 2014-08-02 21:22:32 -07:00
sk89q 504fceceeb Remove /wg cancelall because it doesn't entirely work yet. 2014-08-02 21:19:05 -07:00
sk89q 9a852f4cbe Fix shutdown guard not working. 2014-08-02 21:08:11 -07:00
sk89q fafd3aba6a Implement UUID migration. 2014-08-02 21:03:17 -07:00
sk89q d87a335e85 Disable Flyway validation on migration. 2014-08-02 21:00:02 -07:00
sk89q 471b4496c9 Add task management and improve threaded code. 2014-08-02 18:38:18 -07:00
sk89q 32e39f5c7c Make some dependencies optional=true. 2014-08-02 11:25:27 -07:00
sk89q bf48361b10 Switch to Odeum for executors. 2014-08-02 11:24:25 -07:00
sk89q 387431c9c7 Remove both UUID and names from domains for removal commands. 2014-08-02 10:03:41 -07:00
sk89q 9b69c07663 Show name: for legacy names in region domains. 2014-08-02 09:53:35 -07:00
sk89q a1d59373ac Re-configure how libraries are shaded. 2014-08-02 09:49:52 -07:00
sk89q 81a727fe7f Add support for UUIDs in region commands. 2014-08-02 09:32:30 -07:00
sk89q 189fd15498 Close connections properly in MySQLDatabaseImpl.chooseWorldId(). 2014-08-01 22:32:13 -07:00
sk89q 1a602f2f8a Implement UUID saving/loading support for regions.
Also fix WORLDGUARD-3117.
2014-08-01 22:31:58 -07:00
sk89q 7986238936 Add migrations for region MySQL support. 2014-08-01 21:29:40 -07:00
sk89q a2fc9c94fd Fix NPE when a manager fails to load. 2014-08-01 20:02:50 -07:00
sk89q 51f98c9eb7 Reorganize MySQL region DB and added BoneCP as a dependency. 2014-08-01 19:19:48 -07:00
sk89q 418b8ff6a7 Add support for UUIDs in domains. 2014-08-01 17:36:56 -07:00
sk89q 9cab51dac8 Merge pull request #322 from zreed/master
Use table prefix when deleting from region_poly2d_point.
2014-07-29 21:00:41 -07:00
zreed 26ac987024 Use table prefix when deleting from region_poly2d_point. 2014-07-29 21:11:44 -04:00
sk89q e44875532d Fix NPE in BlacklistEntry due to recent refactor. 2014-07-28 21:02:15 -07:00
sk89q 956d1b4248 Add support for data values in the blacklist. 2014-07-28 16:45:43 -07:00
sk89q 3aa8bbe947 Fix .gitignore ignoring too many things. 2014-07-28 16:45:24 -07:00
sk89q f46b1cb138 Change use of integer IDs to "Target" objects in blacklist code. 2014-07-28 15:58:07 -07:00
sk89q 5b5022b0b8 Change blacklist repeated event tracking to use an expiring cache and cause names as keys. 2014-07-28 15:01:01 -07:00
sk89q d93c7fa09d Add on-dispense blacklist event. 2014-07-28 14:48:30 -07:00
sk89q 2c1d1ef0a3 Remove attachment check because it doesn't really make sense. 2014-07-28 14:45:05 -07:00
sk89q bf97e41697 Rewrite blacklist code. 2014-07-28 14:38:43 -07:00
sk89q c0852d63fe Add asynchronous region load/save for YAML databases.
These changes are intentionally limited so as to maintain backwards
compatibility with existing plugins using WG's API.

Some data structures were changed to CopyOnWrite to ensure thread
safety and the map of regions was changed to a ConcurrentHashMap.

Currently, saving requires making a copy of the regions map which can
cause a delay of a few milliseconds on large data sets.
2014-07-24 18:49:40 -07:00
sk89q acc39e11b1 Handle null causes by skipping them. 2014-07-24 17:38:18 -07:00
sk89q b4880ae982 Modularize potion blocking via the configuration. 2014-07-24 16:08:30 -07:00
Wyatt Childers 1a1acae588 Slight performance optimization to the movement checks to improve performance with slow permissions plugins 2014-07-23 22:26:34 -04:00
sk89q 1581390092 Add unit test to test global command blacklist with region command whitelist. 2014-07-21 19:52:27 -07:00
sk89q cd221ea19c Refactor command filter into a unit tested class.
Also adds support for regex \s as the subcommand delimiter.
2014-07-21 19:36:25 -07:00
sk89q abeab91be4 Add messages warning about auto-god mode and auto-amphibious mode. 2014-07-18 18:39:49 -07:00
sk89q 227f54d315 Remove extraneous file. 2014-07-13 15:11:53 -07:00
sk89q ac88367f6c Handle null custom flags registered by third-party plugins.
See WORLDGUARD-3094.
2014-07-13 02:23:04 -07:00
sk89q f788f0e0d9 Add internal.check-attached-blocks option to check attached blocks.
This does not check the other way yet (i.e. check if other blocks depend
on the block in question).
2014-07-12 21:14:26 -07:00
sk89q 9a4bc70cdd Added basic abstracted events. 2014-07-12 20:59:33 -07:00
sk89q ab46fd6244 Add Guava and jsr305 to dependencies. 2014-07-12 19:38:30 -07:00
sk89q 6deafa660d Cleanup code and add checkstyle configs from WorldEdit. 2014-07-12 19:31:43 -07:00
sk89q 0d2adc5707 Add more detail error messages when parsing regions file. 2014-07-11 13:20:42 -07:00
Albert Pham b0ed119585 Merge pull request #263 from kukelekuuk00/patch-1
Add some command aliases to RegionMemberCommands
2014-07-06 15:55:43 -07:00
sk89q ff2462b084 Removed initial AUTO_INCREMENT values from region_storage.sql
The MySQL code in WG makes my eyes bleed.
2014-07-06 15:38:25 -07:00
sk89q 894a42ea13 Merge pull request #316 from zreed/sqltableprefix 2014-07-06 15:37:26 -07:00
sk89q d827e01760 Merge pull request #313 from TheCutter/master 2014-07-06 15:09:51 -07:00
sk89q 5e6de8b76d Added runtime CraftBukkit dependencies. 2014-07-06 15:03:22 -07:00
sk89q b298bedea0 Set saturation level to food level with feed flag. 2014-06-26 17:47:14 -07:00
TomyLobo fb5ae838d9 Merge pull request #315 from eswick/master
Convert region ID to lowercase when saving polygon points to MySQL database.
2014-06-23 19:14:47 +02:00
eswick 3bfcd69fd9 Convert region ID to lowercase when saving polygon points to MySQL database. Check number of points in polygonal region before registering it.
When saving the points of a polygonal region to a MySQL database, the region ID was not converted to lowercase. If a region ID contained a capital letter, upon reload no points would be found, causing an out-of-bounds exception and essentially leaving WorldGuard unuseable.
2014-06-22 14:13:45 -04:00
Wizjany c66adf0119 Removed sensitive info from reports. 2014-06-17 23:24:13 -04:00
TheCutter 2119b274fd Merge branch 'master' of https://github.com/sk89q/worldguard 2014-06-14 21:36:06 +02:00
wizjany 22f45c45ee Apply obsidian generator disabling to tripwire. 2014-05-07 13:09:06 -04:00
wizjany 0dd9729b35 Fixed logic error in blocked-cmds for real this time.
Closes WORLDGUARD-3050.
2014-04-29 12:01:38 -04:00
wizjany ff46c2cf54 Fixed logic error in blocked-cmds checkings.
Closes WORLDGUARD-3048.
2014-04-26 11:31:24 -04:00
TheCutter 1537fc879e fixed indenation 2014-04-19 15:53:15 +02:00
TheCutter f00352cde0 updates comments 2014-04-19 11:03:03 +02:00
TheCutter fdc74b1c0d fixing syntax for guideline 2014-04-18 20:21:48 +02:00
TheCutter 83a3c61b66 fixed memory leak with closing mysql resources 2014-04-18 20:10:32 +02:00
wizjany 4422d536b7 Fixed a compilation error due to a sort-of-but-not-really-breaking bukkit change. 2014-02-28 21:21:00 -05:00
wizjany 1f40908c04 [maven-release-plugin] prepare for next development iteration 2014-02-28 20:03:38 -05:00
wizjany b707289284 [maven-release-plugin] prepare release 5.9 2014-02-28 20:03:35 -05:00
wizjany 43486bda63 Fix versioning error for release 2014-02-28 20:01:37 -05:00
sk89q 7086a1d0d2 Prepared release of v5.9. 2014-02-28 16:45:09 -08:00
TomyLobo 4dd13bd925 Merge pull request #310 from jmhertlein/master
Fixed ProtectedCuboidRegion::getPoints() returning points in wrong order

Fixes com.sk89q.worldguard.protection.regions.RegionIntersectTest.testIntersection.
2014-02-28 08:19:30 +01:00
TomyLobo 4ce97bca0e Added a unit test for ProtectedRegion.intersectsEdges. 2014-02-28 00:48:40 +01:00
Joshua M Hertlein ec9712f30e Fixed ProtectedCuboidRegion::getPoints() returning points in wrong order
ProtectedPolygonRegion returns points in an order such that you could play "connect the dots" and end up with the correct polygon. ProtectedCuboidRegion returns them in an order such that playing connect the dots gives you a Z shape. This breaks the intersectsEdges() function in ProtectedRegion when comparing cuboids. This commit causes ProtectedCuboidRegion::getPoints() to return them in an order consistent with ProtectedPolygonRegion, which makes intersectsEdges() work correctly.
2014-02-25 13:51:57 -06:00
Albert Pham 0162910964 Added <distributionManagement> to pom.xml 2014-02-23 22:26:36 -08:00
TomyLobo c252a79c1a Copied some .gitignore entries from WorldEdit. 2014-02-10 08:52:29 +01:00
Luke Anderson (stuntguy3000) 89739d4efe Change Resume to Continue 2014-01-27 10:51:35 +10:30
Luke Anderson (stuntguy3000) 9c7fb6a1d3 Changed halt-activity: Added Silent (s) and Information (i) flags, Added Resume (r) flag, remove c flag. 2014-01-26 12:56:59 +10:30
wizjany 2df3290d38 Fixed snowman trails being treated as snow fall. 2014-01-11 16:08:26 -05:00
wizjany 4805df2f03 Fix being able to use bonemeal to turn tall grass into double plants. 2014-01-08 14:56:59 -05:00
wizjany 5bc670db8b Fixed CI link in readme. 2014-01-08 14:56:58 -05:00
Wizjany ffda88f193 Fix number of args for migratedb command. 2013-12-14 17:21:07 -05:00
Dark Arc 96a69aa2ef Resolved an issue where explosions of type OTHER_EXPLOSION were ignoring the world config settings 2013-12-11 00:53:49 -05:00
wizjany 2d90fddbee Check for entities and projectiles removing items from frames too. 2013-12-09 17:46:33 -05:00
wizjany bbd1a0ef10 Protect items in item frames in protected regions. 2013-12-09 08:40:28 -05:00
TomyLobo 6b16ed79b3 Merge pull request #298 from md-5/herd_u_like_ifs
Using checked exceptions for control flow is slow. Lets replace it with an isEmpty check.
2013-12-09 00:28:16 -08:00
md_5 73b9a7fb0d Using checked exceptions for control flow is slow. Lets replace it with an isEmpty check. 2013-12-09 19:22:48 +11:00
wizjany 4a0ae833f0 Revert WE dependency to 5.5.8.
WorldGuard didn't use any new API since then,
so depending on an unstable snapshot wasn't necessary.
2013-11-18 15:30:17 -05:00
wizjany 5f32ebe2de Fix compile-time error due to 23766f20 2013-11-17 21:16:51 -05:00
Albert Pham 723928d239 Merge pull request #289 from sk89q/develop
Tiny changes extracted from various branches.
2013-11-17 15:03:19 -08:00
TomyLobo d024ed7b81 typos, unused imports 2013-11-17 23:59:02 +01:00
TomyLobo ec4143d3dc Bumped WE dependency to 5.5.9-SNAPSHOT. 2013-11-17 23:48:19 +01:00
TomyLobo 071fdaabd3 Added *.iml and .idea to .gitignore. 2013-11-17 23:48:18 +01:00
TomyLobo 23766f20dd Transformed the BlockFadeEvent handler into a switch. 2013-11-16 17:35:35 +01:00
TomyLobo 31739c647b Dissolved a .* import.
Rationale: grepping for qualified class names
2013-11-16 17:35:35 +01:00
Dark Arc faa016180a Added a config option to allow explosion flags to only prevent block
damage
2013-09-22 15:39:10 -04:00
wizjany e26238e814 Added formatting codes, &k/l/m/n/o and &x (reset). 2013-08-31 10:07:46 -04:00
wizjany f8ed1a3e3e Make /rg list default to own regions if the player doesn't have permission otherwise. 2013-08-27 23:36:01 -04:00
Wizjany d47c255168 Check bypass perms for item-drop flag. 2013-08-20 17:03:00 -04:00
wizjany d1e7796f81 Added allow-tamed-spawns setting, on by default.
This will stop WorldGuard from culling tamed animals
in regions with mob-spawning deny when they log in
with their owner.
2013-08-20 14:58:46 -04:00
Wizjany 1095064c5e Update CommandBook dependency to 2.3. 2013-08-18 23:32:51 -04:00
wizjany a15c9d289b There have been bigger non-backwards-compatible changes since. 2013-08-18 18:48:31 -04:00
wizjany c0f95bebf0 Send item-use blacklist event when right-clicking entities. 2013-08-16 13:17:28 -04:00
wizjany 0a54779fc4 Added snow-fall-blocks option to config to restrict snow fall to certain blocks 2013-08-12 18:09:45 -04:00
wizjany ac525958c5 Added config option and flag to prevent soil from drying naturally. 2013-08-12 18:06:31 -04:00
wizjany 458cf64501 Fixed addowner/addmember commands adding command artifacts.
Specifically, "-w <world>" will no longer be added when using it.
This requires WorldEdit with commit cd5f832 or newer.
Additionally fixed a typo: DefaultDomain.removaAll -> removeAll.
2013-08-03 09:46:29 -04:00
wizjany 4acef77623 Fixed milking cows in protected areas.
It seems that Bukkit changed the return of the bucket/itemstack
methods in the event, causing WG to think a different bucket was used.
2013-07-30 11:14:59 -04:00
TomyLobo d38d7fc492 Changed entity report format slightly.
This makes it clearer to users what that floating point number means.
2013-07-30 12:15:28 +02:00
wizjany 2510c3eeb5 Allow players to add newlines (\n) via command, not just manually in yml. 2013-07-25 13:10:16 -04:00
wizjany 326d53fd09 Allow the console to load/save all region managers with one command. 2013-07-25 10:12:03 -04:00
sk89q 75b3082b12 [maven-release-plugin] prepare for next development iteration 2013-07-16 11:07:26 -07:00
sk89q 1f214aadee [maven-release-plugin] prepare release 5.8 2013-07-16 11:07:06 -07:00
sk89q 174b3fad15 Updated Maven release plugin to 2.4.1. 2013-07-16 10:45:44 -07:00
sk89q 07531f67d4 Updated org.bukkit:bukkit dependency to 1.6.2-R0.1-SNAPSHOT. 2013-07-16 10:35:30 -07:00
sk89q 291c45064a Bumped version to 5.8-SNAPSHOT, updated CHANGELOG.txt. 2013-07-07 12:28:57 -07:00
sk89q 6f56cb29a5 Fixed -w flag for /rg load and /rg save. 2013-07-07 12:14:41 -07:00
sk89q 977c7d2f29 Changed DoubleFlag and IntegerFlag to take java.lang.Number objects in unmarshal(). 2013-07-07 11:45:22 -07:00
sk89q ecb87efe8d Update Bukkit dependency to version 1.6.1-R0.1-SNAPSHOT. 2013-07-07 11:42:24 -07:00
sk89q a57c162cd8 Convert heal flags datatype from integer to double.
Existing data should be cast with no data loss.
2013-07-07 11:38:03 -07:00
wizjany 60c3ed4f6b Polish the fix from the last commit and straighten some other multiworld issues in the move handler. 2013-06-23 20:17:20 -04:00
wizjany 714e75eb95 Potential fix for broken multiworld states. 2013-06-23 16:35:57 -04:00
Wizjany 636819c801 Revert change to permissions node for flags.
region.flag.own/member/etc was region.flag.regions.own/member/etc
This shouldn't be changed in between, especially if we maintain compatibility with the other flag node (flag.flags).
2013-06-20 00:52:59 -03:00
wizjany 9a6c2e0685 Finish reverting changes from earlier 2013-06-10 23:12:06 -04:00
wizjany 736eecc13b Add config option to use player teleports for move events.
Additionally removed code duplication in Vehicle listener.
2013-06-08 12:04:58 -04:00
TomyLobo 4718c5dab0 Removed unused imports. 2013-06-07 14:06:07 +02:00
Albert Pham 7e9bd49da2 Added mobs.disable-snowman-trails. 2013-06-02 13:23:01 -07:00
wizjany a0d0ff0b92 Lighter changes in BlockIgnite as well 2013-06-02 11:19:12 -04:00
wizjany b41be0c319 Added a static WorldGuardPlugin instance and made the utility methods in RegionCommands static. 2013-06-01 18:14:59 -04:00
wizjany 17a466059e A few changes in the new region commands.
- Allow setting flags on the global region (bugfix)
- Don't throw permissions errors when listing available flags (bugfix)
- Info command defaults to global region if no others are present (enhancement)
- A few typo and spacing fixes (enhancement)
2013-06-01 17:39:49 -04:00
wizjany 2d9e95a63e Revert lighter changes for now. This brings back the odd behaviors between flint & steel and fire charges, but makes it more intuitive for protection. 2013-06-01 10:14:56 -04:00
Albert Pham 532a45f9e7 Offering a sacrifice to the gods of pedantry. canX() -> mayX() for permissions. 2013-05-31 22:06:37 -07:00
Albert Pham d61e32ebb5 Cleaned up RegionCommands, abstracted region permissions. 2013-05-31 21:56:32 -07:00
Albert Pham b7d38e94c8 Added -a flag to region remove owner/member commands to remove all. 2013-05-29 13:24:40 -07:00
wizjany ae158742f6 [maven-release-plugin] prepare for next development iteration 2013-05-26 17:20:00 -04:00
wizjany c35686f8d1 [maven-release-plugin] prepare release 5.7.5 2013-05-26 17:20:00 -04:00
wizjany a5b6651582 Update CHANGELOG for 5.7.4 and 5.7.5 2013-05-26 17:10:35 -04:00
wizjany 54973fdf82 Large patch with lots of changes and fixes.
- Unified movement checking. Teleporting is now handled by
  entry/exit flags. Additionally, a region movement event is
  much closer to being added.
- Fixed an issue with enderpearls and exit/entry flags conflicting.
- Fixed a null check issue in several commands.
- Fixed allowed and blocked command flags making false matches and
  improved support for blocking/allowing specific command args.
2013-05-26 17:08:51 -04:00
wizjany 0bee631385 Use getName instead of toString for displaying world name. 2013-05-15 07:56:04 -04:00
wizjany 6283382837 Fixed a few movement flag related issues.
WG no longer prefixes greeting/farewell flags with '**', allowing people to customize the message.
(Adding &c** to the beginning of the message will give previous behavior)
Removed the "game mode locked" message since it returns false gamemodes when being called inside a player move event.
2013-05-05 10:57:46 -04:00
Silthus 39bb522051 Fixes heal flag bugs when player.maxHealth > 20
With the new Bukkit Changes the Player Health can be above 20, this fixes the magic number by using the now built in Bukkit functionality.

Examples of this bug were Health jumping to 1/20 hearts when having a heal-amount: -1
2013-05-04 11:47:43 +03:00
wizjany bf80d57abe Add fishing to xp blocker. 2013-04-21 08:59:24 -04:00
wizjany 865b94006a Apply other-explosion flag to entity damage as well. 2013-04-09 17:23:56 -04:00
wizjany 874248f8b5 Fix other explosion flag only clearing blocklist 2013-04-09 12:25:05 -04:00
steffen cef7d5bb12 Fix explosion check order
If the explosion is blocked and the block damage is also blocked, it's necessary to block the explosion (which includes the damage) instead of just the block damage.
2013-04-01 18:34:11 -04:00
wizjany 2a8131780f Don't ignore canceled air right click events.
Apparently Bukkit pre-cancels them even if they would do something.
2013-03-31 19:13:05 -04:00
Wizjany 7094f70f4a Remove duplicate check. (derp) 2013-03-31 19:13:04 -04:00
wizjany df5af6129c Improved lighter handling. 2013-03-23 21:10:30 -04:00
wizjany a6888c3767 Respect LIGHTER flag for ignition build checks 2013-03-23 15:19:56 -04:00
wizjany 1bd367ddde Fix one last witherskull/fireball conflict 2013-03-22 19:28:18 -04:00
wizjany 0cf87ae561 Allow cow milking in no-build areas 2013-03-22 15:35:30 -04:00
wizjany fa80f5f67f Fix infinite durability.
For whatever reason, the Bukkit API thinks that 'Durability" and "Damage"
are synonymous.
2013-03-18 13:25:11 -04:00
sk89q 7f080f920d [maven-release-plugin] prepare for next development iteration 2013-03-16 22:17:14 -07:00
sk89q 13658323b4 [maven-release-plugin] prepare release 5.7.3 2013-03-16 22:16:51 -07:00
sk89q 2d440ab5ba Cleaned up pom.xml. 2013-03-16 22:01:14 -07:00
sk89q dc55673691 Updated changelog for 5.7.3. 2013-03-16 21:12:26 -07:00
wizjany 92bb3948a6 Fix for minecart naming 2013-03-16 21:47:31 -04:00
wizjany f67ad6478c [maven-release-plugin] prepare for next development iteration 2013-03-15 16:01:09 -04:00
wizjany 1d984198ce [maven-release-plugin] prepare release 5.7.2 2013-03-15 16:01:02 -04:00
wizjany f2ca980771 Update changelog to 5.7.2 2013-03-15 15:44:48 -04:00
wizjany b826697aea Add flag check to smelting/mining xp handling 2013-03-15 15:44:34 -04:00
wizjany 89430c13ec Handle TNT Minecarts with tnt flag/settings. 2013-03-15 15:32:57 -04:00
Wizjany f07acea3e1 Updated to MC 1.5 2013-03-15 14:42:20 -04:00
wizjany e9402c55e6 Fixed a bunch of small bugs 2013-03-14 18:45:05 -04:00
wizjany 2eb6c76da8 Fix stack issue. 2013-03-13 14:38:28 -04:00
Wizjany a34e48a145 Added unit test for entry and exit flags to put the matter to rest.
Also cleaned up a few other things regarding tests.
2013-03-01 22:20:16 -05:00
Wizjany 2d50659b48 Apply exp flag and config setting to xp bottles.
"Workaround" for not being able to blacklist exp bottles at the moment.
Although I supposed I could have just fixed that instead, this allows more flexibility.
2013-02-21 10:20:47 -05:00
Wizjany 327ae2b807 Apply crop trampling setting to all entities. 2013-02-21 10:13:17 -05:00
Luuk Jacobs e831b7facc Add some command aliases to RegionMemberCommands 2013-02-19 10:24:35 +01:00
Wizjany dfb6114584 Fix a few wolf issues 2013-01-31 08:23:38 -05:00
Wizjany 5085841d9d [maven-release-plugin] prepare for next development iteration 2013-01-30 16:26:26 -05:00
Wizjany 7a98944469 [maven-release-plugin] prepare release 5.7.1 2013-01-30 16:26:20 -05:00
Wizjany 3d2b455cda Update changelog for 5.7.1 2013-01-30 16:21:55 -05:00
Wizjany 460d5d0691 Made wolves respect pvp stuff. Removed some extraneous code. 2013-01-30 15:27:52 -05:00
Wizjany b5f80351ec Allow a lot of commands to be sent from the console.
Examples:
 /rg addmem <id> <player> -w <worldname>
 /rg flag <id> <flag> -w <worldname> <flagvalue>
 /rg remove <id> -w <worldname>
Command blocks are currently untested.
List of commands: flag, priority, parent, remove,
 addmember, removemember, addowner, removeowner
2013-01-30 14:45:29 -05:00
Wizjany 72a9472a57 Add vine growth flag and config option. 2013-01-30 14:02:45 -05:00
Wizjany 7eb820c688 Fixed bug where players could place beds on the borders of regions without permissions 2013-01-30 13:47:48 -05:00
Wizjany 886b279da6 Bugfixes for bonemeal and minecarts. 2013-01-27 22:43:29 -05:00
Wizjany f2d7135fc5 Check shooter of projectile when one hits a hanging entity 2013-01-25 21:07:11 -05:00
Wizjany d214a859c3 Check the block that the item frame will end in, not the block the player clicked. 2013-01-21 04:08:17 -05:00
Wizjany d1e221c2b7 Don't cancel explosion if we only want to clear blocklist. May potentially cause issues with multiple settings overlapping. 2013-01-19 08:46:51 -05:00
Dark Arc e0e4207a4d Apply a cap to the health and hunger flags to prevent possible exceptions
If a player's health or hunger is set to higher than its respective maximum CraftBukkit will throw exceptions.
2013-01-16 14:48:39 -05:00
Wizjany 4398c781c5 Wither skulls should be handled separately from fireballs 2013-01-15 18:23:53 -05:00
Wizjany 3e06000fd9 Workaround for CraftBukkit bug with slab placement 2013-01-15 16:06:42 -05:00
Wizjany 833795ebe1 Add enderchest and anvil to blacklist inventories. 2013-01-14 13:31:54 -05:00
Wizjany 6e270d5ec3 Setting summary-on-start to false reduces much more clutter now 2013-01-13 17:21:51 -05:00
Wizjany 09a9bea3a7 Move enderchest to use flag 2013-01-13 16:10:06 -05:00
Wizjany 035ccee2a6 Fixed placing stuff in flower pots. (derp) 2013-01-13 13:44:54 -05:00
Wizjany 17aa2a4153 Fix region teleport permission 2013-01-13 06:13:41 -05:00
Wizjany f5bc5c0b47 That was not in there 2013-01-13 03:48:11 -05:00
Wizjany e7a4afde7d [maven-release-plugin] prepare for next development iteration 2013-01-13 03:08:17 -05:00
Wizjany 8758c9b940 [maven-release-plugin] prepare release 5.7 2013-01-13 03:08:13 -05:00
Wizjany a569d20779 Remove max players flag for now.
There are currently too many unhandled circumstances
which can easily break this flag such as players
entering region in weird ways (teleporting, falling,
logging in) and states changing. It is also horribly
inefficient at the moment.
2013-01-13 02:34:34 -05:00
Wizjany 88e01fa083 Fix enderpearl flag properly 2013-01-12 11:39:59 -05:00
Wizjany 7b435f9283 Added changelog for 5.7. Incremented version in pom.xml. 2013-01-12 00:25:55 -05:00
Wizjany a240e5d128 Added config option to block zombies from breaking down doors 2013-01-12 00:25:55 -05:00
Wizjany 0d0ba31d3a Fixes for tripwire, flower pots, wooden buttons, ender chests, and sneaking 2013-01-12 00:25:54 -05:00
Wizjany e79bb3533d Fireball flag should block blaze fireball ignition too now 2013-01-12 00:25:54 -05:00
Wizjany f94c4ec831 Mob damage setting/flag blocks poison DoT 2013-01-12 00:25:54 -05:00
Wizjany d5afb76105 Added config setting and flag to block explosions by plugins. 2013-01-12 00:25:53 -05:00
Wizjany dd7e9ba05e Add enderpearl flag to prevent players from teleporting to/from regions with enderpearls 2013-01-11 18:21:20 -05:00
Wizjany ee54698fdb Fix players being able to plant cocoa beans in protected areas 2013-01-11 17:54:29 -05:00
Wizjany 955b0e991c Added MAX_PLAYER and MAX_PLAYER_MESSAGE flags
Allows setting maximum number of players in a region
and sends a message if a region is at capacity.
2013-01-11 17:09:15 -05:00
Dilandau c1b98b9e40 Decrease call to PluginManager in WGBukkit
If WorldGuard is already found we bypass the call to
the PluginManager and use a cached version.
2013-01-11 16:16:49 -05:00
Dark Arc d6939b7916 Allow EnderPearls to damage the player who threw them in no-pvp areas 2013-01-02 19:46:41 -05:00
Dark Arc 5f0ca37879 Add support for blocking sub commands 2013-01-02 19:03:22 -05:00
Wizjany 548bdb7eb5 Attempt to fix item frame issues 2012-12-31 17:03:14 -05:00
Wizjany 5c85f39228 Block snowballs in pvp regions again. Reverts 671fd58568 2012-12-30 15:11:19 -05:00
Wizjany 85b2cbc03a Null check for entity explosions without an entity. 2012-12-29 11:46:24 -05:00
Wizjany cc78011da6 Build on latest Bukkit snapshot. Closes WORLDGUARD-2381
Fixes EntityChangeBlockEvent errors. Note that 1.4.5-R0.3-SNAPSHOT means build 2505+ and that there ARE 0.3 snapshots below 2505. Thus, this should be treated as temporary and changed on the next Bukkit Beta.
2012-12-29 11:46:14 -05:00
Dark Arc d016da1895 Resolves WORLDGUARD-2316 TNT still lethal when its damage is disabled 2012-11-24 02:42:28 -05:00
Dark Arc 8593f1c80a Resolves WORLDGUARD-2352 Anvils usable despite the use flag 2012-11-24 02:25:59 -05:00
Dark Arc 0b3c40dc3e Implements WORLDGUARD-2315 Enderdragon portal blocking 2012-11-24 02:17:34 -05:00
sk89q 2e7ecc59c0 Fixed typo where BEACON was COMMAND_BLOCK instead. 2012-11-11 19:08:31 -08:00
sk89q 942ce95dbf Fixed #WORLDGUARD-2297, Beacons are not protected in regions. 2012-11-11 18:45:55 -08:00
sk89q 03f77d5ab7 Fixed #WORLDGUARD-2296, Recent fix for dragon eggs in regions not working for left click. 2012-11-11 18:43:34 -08:00
sk89q 8dec32fa6a Added workaround for #WORLDGUARD-2299, java.lang.IllegalArgumentException: Instant potions cannot be extended. 2012-11-11 18:41:18 -08:00
sk89q 8f409d47d9 Fixed #WORLDGUARD-2289, FlagStateManager is not thread synced with the main thread. 2012-11-11 18:36:08 -08:00
sk89q 93f062d4e3 Hey, we have a mailing list now! Subscribe! https://groups.google.com/d/forum/sk-dev-discuss 2012-11-07 13:00:44 -08:00
Dark Arc b8f9ceafbb Resolves comma issue relating to flag listing
This stops commas from being added when a player types in an invalid flag and the player does not have permission to use one or more of the flag that are listed.
2012-11-07 14:20:44 -05:00
sk89q 75d07b6dad [maven-release-plugin] prepare for next development iteration 2012-11-07 09:19:50 -08:00
sk89q 6060a0a430 [maven-release-plugin] prepare release 5.6.5 2012-11-07 09:19:35 -08:00
sk89q 647ba1572c Updated CHANGELOG.txt for 5.6.5. 2012-11-07 09:10:20 -08:00
sk89q 051e0cb811 Fixed regression bug cause item frames and paintings to not be protected. 2012-11-07 09:07:38 -08:00
sk89q b8c9e78910 [maven-release-plugin] prepare for next development iteration 2012-11-06 20:39:09 -08:00
sk89q 2d7d9c6093 [maven-release-plugin] prepare release 5.6.4 2012-11-06 20:38:50 -08:00
sk89q 0f32f56208 Updated CHANGELOG.txt for 5.6.4. 2012-11-06 20:35:18 -08:00
sk89q 5addfd8975 Added security.deop-everyone-on-join and security.block-in-game-op-command. 2012-11-06 20:32:15 -08:00
sk89q 7f108ce8f0 Changed dragon eggs to be checked like it is a broken block in regions. 2012-11-06 20:19:16 -08:00
sk89q 8c883e1ca8 WGBukkit is not supposed to be there. Now in com.sk89q.worldguard.bukkit. 2012-11-06 19:26:05 -08:00
sk89q d18fe6ffa0 Worked around bug with water potions causing errors. 2012-11-06 19:21:12 -08:00
sk89q 80a8ac9e98 Added mobs.block-above-ground-slimes to block slimes spawning naturally above ground (in swamps). 2012-11-06 18:49:32 -08:00
Dark Arc 671fd58568 Stop snowball blocking 2012-11-06 18:59:08 -05:00
Dark Arc c4ea3b59f0 Resolve WORLDGUARD-2281, for Dispensers 2012-11-06 18:44:36 -05:00
Dark Arc 5d5def206d Actually corrected Javadoc 2012-11-06 18:07:26 -05:00
Dark Arc b2ebbb9b55 Corrected Javadoc 2012-11-06 18:04:22 -05:00
Dark Arc 3734c071bf Fixes WORLDGUARD-2281, NPE on Water Potion Drinking
This resolves the issue where WorldGuard would throw a NullPointerException when a player drank a potion of water while potion blocking was enabled.
2012-11-06 18:01:13 -05:00
sk89q b1a419f2a2 [maven-release-plugin] prepare for next development iteration 2012-11-05 12:40:01 -08:00
sk89q bf5e292160 [maven-release-plugin] prepare release 5.6.3 2012-11-05 12:39:46 -08:00
sk89q df57d91270 Possibly fixed the ladder setting. 2012-11-05 12:28:40 -08:00
sk89q 4da1741578 kekekeke forgot static in WGBukkit's methods. 2012-11-05 12:22:04 -08:00
sk89q 7a3774e730 Updated CHANGELOG.txt for 5.6.3. 2012-11-05 12:20:13 -08:00
sk89q e6e21caeea Added helper WGBukkit class to get references to WorldGuard in other Bukkit plugins. 2012-11-05 12:12:25 -08:00
sk89q 200d47ab09 Added physics.vine-like-rope-ladders to make ladders work like vines. 2012-11-05 11:32:40 -08:00
sk89q ab274151d4 Potential fix for WORLDGUARD-2263, mobs.block-{item-frame,painting}-destroy not working. 2012-11-05 11:27:35 -08:00
sk89q aec1e3a529 Fixed NPE in PlayerInteractEvent due to potion blocking. Fixes WORLDGUARD-2269. 2012-11-05 11:09:14 -08:00
sk89q 916caa1eb2 [maven-release-plugin] prepare for next development iteration 2012-11-04 14:49:50 -08:00
sk89q 50b29f8ad6 [maven-release-plugin] prepare release 5.6.2 2012-11-04 14:49:35 -08:00
sk89q 88d662cf27 Updated CHANGELOG.txt for 5.6.2. 2012-11-04 14:48:30 -08:00
sk89q 5316130ae8 Better handle potion blocking with dispensers/splash potions. 2012-11-04 14:46:36 -08:00
sk89q 4f36dbc636 [maven-release-plugin] prepare for next development iteration 2012-11-04 13:48:25 -08:00
sk89q 230a8697bf [maven-release-plugin] prepare release 5.6.1 2012-11-04 13:48:08 -08:00
sk89q 121449b230 Updated changelog for 5.6.1. 2012-11-04 13:44:52 -08:00
sk89q fede549b51 Added gameplay.block-potions. 2012-11-04 13:42:55 -08:00
sk89q 1bdd7f9a6b Fixed a tab issue with WorldGuardBlockListener due to the mycelium commit. 2012-11-04 13:12:06 -08:00
sk89q b3f9da67b7 Changed version to 5.6.1-SNAPSHOT. 2012-11-04 13:06:35 -08:00
sk89q 1ba7d623b4 Adds null check in EntityExplodeEvent's handler, fixing WORLDGUARD-2267. 2012-11-04 13:05:25 -08:00
Gabriel Harris-Rouquette 47902e1177 Added mycelium-spread flags. 2012-11-03 15:31:16 -07:00
sk89q a035bcc671 [maven-release-plugin] prepare for next development iteration 2012-11-03 12:38:06 -07:00
sk89q 9bcc6b9605 [maven-release-plugin] prepare release 5.6 2012-11-03 12:37:52 -07:00
sk89q 282c3a864e Updated CHANGELOG.txt for 5.6. 2012-11-03 12:15:43 -07:00
sk89q eb083a8934 Updated README.html to mention the moved spawn-protection setting, added more explanations. 2012-11-03 12:15:43 -07:00
sk89q 0fc71ff79e Note the issue tracker in README.html. 2012-11-03 12:15:43 -07:00
sk89q 68a7455496 Added backwards compatibility for versions below MC1.4. 2012-11-03 12:15:43 -07:00
Dark Arc fcfc3acbb8 Improved Performance of some operations
Replaced quite a few whiles and fors with for-eachs giving a performance gain. Also fixed a few issues with the MySQLDatabase and made several other minor improvements.
2012-11-03 00:19:40 -04:00
sk89q aa53c0aa6a We have a new issue tracker. 2012-11-02 18:15:02 -07:00
Dark Arc f098905a92 Fixes WORLDGUARD-2205
Mob Damage from projectiles is now properly blocked in regions where applicable.
2012-11-02 21:07:38 -04:00
Dark Arc eec78092b5 Allow damage to be less than 1
This resolves problems with mods that use fake damage events to check with WorldGuard what's going on.
2012-11-02 20:57:24 -04:00
sk89q 34fa5eceb8 Fixed WORLDGUARD-2255, where region.getId() was lowercase'd each pass of a for loop in MySQLDatabase.updatePoly2dPoints(). 2012-11-02 14:13:53 -07:00
Dark Arc c32d2dd6f8 Fixes WORLDGUARD-2254
Players will now be told that they are in a no-PvP area if they are in one and attempting to attack someone, or that the player they are attacking is in a no-PvP area, if that is the case instead.
2012-11-02 17:06:35 -04:00
Dark Arc da80d3536a Fixes WORLDGUARD-2253
Players who are not in god mode will once again receive damage in PVP areas from Ender Pearls.
2012-11-02 17:06:33 -04:00
sk89q e9361022d2 Protected against using (right-clicking) paintings and item frames. 2012-11-02 13:41:53 -07:00
sk89q dd0c1a5ab5 Fixed Withers still breaking blocks if they smash their bodies into them. Fixes WORLDGUARD-2245. 2012-11-02 12:20:59 -07:00
Wojciech Stryjewski bb9dff7b8c Deleting a region flag also deletes group flag
The group flags set with /region flag -g have no effect if the
normal flag is not also set, nor will they be displayed with
/region info once the normal flag is deleted. However, if a
group flag was to remain set in the database, the next time a
user sets the normal flag, they might be surprised to suddenly
see the corresponding group set as well.

Since the -g group is presented to the user as an attribute of
the normal flag, rather than a standalone flag, the group flag
should be deleted along with the normal flag.
2012-11-01 22:43:24 -07:00
Wojciech Stryjewski 7e419c116e Allow /region flag to set group and value at once
The usage for "/region flag" implies both can be set at once:
/region flag <id> <flag> [-g group] [value]

However if the [-g group] [value] portions are specified, only
the group is set and the value is silently ignored. With this
commit, both values can be set at once. All other behavior of
the "flag" command is preserved. If only the [-g group] part is
given, then only the group flag changes and the regular flag's
value is unaffected. If neither part is given, then the flag is
cleared.
2012-11-01 22:43:23 -07:00
Wojciech Stryjewski 2cbc2f5226 Allow removing of -g group flags with /region flag
The @Command parser requires that a value follow the -g option when
used in /refion flag. Therefore, it's not possible to remove the -g
flag by omitting it's value, as it is possible with the regular flags.

Rather, if the group flag is set to what would be the default region
group for the normal flag, then the group flag is actually removed
and the user sees a "Region group flagfor '...' reset to default."
message.
2012-11-01 22:43:23 -07:00
Wojciech Stryjewski 68b5e3e0a8 Improve /region info output for -g group flags
If a region group flag has been set with the -g option to /region flag
the /region info command will not show it at all because these group
flags are not in the DefaultFlag.getFlags() array.

With this code change, if a group flag has been set on "entry" for
example, it might be shown as "Flags: entry -g OWNERS: ALLOW".
2012-11-01 22:43:23 -07:00
BangL 1502ec12a9 Added support for the hanging events, an item frame destroy region flag, and a mobs.block-item-frame-destroy setting.
Now also using Bukkit 1.4.2-R0.2-SNAPSHOT and WorldEdit 5.4.4-SNAPSHOT.
2012-11-01 22:35:15 -07:00
sk89q 6d09b18479 Check for both LARGE_FIREBALL and FIREBALL for the EntityType in the entity listener.
This is to counteract a breaking Bukkit change.
2012-10-30 09:24:10 -07:00
Dark Arc 08ce207636 Fixed bugs in the PRTreeRegionManager class:
* Point would not be returned if the player was at point which exceeded the flat decimal maximum of a region.
* The getAplicableRegionIDs method would not return the parents of a region.
* All test would fail
2012-10-29 12:14:11 -07:00
sk89q f199b977eb Added more tests for the PRTreeRegionManager to fail. 2012-10-29 12:14:10 -07:00
sk89q 5715e2c835 WorldGuard has good unit tests for regions, why not use them for PRTreeRegionManager?
LET'S WATCH THE WORLD BURN.
2012-10-29 12:14:10 -07:00
sk89q b8642b7ca3 Tiny change to PRTree version to make it load a Java6 compile. 2012-10-29 12:14:10 -07:00
Wizjany 2c4d4708d8 Added parent region checking to PRTree manager as per Dark_Arc's specifications. 2012-10-29 12:14:10 -07:00
Darth Android 0edb6e6157 Include the PRTree library in generated artifacts 2012-10-29 12:14:10 -07:00
Darth Android 4f394b5668 Update PRTree library to v1.5
Updated PRTreeRegionManager code to support 3D points and regions
Changed region manager to PRTreeRegionManager
2012-10-29 12:14:09 -07:00
Glitchfinder 9834c30e3a Adding and fixing support for new and existing explosion types. 2012-10-28 20:23:36 -07:00
sk89q f3f1b0870f Changed default region wand to leather (#334). 2012-10-28 14:12:10 -07:00
sk89q 915d314c18 Removed <modules> that magically appeared thanks to Eclipse. 2012-10-28 14:07:41 -07:00
sk89q 02b3ae6aa5 Added mobs.block-wither-block-damage. 2012-10-28 14:01:17 -07:00
sk89q f725e73653 Move to WG 5.6-SNAPSHOT and Bukkit 1.4.2-R0.1-SNAPSHOT. 2012-10-28 14:01:17 -07:00
sk89q c5858ef202 Removed <packaging> from pom.xml. 2012-10-28 13:56:46 -07:00
sk89q ba2fd2ca2e Brought README.md and CONTRIBUTING.md inline with latest updates. 2012-10-28 13:54:06 -07:00
Wojciech Stryjewski 1075d36748 Fix spurious comma in "Flags:" /region info output
When the "/region info" command displays any flags in the region,
it always prints an extra leading comma character after the
"Flags:" prompt.
2012-10-24 12:48:38 -05:00
sk89q 3ee3799e55 I'm OCD like that. Changed WG->${project.name} in readme, added license ver. to README.md. 2012-10-24 00:29:20 -07:00
sk89q 6654b0a67a More readme cleanup. 2012-10-24 00:29:20 -07:00
sk89q 9577c93edb Better place for README.md logo URL. 2012-10-24 00:29:20 -07:00
sk89q 7cd67281bc Move extraneous files to contrib/, added region_storage_update_20110325.sql to assembly. 2012-10-24 00:29:20 -07:00
sk89q d21c226183 Modernized README.html. 2012-10-24 00:29:19 -07:00
sk89q 4322236b9e Updated the ancient README.html. 2012-10-24 00:29:19 -07:00
sk89q 05e408ee65 Updated README.md. 2012-10-24 00:29:19 -07:00
sk89q 3d1012ba94 Cleaned up pom.xml and updated CommandBook to 2.1. 2012-10-24 00:29:19 -07:00
sk89q 94937e41ef Changed the region MySQL database to marshal and unmarshal values using YAML, which should fix the notable problems regarding non-string flag data types. 2012-10-24 00:28:43 -07:00
sk89q 3957aa83fc Say hi to travis-ci. 2012-10-24 00:28:43 -07:00
Rutr 8aa79d1c4c Fixed detection damager(when attac by magic) http://redmine.sk89q.com/issues/901 2012-10-19 09:02:19 +02:00
sk89q 578eeff0e1 [maven-release-plugin] prepare for next development iteration 2012-10-07 10:47:07 -07:00
sk89q 5f2f1c67f5 [maven-release-plugin] prepare release 5.5.4 2012-10-07 10:46:51 -07:00
sk89q c92b9c3d97 Updated CHANGELOG.txt. 2012-10-07 10:40:00 -07:00
sk89q 0951d00da3 Fixed permissions for region loading/saving. 2012-10-06 21:47:37 -07:00
zml2008 6df9c3660b Merge pull request #201 from eric-wieser/patch-1
Did `wcfg.useRegions` really need to be checked twice?
2012-09-16 12:31:17 -07:00
Alexander 19be2bf96e Updated fireball item blocking 2012-08-23 12:41:36 +02:00
Fletch to 99 e10ed6ac7a Report the amount of plugins loaded 2012-08-12 16:56:22 -03:00
sk89q 479ebf4d89 Copying and pasting is bad. Fixed references of worldedit -> worldguard in new pom.xml changes. 2012-08-11 00:28:02 -07:00
sk89q 1f1e36e9f7 Updated pom.xml for license, distributionManagement, maven-site-plugin. 2012-08-11 00:26:06 -07:00
TomyLobo 27e634ae03 Fixed a warning. 2012-08-11 04:37:49 +02:00
unknown e60b20b37b Add 'use' flag to cakes 2012-08-10 22:33:55 +02:00
zml2008 684214ff6a Update for async player chat stupidity 2012-08-04 19:56:48 -07:00
sk89q ba5be6071f Added regions.use-creature-spawn-event configuration setting. 2012-07-23 13:45:04 -07:00
TomyLobo 6c8d13690e Fixed eggs, snowballs and the likes being dupable with /stack. 2012-07-16 16:08:04 +02:00
TomyLobo 3e0b2ef3e4 Upped Bukkit dependency version to 1.2.4-R4.1. 2012-07-14 00:16:45 +02:00
sk89q c5304d2775 [maven-release-plugin] prepare for next development iteration 2012-07-07 10:55:58 -07:00
sk89q ca95ae04a5 [maven-release-plugin] prepare release 5.5.3 2012-07-07 10:55:45 -07:00
sk89q 1ab9f85ca6 Updated CHANGELOG. 2012-07-07 10:39:37 -07:00
sk89q 01ff1b2f8f Added host key check. 2012-07-07 10:33:18 -07:00
Zak Ford 9b17fe68e7 Added configuration option to allow plugin creature spawns 2012-07-01 16:02:24 -04:00
zml2008 0fed35a80f Add bypass handling to the gamemode flag
Set a player's previous gamemode when exiting a gamemode region to the server's default gamemode if there is not a previous gamemode already set
2012-06-15 14:14:13 -07:00
TomyLobo 25280c9fa9 Set Bukkit dependency to R2.1.
That's the current CraftBukkit++ version.
2012-06-11 03:31:50 +02:00
TomyLobo a98ebfdb21 Updated dependencies and added support for fireball item blocking (id 385). 2012-06-07 13:26:28 +02:00
Eric Wieser acb1d18654 Did wcfg.useRegions really need to be checked twice? 2012-04-28 18:18:51 +02:00
TomyLobo 18b5a4e106 Added @Ignore to TestPlayer.
Stupid old mavens...
2012-04-23 11:07:05 +02:00
md_5 bab420a359 Add item drop pickup flag for regions.
Closes #200
2012-04-20 20:25:25 -07:00
zml2008 4f14f1f736 Correctly convert \n to a newline for String flags 2012-04-16 17:00:41 -07:00
zml2008 166831447c Split the region greeting with \n
Improve input handling of EnumFlag
Don't block gamemode changing after the gamemode flag is no longer in
effect but while the move event is still firing
2012-04-15 21:19:02 -07:00
zml2008 f2bd5961d0 Add GameMode flag 2012-04-15 21:19:02 -07:00
zml2008 2cc990a530 Prevent commands in the allow commands list from being blocked and vice versa 2012-04-15 21:19:02 -07:00
TomyLobo f0e6008563 Updated bukkit dependency to 1.2.5-R1.2-SNAPSHOT. 2012-04-15 19:36:15 +02:00
zml2008 93f19cca0a [maven-release-plugin] prepare for next development iteration 2012-04-10 18:30:42 -07:00
zml2008 1cbe508f82 [maven-release-plugin] prepare release 5.5.2 2012-04-10 18:30:36 -07:00
zml2008 0c178c3155 Added recent commits to the changelog 2012-04-10 18:20:57 -07:00
zml2008 e67304389d Added send-chat and receive-chat flags 2012-04-07 14:43:51 -07:00
zml2008 ad5b1cdcba Make sure to update CommandBook installed status in onEnable 2012-04-07 13:46:25 -07:00
zml2008 fe1e09289f Add entity-painting-destroy flag to prevent entities from destroying paintings 2012-04-07 13:45:46 -07:00
zml2008 583ea76e4b Added potion splash flag to prevent splash potions from affecting entities 2012-04-07 12:11:00 -07:00
zml2008 a7d198893e Revert "Added allow-flight boolean flag for regions"
This conflicted with plugins maually setting a player's allow flight setting
This reverts commit 16ce56c1ad.
2012-03-31 07:53:42 -07:00
Nicholas Steicke fe62c8d0c5 Fixed regions with same name in different worlds not behaving correctly
Fixed database connection timing out

Added an error to be thrown explictly when the DB needs updating

Added a generic exception for Fatal errors when loading configuration

Exit the server when we encounter a fatal configuration exception
2012-03-27 17:18:39 -07:00
Deaygo 16ce56c1ad Added allow-flight boolean flag for regions
Closes #198
2012-03-24 18:45:56 -07:00
zml2008 15f0bfb9db Update changelog for release 2012-03-23 21:47:34 -07:00
TomyLobo 22db589742 Restructured /rg list.
- When used with a player name to filter things down, it displays indexes that can be used as "#index" in place of region names now.
- No longer displayer "+-regionname" for regions the target player is the owner of.
2012-03-23 15:13:46 +01:00
TomyLobo 69119e6db7 Added ProtectedRegion.isOwner/Member(String playerName). 2012-03-23 15:13:45 +01:00
TomyLobo 690da2332b Added Domain.contains(String playerName). 2012-03-23 15:13:45 +01:00
sk89q f2fead1444 Changed broadcastNotification() to also check if the player has permission via superperms, in addition to being in the Permissible set. 2012-03-18 13:13:13 -07:00
TomyLobo c4f6267921 A cancellable event is now fired if WorldGuard disallows PvP. 2012-03-17 09:16:03 +01:00
TomyLobo 0dc65d083f Made /region setparent check worldguard.region.setparent.own/member.<parent> instead of worldguard.region.setparent.own/member.<child>.
Same with worldguard.region.setparent.<id>
2012-03-12 15:08:35 +01:00
TomyLobo 40c1d93f02 Allowed passing #<index> in place of a region ID, where <index> is the index as displayed by /region list.
/region claim/remove/redefine are exempt from this and require exact matches.
2012-03-12 15:05:59 +01:00
TomyLobo 2024a93126 Fixed an error that occured when clearing a non-existant region's parent. 2012-03-12 15:05:32 +01:00
TomyLobo 88d79a42e6 Added a -s flag to /region teleport, which sends you to the spawn point instead of the teleport point of a region. 2012-03-12 10:40:03 +01:00
TomyLobo b01b2cce9b Added region/role-based permissions to /region teleport. 2012-03-12 10:39:23 +01:00
TomyLobo c5b1089c96 Changed source and target java version to 1.6 and set the WE dependency to 5.3-SNAPSHOT. 2012-03-12 08:04:08 +01:00
TomyLobo 679e43758b BREAKING CHANGE: Added a LocationFlag class and made the teleport and spawn flags use it.
This means all teleport and spawn flags are cleared.
This also means that world, yaw and pitch are now saved with these flags.
2012-03-12 06:52:36 +01:00
TomyLobo 90e6e5a96c /region info -s now selects the region being queried. 2012-03-12 05:53:58 +01:00
TomyLobo 4fb003c4df Added /region teleport <id>. 2012-03-11 19:31:02 +01:00
TomyLobo 9d5f349a04 Vector flags can now be set to the current location with the value "here" and to a specific position with x,y,z. 2012-03-11 19:08:25 +01:00
TomyLobo f4f4a47a7f Made /region info show the region you're in if you don't specify an id explicitly. 2012-03-11 19:08:24 +01:00
TomyLobo 6a3e987668 /region info changes
- Fixed /region info <world> <id> checking the wrong permission
- Condensed /region info output a bit
- Cleaned up the source a bit
2012-03-11 19:07:25 +01:00
TomyLobo 83f943965f Made /region info show the region you're in if you don't specify an id explicitly. 2012-03-11 19:07:25 +01:00
zml2008 c9fdff169f Prevent block ignition from lightning strikes if lightning is blocked in region.
Fixes #1175
2012-03-10 21:33:24 -08:00
zml2008 5454832918 Fix trailing whitespace and correctly check both permisions systems in WorldGurdPlugin.broadcastNotification() 2012-03-10 17:56:02 -08:00
zml2008 3d6d774b17 Use ignoreCancelled for event cancelled checking 2012-03-08 19:29:53 -08:00
zml2008 1463547af4 Destroy fire blocks when fire-spread is disallowed 2012-03-08 19:03:05 -08:00
TomyLobo 0bcf4b3597 Added a "none" category to region group flags (aliases noone and deny). 2012-03-08 10:30:57 +01:00
TomyLobo 824e8dcb4b Added a construct flag that can be used to restrict block placing/destroying in zones to certain roles. 2012-03-08 10:18:27 +01:00
TomyLobo 4b2f0c8020 Let's not confuse certain highlighters. 2012-03-08 02:05:33 +01:00
Wizjany 7fd424cf65 Added FallingSand to list of intensive entities to be removed with /halt-activiy. 2012-03-03 21:27:35 -05:00
zml2008 5ff2855eb0 Fix entry and exit group flags not working, fix vehicle destroy flag not being allowed with canBuild 2012-03-03 16:46:06 -08:00
TomyLobo 8c8c162a54 Replaced all usage of CreatureType by EntityType. 2012-03-02 20:21:04 +01:00
TomyLobo 37d52f3688 Commented an unused local variable. 2012-03-02 20:10:51 +01:00
TomyLobo f361cbfa71 Removed unused imports. 2012-03-02 20:03:18 +01:00
sk89q ddefbfe2cf Fixed NPE with null ItemStack for pumpkin scuba in EntityDamageEvent. 2012-03-02 10:33:14 -08:00
sk89q 10296cb736 Made auto-god-mode disabled by default again. 2012-03-01 20:57:34 -08:00
zml2008 49dc0599c9 Remove leftover 128 value, fix RegionGroup.ALL handling 2012-03-01 20:49:01 -08:00
zml2008 14348e170b Revert a few of the region flag changes. This should fix issues people have been having at least for now. 2012-03-01 20:11:51 -08:00
zml2008 59d1f0d817 5.5.1 release, bump to 5.5.2-SNAPSHOT to fix stuff 2012-03-01 20:11:50 -08:00
sk89q e024f134a4 Fixed another NPE with the infinite stack remover. 2012-03-01 20:06:02 -08:00
sk89q cf5a5b5b47 Fixed NPE in PlayerInteractEvent regarding infinite stack removal. 2012-03-01 19:52:53 -08:00
sk89q e957f92496 Added sign protection check disable. 2012-03-01 18:51:44 -08:00
TomyLobo 9484bb9941 Fixed some more warnings. 2012-02-25 18:58:22 +01:00
TomyLobo d781f9822f Removed some unused imports. 2012-02-25 18:54:46 +01:00
Wizjany 7845ef2de4 Revert b918b2914.
That breaks it, look at the other use flags before making changes.
2012-02-22 11:36:30 -05:00
zml2008 a9d4ecf33d Improved some group flag defaults to match pre-change behavior 2012-02-20 15:17:34 -08:00
zml2008 6f4a62c7a3 Cleaned up javadoc, deprecated duplicate methods, other cleanup 2012-02-20 15:14:55 -08:00
zml2008 6b4f872742 Added a RegionGroupFlag to evey region flag
Using the /region flag command with -g, the region group that the region flag applies to can be set
Many canBuild checks that occurred with other flag checks have been
replced with this. Some flag checks may be incorrect, and other parts of
this system may need improvement.
2012-02-19 23:31:55 -08:00
zml2008 ef4f00f8f5 Add region information to CommandBook's /whois if CommandBook is eanbled 2012-02-19 21:26:45 -08:00
zml2008 a27deb3936 Removed suppress-tick-sync-warnings setting
This setting often didn't work for people, and has been replaced in CraftBukkit's bukkit.yml with settings.warn-on-overload
2012-02-19 21:24:53 -08:00
TomyLobo 18814c7373 Set WorldGuardPlayerListener.PlayerMoveHandler to default visibility, to fix a warning about unused methods. 2012-02-14 02:32:35 +01:00
TomyLobo 1d9908e1f6 Merged the handlers for EndermanPickup/PlaceEvent into a EntityChangeBlockEvent handler. 2012-02-14 02:32:24 +01:00
TomyLobo 29529e4a06 Removed unused imports. 2012-02-14 02:23:35 +01:00
TomyLobo 74b1003c4c Upped dependency versions for bukkit and worldedit. 2012-02-14 02:21:54 +01:00
NolanSyKinsley 27ffdec323 Fixes shooting onto pvp areas from nopvp areas 2012-02-13 13:54:44 -08:00
zml2008 d9e5fc2b60 [maven-release-plugin] prepare for next development iteration 2012-02-11 16:22:22 -08:00
zml2008 646b3e3064 [maven-release-plugin] prepare release 5.5 2012-02-11 16:22:17 -08:00
zml2008 d3475208ef Add correct git tag defaults to the release plugin config 2012-02-11 16:16:47 -08:00
zml2008 7246da472d Added changelog for 5.5 2012-02-11 16:11:42 -08:00
zml2008 e1f917894a Removed WorldEdit.jar from the classpath to stop conflicts with Bukkit's plugin loader 2012-02-11 12:20:56 -08:00
zml2008 c14d25f860 Now using Bukkit's tagged logging 2012-02-11 12:20:56 -08:00
TomyLobo 57ed91cd28 Updated to new event system 2012-02-11 12:20:56 -08:00
MonsieurApple 47c84beb43 Merge pull request #190 from skeight/master
Fix for bug #728 (Multiverse + Worldguard region with exit flag set)
2012-02-10 11:40:34 -08:00
skeight 1e3032bdce More whitespace fixes... 2012-02-10 11:30:43 -08:00
skeight ed69684843 Fixing up whitespace 2012-02-10 11:29:48 -08:00
skeight 2eea5c7bf7 Fix for bug #728. Multiverse + WorldGuard region exit flag. 2012-02-10 09:06:05 -08:00
zml2008 16da53ae4e Improved compatibility with versions of CommandBook without GodComponent and updated pom dep for 2.0 2012-02-06 20:41:39 -08:00
Nicholas Steicke f45464b0d9 Added MySQL region storage method.
Also added ProtectionDatabaseException, and made use of it across the project
Closes #180
2012-02-07 00:11:55 +01:00
Wesley Wolfe 2351ade6fe Fix inconsistent permission check
Closes #188
2012-02-07 00:11:54 +01:00
Turtle9598 c19ccf9278 Made explosions display their animations even when the event was blocked.
Closes #184
2012-02-07 00:11:54 +01:00
zml2008 5c92762ba9 Configuration should be fixed for real. Finally. 2012-02-07 00:11:54 +01:00
zml2008 e665f966e6 These checks may not work correctly, so reverted 2012-02-07 00:11:53 +01:00
zml2008 7dcca7e505 Fixed default entries not appearing in the global configuration 2012-02-07 00:11:53 +01:00
zml2008 e25049b1d6 Added fallback support for those who don't have a version of CommandBook with GodComponent 2012-02-07 00:11:50 +01:00
zml2008 da9bc4a138 Added LIGHTNING flag to DefaultFlag's flagsList
Fixes #1026
2012-02-06 23:06:12 +01:00
zml2008 1224d3b443 Corrected formatting of configuration files
Fixes #1025
2012-02-06 23:05:39 +01:00
zml2008 d33be37694 Removed /god, /heal, and /stack from WorldGuard to CommandBook. CommandBook is now checked to see whether a player is godded. 2012-02-06 23:05:30 +01:00
zml2008 551ff26a65 Removed remaining usages of org.bukkit.util.config.Configuration 2012-01-23 16:46:13 -08:00
zml2008 74082f9c68 Updated Bukkit repo 2012-01-20 23:45:39 -08:00
zml2008 b93331e184 Removed some unused configuration options 2012-01-11 18:04:14 -08:00
zml2008 d5d26168b3 Added permission worldguard.region.wand to the region wand
Closes #930
2012-01-10 21:15:00 -08:00
TomyLobo 9d848e222b Fixed ProtectedRegion.compareTo.
It properly implements the Comparable interface now.
In particular, it now fulfills the criterion "sgn(x.compareTo(y)) == -sgn(y.compareTo(x))".
2012-01-09 14:47:59 +01:00
TomyLobo 46a2510e85 Fixed FlatRegionManager.getApplicableRegions to return parent regions as well.
Thanks FearThe1337 for noticing.
2012-01-09 14:10:23 +01:00
TomyLobo 0789a453a2 Added a .gitattributes file
This will make your diffs show method names instead of class names on the hunk headers.
2012-01-03 14:47:46 +01:00
zml2008 b30f7fe9c7 Removed usage of Material. 2011-12-31 17:57:09 -08:00
zml2008 525bd199b2 Added exp-drops flag to disable experience drops per-region. 2011-12-31 13:50:43 -08:00
TomyLobo dffd8b59f5 Fixed some warnings. 2011-12-26 11:02:38 +01:00
TomyLobo df206724bd Updated dependency version for WorldGuard from 5.0 to 5.1-SNAPSHOT.
This fixes a warning about raw types.
2011-12-26 10:57:52 +01:00
zml2008 41f31250a9 Added support for fireballs shot by players being blocked by the PVP flag. 2011-12-24 22:49:37 -08:00
zml2008 b29007275f Added dynamic command registration and updated for WE 5.0 API 2011-12-24 22:49:37 -08:00
TomyLobo 35f268319e Split off ender dragon block damage from creeper block damage. 2011-12-18 23:16:12 +01:00
zml2008 6e8a185b63 [maven-release-plugin] prepare for next development iteration 2011-12-17 20:16:48 -08:00
zml2008 120fff1fc4 [maven-release-plugin] prepare release 5.4 2011-12-17 20:16:41 -08:00
zml2008 f879bd5e3a Updated changelog for release 2011-12-17 19:37:24 -08:00
Turtle9598 01f9fd561d Made WorldGuard check to see if both the attacker & defender are in a pvp area. 2011-12-14 20:15:42 -05:00
DerFlash 6802a7d747 Raised the priority of WorldGuard's respawn event listener. 2011-12-11 08:34:14 -08:00
DerFlash b918b29014 Fixed not being able to fill milk buckets in build deny regions
Though added a check for use flag here
2011-12-11 08:29:42 -08:00
zml2008 4895a3313b Forgot to update /slay, /wg report, and /stoplag to new commands system 2011-12-10 12:52:32 -08:00
zml2008 59673c9e66 Simplified autogod config check 2011-12-09 17:57:40 -08:00
Turtle9598 b126255be7 Fixed god mode being assigned to ops if auto enable is false and there is no permissions system
This fixes Bug #873
2011-12-10 01:15:14 +01:00
TomyLobo 606c9f3fd8 Revert "Readded the legacy console sender."
This reverts commit b1256eedcf.
Reason: this breaks if someone modifies CommandSender
The only advantage of having this class is to keep WorldGuard working with old 1.8 builds and pre-1.8 builds.
2011-12-08 14:38:05 +01:00
zml2008 aa306a8df7 Added additional worldguard.stack.damaged permissions to allow stacking of tools with a different damage value 2011-12-07 22:27:00 -08:00
zml2008 b1256eedcf Readded the legacy console sender. 2011-12-07 22:25:41 -08:00
zml2008 4454df341f Commented ProtectedPolygonalRegion.volume() out until someone can fix it. 2011-12-07 21:33:47 -08:00
TomyLobo 5bcac17f1c Fixed compilation with Bukkit >= CB1564.
Sorry, this breaks compatibility with builds < CB1193.
2011-12-08 02:34:26 +01:00
TomyLobo 875b9f326c Removed deprecation of RegionManager.getApplicableRegions.
The underlying functionality has since been implemented.
Also: woo, no more warnings
2011-12-05 06:03:52 +01:00
zml2008 a0d27c6f86 Added WorldEdit as a softdepend. This may fix some issues where WorldEdit's classes cannot be found. 2011-12-04 21:02:39 +01:00
zml2008 1d47d12189 Hopefully fixed WorldConfiguration.getKeys 2011-12-04 10:02:07 -08:00
zml2008 67f78ae8b5 Added per-group region claim maximums 2011-12-04 00:54:33 -08:00
zml2008 5948855da7 Added some more 1.0.0 blocks I forgot 2011-12-02 18:55:29 -08:00
zml2008 f6ec46cdf6 Now actually registering world events 2011-11-30 20:18:03 -08:00
zml2008 ebd2755eb2 Wrong this. 2011-11-30 19:24:53 -08:00
zml2008 78f5827d3d Always the imports... 2011-11-30 19:04:50 -08:00
zml2008 0829070c67 Added some OSX filesystem dust to gitignore and fixed pom.xml comment 2011-11-30 19:01:05 -08:00
zml2008 8b4332e842 Updated for new commands format 2011-11-30 18:59:02 -08:00
zml2008 f904c91443 Updated for Bukkit 1.0 and handling new 1.0 block types in USE flag 2011-11-30 18:59:02 -08:00
Eric Puidokas 944539453e Fixed feed-delay flag 2011-11-29 19:40:08 -08:00
TomyLobo 5856b002df Added .gitignore 2011-11-28 04:39:03 +01:00
TomyLobo 12f68bc227 Fixed a warning 2011-11-28 04:37:30 +01:00
TomyLobo de6e20d60a Improved error messages for group and state flags. 2011-10-30 04:07:37 +01:00
Eric Puidokas 35e6ef5cd8 Implemented edge intersection checking 2011-10-19 23:48:02 +02:00
Eric Puidokas 27251dda2e Refactored and fixed getIntersectingRegions 2011-10-19 23:47:13 +02:00
Eric Puidokas 4bb967ab4a Added Cuboid -> Polygonal intersect tests 2011-10-19 16:21:14 +02:00
Eric Puidokas 7c1f878610 Fixed ProtectedCuboidRegion->ProtectedCuboidRegion intersection checking 2011-10-19 16:21:14 +02:00
Wizjany e8c4c9b218 Fixed sticky pistons not being blocked by the flag in some cases 2011-10-18 17:49:05 -04:00
Eric Puidokas bc37d365ab Added unit tests for ProtectedCuboidRegion.getIntersectingRegions 2011-10-18 02:43:00 +02:00
TomyLobo d9ae1bbd9f Made LegacyConsoleSender compatible with patched Bukkit versions that add methods to CommandSender again.
Don't remove this again, wizjany.
2011-10-16 12:26:22 +02:00
zml2008 e492b30178 Added food level support to godmode and /heal 2011-10-15 23:51:28 -07:00
TomyLobo 920860c298 Fixed some warnings 2011-10-13 15:39:52 -04:00
Wizjany 5f8a6e3423 Workaround for tnt activating as soon as it was placed, regardless of cancellation. 2011-10-11 20:11:07 -04:00
Wizjany 3e7a5056d5 Fixed changelog not getting packaged with the release. 2011-10-09 11:51:43 -04:00
Wizjany 2ec6f04763 Implement non-economy 'buying' of regions via addowner 2011-10-09 11:51:43 -04:00
Wizjany ecef9c9792 Hopefully fix region managers not being created correctly. 2011-10-04 17:43:27 -04:00
Wizjany 810501a508 Added the missing timer to the food flags. 2011-10-04 16:26:54 -04:00
Wizjany 6285a66d76 Fixed allowed/blocked commands not being checked early enough. 2011-10-02 13:36:09 -04:00
zml2008 72e4922e8e Fixed config generation for Windows users 2011-10-02 01:30:10 -07:00
sk89q c1f1885633 [maven-release-plugin] prepare for next development iteration 2011-10-01 20:52:04 -07:00
sk89q 56e514a500 [maven-release-plugin] prepare release 5.3 2011-10-01 20:51:49 -07:00
sk89q 5ede100d56 Changed WorldGuard to use WE 4.7 in the pom.xml. 2011-10-01 20:50:35 -07:00
sk89q f1456b8101 Updated CHANGELOG.txt for 5.3. 2011-10-01 20:26:07 -07:00
Eric Puidokas ef8eb76b16 Added protection.disable-obsidian-generators option 2011-10-01 17:16:45 -04:00
Wizjany b4f2188f72 Added vehicle destroy flag and made players in vehicles subject to movement flags. 2011-10-01 17:16:37 -04:00
zml2008 38c30f5ecd Should fix broken config generation some people have been getting 2011-10-01 16:17:16 -04:00
Wizjany 94c794de6f Trailing whitespace removal 2011-09-27 06:13:19 -04:00
Wizjany fb535e620c Use per-world permissions if supported. 2011-09-26 01:32:48 -04:00
Wizjany 5a42980d78 Fix hunger flags and death messages. 2011-09-26 00:19:57 -04:00
Wizjany 299d2a1f01 That should probably be there 2011-09-25 23:42:50 -04:00
Wizjany 164ff5ea9a Added missing dependency 2011-09-25 23:37:25 -04:00
Wizjany 6c89ef908a Clean up and preparation for release. 2011-09-25 23:31:21 -04:00
Wizjany 3441ae11f2 Added legacy console sender (à la CommandBook). 2011-09-25 22:27:21 -04:00
Wizjany c028331ef9 Added config option and flag to prevent spread of grass. 2011-09-24 22:51:36 -04:00
Wizjany 9343c300cd Added command to flush state manager in case of emergency. 2011-09-24 22:01:07 -04:00
zml2008 63693cc529 Updated for Bukkit changes 2011-09-24 15:57:41 -07:00
Wizjany e6de06aae8 Apply weather settings on world load. 2011-09-22 20:34:38 -04:00
Wizjany 89ce7312d1 Added config options to disable xp drops (even though they should no longer lag) and death messages. 2011-09-21 16:48:56 -04:00
Wizjany b884787377 Fixed 1.8 chests not being blocked and future-proofed some other things. 2011-09-21 15:29:45 -04:00
Wizjany a1427e7743 - Added flags for hunger that do the same that the health ones do (but with hunger)
- Added a config option and a flag to prevent endermen from picking up or placing blocks."
2011-09-20 15:44:54 -04:00
Wizjany 0c02190e19 Added fence gates to USE flag. 2011-09-19 00:58:48 -04:00
zml2008 1f7cce9535 Added experience orbs to the intensive entities list 2011-09-16 20:02:46 -07:00
Wizjany 9fea677b60 Fixed being able to eat protected cake. 2011-09-16 19:18:08 -04:00
Wizjany 6b9a3aff58 Made priming TNT by punching it with flint and steel throw a block break blacklist event. 2011-08-27 16:00:42 -04:00
Wizjany b938271b4d Punching fire in a region without build permissions should no longer douse the fire. 2011-08-27 13:44:40 -04:00
Wizjany 297e06ba71 Fix infinite sign bug. 2011-08-26 22:35:28 -04:00
Wizjany a521ab76a5 Fixed interact and use blacklist events being grouped together incorrectly when right clicking a container. 2011-08-26 20:03:38 -04:00
Wizjany b1c8fc82c4 Fixed piston events being cancelled when they shouldn't be 2011-08-25 18:48:17 -04:00
Wizjany d4ba90c21d Sort /region info player list alphabetically. 2011-08-24 23:48:09 -04:00
Wizjany 14dc868d45 Fixed polygon region edges being unprotected on certain edges. Thanks Droolio. 2011-08-24 17:50:25 -04:00
Wizjany 61a60ecdd6 Fallback to the global region for flags other than StateFlags. Thanks imjake9. 2011-08-24 17:40:01 -04:00
Wizjany 2b56247e21 Allow '/region info' for existing but now illegally-named regions. Thanks Moo0. 2011-08-20 02:22:45 -04:00
Wizjany e0066e6173 Disallowed overwriting regions without specifying redefine. 2011-08-20 02:17:39 -04:00
Wizjany b5b92f91dc Added flag for pistons and fixed a typo in config. 2011-08-20 01:58:46 -04:00
Wizjany 7b12510182 Made sleep flag proactive enough to keep them from blowing the nether up. 2011-08-16 19:24:13 -04:00
TomyLobo e2fc6a3ff0 Fixed heal/damage regions being shifted by half a block towards northeast. 2011-08-15 10:13:39 +02:00
TomyLobo 5acd3a7f6c Fixed warnings. 2011-08-15 09:08:33 +02:00
EduardBaer ce49ca0998 Fix BlockInteractBlacklistEvent 2011-08-11 22:52:20 -04:00
Wizjany eacce487ed Ignore NPE onCreatureSpawn and attempt to get more information about it instead. 2011-08-11 22:52:19 -04:00
Wizjany 602b1d8a27 Bugfixes. Allowed/blocked commands should now respect global flags. Region invincibility/godmode compatibility should now work instead of throwing NPEs. 2011-08-11 22:05:31 -04:00
Wizjany dec469caef Added worldguard.region.flag.regions permissions and flags.<flag>.own for consistency. The old ones will probably be deprecated at some point. Also cleaned up /wg report output slightly. 2011-08-10 20:16:05 -04:00
Wizjany 4194b2ca86 Added the option to disable the use of player move events. Note that this also disables features which use it such as the region entry/exit and greeting/farewell flags. 2011-08-10 20:16:05 -04:00
Wizjany 17741822c1 Allow invincibility flag to disable god mode (when set to deny) unless the player has the worldguard.god.override-regions permission. 2011-08-10 17:43:46 -04:00
Wizjany 3757056e46 Fixed up explosion handling. 2011-08-09 21:02:26 -04:00
Wizjany 0eb68ef864 Added min and max health flags to go along with the other healing flags. Also organized the flag list for readability. 2011-08-09 19:48:10 -04:00
Wizjany 3f77a9b721 Made /stack respect max stack sizes unless the user has worldguard.stack.illegitimate which will stack normally unstackable items. 2011-08-08 12:46:18 -04:00
Wizjany 321b3acf0a Buckets now check the region that the water will end up in, not the block that was clicked 2011-08-08 09:12:10 -04:00
Wizjany dfbbeeb473 Moved around projectile damage events in accordance to Bukkit 2011-08-07 18:42:32 -04:00
Wizjany 31d3f2e7c6 Cancel scheduled tasks on disable 2011-08-07 17:08:18 -04:00
Wizjany 40a66b9be4 Updated snow fall and added flags for snow/ice forming/melting and mushroom growth 2011-08-06 11:29:14 -04:00
sk89q 049a1fb2ed Merge pull request #134 from halvors/cleanup
Cleanup, commented out some unused fields.
2011-07-17 10:50:36 -07:00
halvors 3fc68af05f More imports cleanup. 2011-07-16 23:07:29 +02:00
halvors c3f0c8a7a1 Oops, missed some changes. 2011-07-16 22:39:30 +02:00
halvors cba1a95838 Cleanup, commented out some unused fields. 2011-07-16 22:26:10 +02:00
sk89q 345f4a2e0e Removed some debugging messages. 2011-06-29 17:00:58 -07:00
sk89q 162d53b66e Made TNT blocking more aggressive. Also fixed explosion event. 2011-06-29 16:59:31 -07:00
sk89q bed6782a00 Made /stoplag handle TNT removal better. 2011-06-29 16:17:36 -07:00
Wizjany d90b960597 Moved fireball handling to somewhere that actually gets called by it... 2011-06-29 15:43:01 -04:00
Wizjany 3325feb1cb Re-enable god mode on a reload for those who need it. 2011-06-28 01:05:51 -04:00
Wizjany 62d181eb81 Made it easier for plugins to access the API without using WorldEdit vectors 2011-06-28 00:59:16 -04:00
Wizjany 1e24e9c128 Added config option to block fireball world damage only. Thanks Qalthos 2011-06-28 00:58:13 -04:00
sk89q cfffba25cf Added regions.invincibility-removes-mobs so you can turn on invincibility without creating the possibility about farming. 2011-06-27 13:41:27 -07:00
sk89q 671b4fe2db Added region invincibility flag. 2011-06-27 13:36:43 -07:00
sk89q 5b300bc5d1 Changed the per-world configuration loader to also put configuration entries in the main configuration. 2011-06-27 13:13:31 -07:00
sk89q a5332c2166 Added player-damage.disable-tnt-damage. 2011-06-27 12:57:33 -07:00
sk89q 141d5ccd25 [maven-release-plugin] prepare for next development iteration 2011-06-27 12:09:57 -07:00
sk89q c75b9c2328 [maven-release-plugin] prepare release 5.2.2 2011-06-27 12:09:47 -07:00
sk89q 0863db8cf0 Changed configuration saving so empty lists will be added to the configuration files. 2011-06-27 12:09:03 -07:00
sk89q 53d6a272e6 [maven-release-plugin] prepare for next development iteration 2011-06-27 11:47:48 -07:00
sk89q 71467a7ae7 [maven-release-plugin] prepare release 5.2.1 2011-06-27 11:47:37 -07:00
sk89q 56fa3458ab Updated CHANGELOG.txt for 5.2.1. 2011-06-27 11:37:22 -07:00
sk89q 82e04ac4e5 Changed /region {add|rem}{member|owner} to allow putting owners/members on the global region. 2011-06-27 11:23:33 -07:00
sk89q 564d4442fc Added a bunch of unit tests for regions. 2011-06-27 11:10:20 -07:00
sk89q df8fdd086b Fixed some flag algorithm issues, added the possibility of owners and members on the global region in order to affect build. 2011-06-27 11:10:20 -07:00
sk89q a31476251e Fixed DefaultDomain.size() not counting players. 2011-06-27 11:10:19 -07:00
sk89q 360a655627 Added the ability to add owners/members to the global region for handling guest groups. 2011-06-27 11:10:19 -07:00
sk89q 3b871b9c00 Added more region unit tests. 2011-06-27 11:10:19 -07:00
sk89q 65834a2087 Undeprecated ApplicableRegionSet.allows(StateFlag) 2011-06-27 11:10:19 -07:00
e9d85da691 Merge pull request #107 from Moo0/infobounds
Add region bounds to "/region info"
2011-06-27 09:31:02 -07:00
sk89q cfa78af654 [maven-release-plugin] prepare for next development iteration 2011-06-27 00:00:47 -07:00
sk89q 45d9119150 [maven-release-plugin] prepare release 5.2 2011-06-27 00:00:38 -07:00
sk89q ea487eb6a4 Fixed the %online% macro requiring a player. 2011-06-26 23:41:30 -07:00
sk89q 4e295ea1eb Updated for 5.2. 2011-06-26 23:20:43 -07:00
sk89q 32265414bd Added Javadocs, cleaned up comments. 2011-06-26 23:19:49 -07:00
sk89q 80e706e962 Improved the API. 2011-06-26 22:50:21 -07:00
sk89q 110838715b Gave the ability to use color colors and macros in greeting and farewell messages. 2011-06-26 21:49:34 -07:00
sk89q b90334c8a8 Made WorldGuard catch setHeader() not being yet defined. 2011-06-26 21:49:33 -07:00
sk89q 3ce0530d5f Updated for 5.2. 2011-06-26 21:49:33 -07:00
sk89q 7eaa84d5b1 Added disable-ice-melting, disable-snow-formation, disable-mushroom-spread, disable-snow-melting, disable-ice-formation. 2011-06-26 21:49:32 -07:00
sk89q ad325dfedb Added paintings to blacklist support. 2011-06-26 21:49:32 -07:00
sk89q 5bb7eb6f01 Added default.disable-health-regain. 2011-06-26 21:49:32 -07:00
sk89q 342cfc0801 Added auto-invincible-permission setting, which lets you use the permission 'worldguard.auto-invincible' to become invincible. 2011-06-26 21:49:31 -07:00
sk89q f5c6a9f507 Flames won't appear if you are /god'ed now. 2011-06-26 21:49:31 -07:00
e843ff372e Merge pull request #113 from Moo0/limitoverride
Region limit override permission.
2011-06-26 19:35:40 -07:00
sk89q ed27ffed65 Updated the blacklist with a new ignore-perms option. No more groups! Use permissions! 2011-06-26 18:36:06 -07:00
sk89q 7995ecd867 Updated CHANGELOG.txt. 2011-06-26 17:33:59 -07:00
sk89q fcef6679c4 Updated README.html. 2011-06-26 16:48:51 -07:00
sk89q 742b6a2e27 Made negative healing possible. 2011-06-26 16:39:41 -07:00
sk89q 258fbc8870 Improved the entry/exit flags so that it's harder to break it. Thanks to Siriuo. 2011-06-26 16:29:28 -07:00
sk89q 0fa43ee287 Added a warning about modifying region database files manually. 2011-06-26 15:11:05 -07:00
sk89q fb39261dc7 Fixed floating point inaccuracy in onPlayerMove(). 2011-06-26 14:38:56 -07:00
sk89q 7fce4bf53e Added exit flag to deny exiting a region. 2011-06-26 14:11:11 -07:00
sk89q 13840cf61b Changed the configuration header messages to be more helpful to new users. 2011-06-26 12:59:20 -07:00
sk89q e26f6b5e8d Added 'entry' flag to deny entry. 2011-06-26 12:32:01 -07:00
sk89q 767c49f9fa Added region command whitelisting and the bypass for command checks. 2011-06-26 10:45:12 -07:00
sk89q c9178da608 Added command blocking. 2011-06-26 10:40:08 -07:00
sk89q 855bc59a53 [maven-release-plugin] prepare for next development iteration 2011-06-26 03:15:25 -07:00
sk89q 798c22e94b [maven-release-plugin] prepare release 5.1.1 2011-06-26 03:15:15 -07:00
sk89q ea3be11294 Blanked default configuration files. 2011-06-26 03:13:34 -07:00
sk89q 335073b3b0 [maven-release-plugin] prepare for next development iteration 2011-06-26 03:02:11 -07:00
sk89q 2b6ee344b7 [maven-release-plugin] prepare release 5.1 2011-06-26 03:02:02 -07:00
sk89q 8f55b82e2f Updated for 5.1. 2011-06-26 02:52:40 -07:00
sk89q ba9cd1f3e2 Updated the README.html. 2011-06-26 02:52:13 -07:00
sk89q e0e7ae98e7 Changed configuration files to save and also to inherit from the main configuration. 2011-06-26 02:24:50 -07:00
sk89q b05e439da9 Cleaned up pom.xml and updated maven-assembly-plugin to 2.2.1. 2011-06-26 01:31:59 -07:00
sk89q fb5dbbdf58 Removed .gitignore. 2011-06-26 01:28:24 -07:00
sk89q 9cb9dd0a58 Updated the README.html. 2011-06-26 01:27:55 -07:00
sk89q 276d42561e Added more aggressive TNT flag check. 2011-06-26 00:47:58 -07:00
sk89q 44b98165ba Added region protection to sign change event. 2011-06-26 00:24:09 -07:00
sk89q b5088340fd Fixed deny-spawn. 2011-06-25 23:27:01 -07:00
sk89q b7dd63ebd9 Changed event registration to catch errors. 2011-06-25 21:46:14 -07:00
Wizjany ba376a6326 Registering some other new events 'safely' 2011-06-22 21:29:22 -04:00
sk89q 87a43e8e8f Made SNOW_FORM be registered programatically so it can be used on CraftBukkit versions lacking that. 2011-06-22 08:46:37 -07:00
sk89q b62ada53c3 Re-ordered plugin enable process. 2011-06-22 08:43:10 -07:00
sk89q 4f3198b1bd wiz makes a good point -- PROBABLY should not delete players. 2011-06-20 19:35:14 -07:00
sk89q c9f99e0903 Added /stoplag or /halt-activity to cease all intensive operations (such as fire spread, water flow, mob spawning, etc.) and to remove mobs (except wolves) and item drops proactively for those situations when you (or someone else) messes up really badly. 2011-06-20 19:25:05 -07:00
Moo0 3b4c58b721 Add region limit override permission. 2011-06-20 17:22:33 +01:00
Wizjany 6496bbd87f Added config option to disable mob damage for people not using regions 2011-06-15 13:02:59 -04:00
Wizjany 4ad8d362f7 Reverted change to use flag 2011-06-12 14:36:26 -04:00
Wizjany d9aeb6afaa Fixed NPE in last commit 2011-06-11 16:24:06 -04:00
Wizjany d971389746 Prevent players from using bonemeal on grass if they aren't allowed to build in a region 2011-06-11 14:13:46 -04:00
sk89q 233a2bdbe7 Fixed an important bug with the algorithm for handling region priorities. 2011-06-11 01:21:08 -07:00
sk89q 2277183330 Added some more region priority unit tests. 2011-06-11 01:21:08 -07:00
Wizjany b2cd3d31fd Standardizing override permission nodes (with backwards compatibility) 2011-06-10 16:00:14 -04:00
Wizjany 02f6b3be42 Fixed USE flag being DENY in undefined regions 2011-06-10 15:50:03 -04:00
Wizjany 22e84321fc Removed duplicate handling of lighter fire 2011-06-10 01:41:59 -04:00
Wizjany c472dc89ad Changed the way some flags were handled and canceled 2011-06-09 17:02:19 -04:00
Wizjany b89d9d44b0 Now with 99.9% less Unknown Paste ID 2011-06-09 00:12:06 -04:00
Wizjany a2c21f8ceb Made anti-dumb wolf checks only apply to tamed wolves 2011-06-08 23:55:07 -04:00
sk89q e35596b0fa Allowed blocking weapon usage with the blacklist. 2011-06-07 16:08:50 -07:00
Wizjany b95a7f063b Fixed disabling durability resetting things which use durability otherwise 2011-06-07 16:32:43 -04:00
sk89q e4bbd36d47 <= 0 health? It's too late bby 2011-06-06 16:53:11 -07:00
sk89q 9790ab29a2 Now a very proactive (but not still reserved) infinite stack checker. 2011-06-06 14:46:06 -07:00
sk89q 24cc2d3b36 Changed the proactive infinite stack check to occur on inventory open. 2011-06-06 14:35:57 -07:00
sk89q 12779699e3 Improved the infinite item stack remover by making it a bit more proactive. 2011-06-06 14:31:17 -07:00
sk89q 2188690d20 Changed leave messages to be printed BEFORE enter messages. Suggested by Protected. 2011-06-06 11:30:00 -07:00
sk89q 7059fdfd9e Removed old/redundant code. 2011-06-06 11:29:11 -07:00
sk89q 9e1bde4b00 Merge remote-tracking branch 'remotes/origin/master' 2011-06-06 11:15:40 -07:00
sk89q 45790b60b0 Restored the configuration class name change so plugins don't have to be updated. 2011-06-06 11:08:38 -07:00
sk89q c5f3a27d6b Rewrote greeting/farewell and notify-enter/notify-leave flags. 2011-06-05 17:18:27 -07:00
sk89q d9136aa407 Optimized flags scheduler. 2011-06-05 16:38:28 -07:00
sk89q 183f48a998 Rewrote how healing flags were handled. 2011-06-05 16:31:42 -07:00
Wizjany 3c5bc507a5 Added trap doors to USE flag 2011-06-03 18:05:28 -04:00
Wizjany 548dd0365c Fixed another infinite sign... 2011-06-02 19:34:29 -04:00
Wizjany 4591fc603f Added permission nodes as an alternative to wg-invincible and -amphibious groups. 2011-05-31 19:58:12 -04:00
Wizjany 26946feecc Merge leafdecay flag from zml2008 2011-05-27 19:06:38 -04:00
sk89q dd14f3c469 Fixed priorities and parent-child regions, I believe. More testing is required. Removed dated CSVDatabaseTest. 2011-05-26 21:55:23 -07:00
Moo0 69af41f1e5 Remove permission. 2011-05-24 16:25:45 +01:00
sk89q 474562455d Abstracted chest protection. 2011-05-23 23:32:45 -07:00
sk89q c75d612541 Cleaned up code. The configuration classes were also renamed as they did much more than just configuration. 2011-05-23 23:32:44 -07:00
sk89q 8de6ce9868 Cleaned up code from a merge. 2011-05-23 23:30:54 -07:00
sk89q 97bde50708 Fixed some chest protection issues. 2011-05-23 23:30:54 -07:00
sk89q b23e35cf26 Improved chest-sign protection. 2011-05-23 23:30:53 -07:00
sk89q b58e04707d Timer flags timer removed. It will be restored when it gets rewritten to not leak memory and to handle messages better. 2011-05-23 23:30:53 -07:00
MonsieurApple 846cf63268 Merge pull request #109 from wizjany/master
Ghast fireballs and explosion cancelling
2011-05-23 20:04:24 -07:00
Wizjany 4850bdefdf Added config option to disable explosion-caused damage to players. 2011-05-23 22:26:02 -04:00
Wizjany 424b580eb9 Added ghast fireball handling (instead of grouping with tnt) and fixed god mode player ignition. 2011-05-23 22:25:56 -04:00
MonsieurApple 7f8ad468ca Merge pull request #108 from Moo0/derp
Bug in ProtectedCuboidRegion/getIntersectingRegions.
2011-05-23 13:55:05 -07:00
Moo0 e07e2bd7d1 Someone used the wrong variable in a for. 2011-05-23 21:44:02 +01:00
Moo0 7074963fb1 Add region bounds to "/region info" 2011-05-23 19:48:02 +01:00
MonsieurApple 88acbe655d Merge pull request #106 from kuyanatan/master
Fixed config misspell
2011-05-21 11:15:51 -07:00
Natan 903ebc68a4 Worldgurad != worldguard. 2011-05-21 10:48:07 -07:00
MonsieurApple 49bdccf020 Merge pull request #103 from wizjany/master
Fixed some derpy fire handling
2011-05-17 07:05:09 -07:00
MonsieurApple ba3818884d Merge pull request #99 from Moo0/listbyname
Filter "/region list" by user.
2011-05-16 17:11:13 -07:00
MonsieurApple 64ce904ec1 Merge pull request #104 from wizjany/opPerms
Added config for op permissions
2011-05-16 17:09:59 -07:00
Wizjany 8c5f7ef020 Added config for op permissions 2011-05-16 20:03:45 -04:00
Wizjany 98426f6dcc Added config for op permissions 2011-05-16 19:43:04 -04:00
Wizjany f3ec873ac2 Fixed some derpy fire handling. 2011-05-16 16:27:17 -04:00
MonsieurApple 30961483e1 Merge pull request #101 from wizjany/master
Fixed some commands not accepting flags they should
2011-05-14 11:42:01 -07:00
Wizjany 33e0750959 General commands now use flags as intended 2011-05-14 13:19:02 -04:00
MonsieurApple e59a07e232 Merge pull request #100 from wizjany/master
Painting events and snow fall flag
2011-05-13 05:20:20 -07:00
Wizjany 3b05b9be11 Added support for painting and added a flag for snow falling. 2011-05-13 00:37:48 -04:00
Moo0 943bbd9889 Show regions user is member of, as well as those user is owner of. 2011-05-08 18:55:48 +01:00
Moo0 763cf8dbda Add ability to filter '/region list' by user. 2011-05-08 18:44:08 +01:00
sk89q 5117518d8f Cleaned up code, removed OpenCSV code from WorldGuard. Now it's a dependency (that's compiled into the .jar). 2011-05-03 15:36:04 -07:00
sk89q 936996da17 Moved the unit tests to their proper place as recommended by the Maven gods. 2011-05-03 02:07:21 -07:00
sk89q 019a7e59b7 Alright, here's a surprise. Everything is now on Maven. 2011-05-03 02:04:55 -07:00
sk89q 428a47f889 Merge branch 'master' of https://github.com/wizjany/worldguard 2011-05-03 01:31:49 -07:00
Steven Mattera 2be2cb19b2 Uncommented line 445 on WorldGuardEntityListener 2011-05-03 01:30:07 -07:00
Steven Mattera 66ee09d050 Fixed TimedFlagsTimer to enable HEAL_DELAY,HEAL_AMOUNT,GREETING,FAREWELL,NOTIFY_GREET,NOTIFY_FAREWELL, and PASSTHROUGH Flags. 2011-05-03 01:30:07 -07:00
Steven Mattera 906dab28c1 Added MOB_SPAWNING state flag. 2011-05-03 01:30:06 -07:00
6db8e1d842 Merge pull request #94 from yetanotherx/chest-blacklist.
Don't deny placing a blacklisted item if the block clicked is a chest.
2011-05-03 01:32:00 -07:00
Yetanotherx a665e86096 Don't deny placing a blacklisted item if the block clicked is a chest. People often complain that "i was just trying to open my chest" when they were holding water. 2011-04-30 12:26:39 -04:00
sk89q b7481dbd2e Updated config. 2011-04-24 13:14:12 -07:00
Wizjany b1e509c6f8 Updated for 1.5 and added existing lightning protection. 2011-04-25 04:08:28 +08:00
Wizjany 1f69622a34 Added a lot of missing things to player listener. 2011-04-25 04:06:48 +08:00
Wizjany 215b2b5f75 Added config to stop players from trampling crops. Animals don't work yet (blame CraftBukkit) 2011-04-25 04:04:48 +08:00
Wizjany 1e8c91e92f Added override for flint and steel blocking. 2011-04-25 04:04:47 +08:00
Wizjany 19d447d67d Added handling for weather events. Depends on my craftbukkit pull request. 2011-04-24 15:55:26 -04:00
Wizjany 925fa2ee1b Updated for 1.5 and added existing lightning protection. 2011-04-24 15:53:32 -04:00
Wizjany 1cedf0e9a0 Added a lot of missing things to player listener. 2011-04-23 19:50:58 -04:00
Wizjany ca8bb7f5f0 Added config to stop players from trampling crops. Animals don't work yet (blame CraftBukkit) 2011-04-15 00:20:15 -04:00
Wizjany 9e15a4a557 Added override for flint and steel blocking. 2011-04-14 21:17:11 -04:00
sk89q af5d0c4b0e Re-added cake eat blocking on left click. 2011-04-13 03:11:05 -07:00
sk89q 08ab359534 Fixed region priorities, but it needs a test. 2011-04-13 03:07:17 -07:00
Steven Mattera 28c44e0b2f Added MOB_SPAWNING state flag. 2011-04-13 18:07:13 +08:00
Moo0 7038f49a1a Fix for "/region claim" claiming overlapping region when none exists. 2011-04-13 18:05:12 +08:00
sk89q af25c15286 Merge branch 'master' of https://github.com/wizjany/worldguard 2011-04-13 03:00:27 -07:00
sk89q ffc5281d59 Added protection.remove-infinite-stacks. 2011-04-11 12:34:11 -07:00
sk89q ad659cd32e Fixed a major bug with the sign chest protection. It replaced the second line of the sign with "[Lock]". 2011-04-11 11:55:12 -07:00
sk89q afd3cbd311 Added sign chest protection (needed it for my server). Just put [Lock] on the first line and names on the next three. The first name line must be the sign creator's, so you can track who made what. Friend lists are not yet supported. People with names longer than 15 characters (I believe 16 is the max.) are out of luck. 2011-04-11 10:13:42 -07:00
sk89q a5a5f7e24a Made /wg report look better. 2011-04-09 02:25:47 -07:00
sk89q 1e203b58c3 Fixed a bug, partially, regarding unloaded worlds. 2011-04-07 00:22:15 -07:00
Wizjany 104b7c2cf2 Fixed falling into void and wolves still taking damage. Requires Craftbukkit 638+ 2011-04-07 00:35:52 -04:00
Wizjany 355c89ecab Added missing default global config option to file. 2011-04-07 00:35:52 -04:00
sk89q 1241e18f9c Added /worldguard report [-p] 2011-04-03 17:20:13 -07:00
sk89q 6566acf7eb Added more aliases to /region subcommands. 2011-04-03 11:05:48 -07:00
sk89q 4332ed92f2 Added /region select. 2011-04-03 11:04:18 -07:00
sk89q 2e7f96aab0 Fixed /region setparent. 2011-04-03 10:35:06 -07:00
Wizjany 3cb9b90ef0 Added config to disable damage from falling into the void. 2011-04-03 05:48:32 -04:00
sk89q 21a04cc8c8 Added anti-wolf-dumbness. 2011-04-02 22:44:45 -07:00
sk89q dcc1b59627 Fixed region bypass. 2011-04-02 19:46:26 -07:00
sk89q e8fb3e6d24 Added a region high frequency flags setting to disable high frequency flags. Enable it if you've got the system resources to support it. This covers the fire spread, lava fire spread, lava flow, and water flow flags. 2011-04-02 18:45:11 -07:00
sk89q 93d084d5ba Caught CircularInheritanceException exception. 2011-04-02 18:02:16 -07:00
sk89q e45ecf9c86 Added the ability to clear parents with /region setparent. 2011-04-02 18:01:59 -07:00
sk89q beb10e22f2 Changed the /region flag flags list to check permissions. 2011-04-02 18:00:48 -07:00
sk89q 64b12f8497 Improved vehicle place flag to handle boats. 2011-04-02 17:57:58 -07:00
sk89q 0821a08df2 Updated /god to remove fire. 2011-04-02 17:53:09 -07:00
sk89q 50870a9b32 Fixed flag resolution algorithm not catching NoSuchElementException correctly. Now the spawn flag works. Note that the IDs for the spawn and farewell/greeting flags were changed. 2011-04-02 17:49:11 -07:00
sk89q b823446e28 Fixed flags, added separate lava flow flag. 2011-04-02 17:43:01 -07:00
sk89q 48b00874e5 Removed extra space. 2011-04-02 17:23:56 -07:00
sk89q deba6c79f3 Re-implemented the region spawn location flag. 2011-04-02 17:21:05 -07:00
sk89q c0be10ad94 Changed /god to mention /ungod. 2011-04-02 17:05:11 -07:00
sk89q 5010d35ff3 Added a basic API. 2011-04-02 16:26:35 -07:00
sk89q 42d26a1f4f Moved blacklist logger configuration back to be per-world. 2011-04-02 16:24:37 -07:00
sk89q 92c25d2df4 Updated default configuration file. 2011-04-02 16:22:27 -07:00
sk89q 5b5349fc34 Improved amphibious stuff, added pumpkin scuba. 2011-04-02 16:07:59 -07:00
sk89q cc6ac93b7a Fixed auto-god mode and auto-amphibious mode. 2011-04-02 15:58:52 -07:00
sk89q 1b843b3586 Fixed /god. 2011-04-02 15:54:41 -07:00
sk89q 3b9a426547 Fixed some flags and permissions. 2011-04-02 15:39:44 -07:00
sk89q 989ba0103d Added snakeyaml.jar to the build.xml file. 2011-04-02 14:19:01 -07:00
sk89q b584b996a3 Fixed parenting not saving. 2011-04-02 14:11:12 -07:00
sk89q 896c7fc467 Improved the cake processing mix to be less bitter. 2011-04-02 13:48:40 -07:00
sk89q bd2393342f Fixed the blacklist. 2011-04-02 13:35:57 -07:00
sk89q 762b10cb17 Fixed CSV->YAML conversion. 2011-04-02 12:15:40 -07:00
sk89q 9322eedb4e Fixed an error with the legacy flags. 2011-04-02 11:48:06 -07:00
sk89q 4e2a902b75 Fixed flag resolution algorithm. 2011-04-02 11:47:14 -07:00
sk89q d3b8bd6f39 Fixed more default flag values. 2011-04-02 10:41:33 -07:00
sk89q 0fa64dad7f Fixed the default values for the flags. 2011-04-02 10:40:30 -07:00
sk89q 792e8663e6 Re-implemented the block/player interact hooks that changed in Bukkit recently. 2011-04-02 10:17:02 -07:00
sk89q 4dc999b0d9 Fixed up default configuration files. 2011-04-02 02:40:01 -07:00
sk89q 7c15c2de41 Re-added /worldguard set of commands. 2011-04-02 02:33:23 -07:00
sk89q 43137c3e53 Rolled in Stefan's changes. 2011-04-02 02:07:42 -07:00
sk89q 521ecd438e Added proper support for global regions and a region ID validation regex. 2011-04-02 02:03:32 -07:00
sk89q 949c6599b3 Disallowed '.' in region IDs. 2011-04-02 01:41:13 -07:00
sk89q ea79efe693 /stack re-added. 2011-04-02 01:36:05 -07:00
sk89q b4a89462f8 /locate re-added, but it doesn't seem to work. (Potential Bukkit bug.) 2011-04-02 01:26:22 -07:00
sk89q 70bd3d0e9a Re-added /slay and /heal. 2011-04-02 01:20:11 -07:00
sk89q c33474e0f9 Added /god back in. 2011-04-02 01:16:10 -07:00
sk89q 3d0ebe5c91 Made /stopfire and /allowfire say the world that it was toggled for. 2011-04-02 00:42:19 -07:00
sk89q a9ab0702e0 /region update added. 2011-04-02 00:33:07 -07:00
sk89q 9272741a3c Added more region commands. 2011-04-02 00:18:28 -07:00
sk89q 2b72a99608 Re-added /region setparent. 2011-04-01 23:39:13 -07:00
sk89q 4c38e10fe1 Re-added /region save and /region load. 2011-04-01 23:31:28 -07:00
sk89q 7806b48d34 Re-added /region remove. 2011-04-01 23:23:23 -07:00
sk89q 9803d6b731 Improved YAML loading/saving. 2011-04-01 22:46:45 -07:00
sk89q 649db3aca2 Fixed an extraneous space in an insignificant message. 2011-04-01 22:46:26 -07:00
sk89q b75ab68e7a Completed marshalling implementations for all the flags and changed the LocationFlag to a VectorFlag. 2011-04-01 22:34:31 -07:00
sk89q 8ffc42d349 Added marshalling implementations for most of the flags, fixed configuration issue in WorldConfiguration. 2011-04-01 22:21:30 -07:00
sk89q 145c9750cd Added YAML protection database driver. 2011-04-01 22:12:29 -07:00
sk89q 12647c3a6c Project files and .gitignore should not be in the repo. 2011-04-01 18:28:23 -07:00
sk89q 056f8a57c7 Removed JSON database support. Restored flag loading support to the CSV database so that they can be ported over to the new format. 2011-04-01 18:24:34 -07:00
sk89q 94f0acf9f3 Fixed permissions not being loaded. 2011-04-01 18:05:24 -07:00
sk89q 40bf65d56a Updated for latest Bukkit. 2011-04-01 17:51:33 -07:00
sk89q 726e3a5c20 Added /region flag. DON'T USE THIS VERSION ON A PRODUCTION SERVER. 2011-04-01 13:39:29 -07:00
sk89q d1cab0da7f More stuff works. 2011-03-30 12:01:11 -07:00
sk89q ede4873c6a More progress. 2011-03-27 23:49:30 -07:00
sk89q fd8c827bf1 Updated createDefaultConfiguration() to create parent directories. 2011-03-27 11:18:30 -07:00
sk89q 20afbdf264 More is working! DO NOT USE THIS YET or I will have to personally slap you. 2011-03-26 19:33:29 -07:00
sk89q 0dd92e5189 Work in progress. EVERYTHING IS BROKEN. 2011-03-26 16:59:06 -07:00
sk89q 4b1ba5acb0 Fixed permissions not being load()ed. 2011-03-22 09:34:40 -07:00
sk89q edc94594eb Some cleanup. 2011-03-17 02:31:38 -07:00
DarkLiKally 837efb75d1 Updated iConomy.jar and added quickfix for timed flags crash 2011-03-14 12:01:43 +01:00
DarkLiKally 252208a479 Fixed DoubleRegionFlags 2011-03-10 16:18:30 +01:00
Redecouverte 2641cb7d4f fixed permissions for commands, hasPermission() does "worldguard." + perm so do prefix with "worldguard." 2011-03-09 13:36:10 +01:00
Redecouverte 9c91f06c5d re-added Init() functions to flags class, do not remove it, or the flags class will NOT be loaded on startup which will cause unexpected behaviour 2011-03-09 13:30:07 +01:00
sk89q 7fab4144ae Fixed bad merge. 2011-03-08 10:06:40 -08:00
sk89q 81eb2cad1a Some initial code reorganization. Todo: Have CSVDatabase handle flags so they can be ported over, and do the commands system a cleaner way. 2011-03-08 10:03:49 -08:00
DarkLiKally eda7db7aca Updated MobType to CreateType 2011-03-08 08:54:33 +01:00
DarkLiKally 45a7653dcd Updated iConomy.jar to 4.4.3 (Arcadia) 2011-03-07 08:38:39 +01:00
Valentin Churavy 36fef995e4 fixed nullpointer exception in GlobalRegionManager.java 2011-03-06 15:25:41 +01:00
DarkLiKally af2e862ca2 Updated iConomy.jar to 4.3(.1) 2011-03-04 12:04:30 +01:00
DarkLiKally 7f48ce06be Updated iConomy.jar to 4.2 2011-03-03 10:02:39 +01:00
Redecouverte 1c5ae9ef67 make sure the Flags class is always loaded on startup 2011-03-02 17:37:31 +01:00
Redecouverte 3bf18c41bb flags are now type-safe 2011-03-02 17:24:33 +01:00
DarkLiKally 7ab49f1909 Fixed command /buyregion 2011-03-02 16:44:02 +01:00
DarkLiKally 44b5e5548d added message if player has not enough money for the region 2011-03-02 16:28:01 +01:00
DarkLiKally 50ca9d129b Updated /buyregion command 2011-03-02 15:57:37 +01:00
DarkLiKally 7b725d655c Fixed sign alternative for /buyregion 2011-03-02 13:43:21 +01:00
DarkLiKally 3e9c7aa74b Fixed error with player-eat-check 2011-03-01 19:58:54 +01:00
DarkLiKally 916ed2652e Added check if player eats something 2011-03-01 19:43:50 +01:00
DarkLiKally 59a1726e8c Fixed heal flag (for max. player health(20)) 2011-03-01 15:18:34 +01:00
DarkLiKally 20f91b5258 Fixed denyspawn flag 2011-03-01 12:45:20 +01:00
Redecouverte 353ce7e825 removed legacy comments 2011-02-28 21:15:41 +01:00
Redecouverte 94be4ab18e updated permissions_list.txt 2011-02-28 20:39:30 +01:00
DarkLiKally df7409607f Added administrator notification functionality and flag for greets and farewells 2011-02-28 20:28:14 +01:00
Redecouverte 79b937e8d2 yet another fix for state flag fallback 2011-02-28 19:57:20 +01:00
DarkLiKally 83c6c9c743 Removed unused imports from WorldGuardVehicleListener.java 2011-02-28 19:47:25 +01:00
Redecouverte 6a2affc0f9 new global flags are now read from .yml files 2011-02-28 19:36:46 +01:00
Redecouverte 8ad713c183 implemented passthrough flag 2011-02-28 19:32:59 +01:00
DarkLiKally f8fb746f64 Fixed WorldGuardVehicleListener.java 2011-02-28 19:19:45 +01:00
DarkLiKally c6b3507bf4 Added placeVehicle Flag 2011-02-28 19:15:37 +01:00
Redecouverte 2dc95da6e0 moved registerEvents() int event listeners 2011-02-28 19:05:07 +01:00
Redecouverte 8f9bfcf474 enum flags now also take lovercase names 2011-02-28 18:51:37 +01:00
Redecouverte a8b54757e9 fixed /region info and region flag fallback 2011-02-28 18:36:19 +01:00
Redecouverte 19cfd9edc6 renamed new map to not confuse gson 2011-02-28 18:14:44 +01:00
Redecouverte 03d0f962e5 some more fixes for the new flag containers 2011-02-28 18:08:52 +01:00
Redecouverte 0ff24627ca fixed npe with new flag containers 2011-02-28 17:47:51 +01:00
Redecouverte 4d8cd430b7 renamed isFlagAllowed() to isStateFlagAllowed() 2011-02-28 17:25:31 +01:00
Redecouverte 30b0e5d0b1 rewrote flag system to end the madness 2011-02-28 17:19:51 +01:00
Redecouverte cdf067bba8 fixed crash in removeRegion 2011-02-28 11:00:37 +01:00
Redecouverte e4d05e14ac now using new command system 2011-02-28 10:45:00 +01:00
DarkLiKally 82dc78523f Added sign alternative for /buyregion
Added flag for lever and button usability
2011-02-28 10:42:34 +01:00
Redecouverte 676e744c02 replaced string comparison with instanceof 2011-02-28 00:52:26 +01:00
Redecouverte 0d80265ff2 updated permissions example in config.yml, fixed typo in CommandTpRegion, removed debug output in RegionCommandHandler 2011-02-28 00:49:24 +01:00
DarkLiKally 442521a73c Added getIntersectingRegions() method for polygonal and cuboid regions 2011-02-27 21:03:46 +01:00
Redecouverte dcef083e30 fixed worldguard.notify and worldguard.bypass permissions, optimized getApplicableRegionSet() calls 2011-02-27 19:31:49 +01:00
Redecouverte 162cd20f80 added permissions worldguard.region.priority.own and worldguard.region.priority.all 2011-02-27 18:43:39 +01:00
Redecouverte c74433422a region priority is now set correctly in /region claim 2011-02-27 18:40:32 +01:00
Redecouverte f338650b24 hopefully final fix for tnt block 2011-02-27 18:20:07 +01:00
Redecouverte 65c0d77d3e updated protection classes for getIntersectingRegions() 2011-02-27 18:16:09 +01:00
Redecouverte 09a150b6e9 updated config.yml, removed old permissions 2011-02-27 17:59:01 +01:00
Redecouverte 06173a446a blacklist can now be used as whitelist 2011-02-27 17:48:07 +01:00
Redecouverte d6adea447e json data is now reloaded if manually edited 2011-02-27 17:25:13 +01:00
Redecouverte d042b785ed updated tnt fix, updated respawn teleport 2011-02-27 17:00:34 +01:00
Redecouverte 881846d301 fixed tnt block npe thanks to Brettflan, added claim-only-inside-existing-regions and max-region-count-per-player region options, updated ApplicableRegionSet for regions 2011-02-27 16:24:07 +01:00
DarkLiKally 2092cc43b3 Updated for iConomy 4.0 2011-02-27 09:54:43 +01:00
DarkLiKally dc637d0f2b Fixed wall sign protection 2011-02-26 16:54:18 +01:00
DarkLiKally 987a20b33c Added ability to set a max. claim volume 2011-02-26 15:35:48 +01:00
DarkLiKally dbf65f798f Optimized the countBlocks() method for polygonal regions 2011-02-26 14:56:49 +01:00
DarkLiKally 97aa259b2d Added method to count the blocks in a polygonal region 2011-02-26 14:54:25 +01:00
Redecouverte 770a108bad /region info now names locations correctly 2011-02-26 13:18:31 +01:00
DarkLiKally 71aaa574b2 Added method to count the blocks in a cuboid region 2011-02-26 13:11:27 +01:00
Redecouverte a02fe633e2 fixed spawn/teleport flags 2011-02-26 12:49:14 +01:00
Redecouverte 0669bab563 added aliases /rd, /rc, /rf, /ri, /rl, /rp for region commands 2011-02-26 12:24:49 +01:00
Redecouverte a258400443 fixed npe for onPlayerRespawn 2011-02-26 12:00:02 +01:00
Redecouverte d02c5057c6 for
/region flag id name subname some string with spacaes

valueStr now contains 'some string with spaces'

this does only work for flags with a subname
2011-02-26 11:57:15 +01:00
Redecouverte a473f47235 /tpregion now checks for flag rights 2011-02-26 01:18:50 +01:00
Redecouverte 7bedf6bb15 fixed logical error in playerlistener 2011-02-26 01:08:18 +01:00
Redecouverte 9d813290c6 removed upcoming settings 2011-02-26 01:02:47 +01:00
Redecouverte 05239bccb0 updated FlagInfo, don't check for commands directly in CommandRegionFlag, use FlagInfo 2011-02-26 00:51:35 +01:00
Redecouverte 1d5c28f37f optimized getAffectedRegion() 2011-02-26 00:21:02 +01:00
Redecouverte 16fb6b4f9d fixed some major flaws in the flag system 2011-02-26 00:21:01 +01:00
Redecouverte 97b09aab34 added /region priority command, fixed loading region parent loading 2011-02-26 00:21:01 +01:00
Valentin Churavy 55210caceb Added onPlayerRespawn and registered listener 2011-02-25 23:25:08 +01:00
Valentin Churavy 8127e56603 Added /region flag <id> (spawn|teleport) (allow|deny)
(all|owner|member).
2011-02-25 23:11:21 +01:00
DarkLiKally e61b496ca4 Fixed iConomy 4.0 API support 2011-02-25 21:53:19 +01:00
Redecouverte 3ed8eb76c2 better error messgae for /region flag 2011-02-25 21:17:13 +01:00
Redecouverte a5c3b8a245 more fixed for flag system and /region flag 2011-02-25 21:13:37 +01:00
Redecouverte 3f5d52f901 getAreaFlag() functions now won't throw exceptions, updated /region info, fixed a typo in /region flag, parent regions are no longer required to overlap their children 2011-02-25 20:58:48 +01:00
Redecouverte 46e0607a26 /region info now outputs all flag types, /region flag cspawn still needs fixing 2011-02-25 19:20:49 +01:00
Redecouverte 23fa7a89ad some fixes for /region flag 2011-02-25 18:53:28 +01:00
Redecouverte dcd379bce7 location flags are now supported in FlagInfo class 2011-02-25 18:42:27 +01:00
Redecouverte 40238a9d25 added input filter for json parser 2011-02-25 18:04:21 +01:00
Redecouverte 44db374e09 better console output 2011-02-25 17:50:19 +01:00
Redecouverte d960d543ff fixed npe in creature spawn event listener 2011-02-25 17:44:03 +01:00
Redecouverte 0a45292587 merged with recent commits 2011-02-25 17:28:08 +01:00
Redecouverte 9b4a7c705b configuration is now per-world, updated permissions, made commands compatible with console where possible, /region flag now checks correctly for permissions, & some fixes 2011-02-25 16:50:28 +01:00
DarkLiKally 71a6d8ab44 Updated for iConomy 4.0 API 2011-02-25 15:30:28 +01:00
DarkLiKally 91f9acb633 Fixed /buyregion bug (now regions can be bought only one time) 2011-02-25 12:40:22 +01:00
DarkLiKally 0e45dc5a3f Improved iConomy support: added functionality to /buyregion to set the owenr of the region 2011-02-25 12:37:15 +01:00
DarkLiKally 3341574e02 Replaced some tabs with spaces 2011-02-25 12:22:58 +01:00
DarkLiKally 881dc38a18 Fixed for iConomy 3.0 and
fixed tha tabs in plugin.yml
2011-02-25 10:35:15 +01:00
DarkLiKally e54b201aa5 Updated for iConomy 3.0 2011-02-25 10:06:13 +01:00
DarkLiKally 2d06a40127 Added iConomy.jar to build.xml 2011-02-25 01:48:42 +01:00
DarkLiKally f7e68798fa Added iConomy.jar to the librarys and the /buyregion command class for iConomy Support 2011-02-25 01:41:06 +01:00
DarkLiKally b9fe5d2afc Added iConomy support:
- Ability to pay for claiming a region (price per block)
- Ability to create buyable regions with custom price

NOTE: inserted only placeholders for countBlocks(); so buy on claim will not work correctly

INFO: I had not enough time to test it
2011-02-25 01:36:47 +01:00
DarkLiKally 5f12d99e73 Added water flow flag 2011-02-24 23:14:26 +01:00
Valentin Churavy 933987ac0a /tpr <id> spawn does now need the permissions /tpregion.spawn and also
added /region flag <id> spawn delete
2011-02-24 23:04:50 +01:00
Valentin Churavy 3a10a0969a add /tpr <region id> spawn 2011-02-24 22:53:20 +01:00
Valentin Churavy ba4907e67b add region.contains(location) for /region flag <id> spawn set 2011-02-24 22:29:49 +01:00
Valentin Churavy 99b37147d3 added /tpregion <region id> and /region flag <regionid> teleport
<set|delete>
2011-02-24 22:17:55 +01:00
Valentin Churavy 92a03ab7d6 added /region flag teleport 2011-02-24 21:35:45 +01:00
Redecouverte 68a0c67769 fixed for latest changes 2011-02-24 21:18:08 +01:00
Redecouverte 17e9105b9c commands now handled by commandhandler, updated /region info and /region flag for extended flag data 2011-02-24 21:15:05 +01:00
Redecouverte 5411a294e7 implemented heal, greeting and farewell flag 2011-02-24 21:14:42 +01:00
Redecouverte f821e277de geter with default values for extended AreFlags data 2011-02-24 21:11:31 +01:00
Valentin Churavy 18c2164049 added basic support of region teleport in ProtectedRegion 2011-02-24 20:29:47 +01:00
DarkLiKally c9688a9c58 Fixed an issue with the mob spawn control flags 2011-02-24 17:56:36 +01:00
Valentin Churavy cd599849b2 55: Improved corner handling (Corners are now always inside a
PolygonalRegion)
2011-02-24 17:32:06 +01:00
DarkLiKally 423f0199d0 Updated mob spawn control flags 2011-02-24 16:36:47 +01:00
DarkLiKally 40299eeea4 Changed Logger back to private (I changed it to public for some test reasons) 2011-02-24 16:20:52 +01:00
DarkLiKally 38077275bc Added mob spawn control Flags and global settings 2011-02-24 16:11:44 +01:00
Redecouverte 23aa6dc743 getAreaFlag now respects region priority 2011-02-24 14:52:22 +01:00
Redecouverte b90fb6a2b0 polygonal regions are now recognized by /region command, added extended AreaFlags data functions to ApplicableRegionSet, fixed isFlagAllowed in ApplicableRegionSet can only be executed once problem, updated region managers to not just forward all regions to ApplicableRegionSet 2011-02-24 14:24:23 +01:00
Redecouverte 17c8ed9ebc fixed typo in getRegionManager 2011-02-24 12:42:20 +01:00
Redecouverte a091a32c26 updated imports and comments 2011-02-24 12:14:26 +01:00
Redecouverte 23970a4e36 extended AreaFlags data storage, fixed typo on renaming old regions.txt 2011-02-24 12:06:27 +01:00
Redecouverte f61a9ab5cc added multiworld support for regions and json region database 2011-02-24 11:19:35 +01:00
Redecouverte 4505bb6f4e now including json-simple via build.xml 2011-02-23 20:51:19 +01:00
sk89q bb836aea57 Updated for 4.0-alpha1. 2011-02-23 11:25:10 -08:00
sk89q d584fba31c Updated block damage event handling to work around issues. 2011-02-23 11:07:39 -08:00
Redecouverte feacf3af7b removed CraftBukkit dependency 2011-02-23 19:13:56 +01:00
Redecouverte 8c428bb399 added JSON.simple 1.1 lib 2011-02-23 19:13:55 +01:00
sk89q 8edb6976fb Changed usage of CraftItemStack to ItemStack. 2011-02-23 10:05:29 -08:00
DarkLiKally edd2f460a0 Updated reflowing of water on sponge removal/deactivation 2011-02-22 20:56:57 +01:00
DarkLiKally 8810647bb8 Added reflowing of water on sponge removal/deactivation and
Updated water clearing on sponge creation/activation
2011-02-22 20:44:16 +01:00
DarkLiKally 2204bd67a7 Fixed the water damage block Bug 2011-02-22 17:27:58 +01:00
DarkLiKally c9c747693d Added ability to change default values of region's flags in config.yml for: FLAG_LIGHTER, FLAG_TNT, FLAG_CREEPER_EXPLOSION, FLAG_MOB_DAMAGE 2011-02-22 15:06:25 +01:00
Redecouverte 135d92303d more fixed for cake protection, protected cake now is semi-proteced, only the first slice is not protected 2011-02-22 15:02:57 +01:00
Redecouverte c707434155 fixed cake protection in regions 2011-02-22 14:26:01 +01:00
Valentin Churavy 4b72805a69 55: ProtectedPolygonalRegion should now handle edges better. 2011-02-22 13:58:05 +01:00
Redecouverte d5a9b0c65f really fixed setUpCourtyardRegion().. 2011-02-22 13:33:30 +01:00
Redecouverte 2015604fe2 fixed ProtectedPolygonalRegion construction in setUpCourtyardRegion 2011-02-22 13:33:01 +01:00
Redecouverte 96a290b153 added ItemAcquireBlacklistEvent for onPlayerPickupItem, not implemented in craftbukkit. yet 2011-02-22 13:22:06 +01:00
Redecouverte 912fcfe88a added tests to netbeans project 2011-02-22 13:18:27 +01:00
Redecouverte 4dcf7489fa added NetBeans project files 2011-02-22 13:03:06 +01:00
Redecouverte 7f1552dff8 updated onPlayerDropItem for latest bukkit, updated WorldEdit API calls for latest WorldEdit 2011-02-22 12:04:44 +01:00
Redecouverte d2ca8bffc4 we are now ignoring canceled events 2011-02-22 02:49:20 +01:00
Redecouverte e15b01bac5 added blacklist on-drop event 2011-02-22 02:48:57 +01:00
Redecouverte dcd3cb80b8 switched to parameterless constructor (i guess this is that the bukkit devs intended with their fancy warning) 2011-02-22 02:15:06 +01:00
Redecouverte d0ddc7c271 - added .gitignore to ignore eclipse/etc build files
- events are now registered in onEnable()
2011-02-22 02:03:20 +01:00
DarkLiKally 2b55f3407c Fixed the skeleton damage bug in protected areas 2011-02-22 01:01:31 +01:00
DarkLiKally e84afb4808 Fixed the Skeleton damage bug in protected regions 2011-02-22 01:01:31 +01:00
Redecouverte 10c47eff7e fixed entity damage events for latest bukkit 2011-02-21 23:30:20 +01:00
sk89q aee81f918e Added polygonal regions. They don't save/load yet, nor can you make them in-game yet. They were tested to work a week ago though. 2011-02-20 12:10:42 -08:00
sk89q 95b2d9419f Fixed redstone listener for newer versions of Bukkit. 2011-02-12 19:14:14 -08:00
sk89q feb9ce6633 Re-added priority tree region manager implementation. Add and removal operations are not yet optimized. 2011-02-12 16:09:21 -08:00
sk89q 43489ca087 Changed how ApplicableRegionSet iterated over the region set, allowing it to be reused. 2011-02-12 15:49:55 -08:00
sk89q ce1a15e6ea Improved tick sync message suppression. 2011-02-05 14:00:06 -08:00
sk89q cc72d370ea Added suppress-tick-sync-warnings option. 2011-02-05 13:45:05 -08:00
sk89q d042185660 Added WorldGuardPlugin.canBuild(player, x, y, z) 2011-02-04 20:51:14 -08:00
sk89q e78b639018 Updated CHANGELOG.txt. 2011-02-02 23:37:40 -08:00
sk89q e8ea562b09 Changed 'release' target to also 'clean'. 2011-02-02 23:28:48 -08:00
sk89q 3b5a729ef3 Updated command handling for Bukkit. 2011-02-02 22:27:44 -08:00
sk89q ef7d487ec5 Updated burn event handling. 2011-02-02 22:21:44 -08:00
sk89q b379b8f022 Fixed suffocation disable option. 2011-02-02 21:03:33 -08:00
sk89q a31378c2c8 Changed disable-water-damage to disable-drowning-damage. 2011-02-02 20:51:52 -08:00
sk89q 0d2c2121bb 3.2.1 CHANGELOG.txt. 2011-01-31 14:36:33 -08:00
sk89q 21040b306a Updated for ItemStack change in Bukkit. 2011-01-31 14:35:46 -08:00
sk89q 541b1dbc44 Updated for 3.2. 2011-01-30 01:38:39 -08:00
sk89q 005ac41820 Added PvP default flag. 2011-01-30 01:36:59 -08:00
sk89q dd93772233 Fixed creeper explosion block with WorldGuard. 2011-01-30 01:16:16 -08:00
sk89q 428fc7e5f6 Fixed commands for the Bukkit commands change. 2011-01-30 01:03:57 -08:00
sk89q 5cf38cc885 Added redstone support to sponges, removed classic water. 2011-01-28 10:23:43 -08:00
sk89q 2f6b51e811 Fixed item durability disable for hoes. 2011-01-28 00:59:19 -08:00
sk89q 2f12da6bc6 Fixed error in a test. 2011-01-28 00:06:58 -08:00
sk89q 3985e157d9 Increased the priority of WorldGuard's event handling. 2011-01-24 09:17:20 -08:00
sk89q 3034eb5c12 Updated CHANGELOG.txt. 2011-01-24 09:12:56 -08:00
sk89q f666f1baa9 Fixed creeper and chest flag conflicting. 2011-01-24 09:12:32 -08:00
sk89q 3bbffa7b55 Updated for 3.1. 2011-01-24 02:40:17 -08:00
sk89q bc774e2596 Added /regionmembership permission. 2011-01-24 02:38:18 -08:00
sk89q 65a0e5c188 Possibly fixed projectile blocking in no-PvP zones. 2011-01-24 02:37:11 -08:00
sk89q 772d2cb580 Added ability to disable chest protection. 2011-01-24 02:35:33 -08:00
sk89q edc6825f83 Added WorldGuardPlugin.getRegionLoader(). 2011-01-22 01:41:18 -08:00
sk89q 7b2f9e0c86 Added Javadoc compilation. 2011-01-22 01:31:57 -08:00
sk89q 0fa4fa1862 Added getRegionManager() to WorldGuardPlugin. 2011-01-22 01:31:48 -08:00
sk89q 5be31ebb5c Fixed /god not working for others. 2011-01-21 19:49:22 -08:00
sk89q 962394b2ba Updated for 3.0b2. 2011-01-21 19:45:41 -08:00
sk89q 7cf7c5f44c Fixed issue where permissions were not loaded. 2011-01-21 19:45:06 -08:00
sk89q 5b494a09ec Fixed permissions for /stack, /locate, and /reloadwg. 2011-01-21 17:53:06 -08:00
sk89q 5cfac5da4a Marked version as beta1. 2011-01-21 15:41:25 -08:00
sk89q 203004951b Updated CHANGELOG.txt. 2011-01-21 15:26:43 -08:00
sk89q 765d7402fa Added parent-child relationships to regions, overhauled region code, added global build flag, improved flag support. 2011-01-21 15:23:11 -08:00
sk89q 151b5fc561 Fixed no-PvP zone messages being sent to the wrong person. 2011-01-21 01:37:40 -08:00
sk89q b489da7fe4 Fixed commands so that they work in a recent version of Bukkit. 2011-01-21 01:32:23 -08:00
sk89q 786a0f6f2b Reduced the number of imports in WorldGuardPlugin. 2011-01-21 01:27:18 -08:00
sk89q e2a940e01b Cleaned up code. 2011-01-21 01:21:36 -08:00
sk89q 518c3be478 Fixed errors in TestPlayer.java. 2011-01-21 01:13:20 -08:00
sk89q 6f3eaac008 Fixed NullPointerException in explode hook. 2011-01-21 00:51:50 -08:00
sk89q 31633e9466 Updated for 2.3.1. 2011-01-20 11:23:56 -08:00
sk89q 02913780ec Fixed the item durability disable setting changing the damage value on an empty hand. 2011-01-20 11:23:13 -08:00
sk89q f03a2263d8 Added checks for unchecked exceptions when resolving permissions. 2011-01-20 11:19:59 -08:00
sk89q a8cd832c28 Fixed various cast exceptions with the blacklist loggers. 2011-01-20 11:16:59 -08:00
sk89q abbced0530 Updated changelog. 2011-01-20 02:09:04 -08:00
sk89q 200e07023f Fixed /locate printing the name of the wrong person. 2011-01-20 02:03:43 -08:00
sk89q 5fdd26b53f Fixed CSVDatabase spitting an error if the owners list was empty. 2011-01-20 02:01:50 -08:00
sk89q 61896ea760 Updated example config.yml. 2011-01-20 01:56:42 -08:00
sk89q b43881c299 Added /locate. 2011-01-20 01:54:47 -08:00
sk89q 6046f4defc Fixed teleport-on-suffocation setting. 2011-01-20 01:07:39 -08:00
sk89q 69ccb9f12b Implemented contact damage and fixed other damage protection. 2011-01-20 00:55:20 -08:00
sk89q 430f2f57e9 Made TNT blocking work. 2011-01-19 23:38:16 -08:00
sk89q c3f0bbb41c Added /heal and /slay. 2011-01-19 23:31:20 -08:00
sk89q 7e481e6a9a Moved commands handling to be Bukkit-compliant. 2011-01-19 23:27:35 -08:00
sk89q 627de1aebd Changed how the player item event was handled. 2011-01-19 22:09:15 -08:00
sk89q 194108336b Updated CHANGELOG.txt. 2011-01-17 19:47:24 -08:00
sk89q eade612981 Fixed WorldGuard not getting group lists for permissions correctly. 2011-01-17 19:45:53 -08:00
sk89q 733163cc4c Updated changelog, readme. 2011-01-17 19:22:04 -08:00
sk89q 86a917ddd1 Added creeper block support. 2011-01-17 18:38:12 -08:00
sk89q e8503aa0b9 Now supports GroupUsers (through WorldEdit). 2011-01-17 17:55:56 -08:00
sk89q 01bf9e8406 Fixed issue where the build process did not make sure that plugin.yml would be updated. 2011-01-17 17:47:07 -08:00
sk89q 0bdadf63b3 Fixed errors in tests. 2011-01-17 17:45:51 -08:00
sk89q 5b1c35bf06 Fixed build file not replacing version macro correctly. 2011-01-17 16:51:04 -08:00
sk89q c467acdfac Updated CHANGELOG.txt for 2.1.1. 2011-01-17 02:55:18 -08:00
sk89q 22167a0a07 Allowed placing WorldEdit.jar as a dependency in WorldGuard/. 2011-01-17 02:53:13 -08:00
sk89q 251647c7a2 Added some priority support. 2011-01-17 02:31:32 -08:00
sk89q 80e9799579 Fixed typo in README.txt. 2011-01-17 00:23:17 -08:00
sk89q 95f49f34d0 Cleaned up code. 2011-01-17 00:19:23 -08:00
sk89q b01b67f64c Cleaned up code. 2011-01-17 00:16:02 -08:00
sk89q 603fb5d2b8 Made /reload WorldGuard work for everyone by default. 2011-01-17 00:13:27 -08:00
sk89q 22f7c347ab Simplified release ZIP. 2011-01-17 00:10:32 -08:00
sk89q 08229ed4f9 Made WorldGuard write default configuration files, more friendly. Removed hMod configuration files. 2011-01-17 00:05:35 -08:00
sk89q a942fd08f5 Fixed NullPointerException related to the player item event. 2011-01-16 23:15:30 -08:00
sk89q c96d534c26 Fixed fire spread disable preventing flint and steel too. 2011-01-16 19:38:29 -08:00
sk89q 789a9a9bb4 Fixed configuration file not being reloaded. 2011-01-16 13:33:23 -08:00
sk89q d2435a8026 Updated supporting documentation. 2011-01-16 13:33:14 -08:00
sk89q 36db436fa3 Implemented temporary permissions. 2011-01-16 12:56:17 -08:00
sk89q 30d9978412 Fixed various issues with regions. 2011-01-16 11:54:03 -08:00
sk89q 5db7f124ac Added region claiming, some fixes. 2011-01-16 10:44:37 -08:00
sk89q c82ee055e7 Updated stack command to use ItemType.usesDamageValue(). 2011-01-16 09:15:16 -08:00
sk89q cb1c1efc35 Moved blacklist message flood logger to Blacklist. 2011-01-16 09:11:42 -08:00
sk89q 0037a4e83f Restored blacklist. 2011-01-16 02:50:41 -08:00
sk89q c369b3c62a Removed item drop blacklist. 2011-01-15 23:50:29 -08:00
sk89q 0934a12205 Updated region protection to support chests. 2011-01-15 23:47:15 -08:00
sk89q d19db5f86f Further progress on the port. 2011-01-15 23:21:27 -08:00
sk89q 5657ee6c90 Progress. 2011-01-15 16:33:21 -08:00
404 changed files with 48169 additions and 7807 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
*.java diff=java
+17
View File
@@ -0,0 +1,17 @@
.classpath
.project
.settings/
target/
.DS_Store
**/*.iml
**/.idea
bin/
dependency-reduced-pom.xml
*-private.sh
.gradle/
**/build/
out/
+8
View File
@@ -0,0 +1,8 @@
language: java
dist: trusty
jdk:
- oraclejdk8
notifications:
email: false
before_install: chmod +x gradlew
script: ./gradlew build -S
+915
View File
@@ -0,0 +1,915 @@
# Changelog
## 7.0.1
* Add `/rg toggle-bypass` command which temporarily turns off region bypassing until used again.
* More improvements to `/rg flag` and `/rg flags` commands.
* Fix some checks for adding owners to unclaimed regions.
* Fix an issue with time-/weather-lock flags when logging in to a region with the flag set.
* Fix cause tracking in vehicles (incl. breaking lilypads in a boat)
* Use async teleports on Paper.
* Include hopper minecarts in the ignore hoppers config setting.
* Add sugar cane and cacti to the crop-growth flag. Bamboo is also included pending Spigot throwing an event for it.
* Specifically track when players ignite creepers with flint and steel.
* Fix fuzziness when using bonemeal near a protected region.
* Fix color codes not applying in greeting, etc flags when placed after a newline (\n).
* Add applicable region information to `/wg report`.
* Fix pistons flag not applying to sticky pistons pulling blocks.
* Add some custom metrics for bStats.
* Everything in the RC/beta changelog below.
## 7.0.1 RC 2 (inc. beta 1)
* Due to breaking changes in important Bukkit API, this is not compatible with MC 1.13!
* Update to MC 1.14. Adds protection for new blocks, etc.
* To allow players to read from lecterns, but not take the book, flag interact allow, and then flag chest-access -g nonmembers deny.
* Add ravager-grief flag.
* Fix overprotection of unsaddled pigs with the ride flag.
* Fix lava fire defaulting to off (won't change existing configs).
* Fix damaged/chipped anvils not respecting use flag like regular anvils.
* Add on-equip blacklist event. Note that it is overprotective due to deficiencies in Bukkit API.
* Update WorldEdit CUI when using /rg select.
* Add config option to disable villagers getting zapped into witches. ("weather.disable-villager-witchification")
* Add entity support to interact-whitelist config option (use the Material of the corresponding item).
* Fix vehicle-place protecting the rails at the very top of region boundaries incorrectly.
* Fix for emptying buckets on waterloggable blocks.
* Whitelist all player -> player interactions (previously was spammy in pvp).
* Fix sleep flag not protecting against explosions in nether/end.
* Add config for the teleport-on-void to reset fall distance.
* Fix config options taking material lists requiring "minecraft:" namespace.
* Fix disallowed-lightning-blocks situationally not working.
* Fix errors that occurred when plugins used falling block entities with non-item materials.
* Add special support for Paper servers (papermc.io): Paper's API allows us to track who launched fireworks.
* Fireworks are now protected by default. On Paper servers, members can use them by default (to deal damage),
on non-Paper servers, flag firework-damage allow to revert to old behavior (everyone can deal damage with fireworks by default).
* Misc performance enhancements for Paper servers.
* Add 'regions.use-paper-entity-origin' as an experimental setting (default off) for Paper servers. Enabling it will make non-player entities be treated as members of the place they spawned, instead of their current location when flags are checked.
## 7.0.0
* Added support for MC 1.13, dropped support for previous versions.
* Added lots of interactive text in e.g. `/rg info` command.
* Added `/rg flags` command which allows viewing and interactively setting all flags on a region.
* Large behind-the-scenes changes to WorldGuard's API (developers, see https://worldguard.enginehub.org/en/latest/developer/)
* Places that used numeric block ids (e.g. blacklist) should now use Minecraft's new string IDs.
* Fix various interactions with NPCs and region protection.
* Sponge-simulation now destroys kelp and seagrass, and de-waterlogs blocks.
* Added an option to block conduit effects.
* Fix using newlines in string flags such as greeting and farewell.
* Add item-frame-rotation flag.
* Ender chests no longer require chest-access (since they don't have inventories).
* Add kelp to vine-growth flag/config.
* Add block-trampling flag (for turtle eggs and farmland).
* Add snowman-trails flag.
* Track potion area-of-effect cloud causes for pvp etc. protection.
* Add confirmation to /stoplag command.
* Forcefully eject players from vehicles trying to force their way into entry deny regions (and out of exit deny).
* Fix removing child regions when removing a region with children.
* Fix some over-protectiveness of pistons.
* Chat and command flags (send-/receive- and allowed-/blocked-) now respect deny-message flag.
* Misc fixes.
## 6.2.2
* Added support for MC 1.12.
* Changed flower pots to fall under the build flag.
* Fix heal flag not functioning.
* Add option to allow Forge clients with host-keys setting.
* Add mobs.block-armor-stand-destroy config.
* Add firework-damage flag.
* Add config option to ignore hopper checks.
* Misc fixes.
## 6.2
* Added support for MC 1.11.
* Add a custom flag and session API (for developers, see https://worldguard.enginehub.org/en/latest/developer/)
* Add a config option to ensure location flags (teleport, spawn) are inside their region.
* Misc fixes.
## 6.1.2
* Added support for new blocks in 1.8, 1.9, and 1.10.
* Added protection from nether portals being created in protected region (enable via config `nether-portal-protection`).
* Added protection from slime block piston contraptions pushing into or pulling from regions.
* Added `chorus-fruit-teleport` flag, works similar to `enderpearl` to prevent teleportation.
* Added protection from pulling armor stands, items, and entities from protected regions.
* Changed order of greeting and farewell flags on adjacent regions. When leaving a region with a farewell flag and entering one with a greeting flag, the farewell message will be shown first now.
* Changed /heal command to also fill food/saturation meters.
* Changed fall damage prevention to also prevent flying into walls with elytra being fatal.
* Fixed fire-spread flag only preventing destruction, now prevents spreading too as per its name.
* Fixed creepers targeting players being able to blow things up in certain cases.
* Fixed armor stands being removed by /stoplag.
* Fixed some issues with fireballs being able to explode when ghast-fireball was set to deny.
* Fixed a lot of other minor issues.
## 6.1
* Added `exit-via-teleport` flag (default allow) to control exiting an exit=deny region via teleportation.
* Added a `fall-damage` flag to control player damage caused by falling.
* Added a `time-lock` flag to lock players' time of day. Valid values are from 0 to 24000 for absolute time, or +- any number for relative time.
* Added a `weather-lock` flag to lock players' weather. Valid values are "clear" or "downfall". Unset to restore to normal world weather.
* Added `-s` to the event debugging commands to show a stack trace rather than attempt to detect the causing plugin.
* Added support for using the `-e` argument (sets an empty value for the flag) in the flag set command when the type of flag is of the 'set' type.
* Added NPCs from the Citizens plugin to a whitelist so they are not protected.
* Added support for Spigot's BlockExplodeEvent.
* Changed tripwire to fall under the `use` flag.
* Changed enderchests to fall under the `use` flag.
* Changed vehicles and animals so they are not included in the `interact` flag.
* Changed the display of custom blacklist messages to no longer include a period at the end.
* Changed protection logic to consider connected chests.
* Changed the heal and feed flags to increase values for players who are invincible (or in creative mode) but not decrease them.
* Changed PvP protection to consider both attacker and defender locations.
* Fixed missing protection data for some 1.8-added blocks.
* Fixed compatibility issues with MC 1.7.
* Fixed inverted daylight detectors not being protected.
* Fixed spawn eggs not being included in protection.
* Fixed piston blocking not working due to a bug in Spigot.
* Fixed the blocking of certain invalid entity damage events.
* Fixed creeper explosions not being blocked in certain situations with explosion related flags set.
* Fixed "stickiness" with some position-related flags, sometimes resulting in rubber banding in the exit flags.
* Fixed armor stands so that they are treated more like item frames than mobs.
* Fixed blocks (e.g. sugar canes) adjacent to physics blocks (e.g. sand) not updating.
* Fixed a NullPointerException that occurred sometimes when generating the scheduler section of the report function (`/wg report`).
* Fixed the "no XP drops" configuration not functioning following a previous release.
* Fixed changes to region ownership sometimes not triggering a region database save.
* Fixed bucket protection displaying the "deny effect" even if bucket use was not prevented.
* Fixed CommandFilter matching emoticons and other unwanted characters.
* Fixed an exception occurring sometimes during game mode changes.
* Fixed primed TNT being checked twice for TNT flags.
## 6.0 beta 5
MC 1.7.9, 1.7.10 and 1.8 (Spigot only) are supported.
* Added a feature to detect when another plugin (incorrectly) includes WorldGuard's files, causing errors.
* Added a new `exit-override` flag that can be used on an entry=allow region that players can walk into from an entry=deny region.
* Added a new `entry-deny-message` to change the "entry denied" message.
* Added a new `exit-deny-message` to change the "exit denied" message.
* Changed entry/exit blocking to disembark players from their vehicles.
* Changed the PvP flag to no longer apply to self-attack.
* Fixed [#3220](http://youtrack.sk89q.com/issue/WORLDGUARD-3220): Polygon regions sharing points
* Fixed [#3216](http://youtrack.sk89q.com/issue/WORLDGUARD-3216): Polygon regions 'disappearing' or not working correctly
* Fixed [#3315](http://youtrack.sk89q.com/issue/WORLDGUARD-3315): Invincibility flag and mode not blocking knockback from snowballs, etc.
* Fixed [#3314](http://youtrack.sk89q.com/issue/WORLDGUARD-3314): Protection bypassable by getting a skeleton or creeper to target a player
* Fixed [#3326](http://youtrack.sk89q.com/issue/WORLDGUARD-3326): Enderchests cannot be protected with the use flag
* Fixed [#3327](http://youtrack.sk89q.com/issue/WORLDGUARD-3327): Fake players from some Forge mods are not being detected properly
* Fixed [#3328](http://youtrack.sk89q.com/issue/WORLDGUARD-3328): TypeToken error with CraftBukkit 1.7 in `/wg report`
* Fixed [#3086](http://youtrack.sk89q.com/issue/WORLDGUARD-3086): Region entry / exit messages overlap between seprate worlds
* Fixed [#2542](http://youtrack.sk89q.com/issue/WORLDGUARD-2542): Exit deny regions don't handle respawn / logout consistently
* Fixed [#2731](http://youtrack.sk89q.com/issue/WORLDGUARD-2731): Greeting / farewell messages don't understand region inheritance
* Fixed [#3308](http://youtrack.sk89q.com/issue/WORLDGUARD-3308): Enderchest interaction block not functioning with blacklist.txt
* Fixed [#3312](http://youtrack.sk89q.com/issue/WORLDGUARD-3312): PVP flag blocking enderpearl teleport fall damage
* Fixed [#3309](http://youtrack.sk89q.com/issue/WORLDGUARD-3309): Inventory view commands being blocked in protected regions
* Fixed [#3310](http://youtrack.sk89q.com/issue/WORLDGUARD-3310): USE flag is not allowing workbench usage
* Fixed [#3330](http://youtrack.sk89q.com/issue/WORLDGUARD-3330): Build permissions preventing block placement
* API: Added `BukkitUtil.toRegion(Chunk)`
## 6.0 beta 4
MC 1.7.9, 1.7.10 and 1.8 (Spigot only) are supported.
* Added better support for MC 1.8 blocks (regarding the use flag, etc.).
* Added an an experimental "lite" version of WarmRoast to CPU profile your server (try it: `/wg profile -p`)
* Added permissions for individual flag values (i.e. `worldguard.region.flag.flags.use.allow`).
* Added support for slightly older versions of Bukkit 1.7.9.
* Improved `/wg report`'s output (try it: `/wg report -p`)
* Fixed armor stands not being protected properly.
* Fixed lack of wood plate support with the `USE` flag.
* Fixed left click also being blocked when only right click needed to be blocked.
* Fixed items and paintings/item frames not decaying under some versions of Spigot.
* Fixed parent-child inheritance so the child will always inherit the parent.
* Fixed inheritance issues with a flag is set with a region group on a parent region.
* Fixed high CPU usage when Citizens is also installed.
* Fixed `on-acquire` in the blacklist so it also handles item transfers between inventories.
* Fixed the blacklist not supporting color codes.
* Changed the PvP flag so it applies to self-attack like in WG 5 (this change *may* be reverted).
## 6.0 beta 3
MC 1.7.10 and 1.8 (Spigot only) are supported.
* Support both MC 1.7.10 and 1.8.
* Don't apply the region override permission to PvP.
* Fix incorrect detection of hostile and ambient creatures when protecting against PvE.
* Fix the splash potion flag not working with the other flags.
* Fix potion blocking.
* Fix inability to blacklist the enchantment table and the workbench.
* Make PASSTHROUGH=DENY useful on ``__global__``.
* Fix issues (pistons broken, etc.) caused by adding members to ``__global__``.
* Make the EXP_DROPS flag a build-compat flag and set its deny message.
* Give the player back his/her XP bottle if it was blocked.
* Expand the interaction whitelist configuration to "physical" events.
* Catch command prefixes in the command flags.
* Add a RIDE flag for vehicles.
* Check for names in addition to UUIDs with /rg list.
* Whitelist hoppers and let them cross regions regardless of region protection.
* Revert USE flag's functionality to 5.x, add new INTERACT flag.
* Fix spawn egg blocking.
* Fix failed detection of incorrect blacklist block and item names.
* Fix command prefix bypass with the op command blocking configuration.
* Rewrite and update report generation (wg report).
* Add event cancellation debug commands.
* Fix location flags causing NullPointerExceptions.
* Show more details in error log which world the error belongs to.
* Add missing color codes when parsing input.
* Let players use NPCs always.
* Fix [WorldGuard] in log messages stacking on reloads.
* Better handle empty group / player names due to bad region data.
* Fix players being invincible with BUILD=deny.
* Fix certain entities not being damaged in protected regions.
* Improve entity detection in Entities utility class, add Entities.isNonPlayerCreature().
* Add missing SQL table prefix in statement selecting world names.
## 6.0 beta 2
* Added an `-e` parameter to `/rg flag` that sets the flag to an empty value. You can use this to, for example, make it so the `deny-message` flag is empty, meaning that players won't get a message at all.
* Added a visual smoke effect when an action on a block has been denied.
* Added `event-handling.interaction-whitelist`, a list of items or blocks that should never be protected. For example, adding `wooden_door` to the list would make it so that doors could be used by anyone regardless if they have permission or not. You may still protect the blocks via other means.
* Added `event-handling.emit-block-use-at-feet`, a list of items that, when used, will also be considered as the player using that item on the block at the player's feet. The purpose of this setting is, for example, to allow you to (sort of) prevent the use of a mod-added item that does not emit events.
* Added `-s` to silently turn toggle `/stoplag` and `-i` to show the current state of the setting. (Thanks, [stuntguy3000](https://github.com/stuntguy3000)).
* Added support for Bukkit [Material](http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html) names in the blacklist.
* Fixed [#3167](http://youtrack.sk89q.com/issue/WORLDGUARD-3167): Saplings can be used without permission although it won't place blocks inside the region
* Fixed [#3168](http://youtrack.sk89q.com/issue/WORLDGUARD-3168): Grown saplings that are partially prevented from placing all of its leaves may not remove the sapling
* Fixed [#3169](http://youtrack.sk89q.com/issue/WORLDGUARD-3169): Bonemeal usage falls under the USE flag when it should really fall under building
* Fixed [#3174](http://youtrack.sk89q.com/issue/WORLDGUARD-3174): Boat placement is not properly prevented in a protected region
* Fixed [#3130](http://youtrack.sk89q.com/issue/WORLDGUARD-3130): Polygonal selections allow unlimited claim volumes with /rg claim
* Fixed [#3137](http://youtrack.sk89q.com/issue/WORLDGUARD-3137): Claiming infinite regions is possible due to integer overflow
* Fixed [#3171](http://youtrack.sk89q.com/issue/WORLDGUARD-3171): Can't pickup XP in protected regions without permission
* Fixed [#3170](http://youtrack.sk89q.com/issue/WORLDGUARD-3170): Boats without a driver can be used to break lily pads
* Fixed [#3172](http://youtrack.sk89q.com/issue/WORLDGUARD-3172): Players cannot be damaged by mobs in protected regions unless they have permission
* Fixed [#3152](http://youtrack.sk89q.com/issue/WORLDGUARD-3152): BUILD overrides all other flags, unlike in WG 5
* Fixed [#3154](http://youtrack.sk89q.com/issue/WORLDGUARD-3154): notify-enterflag doesn't work with horses and other vehicles
* Fixed [#3166](http://youtrack.sk89q.com/issue/WORLDGUARD-3166): Trees do not grow naturally within protected regions
## 6.0 beta 1
### UUID support
Regions now fully support the use of UUIDs rather than names for storing the owners and members of a region. Commands still accept names, but they are translated into UUIDs in the background. For users who already have existing region data, names will be automatically converted to UUIDs on the first run of WorldGuard.
It is still possible to specify names rather than a UUID by using the `-n` flag with the region membership commands.
### 'Deny by default'
Previously, a pre-determined list of blocks and entities was used to determine whether an action by the player should be blocked. However, this has been reversed so that every action on a block or entity is denied (in a protected region) unless it has been deemed safe (such as, for example, right clicking with steak). Mods are now supported as a result.
The `USE` flag has been repurposed as a general "interaction" flag and covers every left click or right click of a block or entity. It also covers interaction that falls outside clicking.
### Exhaustive protection
More events are now handled in the protection code. For example,
* It is no longer possible to drop sand or gravel into a protected region from outside.
* It is no longer possible to grief a region by growing a tree into it.
* The entry and exit flags now handle players sitting on vehicles properly.
* Piston-moved blocks cannot be pushed into a different protected region.
* Owners of tamable animals are now considered in protection code.
Even water and lava flow can also be checked, although this requires that it be explicitly enabled in the configuration (flow events are very frequent, so they incur extra CPU cost).
The goal is to provide extremely exhaustive protection.
### Large performance boost for spatial queries
The performance of spatial queries for regions has been substantially increased at least an order of magnitude. Spatial queries are a necessity for the region code to query the list of regions that apply to a location in the world. There should be a negligible difference between 4, 40, and 4000 regions as long as too many regions are not overlapping.
### Background region operations
Region commands are now executed in the background. Notably, saves and loads will not lock up your server while they complete. Additionally, changes to regions are now saved periodically rather than immediately after every change.
### Updated MySQL region support
MySQL support has been completely overhauled. It should now be faster, no longer crash on foreign key index errors, use transactions, and support automatic creation and migration of tables (including support for table prefixes).
### Partial region data saving
For users of MySQL, WorldGuard now only saves changed and deleted regions when saving region data. No longer does WorldGuard have to rewrite the entire region database on each save.
### Improved handling of related flags
Multiple flags that apply to an event are now evaluated together if they are similar. For example, if a player right clicks a bed to sleep in it, both the `USE` and `SLEEP` flag are checked since they are both interaction-related. If one of them is `DENY`, then sleeping is denied (remember, `DENY` overrides `ALLOW`). If one of them is `ALLOW` and the other is not `DENY`, then sleeping is permitted.
Only one "category" of flags needs to evaluate to true to permit an action. `DENY` will not cross categories. For example, if `BUILD` is deny, it will not override `SLEEP`, so if `SLEEP` is set to `ALLOW`, sleeping will be permitted. This is fairly similar to how it worked on WorldGuard 5.
### Flag groups now work properly
While you could always set a group to a flag's value, the functionality was incomplete and did not work most of the time.
Now that groups are supported, you can change a flag so it only applies to a certain group of players. For example, `/rg flag example sleep deny -g members` would deny sleeping for only members of the `example` region.
### Inheritance now works as expected
Previously, a region only inherited flags and other details from its parents if the parent and the child overlapped at the location queried. This is no longer the case and inheritance is now always applied.
In addition, a new `-g` flag for `/rg define` lets you create a region with no physical area so that you can assign flags and use this region as a "template region."
### Settable deny message
It is now possible to change the message that users get when they are prevented from interacting with blocks or entities. This message is defined as a region flag, so you can set it on the `__global__` region or override it in a specific region. In addition, the tone and color of the default message has been softened, but you are free to change it entirely.
### Blacklist support for data values (and later, variants)
The blacklist was rewritten to support more than just block and item IDs. The immediate result is that you can now use data values, but as those are in the process of being deprecated by Mojang, it also allows support for Minecraft's new block variants in the future.
### Debounced events
Events that tend to reoccur very frequently (such as the ones that occur when you stand on a pressure plate continuously) have been "debounced" to reduce the number of checks that WorldGuard has to perform, reducing the amount of wasted CPU. In addition, the "you don't have permission" message is rate limited so players are not flooded with the message.
### New block place and break flags
A long requested feature was the availability of block place and break flags. These newly added flags work in tandem with the `BUILD` flag but can override `BUILD`. At the moment, it is not possible to allow explicit types of blocks to be placed or broken yet.
### Build permission nodes
A new optional (disabled by default in the configuration) feature is the checking of build permission nodes. For every block, entity, and item, the following permission nodes are checked:
* Block place: `worldguard.build.block.place.<material>`
* Block break: `worldguard.build.block.remove.<material>`
* Block interact: `worldguard.build.block.interact.<material>`
* Entity spawn: `worldguard.build.entity.place.<type>`
* Entity destroy: `worldguard.build.entity.remove.<type>`
* Entity interact: `worldguard.build.entity.interact.<type>`
* Entity damage: `worldguard.build.entity.damage.<type>`
* Item use: `worldguard.build.item.use.<material>`
In addition, the permissions are also checked in the style of `worldguard.build.block.<material>.<action>`, so `worldguard.build.block.<material>.place` would work too.
The list of usable material names comes from the [Material enumeration in Bukkit](http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html). For example, the permission for placing the bed block would be `worldguard.build.build.place.bed_block`. Be aware that _Material_ contains both item and block names.
For entity names, see [EntityType](http://jd.bukkit.org/rb/apidocs/org/bukkit/entity/EntityType.html).
### Other changes
* Added a setting to permit "fake players" to bypass protection. Fake players are used by some servers and some mods to allow events to be thrown for mod blocks. WorldGuard considers a player to be a fake player if the name starts with `[` and ends with `]`.
* Added a check so players can no longer disembark in a region from their tamed animal if they don't have permission to get back on.
* Added an item pickup flag to go along with the item drop flag.
* Added a new `//running` command was added to show currently running background tasks.
* Added a blacklist `on-dispense` event.
* Added more detailed error messages when parsing the YAML regions file.
* Added the `-Dworldguard.debug.listener=true` option that can be set on your server's command line to see how WorldGuard processes events, although this will result in a lot of log messages.
* Added log messages that occur on player join when a player had auto-god mode or auto-amphibious mode.
* Fixed the heal command so that it now sets a player's health to the maximum rather than 20.
* Fixed `ProtectedCuboidRegion.getPoints()` returning points in wrong order.
* Fixed the obsidian generator disable option to also apply to tripwire.
* Fixed an error with the blocked commands flag.
* Fixed a connection leak with the MySQL region code.
* Fixed `/wg reload` sometimes not applying new changes right away.
* Changed the region removal command so that child regions are no longer removed without warning when removing the parent region.
* Changed the YAML region data save code to first write the data to a temporary file before replacing the final file.
* Changed how region data is handled when region support is disabled: it is no longer loaded.
* Changed sponges to now be disabled by default. However, if you had previously installed WorldGuard, sponges will still be enabled. Sponges are being added in Minecraft and they work differently than in Minecraft Classic (which WorldGuard emulates). In addition, enabling sponge support in WorldGuard incurs extra CPU cost even if no sponges exist in the world.
* Changed how region data is loaded and saved so failures are now more graceful. If the region data fails to load for a world, then the entire world will be protected by default. In addition, periodic attempts will be made to load the region data in the background.
* Changed the `FEED` flag to maximize the player's saturation level if the hunger level is raised.
* Changed the `wg-invincible` and `wg-amphibious` groups feature so that it now must be enabled in the configuration.
* Removed the ability for WorldGuard to upgrade from a version for Minecraft Alpha.
### API changes
* You can use a new `WorldGuardPlugin.createProtectionQuery()` method to easily check build permissions.
* The listener classes were moved. Consider them internal -- if you want to make use of the listener somehow, please put in a ticket in our issue tracker.
* Much of the protection-related handling was previously scattered throughout the code. Now WorldGuard funnels events into an internal event system and then processes protection queries in a more consistent matter. These events are for internal use so it is strongly recommended that you do not use them (they may change without notice drastically). A lot of the protection-related flag handling was moved there.
* A significant portion of classes under the package of `com.sk89q.worldguard.protection` were changed or removed. However, the basic calls (testing the value of a flag, etc.) should still work, but they may be deprecated. Some of the utility `Domain`-related classes were removed.
* The old region database (load/save) API was removed and replaced with a new one. The new one no longer needs to pointless store a collection of regions on itself -- it has `collection = load()` and `save(collection)` methods.
* Previously, there were subclasses of `RegionManager` that implemented different spatial indices. However, now `RegionManager` is a final class and the spatial indices are separate (see the `RegionIndex` interface).
* A hash table was implemented that caches a list of regions within each loaded chunk. This increases performance of spatial queries substantially.
* A cache of recent spatial queries now exists (a cache of `ApplicableRegionSets`), but you need to make use of `RegionQuery` to make use of this cache. However, if you need to do a spatial query to modify region data, then the old method is better (get a `RegionManager`, etc.).
* `ApplicableRegionSet` was converted into an interface. In addition, there are now "virtual" `ApplicableRegionSet` instances that are returned by `RegionQuery` for certain special cases (such as, for example, region support being disabled by the user or region data being unavailable for a world due to an error). A new `isVirtual()` method is available. This is not an issue if you are getting `ApplicableRegionSet` instances from a `RegionManager`.
* `ApplicableRegionSet` now can accept a pre-sorted collection and its use of a `TreeSet` was removed for performance reasons.
* `FileNotFoundException` is now properly handled in the YAML region file class. It creates the new file and continues on.
* Player names are deprecated by Mojang and so they need to be converted into UUIDs. As this will take some time, you should do this conversion in a background task. To check whether a region contains a player, it recommended that `contains(LocalPlayer)` be used because it's possible that the user may be still using names. A new `WorldGuardPlugin.wrapOfflinePlayer()` method was added for this specific purposes.
* All flags now use `RegionGroup.ALL` as the default region group.
* `StateFlag.getDefault()` now returns a `State` rather than a `boolean`.
* The priority R-tree index now uses the R-tree for region intersection queries. Previously, it was only used for single point containment queries.
* Regions now keep a "dirty" flag and changes it whenever data within the region is changed. When WorldGuard decides to periodically save region data, it may only save changed regions. Calling `save()` on the `RegionManager` is no longer needed as periodical saves happen automatically.
* The old region data migration API was removed in favor of region store drivers. There is no longer a need to have an implementation for every possible conversion (i.e. YAML -> MySQL, MySQL -> YAML, etc.).
* `ProtectedRegion.copyFrom()` was added to copy region settings from another region.
* `@Nullable` annotations were added throughout the code. If you use IntelliJ IDEA, you may notice that it now warns you when a return value may be `null`.
## 5.9
* Added a config option to allow explosion flags to only prevent block damage
* Added allow-tamed-spawns setting, on by default. This will stop WorldGuard from culling tamed animals.
* Added config option and flag to prevent soil from drying naturally.
* Added formatting codes, &k/l/m/n/o and &x (reset).
* Added snow-fall-blocks option to config to restrict snow fall to certain blocks
* Allow players to add newlines (\n) via command, not just manually in yml.
* Allow the console to load/save all region managers with one command.
* Changed entity report format slightly.
* Check bypass perms for item-drop flag.
* Check for entities and projectiles removing items from frames too.
* Fix being able to use bonemeal to turn tall grass into double plants.
* Fix number of arguments for migratedb command.
* Fixed addowner/addmember commands adding command artifacts. Specifically, "-w <world>" will no longer be added when using it.
* Fixed milking cows in protected areas due to changes in Bukkit.
* Fixed ProtectedCuboidRegion::getPoints() returning points in wrong order.
* Fixed snowman trails being treated as snow fall.
* Make /rg list default to own regions if the player doesn't have permission otherwise.
* Protected items in item frames in protected regions.
* Resolved an issue where explosions of type OTHER_EXPLOSION were ignoring the world configuration settings.
* Send item-use blacklist event when right-clicking entities.
* Transformed the BlockFadeEvent handler into a switch.
## 5.8
* BREAKING CHANGE: This version has been built for versions of Bukkit for MC 1.6.1 and newer. Do not try to use this version of WG on an older Bukkit version.
* Added support for Minecraft 1.6+. Actual support of new 1.6 additions is dependant on Bukkit. Please use a newer build of Bukkit if, for example, you seem to be unable to add "Horses" to your lists of entities.
* Added mobs.disable-snowman-trails to disable the trails left by walking snowmen.
* Added -a flag to /region removeowner and /region removemember to remove all objects.
* Teleporting is now handled by entry/exit flags. If this is causing people to get entirely stuck inside entry/exit deny regions, set the new setting 'use-player-teleports' to 'false' in your configuration.
* Updated formatting for region commands, especially /region info.
* Changed permissions checking for /region commands to be more consistent, checking for region IDs as a sub-node. This means that if some permissions for some region commands no longer work, add '.*' to the end of permission lines for WG in your permission plugin.
## 5.7.5
* Refixed a few issues from 5.7.4.
## 5.7.4
* BREAKING CHANGE: Removed the cyan "**" in front of greeting and farewell messages to allow more customizability. You can re-add them by adding "&c**" to the flag.
* Fixed an issue enderpearling inside exit/entry deny regions.
* Added checks to players teleporting in and out of exit/entry regions.
* Fix bad matching in blocked and allowed command flags.
* Fixed heal flag bugs when player max health was increased.
* Add fishing to xp blocker.
* Applied other-explosion flag to entity damage as well.
* Fixed an issue with interaction that should allow blacklisting item use actions with no block involved (eg fishing rods, potions)
* Fix witherskull/fireball settings not being differentiated in one case
* Allow cow milking in no-build areas
* Fix infinite durability breaking items instantly.
## 5.7.3
* Fixed the error caused by Bukkit's change of the TNT minecart API.
## 5.7.2
* Updated to MineCraft 1.5.
* Added TNT Minecart support. They are handled with the same flags/settings as TNT.
* Added mining and smelting xp handling to the xp drops flag and setting.
* Fixed a few edge cases for placing items on region borders.
* Legacy: Fixed issue with //stack not respecting item metadata.
## 5.7.1
* Added a vine growth config option and flag.
* Added support for many commands to be used from console. Usage is with -w flag and a world name e.g. /rg addmem <id> <player> -w <worldname> /rg flag <id> <flag> -w <worldname> <flagvalue>
* Fixed bug that blocks placing plants in flower pots.
* Fixed permissions check for /rg tp
* Fixed enderchests not being accessible (they are now part of the USE flag)
* Fixed an issue with slabs being placable in protected regions. This was also fixed in CraftBukkit but has been left in for users running other versions.
* Fixed wither skulls being handled with other fireballs, despite having their own settings.
* Fixed item frames being placable on region borders.
* Fixed a bug that made explosions more ineffective than they should have been.
* Fixed bonemeal usage in protected regions.
* Fixed special minecarts being placable in protected regions.
* Fixed bugs being placable on region borders.
* Fixed wolves bypassing pvp flags.
## 5.7
* Fixed thread sync issue with FlagStateManager.
* Fixed dragon egg region protection not working in certain cases.
* Added beacon and anvil usage protection in regions.
* Add mobs.block-enderdragon-portal-creation to stop enderdragons from making portals on death.
* Fix TNT being lethal in some case when damage was disabled.
* Fix snowballs and enderpearls being able to knock players back in pvp deny regions.
* Add subcommand support for allowed and blocked command flags.
* Add max-players-allowed and max-players-reject-message flags to limit the numbers of players in a region.
* Fix players being able to plant cocoa beans in protected areas.
* Add an enderpearl flag to prevent players from teleporting to and from regions.
* Added mobs.block-other-explosions config setting and other-explosion flag to block explosions caused by uncovered things, such as other plugins. (It doesn't actually have to be a mob)
* Fix mob damage setting and flag not blocking the DoT wither effect.
* Ghast fireball flag will not block blaze fireballs from lighting things on fire.
* Fixed players without region permissions being able to trigger tripwires, use enderchests, use wooden buttons, and put plants in flower pots.
* Added mobs.block-zombie-door-destruction setting to stop zombies from breaking down doors while difficulty is set to hard.
Thank you to thvortex, Dilandau, tophathacker, and Dark_arc for their contributions this release.
## 5.6.5
* Fixed a regression that caused paintings and item frames to no longer be properly protected.
## 5.6.4
* Added mobs.block-above-ground-slimes to block slimes spawning naturally above ground.
* Added security.deop-everyone-on-join to de-op all players when they join.
* Added security.block-in-game-op-command to prevent usage of /op from in-game.
* Fixed a NullPointerException in PlayerInteract involving water potions and potion blocking.
* Fixed an issue with snowballs being blocked in regions.
* Changed dragon eggs to be checked like it is a broken block in regions.
* Moved developer's WGBukkit class to package com.sk89q.worldguard.bukkit.
## 5.6.3
* Added helper WGBukkit class to get references to WorldGuard from other plugins.
* Added physics.vine-like-rope-ladders to make ladders work like vines. As long as the top ladder block is present, ladder blocks will hold even if they have no block behind them, like a rope ladder.
* Fixed NullPointerException in PlayerInteractEvent caused by potion blocking.
* Fixed mobs.block-{item-frame,painting}-destroy not working.
Thank you to def for testing the above fixes and features.
## 5.6.2
* Fixed potion blocking not working well for splash potions.
## 5.6.1
* Added a mycelium-spread region flag.
* Added a dynamics.disable-mycelium-spread configuration setting.
* Added new gameplay.block-potions option. For example: gameplay: block-potions: [invisibility, speed]
* Fixed a bug in the entity explosion event handler that caused a NullPointerException.
Thank you for gabizou for his contribution in this release.
## 5.6
* Added official support for Minecraft 1.4. Support for 1.3.2 (and below) is still provided in this release.
* Added support for new and existing explosion types.
* Added support for blocking withers with the following settings: mobs: block-wither-explosions: false block-wither-block-damage: false block-wither-skull-explosions: false block-wither-skull-block-damage: true
* Added support for blocking item frames (and their use) in protected regions.
* Added item frame destruction region flags (if you wish to disable item frame destruction completely).
* (Re-)added support for priority R-tree region indexes. This means quicker region lookup, and better support for servers with thousands of regions.
* Improved /region info output for -g group flags.
* Allowed removing of -g group flags with /region flag.
* Allowed /region flag to set group and value at once.
* Deleting a region flag now also deletes group flag.
* Fixed detection of attack by projectiles to be more accurate.
* Fixed support for saving non-string flags in the MySQL region support.
* Fixed spurious comma in "Flags:" /region info output.
* Fixed players who are not in god mode not receiving damage in PVP areas from enderpearls.
* Players will now be told that they are in a no-PvP area if they are in one and attempting to attack someone, or that the player they are attacking is in a no-PvP area, if that is the case instead.
* Fixed an issue where region.getId() was lowercase'd each pass of a for loop in MySQLDatabase.updatePoly2dPoints().
* Fixed mob damage from projectiles not being properly blocked in regions where applicable.
* Changed default region wand to leather (#334).
Thank you to the following individuals for their contribution:
thvortex, Rutr, Glitchfinder, and DarthAndroid.
## 5.5.4
* Minecraft 1.3 support.
* Fixed /stack dupe bugs.
* Added regions.use-creature-spawn-event.
* Update for Async chat issue.
* Add use flag to cakes.
* Report number of plugins loaded in report writer.
* Updated fireblal item blocking.
* Fixed permissions for /region reload.
## 5.5.3
* Added game mode flag.
* Added item drop pickup flag to regions.
* Added support for fireball item blocking (385).
* Added configuration option to allow creature spawns from plugins.
* Added host key check.
* Added a new line split feature to region greetings.
* Prevented commands in the allow commands list from being blocked and vice versa.
## 5.5.2
* Added potion-splash flag to block splash potions
* Add entity-painting-destroy which can be used to prevent entities from destroying paintings (skeletons firing arrows)
* Added send-chat and receive-chat flags
* Fixed having regions in multiple worlds with the same name not working with MySQL
* A cancellable event is now fired if WorldGuard disallows PvP. (for developers!)
* Made /region setparent check worldguard.region.setparent.own/member.<parent> instead of worldguard.region.setparent.own/member.<child>.
* Allowed passing #<index> in place of a region ID, where <index> is the index as displayed by /region list.
* Fixed an error that occured when clearing a non-existant region's parent.
* Added a -s flag to /region teleport, which sends you to the spawn point instead of the teleport point of a region.
* Added region/role-based permissions to /region teleport.
* BREAKING CHANGE: Added a LocationFlag class and made the teleport and spawn flags use it.
* /region info -s now selects the region being queried.
* Added /region teleport <id>.
* Vector flags can now be set to the current location with the value "here" and to a specific position with x,y,z.
* Made /region info show the region you're in if you don't specify an id explicitly.
* Prevent block ignition from lightning strikes if lightning is blocked in region. Fixes #1175
* Correctly check both WEPIF and superperms in WorldGurdPlugin.broadcastNotification()
* Destroy fire blocks when fire-spread is disallowed
* Added a construct flag that can be used to restrict block placing/destroying in zones to certain roles.
* Added FallingSand to list of intensive entities to be removed with /halt-activiy.
* Replaced all usage of CreatureType by EntityType.
* Updated to support Bukkit 1.2-R0.3 and newer
* Made auto-god-mode disabled by default again.
* Added sign protection check disable.
* Cleaned up javadoc, deprecated duplicate methods, other cleanup
* Added a RegionGroupFlag to evey region flag Using the /region flag command with -g, the region group that the region flag applies to can be set.
## 5.5.1
* Fixed attacking with arrows from non-PVP to PVP areas
* Compatibility with Bukkit 1.1-R5
* Removed broken suppress-tick-sync-warnings config option. See bukkit.yml's setings.warn-on-overload option instead.
* Add region and 'can build' information to CommandBook's /whois
Contributions thanks to: NolanSyKinsley
## 5.5
* Removed WorldEdit.jar from the classpath to stop conflicts with Bukkit's plugin loader
* Now using Bukkit's tagged logging
* Updated to new event system
* Flush player flag state cache on world change
* Improved compatibility with versions of CommandBook without GodComponent and updated pom dep for 2.0
* Added MySQL region storage method.
* Made explosions display their animations even when the event was blocked.
* Added fallback support for those who don't have a version of CommandBook with GodComponent
* Added LIGHTNING flag to DefaultFlag's flagsList Fixes #1026
* Removed /god, /heal, /locate, and /stack from WorldGuard to CommandBook. CommandBook is now checked to see whether a player is godded.
* Removed remaining usages of org.bukkit.util.config.Configuration
* Removed some unused configuration options
* Added permission worldguard.region.wand to the region wand
* Fixed ProtectedRegion.compareTo.
* Fixed FlatRegionManager.getApplicableRegions to return parent regions as well.
* Added exp-drops flag to disable experience drops per-region.
* Fixed some warnings.
* Updated dependency version for WorldGuard from 5.0 to 5.1-SNAPSHOT.
* Added support for fireballs shot by players being blocked by the PVP flag.
* Now using dynamic command registration
* Split off ender dragon block damage from creeper block damage.
Contributions thanks to: narthollis, DarkArc, Wolvereness, and skeight
## 5.4
* Fixed configuration generation on Windows
* Fixed intersection calculation for regions
* Fixed timer and feeding delay for food flags
* Fixed region managers not being created properly (This caused errors related to CREATURE_SPAWN)
* Added support for Minecraft 1.0.1 blocks
* Added support for enchantments and tool damage (worldguard.stack.damaged is the node) with /stack
* Made being in the wg-invincible group respect the configuration's auto-invincible setting
* Added per-group region claim limit maximum
* Added worldguard.region.addowner.unclaimed.* permission for non-economy region 'buying'
* Checking allowed/blocked commands now occurs earlier to override more plugins
* Made PVP flag check whether either player is in a pvp deny region for blocking
Contributions thanks to: epuidokas, wizjany, Turtle9598, and DerFlash
## 5.3
* Added new config options and flags to better handle explosions of all types
* Added config options and flags for snow, ice, mushroom spread, grass spread, and leaf decay
* Added min and max health flags to clamp the values for the existing healing flags
* Added hunger flags similar to the existing healing flags
* Added an option to disable the use of the move event. This can boost performance on large servers but will disable the greeting/farewell and entry/exit flags
* Added flag to prevent pistons (including those that are outside the region, but would affect blocks inside the region)
* Added a /wg flushstates [player] command to free players stuck in a region that was exit-deny but no longer exists or the flag was removed
* Added a config option to disable xp orb dropping
* Added config option to disable redstone wire obsidian generators
* Added a vehicle-destroy flag
* Added enderman protection config and flag
* Allowed and blocked command flags will now fall back to the global region
* The worldguard.region.flag.own/member permissions are now worldguard.region.flag.regions.own/member! Please change your permissions accordingly.
* Made //stack respect max stack sizes unless the player has the worldguard.stack.illegitimate permission
* Setting invincibility flag to deny will override god mode unless the player has worldguard.god.override-regions
* The sleep flag will now prevent beds in the nether from exploding if set to deny
* Existing regions can no longer be accidentally overwritten. Use /region redefine to move an existing region.
* The info command will now sort players alphabetically
* Priming TNT by punching it with flint and steal should throw a blacklist event (consistent with old Minecraft versions)
* The /stoplag command will now remove xp orbs
* Permissions system will use per-world permissions if the provider supports it
* Players in vehicles are now subject to entry/exit and greeting/farewell flags
* Fixed interact blacklist event not logging correctly
* Fixed heal flag taking effect half a block northeast of the region
* Fixed a infinite sign dropping bug
* Fixed players being able to douse fire by punching it in regions they couldn't build it
* Fixed players being able to eat protected cake
* Fence gate usage can be blocked with the use flag
* Fixed chests being unprotected when they should be in 1.8
* Fixed weather config settings not applying when a world was loaded
* Fixed explosion handling in certain cases
* Fixed arrows working in non-pvp zones
* Fixed buckets working on the border of protected regions in certain cases
Contributions thanks to:
wizjany, zml2008, imjake9, Droolio, epuidokas,
EduardBaer, TomyLobo, and halvors
## 5.2.2
* Changed configuration saving so empty lists will be added to the configuration files.
## 5.2.1
* Add region bounds to /region info
* Added the ability to add owners/members to the global region for handling guest groups. Now if there's owners or members on the global region, then those that are not on the list cannot build.
* Fixed some flag algorithm issues.
* API: Fixed DefaultDomain.size() not counting players.
* API: Undeprecated ApplicableRegionSet.allows(StateFlag).
## 5.2
* Gave the ability to use color colors and macros in greeting and farewell messages.
* Added disable-ice-melting, disable-snow-formation, disable-mushroom-spread, disable-snow-melting, disable-ice-formation.
* Added paintings to blacklist support.
* Added default.disable-health-regain.
* Added auto-invincible-permission setting, which lets you use the permission 'worldguard.auto-invincible' to become invincible on join automatically.
* Flames won't appear if you are /god'ed now.
* Added blocked-cmds region flag to block commands.
* Added allowed-cmds region flag to whitelist commands.
* Added entry region flag to block entry. Use entry-group to determine who this affects.
* Added exit region flag to block exit. Use exit-group to determine who this affects.
* Made negative healing possible via the healing flag.
* Changed the configuration header messages to be more helpful to new users.
* Added a warning about modifying region files by hand.
* Improved the API for plugin developers.
## 5.1
* A lot of changes.
## 4.0-alpha1
* This release is only to fix WorldGuard for Bukkit. Ignore the 4.0 label. Just move along. Nothing to see.
## 3.2.2
* Changed disable-water-damage to disable-drowning-damage.
* Fixed suffocation disable option.
* Fixed fire spread blocking.
* stopfire and allowfire now work in server console, just like in hMod.
## 3.2.1
* Updated for recent Bukkit ItemStack change.
## 3.2
* Added regions.default.pvp to control default PvP setting.
* Updated WorldGuard for the newer builds of Bukkit.
* Fixed creeper explosion blocking.
* Added redstone support to sponges, removed classic water.
* Fixed item durability disable for hoes.
## 3.1.2
* Increased the priority of WorldGuard's event handling.
## 3.1.1
* Fixed creeper and chest flag conflicting.
## 3.1
* Added ability to disable chest protection. New configuration setting (regions.build.chest-access) and new chest flag.
* Possibly fixed projectile blocking in no-PvP zones.
* Added /regionmembership permission that lets people only change the owners and members of regions they own.
## 3.0b2
* Fixed issue where built-in permissions were not (re)loaded.
* Fixed /god not working for others.
## 3.0b1
* Added parent-child relationships to regions.
* Added global build flag.
* Improved flag support.
* Fixed no-PvP zone messages being sent to the wrong person.
* Fixed commands so that they work in a recent version of Bukkit.
* Fixed NullPointerException in explode hook.
## 2.3.1
* Fixed various cast exceptions with the blacklist loggers.
* Added checks for unchecked exceptions when resolving permissions.
* Fixed the item durability disable setting changing the damage value on an empty hand.
## 2.3
* /god now works very well.
* Item (TNT, flint and steel, etc.) blocking should now work.
* The TNT blocking configuration variable should now work.
* Re-added /heal (not sure where that went), added /slay.
* Implemented contact damage disable toggle.
* Made all player damage disabling configuration parameters work.
* Fixed teleport-on-suffocation setting.
* Added /locate <name>, /locate <x> <y> <z>, and /locate that lets you program/change your compass bearing to point to a player's position (not yet live), a position, or back to spawn.
* Fixed CSVDatabase spitting an error if the owners list was empty.
## 2.2
* Now supports GroupUsers.
* Added support for blocking creeper explosions.
* Fixed a bug where a player's groups were not being loaded correctly, causing the blacklist group ignore option to not work.
## 2.1.1
* Fixed fire spread disable preventing flint and steel too.
* Fixed NullPointerException related to the player item event.
* Made setup simpler.
## 2.1
* Improved Bukkit support.
## 2.0beta3
* Fixed NullPointerException inside the ignite hook.
## 2.0beta2
* Fixed a NullPointerException in the damage hook.
## 2.0beta1
* Added area protection. Use /region or /rg to define regions.
## 1.8.1
* Fixed NullPointerException.
## 1.8
* Updated for Minecraft beta.
* Blacklist hooks have CHANGED. The new hooks are work better. on-create has been replaced with on-place (for block placement) and on-use (for item usage, light buckets and lighters). The old on-use is now on-right-click although it currently does nothing.
* Added coordinates to blacklist file logger.
* Added suffocation damage prevention.
## 1.7.1
* Updated for v0.2.8.
## 1.7
* Updated for v0.2.6_02 and hMod b129.
* Added option to prevent water from damaging particular blocks (Redstone wire, Minecart tracks, etc.). See disable-water-damage-blocks.
* /reload WorldGuard should now reload WorldGuard's configuration.
* Added wg-invincible and wg-amphibious groups that let you give certain players invincibility or underwater breathing.
* Added the ability to disable fall, water, lava, and/or fire damage.
* Water/lava bucket blocking should now be more reliable.
* Added /stack (alias /;) commands to stack items in your inventory into piles up to 64 items in size. Even unstackable items like signs can be stacked.
* /god mode should now let you gain health.
* /god mode should now work more reliably.
* Caught an error message for when the configuration file does not exist.
## 1.6
* Added spawn protection that prevents damage when a player spawns.
* Added login protection that prevents damage when a player joins.
* Added /god. /god can be used on others, provided that the /godother permission is set for the command's user.
## 1.5.1
* Removed the 'java.lang.NoSuchMethodError: Item.setDamage(I)V' error generated.
## 1.5
* Removed the block lag fix.
* WorldGuard now conditionally loads features so you can use any up-to-date build of hMod and the unsupported features won't break the entire plugin. When WG loads, check the server console for a report of features that are not supported by your version of hMod.
* Changed some configuration defaults: disable-lava-fire=true simulate-sponge=true item-durability=false
## 1.4.1
* Fixed issue with the block lag fix dropping item stacks of 0 quantity.
## 1.4
* New on-acquire hook. This does both a total inventory check on inventory change and item pick up denial. The item pick up denial is largely thanks to Dinnerbone for fulfilling my request to add a particular hook.
* Item durability can now be toggled with item-durability. Thanks to Dinnerbone for figuring this out while filfilling my request. The default setting is to fix item durability.
* New no-physics-gravel and no-physics-sand options allow you to prevent gravel and sand from falling.
* New allow-portal-anywhere option allows you to create portal blocks anywhere.
## 1.3
* UPGRADE WARNING: If you are using database logging, you must add a NULL 'comment' VARCHAR field to the table. The line of SQL that you can run for MySQL can be found in blacklist_table.sql.
* Improved plugin compatibility with the block lag fix. For maximum compatibility, you must now list WorldGuard as the first plugin in server.properties and you cannot reload or enable the plugin while the server is up. This is for bad plugins that unnecessarily use the "critical" priority for its hooks like the LWC. Most plugins don't do that though, so this won't apply for most people.
* Fixed signs being blank if they were denied via the blacklist.
* Added on-break event to the blacklist.
* Added comments and messages. Comments are only for your own use and they are printed with the log and notify actions of the blacklist. The message replaces the message that is shown the user and it is optional.
* The blacklist notification messages are now more compact and are light grey instead of light purple.
* The notify, log, and tell actions will now trigger every time for the on-break, on-create, on-drop events rather than wait 3 seconds between events for the same item or block for a player.
## 1.2
* /stopfire and /allowfire disable and enable fire spreading globally.
* Block lag fix slightly improved in accuracy for item drops.
* Sponge updated to remove water when the sponge block is set. Sponge radius can now be controlled using the 'sponge-radius' parameter and the default is now set to simulate Classic.
* Updated for a newer build of "b126," meaning that lava spread control now works well!
* A new summary of the status of some core protections is now printed on start. Disable this with 'summary-on-start'.
* Blacklist system has been overhauled. Check README.txt for changed configuration settings!
* The blacklist's method of preventing notification repeats is now better, instead waiting 3 seconds before notifying again (before it didn't notify again at all unless the user started using another blocked action).
* To give users the ability to receive notifications, the command to give permission to has been changed to /worldguardnotify, although the old one (that was never mentioned anywhere) still works.
* Water and lava buckets are now psuedo-blocked using an unreliable method that risks the stability of your server (no other plugin does it better though). Use it as your own risk.
* Added on item drop and on item use (i.e. chest) events.
* Chests, signs, and furnaces can now be blocked better with the blacklist system.
* The event names in the blacklist configuration have changed but the old event names should still work. The new names should make "more sense."
* A new "ban" action has been added to the blacklist.
* Action messages have been improved, now longer saying "destroyed" for everything.
* Logging to file has been completely changed, allowing you to use the date and time and the player's username in the log filename. It no longer rotates log files based on size, however.
* Logging to database is now supported.
* Tools can now be destroyed on drop to alleviate the durability cheat. You can do this with either with the blacklist or with the 'item-drop-blacklist' configuration option. The configuration option prints more friendly messages than the 'tell' action of blacklists.
## 1.1.2
* Block lag fix: Snow and glass should no longer drop items.
* Block lag fix: Block object now reset after hook call.
## 1.1.1
* Fixed redstone wire dropping wood blocks with the block lag fix.
* The block lag fix now consults other plugins so that ALL protection mechanisms and plugins should work.
## 1.1
* Added block lag fix.
## 1.0
* Initial release.
-150
View File
@@ -1,150 +0,0 @@
2.0beta3:
- Fixed NullPointerException inside the ignite hook.
2.0beta2:
- Fixed a NullPointerException in the damage hook.
2.0beta1:
- Added area protection. Use /region or /rg to define regions.
1.8.1
- Fixed NullPointerException.
1.8
- Updated for Minecraft beta.
- Blacklist hooks have CHANGED. The new hooks are work better. on-create has
been replaced with on-place (for block placement) and on-use
(for item usage, light buckets and lighters). The old on-use is now
on-right-click although it currently does nothing.
- Added coordinates to blacklist file logger.
- Added suffocation damage prevention.
1.7.1
- Updated for v0.2.8.
1.7
- Updated for v0.2.6_02 and hMod b129.
- Added option to prevent water from damaging particular blocks
(Redstone wire, Minecart tracks, etc.). See disable-water-damage-blocks.
- /reload WorldGuard should now reload WorldGuard's configuration.
- Added wg-invincible and wg-amphibious groups that let you give certain
players invincibility or underwater breathing.
- Added the ability to disable fall, water, lava, and/or fire damage.
- Water/lava bucket blocking should now be more reliable.
- Added /stack (alias /;) commands to stack items in your inventory into
piles up to 64 items in size. Even unstackable items like signs can be
stacked.
- /god mode should now let you gain health.
- /god mode should now work more reliably.
- Caught an error message for when the configuration file does not exist.
1.6
- Added spawn protection that prevents damage when a player spawns.
- Added login protection that prevents damage when a player joins.
- Added /god. /god can be used on others, provided that the /godother
permission is set for the command's user.
1.5.1
- Removed the 'java.lang.NoSuchMethodError: Item.setDamage(I)V' error
generated.
1.5
- Removed the block lag fix.
- WorldGuard now conditionally loads features so you can use any up-to-date
build of hMod and the unsupported features won't break the entire
plugin. When WG loads, check the server console for a report of
features that are not supported by your version of hMod.
- Changed some configuration defaults:
disable-lava-fire=true
simulate-sponge=true
item-durability=false
1.4.1
- Fixed issue with the block lag fix dropping item stacks of 0 quantity.
1.4
- New on-acquire hook. This does both a total inventory check on inventory
change and item pick up denial. The item pick up denial is largely
thanks to Dinnerbone for fulfilling my request to add a particular hook.
- Item durability can now be toggled with item-durability. Thanks to
Dinnerbone for figuring this out while filfilling my request. The
default setting is to fix item durability.
- New no-physics-gravel and no-physics-sand options allow you to
prevent gravel and sand from falling.
- New allow-portal-anywhere option allows you to create portal blocks
anywhere.
1.3
- UPGRADE WARNING: If you are using database logging, you must add a
NULL 'comment' VARCHAR field to the table. The line of SQL that you
can run for MySQL can be found in blacklist_table.sql.
- Improved plugin compatibility with the block lag fix. For maximum
compatibility, you must now list WorldGuard as the first plugin in
server.properties and you cannot reload or enable the plugin
while the server is up. This is for bad plugins that unnecessarily
use the "critical" priority for its hooks like the LWC. Most plugins
don't do that though, so this won't apply for most people.
- Fixed signs being blank if they were denied via the blacklist.
- Added on-break event to the blacklist.
- Added comments and messages. Comments are only for your own use and they
are printed with the log and notify actions of the blacklist. The
message replaces the message that is shown the user and it is optional.
- The blacklist notification messages are now more compact and are
light grey instead of light purple.
- The notify, log, and tell actions will now trigger every time for the
on-break, on-create, on-drop events rather than wait 3 seconds between
events for the same item or block for a player.
1.2
- /stopfire and /allowfire disable and enable fire spreading globally.
- Block lag fix slightly improved in accuracy for item drops.
- Sponge updated to remove water when the sponge block is set. Sponge radius
can now be controlled using the 'sponge-radius' parameter and the
default is now set to simulate Classic.
- Updated for a newer build of "b126," meaning that lava spread control
now works well!
- A new summary of the status of some core protections is now printed
on start. Disable this with 'summary-on-start'.
- Blacklist system has been overhauled. Check README.txt for changed
configuration settings!
- The blacklist's method of preventing notification repeats is now better,
instead waiting 3 seconds before notifying again (before it didn't
notify again at all unless the user started using another blocked
action).
- To give users the ability to receive notifications, the command to give
permission to has been changed to /worldguardnotify, although the
old one (that was never mentioned anywhere) still works.
- Water and lava buckets are now psuedo-blocked using an unreliable
method that risks the stability of your server (no other plugin
does it better though). Use it as your own risk.
- Added on item drop and on item use (i.e. chest) events.
- Chests, signs, and furnaces can now be blocked better with the
blacklist system.
- The event names in the blacklist configuration have changed but the old
event names should still work. The new names should make "more sense."
- A new "ban" action has been added to the blacklist.
- Action messages have been improved, now longer saying "destroyed"
for everything.
- Logging to file has been completely changed, allowing you to use
the date and time and the player's username in the log filename. It
no longer rotates log files based on size, however.
- Logging to database is now supported.
- Tools can now be destroyed on drop to alleviate the durability cheat.
You can do this with either with the blacklist or with the
'item-drop-blacklist' configuration option. The configuration option
prints more friendly messages than the 'tell' action of blacklists.
1.1.2
- Block lag fix: Snow and glass should no longer drop items.
- Block lag fix: Block object now reset after hook call.
1.1.1
- Fixed redstone wire dropping wood blocks with the block lag fix.
- The block lag fix now consults other plugins so that ALL protection
mechanisms and plugins should work.
1.1
- Added block lag fix.
1.0
- Initial release.
+68
View File
@@ -0,0 +1,68 @@
# Contributing
Thank you for your interest in contributing to WorldGuard! We appreciate your
effort, but to make sure that the inclusion of your patch is a smooth process, we
ask that you make note of the following guidelines.
* **Follow the [Oracle coding conventions](https://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html).**
We can't stress this enough; if your code has notable issues, it may delay
the process significantly.
* **Target Java 6 for source and compilation.** Make sure to mark methods with
` @Override` that override methods of parent classes, or that implement
methods of interfaces (Java 6+).
* **Use only spaces for indentation.** Our indents are 4-spaces long, and tabs
are unacceptable.
* **Wrap code to a 89 column limit.** We do this to make side by side diffs
and other such tasks easier. Ignore this guideline if it makes the code
too unreadable.
* **Write complete Javadocs.** Do so only for public methods, and make sure
that your `@param` and `@return` fields are not just blank.
* **Don't tag classes with @author.** Some legacy classes may have this tag,
but we are phasing it out.
* **Make sure the code is efficient.** One way you can achieve this is to spend
around ten minutes to think about what the code is doing and whether it
seems awfully roundabout. If you had to copy the same large piece of
code in several places, that's bad.
* **Keep commit summaries under 70 characters.** For more details, place two
new lines after the summary line and write away!
* **Test your code.** We're not interested in broken code, for the obvious reasons.
* **Write unit tests.** While this is strictly optional, we recommend it for
complicated algorithms.
Checklist
---------
Ready to submit? Perform the checklist below:
1. Have all tabs been replaced into four spaces? Are indentations 4-space wide?
2. Have I written proper Javadocs for my public methods? Are the @param and
@return fields actually filled out?
3. Have I `git rebase`d my pull request to the latest commit of the target
branch?
4. Have I combined my commits into a reasonably small number (if not one)
commit using `git rebase`?
5. Have I made my pull request too large? Pull requests should introduce
small sets of changes at a time. Major changes should be discussed with
the team prior to starting work.
6. Are my commit messages descriptive?
You should be aware of [`git rebase`](http://learn.github.com/p/rebasing.html).
It allows you to modify existing commit messages, and combine, break apart, or
adjust past changes.
Example
-------
This is **GOOD:**
if (var.func(param1, param2)) {
// do things
}
This is **EXTREMELY BAD:**
if(var.func( param1, param2 ))
{
// do things
}
+16
View File
@@ -0,0 +1,16 @@
WorldGuard, a suite of tools for Minecraft
Copyright (C) sk89q <http://www.sk89q.com>
Copyright (C) WorldGuard team and contributors
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-15
View File
@@ -1,15 +0,0 @@
Installation
------------
This plugin requires Hey0's server modification.
1. Create a "plugins" folder inside your "bin" folder.
2. Copy WorldGuard.jar into "plugins".
3. Add "WorldGuard" to the "plugins" line of your server.properties file.
If it's not already there, add the line. The line should look like this:
plugins=WorldGuard
If you have multiple plugins, separate plugin names with commas.
+201 -165
View File
@@ -1,165 +1,201 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
----------------------------------------------------------------------------
This work includes Robert Olofsson's Priority R-Tree implementation, for which
its license is reproduced below.
Copyright (c) 2008-2010 Robert Olofsson.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the authors nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+46
View File
@@ -0,0 +1,46 @@
# ![WorldGuard](worldguard-logo.png)
WorldGuard lets you and players guard areas of land against griefers and undesirables, as well as tweak and disable various gameplay features of Minecraft.
* Block creeper and wither block damage, falling damage, etc.;
* Disable fire spread, lava fire spread, ice formation, Endermen picking up blocks, etc.;
* Blacklist certain items and blocks so they can't be used;
* Warn moderators when certain items and blocks are used;
* Protect areas of your world so only certain people can build in them;
* Set areas where PVP, TNT, mob damage, and other features are disabled;
* Protect your server from various 'exploits' like magical obsidian creation machines;
* Disable, or enable, various Minecraft features, like sponges from classic;
* Add useful commands like an immediate "STOP ALL FIRE SPREAD" command.
* Enable only features you want! Everything is off by default.
WorldGuard is open source and is available under the GNU Lesser
General Public License v3.
Currently, Bukkit is required to use WorldGuard. You can get a release copy of WorldGuard from the [BukkitDev site](http://dev.bukkit.org/bukkit-plugins/worldguard/).
Compiling
---------
The project is written for Java 8 and our build process makes use of
[Gradle](http://gradle.org).
Dependencies are automatically handled by Gradle.
Contributing
------------
We happily accept contributions, especially through pull requests on GitHub.
Please read CONTRIBUTING.md for important guidelines to follow.
Submissions must be licensed under the GNU Lesser General Public License v3.
Links
-----
* [Homepage](http://enginehub.org/worldguard)
* [Discord](https://discord.gg/enginehub)
* [IRC channel](https://webchat.esper.net/?join=sk89q) (#sk89q on irc.esper.net)
* [Issue tracker](https://dev.enginehub.org/issues/WORLDGUARD)
* [Continuous integration](http://builds.enginehub.org) [![Build Status](https://ci.enginehub.org/app/rest/builds/buildType:bt11,branch:master/statusIcon.svg)](http://ci.enginehub.org/viewType.html?buildTypeId=bt11&guest=1)
* [End-user documentation](https://worldguard.enginehub.org/en/latest/)
-251
View File
@@ -1,251 +0,0 @@
WorldGuard
Copyright (c) 2010 sk89q <http://www.sk89q.com>
Licensed under the GNU Lesser General Public License v3
Introduction
------------
WorldGuard has a number of features, any of which you can choose to
use or not:
- Enforce only one session for a player on a server (can't login twice).
- Block creeper explosions.
- Block TNT explosions.
- Block lighters from setting fires.
- Block all fires.
- Disable fall damage, lava damage, fire damage, and/or water damage.
- Allow fire but prevent it from burning certain blocks.
- Prevent lava from starting fires.
- Restrict lava spreading to only some block types.
- Simulate classic-esque water by letting water infinitely expand in
area (only if there is a block underneath).
- Prevent water from destroying blocks like Redstone wire and flowers.
- Simulate the function of the sponge from Minecraft Classic.
- Notify admins, block, log, kick or ban for the use of certain block types
or items.
- Temporarily stop fire globally with some commands.
- Destroy tools on drop to alleviate the durability cheat.
- Prevent gravel and sand from falling.
- Allow portal blocks to be placed anywhere.
hMod is required as WorldGuard is a plugin for hMod.
Configuration
-------------
A "worldguard.properties" will be created the first the time that you load
WorldGuard on your server. You can either restart your server or use
/reloadplugin WorldGuard to reload the configuraton file after editing it.
NOTE: Some features may require a custom version of hMod. When the server
is loaded with the plugin, WorldGuard will tell you the features
unsupported by your version of hMod.
- summary-on-start (def. true)
Print a summary of WorldGuard's protection settings at-a-glance when
the plugin is loaded.
- item-durability (def. false)
**Requires special version of hMod
Enables item durability.
- classic-water (def. false)
Toggle use of classic water. Be foreward that your world may be
flooded if you are not careful. If you have WorldEdit, you can use
//drain in such an event, although that will drain the entire pool
as well. This classic-esque water will only spread infinitely over
ground, but if there are air blocks underneath, the water will not
spread (preventing waterfalls from becoming tsunamis).
- simulate-sponge (def. true)
Toggle simulation of the sponge from Classic. It blocks water from
flowing near the sponge.
- sponge-radius (def. 3)
The radius of the sponge's effect. The default is that of Classic,
creating a 5x5x5 cuboid free of water. Increasing the number will
increase server load exponentially, although 3-5 has fairly low impact.
- no-physics-gravel (def. false)
**Requires special version of hMod
Prevents gravel from falling due to gravity.
- no-physics-sand (def. false)
**Requires special version of hMod
Prevents sand from falling due to gravity.
- allow-portal-anywhere (def. false)
**Requires special version of hMod
Allows you to place portal blocks anywhere.
- enforce-single-session (def. true)
Enforce single sessions. If the player is already found to be on
the server when s/he logs in, the other player will be kicked with
an informative message. The inventory will have been saved before
the new session starts.
- block-tnt (def. false)
Block TNT explosions. TNT will still explode client-side but the blocks
will be "restored" in a few seconds afterwards.
- block-lighter (def. false)
Block flint and steel fires. Those with access to the commands
/uselighter or /lighter can bypass this. /uselighter is not a real
command; it is only used for permissions.
- block-creepers (def. false)
Block creeper explosions from destroying terrain (and possibly from
causing damage).
- disable-lava-fire (def. true)
Prevent lava from starting fires.
- allowed-lava-spread-blocks (no default)
List of block names/IDs to allow lava to spread to. Leave blank
to disable this feature.
- disable-all-fire-spread (def. false)
Disable all fire from spreading.
- disallowed-fire-spread-blocks (no default)
List of block names/IDs to prevent fire from spreading to. Leave blank
to disable this feature. Enabling disable-all-fire-spread will
override this function.
- disable-water-damage-blocks (no default)
List of blocks that should not be destroyed by water (Redstone wire,
minecart tracks, flowers, etc.).
- item-drop-blacklist (no default)
List of block names/IDs to destroy on drop. This can alleviate the
durability cheat that allows you to drop your tools to fix their
durability. You can also enforce this with the blacklist but
this is an easier way to do it (this way also prints a more
friendly message than if you used the 'tell' action of the blacklist).
- login-protection (def. 3)
Number of seconds to keep a player invincible when the player joins.
- spawn-protection (def. 0)
Number of seconds to keep a player invincible when the player spawns.
This does not apply to players joining the server.
- kick-on-death (def. false)
Kick players when they die (and respawn). This is to work around the
issues of invisible players when players die.
- disable-fall-damage (def. false)
- disable-lava-damage (def. false)
- disable-fire-damage (def. false)
- disable-water-damage (def. false)
Disable various types of damage.
- log-console (def. true)
For blacklist log actions, print to console.
- log-file (def. false)
For blacklist log actions, log to file.
- log-file-path (def. "worldguard/logs/%Y-%m-%d.log")
Log blacklist events to file. You can use these patterns in the path:
%Y the year (YYYY)
%m the month (MM)
%d the day (DD)
%W the week of the year (00-52)
%H 24-hour time (HH)
%h 12-hour time (HH)
%i the minute (mm)
%s the second (ss)
%u the user's name
%% translates to a single percent sign "%"
The files are not automatically rotated if they get large so you should
perhaps put a week in the filename at least.
Escape backslashes with another backslash, like so:
C:\path\to\log.txt -> C:\\path\\to\\log.txt
- log-file-open-files (def. 10)
The number of log files to keep open at once. Unless you use dynamic
patterns in the path, the value of this variable won't matter. However,
if, for example, you use a player's username in the filename and you
have many users who cause logged events to occur, files would have
to be opened for each user and this parameter would matter.
- log-database (def. false)
Log blacklist events to database.
- log-database-dsn (def. "jdbc:mysql://localhost:3306/minecraft")
Connection string. A string to use for MySQL would be:
jdbc:mysql://localhost:3306/minecraft
The "minecraft" part at the end is the database name.
Escape colons with a backslash, like so:
jdbc:mysql://localhost:3306/minecraft
->
jdbc\:mysql\://localhost\:3306/minecraft
- log-database-user (def. "root")
Database username.
- log-database-pass (def. "")
Database password.
- log-database-table (def. "blacklist_events")
Database table to use.
Commands
--------
- /stopfire and /allowfire
Disables and enables fire spread globally. Both commands require the
permission to use only "/stopfire. Re-enabling fire spread with this
command will not override other fire spread control features of
WorldGuard. Note that disabling fire does not disable fire damage
but fire at least won't spread.
- /god
Toggles your invincibility. Players must have permission to use "/god"
to be able to use this command. You can also use this command to
toggle the invincibility of others although you must have the
"/godother" permission.
Server Commands
---------------
- fire-stop and fire-allow
Disables and enables fire spread globally. Re-enabling fire spread
with this command will not override other fire spread control features
of WorldGuard. Note that disabling fire does not disable fire damage
but fire at least won't spread.
Blacklists
----------
Blacklists let you control the use of blocks and items. You can have
certain rules apply to only some groups.
Edit the included worldguard-blacklist.txt file and follow the
instructions inside. The file comes with the download for WorldGuard.
Other Features
--------------
To give someone invincibility every time s/he joins the server, create
a wg-invincible group and add the group to the user or have the user's
group inherit this group.
To give someone the ability to breathe under water, create
a wg-amphibious group and add the group to the user or have the user's
group inherit this group.
Thanks
------
While I would like to thank everyone for their support, I would like to
say thanks to the following individuals for their direct
contributions to WorldGuard:
- Sturmeh, for contributing the original durability workaround
- Meaglin, for changing the on flow hook at my request
- Dinnerbone, for implementing the on item pick up hook at my request,
and also for figuring out the durability bug in the process
+26
View File
@@ -0,0 +1,26 @@
import org.ajoberstar.grgit.Grgit
logger.lifecycle("""
*******************************************
You are building WorldGuard!
If you encounter trouble:
1) Try running 'build' in a separate Gradle run
2) Use gradlew and not gradle
3) If you still need help, ask on Discord! https://discord.gg/enginehub
Output files will be in [subproject]/build/libs
*******************************************
""")
applyRootArtifactoryConfig()
if (!project.hasProperty("gitCommitHash")) {
apply(plugin = "org.ajoberstar.grgit")
ext["gitCommitHash"] = try {
(ext["grgit"] as Grgit?)?.head()?.abbreviatedId
} catch (e: Exception) {
logger.warn("Error getting commit hash", e)
"no_git_id"
}
}
-88
View File
@@ -1,88 +0,0 @@
<project name="WorldGuard" default="dist" basedir=".">
<description>WorldGuard fixes bugs with Minecraft SMP and provides for
protection.</description>
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<property name="release.dir" location="release"/>
<property name="lib.dir" location="lib"/>
<target name="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- Compile the source files -->
<target name="compile" depends="init">
<javac srcdir="${src.dir}" deprecation="true" includeantruntime="true" destdir="${build.dir}" debug="true">
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<!-- Build the .jar -->
<target name="jar" depends="compile">
<mkdir dir="${dist.dir}"/>
<manifest file="manifest.mf" mode="replace">
<attribute name="Implementation-Title" value="WorldGuard"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="WorldGuard-Version" value="${version}"/>
<attribute name="Class-Path" value="WorldEdit.jar"/>
</manifest>
<jar jarfile="${dist.dir}/WorldGuard.jar" basedir="${build.dir}" manifest="manifest.mf"/>
</target>
<!-- Create the .jar -->
<target name="dist">
<property name="version" value="nightly"/>
<antcall target="jar"/>
</target>
<!-- Build a release -->
<target name="release">
<input message="Enter version:" addproperty="version"/>
<antcall target="jar"/>
<delete dir="${release.dir}"/>
<mkdir dir="${release.dir}"/>
<copy todir="${release.dir}">
<fileset dir="."/>
<globmapper from="*.txt" to="*.txt"/>
</copy>
<copy tofile="${release.dir}/worldguard.updatr" file="worldguard.updatr"/>
<replace file="${release.dir}/worldguard.updatr" token="%version%" value="${version}"/>
<copy file="worldguard.properties" todir="${release.dir}"/>
<copy tofile="${release.dir}/WorldGuard.jar" file="${dist.dir}/WorldGuard.jar"/>
<zip destfile="${release.dir}/worldguard-${version}.zip" basedir="${release.dir}" excludes="*.zip"/>
<mkdir dir="${release.dir}/src"/>
<copy todir="${release.dir}/src">
<fileset dir="${src.dir}"/>
</copy>
<zip destfile="${release.dir}/worldguard-${version}-source.zip" basedir="${release.dir}" excludes="*.zip"/>
</target>
<!-- Clean the output -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${release.dir}"/>
</target>
<!--<target name="-get-version-git" if="git-revision">
<sequential>
<exec executable="git" failifexecutionfails="false" outputproperty="git-revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git-revision-dirty">
<arg value="diff"/>
<arg value="- -shortstat"/>
</exec>
<condition else="dev-${git-revision}-modified" property="version" value="dev-${git-revision}">
<equals arg1="" arg2="${git-revision-dirty}"/>
</condition>
</sequential>
</target>-->
</project>
+19
View File
@@ -0,0 +1,19 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version embeddedKotlinVersion
}
repositories {
jcenter()
gradlePluginPortal()
}
dependencies {
implementation(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
}
@@ -0,0 +1,40 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.named
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
private const val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
private const val ARTIFACTORY_USER = "artifactory_user"
private const val ARTIFACTORY_PASSWORD = "artifactory_password"
fun Project.applyRootArtifactoryConfig() {
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""
apply(plugin = "com.jfrog.artifactory")
configure<ArtifactoryPluginConvention> {
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
clientConfig.publisher.run {
repoKey = when {
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local"
else -> "libs-release-local"
}
username = "${project.property(ARTIFACTORY_USER)}"
password = "${project.property(ARTIFACTORY_PASSWORD)}"
isMaven = true
isIvy = false
}
}
tasks.named<ArtifactoryTask>("artifactoryPublish") {
isSkip = true
}
}
fun Project.applyCommonArtifactoryConfig() {
val named = tasks.named<ArtifactoryTask>("artifactoryPublish") {
publishConfigs("archives")
}
}
+18
View File
@@ -0,0 +1,18 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.repositories
fun Project.applyCommonConfiguration() {
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
maven { url = uri("https://maven.sk89q.com/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor(5, "minutes")
}
}
}
+12
View File
@@ -0,0 +1,12 @@
import org.gradle.api.Project
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.the
val Project.ext: ExtraPropertiesExtension
get() = extensions.getByType()
val Project.sourceSets: SourceSetContainer
get() = the<JavaPluginConvention>().sourceSets
+96
View File
@@ -0,0 +1,96 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.internal.HasConvention
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getPlugin
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.register
fun Project.applyLibrariesConfiguration() {
applyCommonConfiguration()
apply(plugin = "java-base")
apply(plugin = "maven")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.jfrog.artifactory")
configurations {
create("shade")
getByName("archives").extendsFrom(getByName("default"))
}
group = "${rootProject.group}.worldguard-libs"
tasks.register<ShadowJar>("jar") {
configurations = listOf(project.configurations["shade"])
archiveClassifier.set("")
dependencies {
exclude(dependency("com.google.code.findbugs:jsr305:1.3.9"))
}
relocate("com.sk89q.squirrelid", "com.sk89q.worldguard.util.profile")
}
val altConfigFiles = { artifactType: String ->
val deps = configurations["shade"].incoming.dependencies
.filterIsInstance<ModuleDependency>()
.map { it.copy() }
.map { dependency ->
dependency.artifact {
name = dependency.name
type = artifactType
extension = "jar"
classifier = artifactType
}
dependency
}
files(configurations.detachedConfiguration(*deps.toTypedArray())
.resolvedConfiguration.lenientConfiguration.artifacts
.filter { it.classifier == artifactType }
.map { zipTree(it.file) })
}
tasks.register<Jar>("sourcesJar") {
from({
altConfigFiles("sources")
})
val filePattern = Regex("(.*)com/sk89q/squirrelid((?:/|$).*)")
val textPattern = Regex("com\\.sk89q\\.squirrelid")
eachFile {
filter {
it.replaceFirst(textPattern, "com.sk89q.worldguard.util.profile")
}
path = path.replaceFirst(filePattern, "$1com/sk89q/worldguard/util/profile$2")
}
archiveClassifier.set("sources")
}
tasks.named("assemble").configure {
dependsOn("jar", "sourcesJar")
}
artifacts {
val jar = tasks.named("jar")
add("default", jar) {
builtBy(jar)
}
val sourcesJar = tasks.named("sourcesJar")
add("archives", sourcesJar) {
builtBy(sourcesJar)
}
}
tasks.register<Upload>("install") {
configuration = configurations["archives"]
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
pom.version = project.version.toString()
pom.artifactId = project.name
}
}
applyCommonArtifactoryConfig()
}
+119
View File
@@ -0,0 +1,119 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecrell.gradle.licenser.LicenseExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test
import org.gradle.external.javadoc.CoreJavadocOptions
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
fun Project.applyPlatformAndCoreConfiguration() {
applyCommonConfiguration()
apply(plugin = "java")
apply(plugin = "eclipse")
apply(plugin = "idea")
apply(plugin = "maven")
apply(plugin = "checkstyle")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.jfrog.artifactory")
apply(plugin = "net.minecrell.licenser")
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
configure<CheckstyleExtension> {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = "7.6.1"
}
tasks.withType<Test>().configureEach {
useJUnit()
}
dependencies {
"testCompile"("junit:junit:${Versions.JUNIT}")
// TODO switch to jupiter - doesn't support abstract test classes so tests need rewriting
//"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
//"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
}
// Java 8 turns on doclint which we fail
tasks.withType<Javadoc>().configureEach {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
tasks.register<Jar>("javadocJar") {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(tasks.getByName<Javadoc>("javadoc").destinationDir)
}
tasks.named("assemble").configure {
dependsOn("javadocJar")
}
artifacts {
add("archives", tasks.named("jar"))
add("archives", tasks.named("javadocJar"))
}
if (name == "worldguard-core" || name == "worldguard-bukkit") {
tasks.register<Jar>("sourcesJar") {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
artifacts {
add("archives", tasks.named("sourcesJar"))
}
tasks.named("assemble").configure {
dependsOn("sourcesJar")
}
}
tasks.named("check").configure {
dependsOn("checkstyleMain", "checkstyleTest")
}
applyCommonArtifactoryConfig()
configure<LicenseExtension> {
header = rootProject.file("HEADER.txt")
include("**/*.java")
}
}
fun Project.applyShadowConfiguration() {
tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("dist")
dependencies {
include(project(":worldguard-libs:core"))
//include(project(":worldguard-libs:${project.name.replace("worldguard-", "")}"))
include(project(":worldguard-core"))
relocate("org.flywaydb", "com.sk89q.worldguard.internal.flywaydb") {
include(dependency("org.flywaydb:flyway-core:3.0"))
}
relocate("com.sk89q.squirrelid", "com.sk89q.worldguard.util.profile")
}
exclude("GradleStart**")
exclude(".cache")
exclude("LICENSE*")
}
}
+7
View File
@@ -0,0 +1,7 @@
object Versions {
// const val PISTON = "0.4.3"
// const val AUTO_VALUE = "1.6.5"
const val WORLDEDIT = "7.1.0-SNAPSHOT"
const val JUNIT = "4.11"
const val SQUIRRELID = "0.2.0"
}
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Tabs are strictly banned -->
<module name="FileTabCharacter"/>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>
<module name="TreeWalker">
<!-- Important basics -->
<!-- <module name="PackageDeclaration"/> Unlikely that we would miss this in a PR -->
<module name="OuterTypeFilename"/> <!-- TypeName -> TypeName.java -->
<!--
Control package usage, so people don't insert Bukkit into WG where it shouldn't belong, etc.
It is a bit draconian, so update as necessary!
-->
<module name="ImportControl">
<property name="file" value="${config_loc}/import-control.xml"/>
</module>
<!-- Code -->
<module name="HideUtilityClassConstructor"/> <!-- Utility classes should not have a constructor -->
<module name="CovariantEquals"/>
<module name="EqualsHashCode"/> <!-- equals() and hashCode() go together -->
<module name="NestedTryDepth"> <!-- SHOULD not need to adjust this -->
<property name="max" value="2"/>
</module>
<module name="SuperFinalize"/> <!-- We don't actually use this -->
<!-- Style -->
<module name="LeftCurly"> <!-- Left brace never goes on another line -->
<property name="option" value="eol"/>
</module> <!-- We don't check right brace -->
<module name="DefaultComesLast"/> <!-- default case in switch should be last -->
<module name="GenericWhitespace"/>
<!-- Naming -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- <module name="PackageName"/> Unlikely that we would miss this in a PR -->
<module name="ParameterName"/>
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
</module>
</module>
+36
View File
@@ -0,0 +1,36 @@
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
<import-control pkg="com.sk89q">
<allow pkg="java"/>
<allow pkg="javax"/>
<allow pkg="org.junit"/>
<allow pkg="org.hamcrest"/>
<allow pkg="org.mockito"/>
<allow pkg="junit.framework"/>
<allow pkg="com.sk89q"/>
<allow pkg="com.google.common"/>
<subpackage name="worldguard">
<allow pkg="org.khelekore"/>
<allow pkg="org.flywaydb"/>
<allow pkg="org.yaml"/>
<allow pkg="org.enginehub.piston"/>
<subpackage name="util.profile.resolver">
<allow pkg="org.bukkit"/>
<allow pkg="io.papermc.lib"/>
<allow pkg="com.destroystokyo.paper"/>
</subpackage>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
<allow pkg="org.bstats.bukkit"/>
<allow pkg="io.papermc.lib"/>
<allow pkg="com.destroystokyo.paper"/>
</subpackage>
</subpackage>
</import-control>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="ProtectedRegion.java" checks="EqualsHashCode"/>
</suppressions>
+2
View File
@@ -0,0 +1,2 @@
group=com.sk89q.worldguard
version=7.0.2-SNAPSHOT
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+84
View File
@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+7
View File
@@ -0,0 +1,7 @@
rootProject.name = "worldguard"
include("worldguard-libs")
include("worldguard-libs:core")
include("worldguard-core")
//include("worldguard-libs:bukkit")
include("worldguard-bukkit")
-418
View File
@@ -1,418 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.io.*;
/**
*
* @author sk89q
*/
public class Blacklist {
/**
* Logger.
*/
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
/**
* List of entries by block ID.
*/
private Map<Integer,List<BlacklistEntry>> blacklist
= new HashMap<Integer,List<BlacklistEntry>>();
/**
* Logger.
*/
private BlacklistLogger blacklistLogger = new BlacklistLogger();
/**
* Blacklist contains on-acquire events.
*/
private boolean hasOnAcquire;
/**
* Returns whether the list is empty.
*
* @return
*/
public boolean isEmpty() {
return blacklist.isEmpty();
}
/**
* Get the entries for an item or list.
*/
public List<BlacklistEntry> getEntries(int id) {
return blacklist.get(id);
}
/**
* Get the logger.
*
* @return
*/
public BlacklistLogger getLogger() {
return blacklistLogger;
}
/**
* Called on block destruction. Returns true to let the action pass
* through.
*
* @param block
* @param player
* @return
*/
public boolean onDestroy(final Block block, final Player player) {
List<BlacklistEntry> entries = getEntries(block.getType());
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onDestroy(block, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on block break. Returns true to let the action pass
* through.
*
* @param block
* @param player
* @return
*/
public boolean onBreak(final Block block, final Player player) {
List<BlacklistEntry> entries = getEntries(block.getType());
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onBreak(block, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on left click. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onDestroyWith(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onDestroyWith(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on place. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onPlace(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onPlace(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on right click upon. Returns true to let the action pass through.
*
* @param block
* @param player
* @return
*/
public boolean onRightClick(Block block, Player player) {
List<BlacklistEntry> entries = getEntries(block.getType());
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onRightClick(block, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on item use. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onUse(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onUse(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on right click upon. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onSilentUse(Block block, Player player) {
List<BlacklistEntry> entries = getEntries(block.getType());
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onSilentUse(block, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on drop. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onDrop(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onDrop(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on acquire. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onAcquire(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onAcquire(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Called on acquire. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onSilentAcquire(int item, Player player) {
List<BlacklistEntry> entries = getEntries(item);
if (entries == null) {
return true;
}
boolean ret = true;
for (BlacklistEntry entry : entries) {
if (!entry.onSilentAcquire(item, player)) {
ret = false;
}
}
return ret;
}
/**
* Load the blacklist.
*
* @param file
* @return
* @throws IOException
*/
public void load(File file) throws IOException {
FileReader input = null;
Map<Integer,List<BlacklistEntry>> blacklist =
new HashMap<Integer,List<BlacklistEntry>>();
try {
input = new FileReader(file);
BufferedReader buff = new BufferedReader(input);
hasOnAcquire = false;
String line;
List<BlacklistEntry> currentEntries = null;
while ((line = buff.readLine()) != null) {
line = line.trim();
// Blank line
if (line.length() == 0) {
continue;
} else if (line.charAt(0) == ';' || line.charAt(0) == '#') {
continue;
}
if (line.matches("^\\[.*\\]$")) {
String[] items = line.substring(1, line.length() - 1).split(",");
currentEntries = new ArrayList<BlacklistEntry>();
for (String item : items) {
int id = 0;
try {
id = Integer.parseInt(item.trim());
} catch (NumberFormatException e) {
id = etc.getDataSource().getItem(item.trim());
if (id == 0) {
logger.log(Level.WARNING, "WorldGuard: Unknown block name: "
+ item);
break;
}
}
BlacklistEntry entry = new BlacklistEntry(this);
if (blacklist.containsKey(id)) {
blacklist.get(id).add(entry);
} else {
List<BlacklistEntry> entries = new ArrayList<BlacklistEntry>();
entries.add(entry);
blacklist.put(id, entries);
}
currentEntries.add(entry);
}
} else if (currentEntries != null) {
String[] parts = line.split("=");
if (parts.length == 1) {
logger.log(Level.WARNING, "Found option with no value "
+ file.getName() + " for '" + line + "'");
continue;
}
boolean unknownOption = false;
for (BlacklistEntry entry : currentEntries) {
if (parts[0].equalsIgnoreCase("ignore-groups")) {
entry.setIgnoreGroups(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-destroy")) {
entry.setDestroyActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-break")) {
entry.setBreakActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-left")
|| parts[0].equalsIgnoreCase("on-destroy-with")) {
entry.setDestroyWithActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-place")) {
entry.setPlaceActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-use")) {
entry.setUseActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-right-click")) {
entry.setRightClickActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-drop")) {
entry.setDropActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("on-acquire")) {
hasOnAcquire = true;
entry.setAcquireActions(parts[1].split(","));
} else if (parts[0].equalsIgnoreCase("message")) {
entry.setMessage(parts[1].trim());
} else if (parts[0].equalsIgnoreCase("comment")) {
entry.setComment(parts[1].trim());
} else {
unknownOption = true;
}
}
if (unknownOption) {
logger.log(Level.WARNING, "Unknown option '" + parts[0]
+ "' in " + file.getName() + " for '" + line + "'");
}
} else {
logger.log(Level.WARNING, "Found option with no heading "
+ file.getName() + " for '" + line + "'");
}
}
this.blacklist = blacklist;
} finally {
try {
if (input != null) {
input.close();
}
} catch (IOException e2) {
}
}
}
/**
* Blacklist contains on-acquire events.
*
* @return
*/
public boolean hasOnAcquire() {
return hasOnAcquire;
}
}
-746
View File
@@ -1,746 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
/**
*
* @author sk89q
*/
public class BlacklistEntry {
/**
* Used to prevent spamming.
*/
private static Map<String,BlacklistTrackedEvent> lastAffected =
new HashMap<String,BlacklistTrackedEvent>();
/**
* Parent blacklist entry.
*/
private Blacklist blacklist;
/**
* List of groups to not affect.
*/
private Set<String> ignoreGroups;
/**
* List of actions to perform on destruction.
*/
private String[] destroyActions;
/**
* List of actions to perform on break.
*/
private String[] breakActions;
/**
* List of actions to perform on left click.
*/
private String[] destroyWithActions;
/**
* List of actions to perform on block placement.
*/
private String[] placeActions;
/**
* List of actions to perform on item use.
*/
private String[] useActions;
/**
* List of actions to perform on right click upon.
*/
private String[] rightClickActions;
/**
* List of actions to perform on drop.
*/
private String[] dropActions;
/**
* List of actions to perform on drop.
*/
private String[] acquireActions;
/**
* Message for users.
*/
private String message;
/**
* Comment for administrators.
*/
private String comment;
/**
* Used to ignore messages.
*/
private static ActionHandler silentHandler = new ActionHandler() {
public void log(String itemName) {}
public void kick(String itemName) {}
public void ban(String itemName) {}
public void notifyAdmins(String itemName) {}
public void tell(String itemName) {}
};
/**
* Construct the object.
*
* @param blacklist
*/
public BlacklistEntry(Blacklist blacklist) {
this.blacklist = blacklist;
}
/**
* @return the ignoreGroups
*/
public String[] getIgnoreGroups() {
return ignoreGroups.toArray(new String[ignoreGroups.size()]);
}
/**
* @param ignoreGroups the ignoreGroups to set
*/
public void setIgnoreGroups(String[] ignoreGroups) {
Set<String> ignoreGroupsSet = new HashSet<String>();
for (String group : ignoreGroups) {
ignoreGroupsSet.add(group.toLowerCase());
}
this.ignoreGroups = ignoreGroupsSet;
}
/**
* @return
*/
public String[] getDestroyActions() {
return destroyActions;
}
/**
* @param actions
*/
public void setDestroyActions(String[] actions) {
this.destroyActions = actions;
}
/**
* @return
*/
public String[] getBreakActions() {
return breakActions;
}
/**
* @param actions
*/
public void setBreakActions(String[] actions) {
this.breakActions = actions;
}
/**
* @return
*/
public String[] getDestroyWithActions() {
return destroyWithActions;
}
/**
* @param action
*/
public void setDestroyWithActions(String[] actions) {
this.destroyWithActions = actions;
}
/**
* @return
*/
public String[] getPlaceActions() {
return placeActions;
}
/**
* @param actions
*/
public void setPlaceActions(String[] actions) {
this.placeActions = actions;
}
/**
* @return
*/
public String[] getUseActions() {
return useActions;
}
/**
* @param actions
*/
public void setUseActions(String[] actions) {
this.useActions = actions;
}
/**
* @return
*/
public String[] getRightClickActions() {
return rightClickActions;
}
/**
* @param actions
*/
public void setRightClickActions(String[] actions) {
this.rightClickActions = actions;
}
/**
* @return
*/
public String[] getDropActions() {
return dropActions;
}
/**
* @param actions
*/
public void setDropActions(String[] actions) {
this.dropActions = actions;
}
/**
* @return
*/
public String[] getAcquireActions() {
return acquireActions;
}
/**
* @param actions
*/
public void setAcquireActions(String[] actions) {
this.acquireActions = actions;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message the message to set
*/
public void setMessage(String message) {
this.message = message;
}
/**
* @return the comment
*/
public String getComment() {
return comment;
}
/**
* @param comment the comment to set
*/
public void setComment(String comment) {
this.comment = comment;
}
/**
* Returns true if this player should be ignored.
*
* @param player
* @return
*/
public boolean shouldIgnore(Player player) {
if (ignoreGroups == null) {
return false;
}
for (String group : player.getGroups()) {
if (ignoreGroups.contains(group.toLowerCase())) {
return true;
}
}
return false;
}
/**
* Announces a message to all administrators.
*
* @param str
*/
public void notifyAdmins(String str) {
for (Player player : etc.getServer().getPlayerList()) {
if (player.canUseCommand("/wprotectalerts")
|| player.canUseCommand("/worldguardnotify")) {
player.sendMessage(Colors.LightGray + "WG: " + str);
}
}
}
/**
* Ban a player.
*
* @param player
* @param msg
*/
public void banPlayer(Player player, String msg) {
etc.getServer().ban(player.getName());
etc.getLoader().callHook(PluginLoader.Hook.BAN, new Object[]{
player.getUser(), player.getUser(), msg
});
player.kick(msg);
}
/**
* Called on block destruction. Returns true to let the action pass
* through.
*
* @param block
* @param player
* @return
*/
public boolean onDestroy(final Block block, final Player player) {
if (destroyActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logDestroyAttempt(player, block, comment);
}
public void kick(String itemName) {
player.kick("You are not allowed to destroy " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You are not allowed to destroy " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (destroy) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You are not allowed to destroy " + itemName + ".");
}
};
return process(block.getType(), player, destroyActions, handler, false, false);
}
/**
* Called on block break. Returns true to let the action pass
* through.
*
* @param block
* @param player
* @return
*/
public boolean onBreak(final Block block, final Player player) {
if (breakActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logBreakAttempt(player, block, comment);
}
public void kick(String itemName) {
player.kick("You are not allowed to break " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You are not allowed to break " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (break) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You are not allowed to break " + itemName + ".");
}
};
return process(block.getType(), player, breakActions, handler, true, false);
}
/**
* Called on left click. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onDestroyWith(final int item, final Player player) {
if (destroyWithActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logDestroyWithAttempt(player, item, comment);
}
public void kick(String itemName) {
player.kick("You can't destroy with " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't destroy with " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (destroy w/) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You can't destroy with " + itemName + ".");
}
};
return process(item, player, destroyWithActions, handler, false, false);
}
/**
* Called on block placement. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onPlace(final int item, final Player player) {
if (placeActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logPlaceAttempt(player, item, comment);
}
public void kick(String itemName) {
player.kick("You can't place " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't place " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (place) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You can't place " + itemName + ".");
}
};
return process(item, player, placeActions, handler, true, false);
}
/**
* Called on use. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onUse(final int item, final Player player) {
if (useActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logUseAttempt(player, item, comment);
}
public void kick(String itemName) {
player.kick("You can't use " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't use " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (use) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You're not allowed to use " + itemName + ".");
}
};
return process(item, player, useActions, handler, false, false);
}
/**
* Called on right click upon. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onRightClick(final Block block, final Player player) {
if (useActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logRightClickAttempt(player, block, comment);
}
public void kick(String itemName) {
player.kick("You can't use " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't use " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (use) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You're not allowed to use " + itemName + ".");
}
};
return process(block.getType(), player, useActions, handler, false, false);
}
/**
* Called on right click upon. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onSilentUse(final Block block, final Player player) {
if (useActions == null) {
return true;
}
return process(block.getType(), player, useActions, silentHandler, false, true);
}
/**
* Called on item drop. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onDrop(final int item, final Player player) {
if (dropActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logDropAttempt(player, item, comment);
}
public void kick(String itemName) {
player.kick("You can't drop " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't drop " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (drop) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You're not allowed to drop " + itemName + ".");
}
};
return process(item, player, dropActions, handler, true, false);
}
/**
* Called on item acquire. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onAcquire(final int item, final Player player) {
if (acquireActions == null) {
return true;
}
final BlacklistEntry entry = this;
ActionHandler handler = new ActionHandler() {
public void log(String itemName) {
blacklist.getLogger().logAcquireAttempt(player, item, comment);
}
public void kick(String itemName) {
player.kick("You can't acquire " + itemName);
}
public void ban(String itemName) {
entry.banPlayer(player, "Banned: You can't acquire " + itemName);
}
public void notifyAdmins(String itemName) {
entry.notifyAdmins(player.getName() + " (acquire) " + itemName
+ (comment != null ? " (" + comment + ")" : "") + ".");
}
public void tell(String itemName) {
player.sendMessage(Colors.Yellow + "You're not allowed to acquire " + itemName + ".");
}
};
return process(item, player, acquireActions, handler, true, false);
}
/**
* Called on item acquire. Returns true to let the action pass through.
*
* @param item
* @param player
* @return
*/
public boolean onSilentAcquire(final int item, final Player player) {
if (acquireActions == null) {
return true;
}
return process(item, player, acquireActions, silentHandler, false, true);
}
/**
* Internal method to handle the actions.
*
* @param id
* @param player
* @param actions
* @param handler
* @param allowRepeat
* @param silent
* @return
*/
private boolean process(int id, Player player, String[] actions,
ActionHandler handler, boolean allowRepeat, boolean silent) {
if (shouldIgnore(player)) {
return true;
}
String name = player.getName();
long now = System.currentTimeMillis();
boolean repeating = false;
// Check to see whether this event is being repeated
BlacklistTrackedEvent tracked = lastAffected.get(name);
if (tracked != null) {
if (tracked.getId() == id && tracked.getTime() > now - 3000) {
repeating = true;
} else {
tracked.setTime(now);
tracked.setId(id);
}
} else {
lastAffected.put(name, new BlacklistTrackedEvent(id, now));
}
boolean ret = true;
for (String action : actions) {
// Deny
if (action.equalsIgnoreCase("deny")) {
if (silent) {
return false;
}
ret = false;
// Kick
} else if (action.equalsIgnoreCase("kick")) {
if (this.message != null) {
player.kick(String.format(this.message,
etc.getDataSource().getItem(id)));
} else {
handler.kick(etc.getDataSource().getItem(id));
}
// Ban
} else if (action.equalsIgnoreCase("ban")) {
handler.ban(etc.getDataSource().getItem(id));
if (this.message != null) {
banPlayer(player, "Banned: " + String.format(this.message,
etc.getDataSource().getItem(id)));
} else {
handler.ban(etc.getDataSource().getItem(id));
}
} else if (!repeating || allowRepeat) {
// Notify
if (action.equalsIgnoreCase("notify")) {
handler.notifyAdmins(etc.getDataSource().getItem(id));
// Log
} else if (action.equalsIgnoreCase("log")) {
handler.log(etc.getDataSource().getItem(id));
// Tell
} else if (action.equalsIgnoreCase("tell")) {
if (this.message != null) {
player.sendMessage(Colors.Yellow +
String.format(message, etc.getDataSource().getItem(id))
+ ".");
} else {
handler.tell(etc.getDataSource().getItem(id));
}
}
}
}
return ret;
}
/**
* Forget a player.
*
* @param player
*/
public static void forgetPlayer(Player player) {
lastAffected.remove(player.getName());
}
/**
* Forget all players.
*
* @param player
*/
public static void forgetAllPlayers() {
lastAffected.clear();
}
/**
* Gets called for actions.
*/
private static interface ActionHandler {
public void log(String itemName);
public void kick(String itemName);
public void ban(String itemName);
public void notifyAdmins(String itemName);
public void tell(String itemName);
}
}
-165
View File
@@ -1,165 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.Set;
import java.util.HashSet;
/**
*
* @author sk89q
*/
public class BlacklistLogger implements BlacklistLoggerHandler {
/**
* List of logger handlers.
*/
private Set<BlacklistLoggerHandler> handlers
= new HashSet<BlacklistLoggerHandler>();
/**
* Add a handler.
*
* @param handler
*/
public void addHandler(BlacklistLoggerHandler handler) {
handlers.add(handler);
}
/**
* Add a handler.
*
* @param handler
*/
public void removeHandler(BlacklistLoggerHandler handler) {
handlers.remove(handler);
}
/**
* Add a handler.
*
* @param handler
*/
public void clearHandlers() {
handlers.clear();
}
/**
* Log a block destroy attempt.
*
* @param player
* @param block
*/
public void logDestroyAttempt(Player player, Block block, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logDestroyAttempt(player, block, comment);
}
}
/**
* Log a block break attempt.
*
* @param player
* @param block
*/
public void logBreakAttempt(Player player, Block block, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logBreakAttempt(player, block, comment);
}
}
/**
* Log a right click on attempt.
*
* @param player
* @param block
*/
public void logUseAttempt(Player player, int item, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logUseAttempt(player, item, comment);
}
}
/**
* Log a right click on attempt.
*
* @param player
* @param block
*/
public void logRightClickAttempt(Player player, Block block, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logRightClickAttempt(player, block, comment);
}
}
/**
* Right a left click attempt.
*
* @param player
* @param item
*/
public void logDestroyWithAttempt(Player player, int item, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logDestroyWithAttempt(player, item, comment);
}
}
/**
* Log a place attempt.
*
* @param player
* @param item
*/
public void logPlaceAttempt(Player player, int item, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logPlaceAttempt(player, item, comment);
}
}
/**
* Log a drop attempt.
*
* @param player
* @param item
*/
public void logDropAttempt(Player player, int item, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logDropAttempt(player, item, comment);
}
}
/**
* Log an acquire attempt.
*
* @param player
* @param item
*/
public void logAcquireAttempt(Player player, int item, String comment) {
for (BlacklistLoggerHandler handler : handlers) {
handler.logAcquireAttempt(player, item, comment);
}
}
/**
* Close the connection.
*/
public void close() {
for (BlacklistLoggerHandler handler : handlers) {
handler.close();
}
}
}
-86
View File
@@ -1,86 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Interface for loggers for the blacklist.
*
* @author sk89q
*/
public interface BlacklistLoggerHandler {
/**
* Log a block destroy attempt.
*
* @param player
* @param block
*/
public void logDestroyAttempt(Player player, Block block, String comment);
/**
* Log a block break attempt.
*
* @param player
* @param block
*/
public void logBreakAttempt(Player player, Block block, String comment);
/**
* Log a use attempt.
*
* @param player
* @param block
*/
public void logUseAttempt(Player player, int item, String comment);
/**
* Right a left click attempt.
*
* @param player
* @param item
*/
public void logDestroyWithAttempt(Player player, int item, String comment);
/**
* Log a place attempt.
*
* @param player
* @param item
*/
public void logPlaceAttempt(Player player, int item, String comment);
/**
* Log a right click on attempt.
*
* @param player
* @param item
*/
public void logRightClickAttempt(Player player, Block block, String comment);
/**
* Log a drop attempt.
*
* @param player
* @param item
*/
public void logDropAttempt(Player player, int item, String comment);
/**
* Log an acquire attempt.
*
* @param player
* @param item
*/
public void logAcquireAttempt(Player player, int item, String comment);
/**
* Close the logger.
*/
public void close();
}
-66
View File
@@ -1,66 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
* @author sk89q
*/
public class BlacklistTrackedEvent {
private int id;
private long time;
/**
* Construct the object.
*
* @param id
* @param time
*/
public BlacklistTrackedEvent(int id, long time) {
this.id = id;
this.time = time;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the time
*/
public long getTime() {
return time;
}
/**
* @param time the time to set
*/
public void setTime(long time) {
this.time = time;
}
}
-143
View File
@@ -1,143 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.logging.Logger;
import java.util.logging.Level;
/**
*
* @author sk89q
*/
public class ConsoleLoggerHandler implements BlacklistLoggerHandler {
/**
* Logger.
*/
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
/**
* Log a block destroy attempt.
*
* @param player
* @param block
*/
public void logDestroyAttempt(Player player, Block block, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to destroy " + getFriendlyItemName(block.getType())
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log a block break attempt.
*
* @param player
* @param block
*/
public void logBreakAttempt(Player player, Block block, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to break " + getFriendlyItemName(block.getType())
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log a right click on attempt.
*
* @param player
* @param block
*/
public void logRightClickAttempt(Player player, Block block, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to right click " + getFriendlyItemName(block.getType())
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log an attempt to destroy with an item.
*
* @param player
* @param item
*/
public void logDestroyWithAttempt(Player player, int item, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to destroy with " + getFriendlyItemName(item)
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log a block creation attempt.
*
* @param player
* @param item
*/
public void logPlaceAttempt(Player player, int item, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to place " + getFriendlyItemName(item)
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log a use attempt.
*
* @param player
* @param item
*/
public void logUseAttempt(Player player, int item, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to use " + getFriendlyItemName(item)
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log a drop attempt.
*
* @param player
* @param item
*/
public void logDropAttempt(Player player, int item, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to drop " + getFriendlyItemName(item)
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Log an acquire attempt.
*
* @param player
* @param item
*/
public void logAcquireAttempt(Player player, int item, String comment) {
logger.log(Level.INFO, "WorldGuard: " + player.getName()
+ " tried to acquire " + getFriendlyItemName(item)
+ (comment != null ? " (" + comment + ")" : ""));
}
/**
* Get an item's friendly name with its ID.
*
* @param id
*/
private static String getFriendlyItemName(int id) {
return etc.getDataSource().getItem(id) + " (#" + id + ")";
}
/**
* Close the connection.
*/
public void close() {
}
}
-227
View File
@@ -1,227 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.logging.Logger;
import java.util.logging.Level;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.PreparedStatement;
/**
*
* @author sk89q
*/
public class DatabaseLoggerHandler implements BlacklistLoggerHandler {
/**
* Logger.
*/
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
/**
* DSN.
*/
private String dsn;
/**
* Username.
*/
private String user;
/**
* Password.
*/
private String pass;
/**
* Table.
*/
private String table;
/**
* Database connection.
*/
private Connection conn;
/**
* Construct the object.
*
* @param dsn
* @param user
* @param pass
*/
public DatabaseLoggerHandler(String dsn, String user, String pass, String table) {
this.dsn = dsn;
this.user = user;
this.pass = pass;
this.table = table;
}
/**
* Gets the database connection.
*
* @return
* @throws SQLException
*/
private Connection getConnection() throws SQLException {
if (conn == null || conn.isClosed()) {
conn = DriverManager.getConnection(dsn, user, pass);
}
return conn;
}
/**
* Log an event to the database.
*
* @param event
* @param name
* @param x
* @param y
* @param z
* @param item
* @param comment
*/
private void logEvent(String event, String name, int x, int y, int z, int item,
String comment) {
try {
Connection conn = getConnection();
PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO " + table
+ "(event, player, x, y, z, item, time, comment) VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?)");
stmt.setString(1, event);
stmt.setString(2, name);
stmt.setInt(3, x);
stmt.setInt(4, y);
stmt.setInt(5, z);
stmt.setInt(6, item);
stmt.setInt(7, (int)(System.currentTimeMillis() / 1000));
stmt.setString(8, comment);
stmt.executeUpdate();
} catch (SQLException e) {
logger.log(Level.SEVERE, "Failed to log blacklist event to database: "
+ e.getMessage());
}
}
/**
* Log a block destroy attempt.
*
* @param player
* @param block
*/
public void logDestroyAttempt(Player player, Block block, String comment) {
logEvent("DESTROY", player.getName(),
block.getX(), block.getY(), block.getZ(), block.getType(),
comment);
}
/**
* Log a block break attempt.
*
* @param player
* @param block
*/
public void logBreakAttempt(Player player, Block block, String comment) {
logEvent("BREAK", player.getName(),
block.getX(), block.getY(), block.getZ(), block.getType(),
comment);
}
/**
* Log a right click on attempt.
*
* @param player
* @param block
*/
public void logRightClickAttempt(Player player, Block block, String comment) {
logEvent("RIGHT_CLICK", player.getName(),
block.getX(), block.getY(), block.getZ(), block.getType(),
comment);
}
/**
* Right a left click attempt.
*
* @param player
* @param item
*/
public void logDestroyWithAttempt(Player player, int item, String comment) {
logEvent("DESTROY_WITH", player.getName(),
(int)Math.floor(player.getX()), (int)Math.floor(player.getY()),
(int)Math.floor(player.getZ()), item, comment);
}
/**
* Log a place attempt.
*
* @param player
* @param item
*/
public void logPlaceAttempt(Player player, int item, String comment) {
logEvent("PLACE", player.getName(),
(int)Math.floor(player.getX()), (int)Math.floor(player.getY()),
(int)Math.floor(player.getZ()), item, comment);
}
/**
* Log a use attempt.
*
* @param player
* @param item
*/
public void logUseAttempt(Player player, int item, String comment) {
logEvent("USE", player.getName(),
(int)Math.floor(player.getX()), (int)Math.floor(player.getY()),
(int)Math.floor(player.getZ()), item, comment);
}
/**
* Log a drop attempt.
*
* @param player
* @param item
*/
public void logDropAttempt(Player player, int item, String comment) {
logEvent("DROP", player.getName(),
(int)Math.floor(player.getX()), (int)Math.floor(player.getY()),
(int)Math.floor(player.getZ()), item, comment);
}
/**
* Log an aquire attempt.
*
* @param player
* @param item
*/
public void logAcquireAttempt(Player player, int item, String comment) {
logEvent("AQUIRE", player.getName(),
(int)Math.floor(player.getX()), (int)Math.floor(player.getY()),
(int)Math.floor(player.getZ()), item, comment);
}
/**
* Close the connection.
*/
public void close() {
try {
if (conn != null && !conn.isClosed()) {
conn.close();
}
} catch (SQLException e) {
}
}
}
-98
View File
@@ -1,98 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.io.*;
/**
*
* @author sk89q
*/
public class FileLoggerWriter implements Comparable<FileLoggerWriter> {
/**
* Path.
*/
public String path;
/**
* Writer.
*/
private BufferedWriter writer;
/**
* Last use.
*/
private long lastUse;
/**
* Construct the object.
*
* @param writer
*/
public FileLoggerWriter(String path, BufferedWriter writer) {
this.path = path;
this.writer = writer;
lastUse = System.currentTimeMillis();
}
/**
* File path.
*
* @return
*/
public String getPath() {
return path;
}
/**
* @return the writer
*/
public BufferedWriter getWriter() {
return writer;
}
/**
* @return the lastUse
*/
public long getLastUse() {
return lastUse;
}
/**
* Update last use time.
*
* @return
*/
public void updateLastUse() {
lastUse = System.currentTimeMillis();
}
/**
* Comparison function.
*
* @param other
* @return
*/
public int compareTo(FileLoggerWriter other) {
if (lastUse > other.lastUse) {
return 1;
} else if (lastUse < other.lastUse) {
return -1;
} else {
return 0;
}
}
}
-38
View File
@@ -1,38 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.sk89q.worldguard.LocalPlayer;
public class HMPlayer extends LocalPlayer {
private Player player;
public HMPlayer(Player player) {
this.player = player;
}
@Override
public String getName() {
return player.getName();
}
@Override
public boolean hasGroup(String group) {
return player.isInGroup(group);
}
}
-43
View File
@@ -1,43 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Inventory related functions.
*
* @author sk89q
*/
public class ItemArrayUtil {
/**
* Set the contents of an ItemArray.
*
* @param itemArray
* @param contents
*/
public static void setContents(ItemArray<?> itemArray, Item[] contents) {
int size = itemArray.getContentsSize();
for (int i = 0; i < size; i++) {
if (contents[i] == null) {
itemArray.removeItem(i);
} else {
itemArray.setSlot(contents[i], i);
}
}
}
}
-62
View File
@@ -1,62 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.logging.Handler;
import java.util.logging.LogRecord;
/**
* Sends all logger messages to a player.
*
* @author sk89q
*/
public class LoggerToChatHandler extends Handler {
/**
* Player.
*/
private Player player;
/**
* Construct the object.
*
* @param player
*/
public LoggerToChatHandler(Player player) {
this.player = player;
}
/**
* Close the handler.
*/
public void close() {
}
/**
* Flush the output.
*/
public void flush() {
}
/**
* Publish a log record.
*/
public void publish(LogRecord record) {
player.sendMessage(Colors.LightGray + record.getLevel().getName() + ": "
+ Colors.White + record.getMessage());
}
}
-202
View File
@@ -1,202 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
import java.util.List;
import java.util.ArrayList;
import java.net.URL;
import java.io.*;
/**
* Entry point for the plugin for hey0's mod.
*
* @author sk89q
*/
public class WorldGuard extends Plugin {
/**
* Logger.
*/
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
/**
* Listener for the plugin system.
*/
private WorldGuardListener listener;
/**
* Initialize the plugin.
*/
public WorldGuard() {
try {
listener = new WorldGuardListener(this);
} catch (NoClassDefFoundError e) {
logger.severe("*** WORLDGUARD FAILED TO LOAD. ALL PROTECTION IS DISABLED!");
logger.severe("*** YOUR SERVER WILL BE SAVED AND STOPPED TO PREVENT DAMAGE TO YOUR WORLD. DISABLE WORLDGUARD OR CORRECT THE PROBLEM.");
logger.severe("*** WorldEdit must be placed into the plugins/ directory");
etc.getServer().useConsoleCommand("stop");
}
}
/**
* Initializes the plugin.
*/
@Override
public void initialize() {
if (listener == null) {
return;
}
List<String> missingFeatures = new ArrayList<String>();
registerHook("COMMAND", PluginListener.Priority.MEDIUM);
registerHook("SERVERCOMMAND", PluginListener.Priority.MEDIUM);
registerHook("EXPLODE", PluginListener.Priority.HIGH);
registerHook("IGNITE", PluginListener.Priority.HIGH);
registerHook("FLOW", PluginListener.Priority.HIGH);
registerHook("LOGINCHECK", PluginListener.Priority.HIGH);
registerHook("LOGIN", PluginListener.Priority.MEDIUM);
registerHook("BLOCK_CREATED", PluginListener.Priority.HIGH);
registerHook("BLOCK_DESTROYED", PluginListener.Priority.CRITICAL);
registerHook("BLOCK_BROKEN", PluginListener.Priority.HIGH);
registerHook("BLOCK_PLACE", PluginListener.Priority.HIGH);
registerHook("DISCONNECT", PluginListener.Priority.HIGH);
registerHook("ITEM_DROP", PluginListener.Priority.HIGH);
registerHook("ITEM_USE", PluginListener.Priority.HIGH);
registerHook("ITEM_PICK_UP", PluginListener.Priority.HIGH);
registerHook("SIGN_CHANGE", PluginListener.Priority.HIGH);
registerHook("OPEN_INVENTORY", PluginListener.Priority.HIGH);
registerHook("BLOCK_PHYSICS", PluginListener.Priority.MEDIUM);
registerHook("HEALTH_CHANGE", PluginListener.Priority.MEDIUM);
registerHook("DAMAGE", PluginListener.Priority.MEDIUM);
registerHook("LIQUID_DESTROY", PluginListener.Priority.MEDIUM);
registerHook("BLOCK_RIGHTCLICKED", PluginListener.Priority.MEDIUM);
if (missingFeatures.size() > 0) {
logger.log(Level.WARNING, "WorldGuard: Your version of hMod does not support "
+ concatMissingFeatures(missingFeatures) + ".");
} else {
logger.log(Level.INFO, "WorldGuard: Your version of hMod appears to"
+ " support all features.");
}
}
/**
* Conditionally registers a hook.
*
* @param name
* @param priority
* @return where the hook was registered correctly
*/
public boolean registerHook(String name, PluginListener.Priority priority) {
try {
PluginLoader.Hook hook = PluginLoader.Hook.valueOf(name);
etc.getLoader().addListener(hook, listener, this, priority);
return true;
} catch (IllegalArgumentException e) {
logger.log(Level.WARNING, "WorldGuard: Missing hook " + name + "!");
return false;
}
}
/**
* Enables the plugin.
*/
@Override
public void enable() {
if (listener == null) {
return;
}
logger.log(Level.INFO, "WorldGuard version " + getVersion() + " loaded");
listener.loadConfiguration();
etc.getInstance().addCommand("/stopfire", "Globally stop fire spread");
etc.getInstance().addCommand("/allowfire", "Globally re-enable fire spread");
}
/**
* Disables the plugin.
*/
@Override
public void disable() {
try {
listener.disable();
BlacklistEntry.forgetAllPlayers();
} catch (Throwable t) {
}
etc.getInstance().removeCommand("/stopfire");
etc.getInstance().removeCommand("/allowfire");
}
/**
* Get the WorldGuard version.
*
* @return
*/
private String getVersion() {
try {
String classContainer = WorldGuard.class.getProtectionDomain()
.getCodeSource().getLocation().toString();
URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(manifestUrl.openStream());
Attributes attrib = manifest.getMainAttributes();
String ver = (String)attrib.getValue("WorldGuard-Version");
return ver != null ? ver : "(unavailable)";
} catch (IOException e) {
return "(unknown)";
}
}
/**
* Joins a string from an array of strings.
*
* @param str
* @param delimiter
* @return
*/
private static String concatMissingFeatures(List<String> str) {
if (str.isEmpty()) {
return "";
}
int size = str.size();
StringBuilder buffer = new StringBuilder();
buffer.append("(1) ");
buffer.append(str.get(0));
for (int i = 1; i < size; i++) {
if (i == size - 1) {
buffer.append(" or ");
buffer.append("(");
buffer.append(i + 1);
buffer.append(") ");
buffer.append(str.get(i));
} else {
buffer.append(", ");
buffer.append("(");
buffer.append(i + 1);
buffer.append(") ");
buffer.append(str.get(i));
}
}
return buffer.toString();
}
}
File diff suppressed because it is too large. Load diff
-307
View File
@@ -1,307 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV parser released under a commercial-friendly license.
* This just implements splitting a single line into fields.
*
* @author Glen Smith
* @author Rainer Pruy
*
*/
public class CSVParser {
private final char separator;
private final char quotechar;
private final char escape;
private final boolean strictQuotes;
private String pending;
private boolean inField = false;
private final boolean ignoreLeadingWhiteSpace;
/** The default separator to use if none is supplied to the constructor. */
public static final char DEFAULT_SEPARATOR = ',';
public static final int INITIAL_READ_SIZE = 128;
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/**
* The default escape character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_ESCAPE_CHARACTER = '\\';
/**
* The default strict quote behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_STRICT_QUOTES = false;
/**
* The default leading whitespace behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE = true;
/**
* Constructs CSVParser using a comma for the separator.
*/
public CSVParser() {
this(DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVParser(char separator) {
this(separator, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator and quote char.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVParser(char separator, char quotechar) {
this(separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
*/
public CSVParser(char separator, char quotechar, char escape) {
this(separator, quotechar, escape, DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" flag
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param strictQuotes
* if true, characters outside the quotes are ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes) {
this(separator, quotechar, escape, strictQuotes, DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" and "ignore leading whitespace" flags
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param strictQuotes
* if true, characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace
* if true, white space in front of a quote in a field is ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
this.separator = separator;
this.quotechar = quotechar;
this.escape = escape;
this.strictQuotes = strictQuotes;
this.ignoreLeadingWhiteSpace = ignoreLeadingWhiteSpace;
}
/**
*
* @return true if something was left over from last call(s)
*/
public boolean isPending() {
return pending != null;
}
public String[] parseLineMulti(String nextLine) throws IOException {
return parseLine(nextLine, true);
}
public String[] parseLine(String nextLine) throws IOException {
return parseLine(nextLine, false);
}
/**
* Parses an incoming String and returns an array of elements.
*
* @param nextLine
* the string to parse
* @param multi
* @return the comma-tokenized list of elements, or null if nextLine is null
* @throws IOException if bad things happen during the read
*/
private String[] parseLine(String nextLine, boolean multi) throws IOException {
if (!multi && pending != null) {
pending = null;
}
if (nextLine == null) {
if (pending != null) {
String s = pending;
pending = null;
return new String[] {s};
} else {
return null;
}
}
List<String>tokensOnThisLine = new ArrayList<String>();
StringBuilder sb = new StringBuilder(INITIAL_READ_SIZE);
boolean inQuotes = false;
if (pending != null) {
sb.append(pending);
pending = null;
inQuotes = true;
}
for (int i = 0; i < nextLine.length(); i++) {
char c = nextLine.charAt(i);
if (c == this.escape) {
if( isNextCharacterEscapable(nextLine, inQuotes || inField, i) ){
sb.append(nextLine.charAt(i+1));
i++;
}
} else if (c == quotechar) {
if( isNextCharacterEscapedQuote(nextLine, inQuotes || inField, i) ){
sb.append(nextLine.charAt(i+1));
i++;
}else{
inQuotes = !inQuotes;
// the tricky case of an embedded quote in the middle: a,bc"d"ef,g
if (!strictQuotes) {
if(i>2 //not on the beginning of the line
&& nextLine.charAt(i-1) != this.separator //not at the beginning of an escape sequence
&& nextLine.length()>(i+1) &&
nextLine.charAt(i+1) != this.separator //not at the end of an escape sequence
){
if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) {
sb = new StringBuilder(INITIAL_READ_SIZE); //discard white space leading up to quote
} else {
sb.append(c);
}
}
}
}
inField = !inField;
} else if (c == separator && !inQuotes) {
tokensOnThisLine.add(sb.toString());
sb = new StringBuilder(INITIAL_READ_SIZE); // start work on next token
inField = false;
} else {
if (!strictQuotes || inQuotes){
sb.append(c);
inField = true;
}
}
}
// line is done - check status
if (inQuotes) {
if (multi) {
// continuing a quoted section, re-append newline
sb.append("\n");
pending = sb.toString();
sb = null; // this partial content is not to be added to field list yet
} else {
throw new IOException("Un-terminated quoted field at end of CSV line");
}
}
if (sb != null) {
tokensOnThisLine.add(sb.toString());
}
return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]);
}
/**
* precondition: the current character is a quote or an escape
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i+1) // there is indeed another character to check.
&& nextLine.charAt(i+1) == quotechar;
}
/**
* precondition: the current character is an escape
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i+1) // there is indeed another character to check.
&& ( nextLine.charAt(i+1) == quotechar || nextLine.charAt(i+1) == this.escape);
}
/**
* precondition: sb.length() > 0
* @param sb A sequence of characters to examine
* @return true if every character in the sequence is whitespace
*/
protected boolean isAllWhiteSpace(CharSequence sb) {
boolean result = true;
for (int i = 0; i < sb.length(); i++) {
char c = sb.charAt(i);
if ( !Character.isWhitespace(c) ) {
return false;
}
}
return result;
}
}
-282
View File
@@ -1,282 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV reader released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVReader implements Closeable {
private BufferedReader br;
private boolean hasNext = true;
private CSVParser parser;
private int skipLines;
private boolean linesSkiped;
/**
* The default line to start reading.
*/
public static final int DEFAULT_SKIP_LINES = 0;
/**
* Constructs CSVReader using a comma for the separator.
*
* @param reader
* the reader to an underlying CSV source.
*/
public CSVReader(Reader reader) {
this(reader, CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVReader(Reader reader, char separator) {
this(reader, separator, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVReader(Reader reader, char separator, char quotechar) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator, quote char and quote handling
* behavior.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, boolean strictQuotes) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, strictQuotes);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
*/
public CSVReader(Reader reader, char separator,
char quotechar, char escape) {
this(reader, separator, quotechar, escape, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, int line) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line) {
this(reader, separator, quotechar, escape, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) {
this(reader, separator, quotechar, escape, line, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace
* it true, parser should ignore white space before a quote in a field
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
this.br = new BufferedReader(reader);
this.parser = new CSVParser(separator, quotechar, escape, strictQuotes, ignoreLeadingWhiteSpace);
this.skipLines = line;
}
/**
* Reads the entire file into a List with each element being a String[] of
* tokens.
*
* @return a List of String[], with each String[] representing a line of the
* file.
*
* @throws IOException
* if bad things happen during the read
*/
public List<String[]> readAll() throws IOException {
List<String[]> allElements = new ArrayList<String[]>();
while (hasNext) {
String[] nextLineAsTokens = readNext();
if (nextLineAsTokens != null)
allElements.add(nextLineAsTokens);
}
return allElements;
}
/**
* Reads the next line from the buffer and converts to a string array.
*
* @return a string array with each comma-separated element as a separate
* entry.
*
* @throws IOException
* if bad things happen during the read
*/
public String[] readNext() throws IOException {
String[] result = null;
do {
String nextLine = getNextLine();
if (!hasNext) {
return result; // should throw if still pending?
}
String[] r = parser.parseLineMulti(nextLine);
if (r.length > 0) {
if (result == null) {
result = r;
} else {
String[] t = new String[result.length+r.length];
System.arraycopy(result, 0, t, 0, result.length);
System.arraycopy(r, 0, t, result.length, r.length);
result = t;
}
}
} while (parser.isPending());
return result;
}
/**
* Reads the next line from the file.
*
* @return the next line from the file without trailing newline
* @throws IOException
* if bad things happen during the read
*/
private String getNextLine() throws IOException {
if (!this.linesSkiped) {
for (int i = 0; i < skipLines; i++) {
br.readLine();
}
this.linesSkiped = true;
}
String nextLine = br.readLine();
if (nextLine == null) {
hasNext = false;
}
return hasNext ? nextLine : null;
}
/**
* Closes the underlying reader.
*
* @throws IOException if the close fails
*/
public void close() throws IOException{
br.close();
}
}
-302
View File
@@ -1,302 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.Closeable;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* A very simple CSV writer released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVWriter implements Closeable {
public static final int INITIAL_STRING_SIZE = 128;
private Writer rawWriter;
private PrintWriter pw;
private char separator;
private char quotechar;
private char escapechar;
private String lineEnd;
/** The character used for escaping quotes. */
public static final char DEFAULT_ESCAPE_CHARACTER = '"';
/** The default separator to use if none is supplied to the constructor. */
public static final char DEFAULT_SEPARATOR = ',';
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/** The quote constant to use when you wish to suppress all quoting. */
public static final char NO_QUOTE_CHARACTER = '\u0000';
/** The escape constant to use when you wish to suppress all escaping. */
public static final char NO_ESCAPE_CHARACTER = '\u0000';
/** Default line terminator uses platform encoding. */
public static final String DEFAULT_LINE_END = "\n";
private ResultSetHelper resultService = new ResultSetHelperService();
/**
* Constructs CSVWriter using a comma for the separator.
*
* @param writer
* the writer to an underlying CSV source.
*/
public CSVWriter(Writer writer) {
this(writer, DEFAULT_SEPARATOR);
}
/**
* Constructs CSVWriter with supplied separator.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVWriter(Writer writer, char separator) {
this(writer, separator, DEFAULT_QUOTE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVWriter(Writer writer, char separator, char quotechar) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar) {
this(writer, separator, quotechar, escapechar, DEFAULT_LINE_END);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, String lineEnd) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER, lineEnd);
}
/**
* Constructs CSVWriter with supplied separator, quote char, escape char and line ending.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar, String lineEnd) {
this.rawWriter = writer;
this.pw = new PrintWriter(writer);
this.separator = separator;
this.quotechar = quotechar;
this.escapechar = escapechar;
this.lineEnd = lineEnd;
}
/**
* Writes the entire list to a CSV file. The list is assumed to be a
* String[]
*
* @param allLines
* a List of String[], with each String[] representing a line of
* the file.
*/
public void writeAll(List<String[]> allLines) {
for (String[] line : allLines) {
writeNext(line);
}
}
protected void writeColumnNames(ResultSet rs)
throws SQLException {
writeNext(resultService.getColumnNames(rs));
}
/**
* Writes the entire ResultSet to a CSV file.
*
* The caller is responsible for closing the ResultSet.
*
* @param rs the recordset to write
* @param includeColumnNames true if you want column names in the output, false otherwise
*
* @throws java.io.IOException thrown by getColumnValue
* @throws java.sql.SQLException thrown by getColumnValue
*/
public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames) throws SQLException, IOException {
if (includeColumnNames) {
writeColumnNames(rs);
}
while (rs.next())
{
writeNext(resultService.getColumnValues(rs));
}
}
/**
* Writes the next line to the file.
*
* @param nextLine
* a string array with each comma-separated element as a separate
* entry.
*/
public void writeNext(String[] nextLine) {
if (nextLine == null)
return;
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int i = 0; i < nextLine.length; i++) {
if (i != 0) {
sb.append(separator);
}
String nextElement = nextLine[i];
if (nextElement == null)
continue;
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
sb.append(stringContainsSpecialCharacters(nextElement) ? processLine(nextElement) : nextElement);
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
}
sb.append(lineEnd);
pw.write(sb.toString());
}
private boolean stringContainsSpecialCharacters(String line) {
return line.indexOf(quotechar) != -1 || line.indexOf(escapechar) != -1;
}
protected StringBuilder processLine(String nextElement)
{
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int j = 0; j < nextElement.length(); j++) {
char nextChar = nextElement.charAt(j);
if (escapechar != NO_ESCAPE_CHARACTER && nextChar == quotechar) {
sb.append(escapechar).append(nextChar);
} else if (escapechar != NO_ESCAPE_CHARACTER && nextChar == escapechar) {
sb.append(escapechar).append(nextChar);
} else {
sb.append(nextChar);
}
}
return sb;
}
/**
* Flush underlying stream to writer.
*
* @throws IOException if bad things happen
*/
public void flush() throws IOException {
pw.flush();
}
/**
* Close the underlying stream writer flushing any buffered content.
*
* @throws IOException if bad things happen
*
*/
public void close() throws IOException {
flush();
pw.close();
rawWriter.close();
}
/**
* Checks to see if the there has been an error in the printstream.
*/
public boolean checkError() {
return pw.checkError();
}
public void setResultService(ResultSetHelper resultService) {
this.resultService = resultService;
}
}
@@ -1,33 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
*
*
*
*
*/
public interface ResultSetHelper {
public String[] getColumnNames(ResultSet rs) throws SQLException;
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException;
}
@@ -1,183 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* helper class for processing JDBC ResultSet objects
*
*
*/
public class ResultSetHelperService implements ResultSetHelper {
public static final int CLOBBUFFERSIZE = 2048;
// note: we want to maintain compatibility with Java 5 VM's
// These types don't exist in Java 5
private static final int NVARCHAR = -9;
private static final int NCHAR = -15;
private static final int LONGNVARCHAR = -16;
private static final int NCLOB = 2011;
public String[] getColumnNames(ResultSet rs) throws SQLException {
List<String> names = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
names.add(metadata.getColumnName(i+1));
}
String[] nameArray = new String[names.size()];
return names.toArray(nameArray);
}
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException {
List<String> values = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
values.add(getColumnValue(rs, metadata.getColumnType(i + 1), i + 1));
}
String[] valueArray = new String[values.size()];
return values.toArray(valueArray);
}
private String handleObject(Object obj){
return obj == null ? "" : String.valueOf(obj);
}
private String handleBigDecimal(BigDecimal decimal) {
return decimal == null ? "" : decimal.toString();
}
private String handleLong(ResultSet rs, int columnIndex) throws SQLException {
long lv = rs.getLong(columnIndex);
return rs.wasNull() ? "" : Long.toString(lv);
}
private String handleInteger(ResultSet rs, int columnIndex) throws SQLException {
int i = rs.getInt(columnIndex);
return rs.wasNull() ? "" : Integer.toString(i);
}
private String handleDate(ResultSet rs, int columnIndex) throws SQLException {
java.sql.Date date = rs.getDate(columnIndex);
String value = null;
if (date != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
value = dateFormat.format(date);
}
return value;
}
private String handleTime(Time time) {
return time == null ? null : time.toString();
}
private String handleTimestamp(Timestamp timestamp) {
SimpleDateFormat timeFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
return timestamp == null ? null : timeFormat.format(timestamp);
}
private String getColumnValue(ResultSet rs, int colType, int colIndex)
throws SQLException, IOException {
String value = "";
switch (colType)
{
case Types.BIT:
case Types.JAVA_OBJECT:
value = handleObject(rs.getObject(colIndex));
break;
case Types.BOOLEAN:
boolean b = rs.getBoolean(colIndex);
value = Boolean.valueOf(b).toString();
break;
case NCLOB: // todo : use rs.getNClob
case Types.CLOB:
Clob c = rs.getClob(colIndex);
if (c != null) {
value = read(c);
}
break;
case Types.BIGINT:
value = handleLong(rs, colIndex);
break;
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
case Types.NUMERIC:
value = handleBigDecimal(rs.getBigDecimal(colIndex));
break;
case Types.INTEGER:
case Types.TINYINT:
case Types.SMALLINT:
value = handleInteger(rs, colIndex);
break;
case Types.DATE:
value = handleDate(rs, colIndex);
break;
case Types.TIME:
value = handleTime(rs.getTime(colIndex));
break;
case Types.TIMESTAMP:
value = handleTimestamp(rs.getTimestamp(colIndex));
break;
case NVARCHAR: // todo : use rs.getNString
case NCHAR: // todo : use rs.getNString
case LONGNVARCHAR: // todo : use rs.getNString
case Types.LONGVARCHAR:
case Types.VARCHAR:
case Types.CHAR:
value = rs.getString(colIndex);
break;
default:
value = "";
}
if (value == null)
{
value = "";
}
return value;
}
private static String read(Clob c) throws SQLException, IOException
{
StringBuilder sb = new StringBuilder( (int) c.length());
Reader r = c.getCharacterStream();
char[] cbuf = new char[CLOBBUFFERSIZE];
int n;
while ((n = r.read(cbuf, 0, cbuf.length)) != -1) {
sb.append(cbuf, 0, n);
}
return sb.toString();
}
}
-51
View File
@@ -1,51 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard;
public abstract class LocalPlayer {
/**
* Get a player's name.
*
* @return
*/
public abstract String getName();
/**
* Returns true if the player is inside a group.
*
* @param group
* @return
*/
public abstract boolean hasGroup(String group);
@Override
public boolean equals(Object obj) {
if (!(obj instanceof LocalPlayer)) {
return false;
}
return ((LocalPlayer)obj).getName().equals(getName());
}
@Override
public int hashCode() {
return getName().hashCode();
}
}
@@ -1,108 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.domains;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import com.sk89q.worldguard.LocalPlayer;
public class DefaultDomain implements Domain {
private Set<String> groups;
private Set<String> players;
public DefaultDomain() {
this.groups = new LinkedHashSet<String>();
this.players = new HashSet<String>();
}
public void addPlayer(String name) {
players.add(name.toLowerCase());
}
public void addPlayer(LocalPlayer player) {
players.add(player.getName().toLowerCase());
}
public void removePlayer(String name) {
players.remove(name.toLowerCase());
}
public void removePlayer(LocalPlayer player) {
players.remove(player.getName().toLowerCase());
}
public void addGroup(String name) {
groups.add(name.toLowerCase());
}
public void removeGroup(String name) {
groups.remove(name.toLowerCase());
}
public Set<String> getGroups() {
return groups;
}
public Set<String> getPlayers() {
return players;
}
public boolean contains(LocalPlayer player) {
if (players.contains(player.getName().toLowerCase())) {
return true;
}
for (String group : groups) {
if (player.hasGroup(group)) {
return true;
}
}
return false;
}
public int size() {
return groups.size();
}
public String toPlayersString() {
StringBuilder str = new StringBuilder();
for (Iterator<String> it = players.iterator(); it.hasNext(); ) {
str.append(it.next());
if (it.hasNext()) {
str.append(", ");
}
}
return str.toString();
}
public String toGroupsString() {
StringBuilder str = new StringBuilder();
for (Iterator<String> it = groups.iterator(); it.hasNext(); ) {
str.append(it.next());
if (it.hasNext()) {
str.append(", ");
}
}
return str.toString();
}
}
@@ -1,13 +0,0 @@
package com.sk89q.worldguard.domains;
import com.sk89q.worldguard.LocalPlayer;
public interface Domain {
/**
* Returns true if a domain contains a player.
*
* @param player
* @return
*/
public boolean contains(LocalPlayer player);
}
@@ -1,55 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.domains;
import java.util.Set;
import java.util.LinkedHashSet;
import com.sk89q.worldguard.LocalPlayer;
public class DomainCollection implements Domain {
private Set<Domain> domains;
public DomainCollection() {
domains = new LinkedHashSet<Domain>();
}
public void add(Domain domain) {
domains.add(domain);
}
public void remove(Domain domain) {
domains.remove(domain);
}
public int size() {
return domains.size();
}
public boolean contains(LocalPlayer player) {
for (Domain domain : domains) {
if (domain.contains(player)) {
return true;
}
}
return false;
}
}
@@ -1,56 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.domains;
import java.util.Arrays;
import java.util.Set;
import java.util.LinkedHashSet;
import com.sk89q.worldguard.LocalPlayer;
public class GroupDomain implements Domain {
private Set<String> groups;
public GroupDomain() {
this.groups = new LinkedHashSet<String>();
}
public GroupDomain(String[] groups) {
this.groups = new LinkedHashSet<String>(Arrays.asList(groups));
}
public void addGroup(String name) {
groups.add(name);
}
public boolean contains(LocalPlayer player) {
for (String group : groups) {
if (player.hasGroup(group)) {
return true;
}
}
return false;
}
public int size() {
return groups.size();
}
}
@@ -1,53 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.domains;
import java.util.Set;
import java.util.HashSet;
import com.sk89q.worldguard.LocalPlayer;
public class PlayerDomain implements Domain {
private Set<String> players;
public PlayerDomain() {
this.players = new HashSet<String>();
}
public PlayerDomain(String[] players) {
this.players = new HashSet<String>();
for (String name : players) {
this.players.add(name.toLowerCase());
}
}
public void addPlayer(String name) {
players.add(name.toLowerCase());
}
public boolean contains(LocalPlayer player) {
return players.contains(player.getName().toLowerCase());
}
public int size() {
return players.size();
}
}
@@ -1,125 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.util.Map;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.protection.AreaFlags.State;
/**
* Represents a set of regions and their rules as applied to one point.
*
* @author sk89q
*/
public class ApplicableRegionSet {
private Vector pt;
private Map<String,ProtectedRegion> regions;
public ApplicableRegionSet(Vector pt, Map<String,ProtectedRegion> regions) {
this.pt = pt;
this.regions = regions;
}
public boolean canBuild(LocalPlayer player) {
boolean allowed = false;
boolean found = false;
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowBuild == State.DENY) return false;
found = true;
if (!allowed && region.getFlags().allowBuild == State.ALLOW) {
allowed = true;
}
if (!allowed && region.getOwners().contains(player)) {
allowed = true;
}
}
return found ? allowed : true;
}
public boolean allowsPvP() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowBuild == State.DENY) return false;
}
return true;
}
public boolean allowsMobDamage() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowMobDamage == State.DENY) return false;
}
return true;
}
public boolean allowsCreeperExplosions() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowCreeperExplosions == State.DENY) return false;
}
return true;
}
public boolean allowsTNT() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowTNT == State.DENY) return false;
}
return true;
}
public boolean allowsLighter() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowLighter == State.DENY) return false;
}
return true;
}
public boolean allowsFireSpread() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowFireSpread == State.DENY) return false;
}
return true;
}
public boolean allowsLavaFire() {
for (ProtectedRegion region : regions.values()) {
if (!region.contains(pt)) continue;
if (region.getFlags().allowLavaFire == State.DENY) return false;
}
return true;
}
}
@@ -1,59 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
/**
*
* @author sk89q
*/
public class AreaFlags {
public enum State {
NONE,
ALLOW,
DENY,
};
public State allowBuild = State.NONE;
public State allowPvP = State.NONE;
public State allowMobDamage = State.NONE;
public State allowCreeperExplosions = State.NONE;
public State allowTNT = State.NONE;
public State allowLighter = State.NONE;
public State allowFireSpread = State.NONE;
public State allowLavaFire = State.NONE;
@Override
public boolean equals(Object obj) {
if (!(obj instanceof AreaFlags)) {
return false;
}
AreaFlags other = (AreaFlags)obj;
return other.allowBuild == allowBuild
&& other.allowPvP == allowPvP
&& other.allowMobDamage == allowMobDamage
&& other.allowCreeperExplosions == allowCreeperExplosions
&& other.allowTNT == allowTNT
&& other.allowLighter == allowLighter
&& other.allowFireSpread == allowFireSpread
&& other.allowLavaFire == allowLavaFire;
}
}
@@ -1,333 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.AreaFlags.State;
/**
* Represents a protected area database that uses CSV files.
*
* @author sk89q
*/
public class CSVDatabase implements ProtectionDatabase {
private static Logger logger = Logger.getLogger("Minecraft.WorldGuard");
/**
* References the CSV file.
*/
private File file;
/**
* Holds the list of regions.
*/
private Map<String,ProtectedRegion> regions;
/**
* Construct the database with a path to a file. No file is read or
* written at this time.
*
* @param file
*/
public CSVDatabase(File file) {
this.file = file;
}
/**
* Saves the database.
*/
@Override
public void save() throws IOException {
CSVWriter writer = new CSVWriter(new FileWriter(file));
try {
for (Map.Entry<String,ProtectedRegion> entry : regions.entrySet()) {
String id = entry.getKey();
ProtectedRegion region = entry.getValue();
if (!(region instanceof ProtectedCuboidRegion)) {
logger.warning("The CSV database only supports cuboid regions.");
continue;
}
ProtectedCuboidRegion cuboid = (ProtectedCuboidRegion)region;
BlockVector min = cuboid.getMinimumPoint();
BlockVector max = cuboid.getMaximumPoint();
writer.writeNext(new String[] {
id,
"cuboid",
String.valueOf(min.getBlockX()),
String.valueOf(min.getBlockY()),
String.valueOf(min.getBlockZ()),
String.valueOf(max.getBlockX()),
String.valueOf(max.getBlockY()),
String.valueOf(max.getBlockZ()),
String.valueOf(cuboid.getPriority()),
writeDomains(cuboid.getOwners()),
writeFlags(cuboid.getFlags()),
cuboid.getEnterMessage(),
});
}
} finally {
try {
writer.close();
} catch (IOException e) {
}
}
}
/**
* Load the database from file.
*/
@Override
public void load() throws IOException {
Map<String,ProtectedRegion> regions =
new HashMap<String,ProtectedRegion>();
CSVReader reader = new CSVReader(new FileReader(file));
try {
String[] line;
while ((line = reader.readNext()) != null) {
if (line.length >= 12) {
String type = line[1];
if (!type.equalsIgnoreCase("cuboid")) {
logger.warning("Only cuboid region types are supported: "
+ line);
break;
}
String id = line[0];
BlockVector min = new BlockVector(
Integer.parseInt(line[2]),
Integer.parseInt(line[3]),
Integer.parseInt(line[4]));
BlockVector max = new BlockVector(
Integer.parseInt(line[5]),
Integer.parseInt(line[6]),
Integer.parseInt(line[7]));
int priority = Integer.parseInt(line[8]);
String ownersData = line[9];
String flagsData = line[10];
String enterMessage = line[11];
ProtectedRegion region = new ProtectedCuboidRegion(min, max);
region.setPriority(priority);
region.setOwners(this.parseDomains(ownersData));
region.setEnterMessage(enterMessage);
region.setFlags(parseFlags(flagsData));
regions.put(id, region);
} else {
logger.warning("Line has invalid: " + line);
}
}
} finally {
try {
reader.close();
} catch (IOException e) {
}
}
this.regions = regions;
}
/**
* Load the list of regions into a region manager.
*
* @throws IOException
*/
public void load(RegionManager manager) throws IOException {
load();
manager.setRegions(regions);
}
/**
* Save the list of regions from a region manager.
*
* @throws IOException
*/
public void save(RegionManager manager) throws IOException {
regions = manager.getRegions();
save();
}
/**
* Used to parse the specified domain in the CSV file.
*
* @param data
* @return
*/
private DefaultDomain parseDomains(String data) {
DefaultDomain domain = new DefaultDomain();
Pattern pattern = Pattern.compile("^([A-Za-z]):(.*)$");
String[] parts = data.split(",");
for (String part : parts) {
Matcher matcher = pattern.matcher(part);
if (!matcher.matches()) {
logger.warning("Invalid owner specification: " + part);
continue;
}
String type = matcher.group(1);
String id = matcher.group(2);
if (type.equals("u")) {
domain.addPlayer(id);
} else if (type.equals("g")) {
domain.addGroup(id);
} else {
logger.warning("Unknown owner specification: " + type);
}
}
return domain;
}
/**
* Used to parse the list of flags.
*
* @param data
* @return
*/
private AreaFlags parseFlags(String data) {
AreaFlags flags = new AreaFlags();
State curState = State.ALLOW;
for (int i = 0; i < data.length(); i++) {
char flag = data.charAt(i);
if (flag == '+') {
curState = State.ALLOW;
} else if (flag == '-') {
curState = State.DENY;
} else if (flag == 'b') {
flags.allowBuild = curState;
} else if (flag == 'p') {
flags.allowPvP = curState;
} else if (flag == 'm') {
flags.allowMobDamage = curState;
} else if (flag == 'c') {
flags.allowCreeperExplosions = curState;
} else if (flag == 't') {
flags.allowTNT = curState;
} else if (flag == 'l') {
flags.allowLighter = curState;
} else if (flag == 'f') {
flags.allowFireSpread = curState;
} else if (flag == 'F') {
flags.allowLavaFire = curState;
} else {
logger.warning("Unknown area flag/flag modifier: " + flag);
}
}
return flags;
}
/**
* Used to write the list of domains.
*
* @param domain
* @return
*/
private String writeDomains(DefaultDomain domain) {
StringBuilder str = new StringBuilder();
for (String player : domain.getPlayers()) {
str.append("u:" + player + ",");
}
for (String group : domain.getGroups()) {
str.append("g:" + group + ",");
}
return str.length() > 0 ?
str.toString().substring(0, str.length() - 1) : "";
}
/**
* Helper method to prepend '+' or '-' in front of a flag according
* to the flag's state.
*
* @param state
* @param flag
* @return
*/
private String writeFlag(State state, String flag) {
if (state == State.ALLOW) {
return "+" + flag;
} else if (state == State.DENY) {
return "-" + flag;
}
return "";
}
/**
* Used to write the list of flags.
*
* @param flags
* @return
*/
private String writeFlags(AreaFlags flags) {
StringBuilder str = new StringBuilder();
str.append(writeFlag(flags.allowBuild, "b"));
str.append(writeFlag(flags.allowPvP, "p"));
str.append(writeFlag(flags.allowMobDamage, "m"));
str.append(writeFlag(flags.allowCreeperExplosions, "c"));
str.append(writeFlag(flags.allowTNT, "t"));
str.append(writeFlag(flags.allowLighter, "l"));
str.append(writeFlag(flags.allowFireSpread, "f"));
str.append(writeFlag(flags.allowLavaFire, "F"));
return str.toString();
}
/**
* Get a list of protected regions.
*
* @return
*/
public Map<String,ProtectedRegion> getRegions() {
return regions;
}
/**
* Get a list of protected regions.
*
* @return
*/
public void setRegions(Map<String,ProtectedRegion> regions) {
this.regions = regions;
}
}
@@ -1,41 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
/**
* Caches the results of the protection to prevent necessary lookups.
*
* @author sk89q
*/
public class CacheManager {
/**
* Region manager.
*/
private RegionManager manager;
/**
* Construct the object.
*
* @param manager
*/
public CacheManager(RegionManager manager) {
this.manager = manager;
}
}
@@ -1,140 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.LinkedHashMap;
import com.sk89q.worldedit.Vector;
/**
* A very simple implementation of the region manager that uses a flat list
* and iterates through the list to identify applicable regions. This method
* is not very efficient.
*
* @author sk89q
*/
public class FlatRegionManager implements RegionManager {
/**
* List of protected regions.
*/
private Map<String,ProtectedRegion> regions;
/**
* Construct the manager.
*/
public FlatRegionManager() {
regions = new LinkedHashMap<String,ProtectedRegion>();
}
/**
* Get a list of protected regions.
*
* @return
*/
public Map<String,ProtectedRegion> getRegions() {
return regions;
}
/**
* Adds a region.
*
* @param id
* @param region
*/
public void addRegion(String id, ProtectedRegion region) {
regions.put(id, region);
}
/**
* Removes a region.
*
* @param id
*/
public void removeRegion(String id) {
regions.remove(id);
}
/**
* Return whether a region exists by an ID.
*
* @param id
* @return
*/
public boolean hasRegion(String id) {
return regions.containsKey(id);
}
/**
* Get a region by its ID.
*
* @param id
*/
public ProtectedRegion getRegion(String id) {
return regions.get(id);
}
/**
* Set a list of protected regions.
*
* @return
*/
public void setRegions(Map<String,ProtectedRegion> regions) {
this.regions = regions;
}
/**
* Get an object for a point for rules to be applied with.
*
* @param pt
* @return
*/
public ApplicableRegionSet getApplicableRegions(Vector pt) {
return new ApplicableRegionSet(pt, regions);
}
/**
* Get a list of region IDs that contain a point.
*
* @param pt
* @return
*/
public List<String> getApplicableRegionsIDs(Vector pt) {
List<String> applicable = new ArrayList<String>();
for (Map.Entry<String,ProtectedRegion> entry : regions.entrySet()) {
if (entry.getValue().contains(pt)) {
applicable.add(entry.getKey());
}
}
return applicable;
}
/**
* Get the number of regions.
*
* @return
*/
public int size() {
return regions.size();
}
}
@@ -1,97 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import com.sk89q.worldedit.*;
/**
* Represents a cuboid region that can be protected.
*
* @author sk89q
*/
public class ProtectedCuboidRegion extends ProtectedRegion {
/**
* Store the first point.
*/
private BlockVector min;
/**
* Store the second point.
*/
private BlockVector max;
/**
* Construct a new instance of this cuboid region.
*
* @param pos1
* @param pos2
* @param priority
*/
public ProtectedCuboidRegion(BlockVector min, BlockVector max) {
super();
this.min = min;
this.max = max;
}
/**
* Get the lower point of the cuboid.
*
* @return min point
*/
public BlockVector getMinimumPoint() {
return min;
}
/**
* Set the lower point of the cuboid.
*
* @param pt
*/
public void setMinimumPoint(BlockVector pt) {
min = pt;
}
/**
* Get the upper point of the cuboid.
*
* @return max point
*/
public BlockVector getMaximumPoint() {
return max;
}
/**
* Set the upper point of the cuboid.
*
* @param pt
*/
public void setMaximumPoint(BlockVector pt) {
max = pt;
}
@Override
public boolean contains(Vector pt) {
int x = pt.getBlockX();
int y = pt.getBlockY();
int z = pt.getBlockZ();
return x >= min.getBlockX() && x <= max.getBlockX()
&& y >= min.getBlockY() && y <= max.getBlockY()
&& z >= min.getBlockZ() && z <= max.getBlockZ();
}
}
@@ -1,128 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.domains.DefaultDomain;
/**
* Represents a region of any shape and size that can be protected.
*
* @author sk89q
*/
public abstract class ProtectedRegion {
/**
* Area message.
*/
private String enterMessage;
/**
* List of owners.
*/
private DefaultDomain owners = new DefaultDomain();
/**
* Priority.
*/
private int priority = 0;
/**
* Area flags.
*/
private AreaFlags flags = new AreaFlags();
/**
* Construct a new instance of this cuboid region.
*
* @param id
* @param priority
* @param owners
* @param enterMessage
*/
public ProtectedRegion() {
this.priority = 0;
this.owners = new DefaultDomain();
this.enterMessage = null;
}
/**
* @return the priority
*/
public int getPriority() {
return priority;
}
/**
* @param priority the priority to set
*/
public void setPriority(int priority) {
this.priority = priority;
}
/**
* Se flags.
* @param flags
*/
public void setFlags(AreaFlags flags) {
this.flags = flags;
}
/**
* @return the enterMessage
*/
public String getEnterMessage() {
return enterMessage;
}
/**
* @param enterMessage the enterMessage to set
*/
public void setEnterMessage(String enterMessage) {
this.enterMessage = enterMessage;
}
/**
* @return the owners
*/
public DefaultDomain getOwners() {
return owners;
}
/**
* @param owners the owners to set
*/
public void setOwners(DefaultDomain owners) {
this.owners = owners;
}
/**
* Get flags.
*
* @return
*/
public AreaFlags getFlags() {
return flags;
}
/**
* Check to see if a point is inside this region.
*
* @param pt
* @return
*/
public abstract boolean contains(Vector pt);
}
@@ -1,68 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.io.IOException;
import java.util.Map;
/**
* Represents a database to read and write lists of regions from and to.
*
* @author sk89q
*/
public interface ProtectionDatabase {
/**
* Load the list of regions. The method should not modify the list returned
* by getRegions() unless the load finishes successfully.
*
* @throws IOException
*/
public void load() throws IOException;
/**
* Save the list of regions.
*
* @throws IOException
*/
public void save() throws IOException;
/**
* Load the list of regions into a region manager.
*
* @throws IOException
*/
public void load(RegionManager manager) throws IOException;
/**
* Save the list of regions from a region manager.
*
* @throws IOException
*/
public void save(RegionManager manager) throws IOException;
/**
* Get a list of regions.
*
* @return
*/
public Map<String,ProtectedRegion> getRegions();
/**
* Set the list of regions.
*
* @param regions
*/
public void setRegions(Map<String,ProtectedRegion> regions);
}
@@ -1,101 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.util.List;
import java.util.Map;
import com.sk89q.worldedit.Vector;
/**
* An interface for getting, setting, and looking up regions. The most
* simple implementation uses a flat list and iterates through the entire
* list to look for applicable regions, but a more complicated (and more
* efficient) implementation may use space partitioning techniques.
*
* @author sk89q
*/
public interface RegionManager {
/**
* Get a list of protected regions.
*
* @return
*/
public Map<String,ProtectedRegion> getRegions();
/**
* Set a list of protected regions.
*
* @return
*/
public void setRegions(Map<String,ProtectedRegion> regions);
/**
* Adds a region.
*
* @param id
* @param region
*/
public void addRegion(String id, ProtectedRegion region);
/**
* Return whether a region exists by an ID.
*
* @param id
* @return
*/
public boolean hasRegion(String id);
/**
* Get a region by its ID.
*
* @param id
*/
public ProtectedRegion getRegion(String id);
/**
* Removes a region.
*
* @param id
*/
public void removeRegion(String id);
/**
* Get an object for a point for rules to be applied with.
*
* @param pt
* @return
*/
public ApplicableRegionSet getApplicableRegions(Vector pt);
/**
* Get a list of region IDs that contain a point.
*
* @param pt
* @return
*/
public List<String> getApplicableRegionsIDs(Vector pt);
/**
* Get the number of regions.
*
* @return
*/
public int size();
}
@@ -1,47 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard;
import java.util.Set;
import java.util.HashSet;
import com.sk89q.worldguard.LocalPlayer;
public class TestPlayer extends LocalPlayer {
private String name;
private Set<String> groups = new HashSet<String>();
public TestPlayer(String name) {
this.name = name;
}
public void addGroup(String group) {
groups.add(group.toLowerCase());
}
@Override
public String getName() {
return name;
}
@Override
public boolean hasGroup(String group) {
return groups.contains(group.toLowerCase());
}
}
@@ -1,130 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.TestPlayer;
import com.sk89q.worldguard.domains.DefaultDomain;
public class ApplicableRegionSetTest {
static String COURTYARD_ID = "courtyard";
static String FOUNTAIN_ID = "fountain";
static String MEMBER_GROUP = "member";
static String COURTYARD_GROUP = "courtyard";
Vector inFountain = new Vector(2, 2, 2);
Vector inCourtyard = new Vector(7, 7, 7);
Vector outside = new Vector(15, 15, 15);
RegionManager manager;
TestPlayer player1;
TestPlayer player2;
@Before
public void setUp() throws Exception {
manager = new FlatRegionManager();
setUpPlayers();
setUpCourtyardRegion();
setUpFountainRegion();
}
void setUpPlayers() {
player1 = new TestPlayer("tetsu");
player1.addGroup(MEMBER_GROUP);
player1.addGroup(COURTYARD_GROUP);
player2 = new TestPlayer("alex");
player2.addGroup(MEMBER_GROUP);
}
void setUpCourtyardRegion() {
DefaultDomain domain = new DefaultDomain();
domain.addGroup(COURTYARD_GROUP);
ProtectedRegion region = new ProtectedCuboidRegion(
new BlockVector(0, 0, 0), new BlockVector(10, 10, 10));
AreaFlags flags = new AreaFlags();
flags.allowBuild = AreaFlags.State.NONE;
flags.allowFireSpread = AreaFlags.State.ALLOW;
region.setFlags(flags);
region.setOwners(domain);
manager.addRegion(COURTYARD_ID, region);
}
void setUpFountainRegion() {
ProtectedRegion region = new ProtectedCuboidRegion(
new BlockVector(0, 0, 0), new BlockVector(5, 5, 5));
AreaFlags flags = new AreaFlags();
flags.allowBuild = AreaFlags.State.ALLOW;
flags.allowFireSpread = AreaFlags.State.DENY;
region.setFlags(flags);
manager.addRegion(FOUNTAIN_ID, region);
}
@Test
public void testNonBuildFlag() {
ApplicableRegionSet appl;
// Outside
appl = manager.getApplicableRegions(outside);
assertTrue(appl.allowsFireSpread());
// Inside courtyard
appl = manager.getApplicableRegions(inCourtyard);
assertTrue(appl.allowsFireSpread());
// Inside fountain
appl = manager.getApplicableRegions(inFountain);
assertFalse(appl.allowsFireSpread());
}
@Test
public void testPlayer1BuildAccess() {
ApplicableRegionSet appl;
// Outside
appl = manager.getApplicableRegions(outside);
assertTrue(appl.canBuild(player1));
// Inside courtyard
appl = manager.getApplicableRegions(inCourtyard);
assertTrue(appl.canBuild(player1));
// Inside fountain
appl = manager.getApplicableRegions(inFountain);
assertTrue(appl.canBuild(player1));
}
@Test
public void testPlayer2BuildAccess() {
ApplicableRegionSet appl;
// Outside
appl = manager.getApplicableRegions(outside);
assertTrue(appl.canBuild(player2));
// Inside courtyard
appl = manager.getApplicableRegions(inCourtyard);
assertFalse(appl.canBuild(player2));
// Inside fountain
appl = manager.getApplicableRegions(inFountain);
assertTrue(appl.canBuild(player2));
}
}
@@ -1,124 +0,0 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.protection;
import java.io.*;
import java.util.Map;
import java.util.HashMap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldguard.domains.DefaultDomain;
public class CSVDatabaseTest {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testLoadSave() throws Exception {
File temp = File.createTempFile("worldguard_csv_test", ".tmp");
temp.deleteOnExit();
Map<String,ProtectedRegion> regions =
new HashMap<String,ProtectedRegion>();
regions.put("test1", getTestRegion1());
regions.put("test2", getTestRegion2());
CSVDatabase writeDB = new CSVDatabase(temp);
writeDB.setRegions(regions);
writeDB.save();
CSVDatabase readDB = new CSVDatabase(temp);
readDB.load();
Map<String,ProtectedRegion> loaded = readDB.getRegions();
ProtectedRegion region1 = loaded.get("test1");
checkTestRegion1(region1);
}
private void checkTestRegion1(ProtectedRegion region) {
AreaFlags flags = new AreaFlags();
flags.allowFireSpread = AreaFlags.State.ALLOW;
flags.allowPvP = AreaFlags.State.DENY;
flags.allowLighter = AreaFlags.State.DENY;
region.setFlags(flags);
assertEquals(region.getFlags(), flags);
}
private ProtectedRegion getTestRegion1() {
BlockVector min = new BlockVector(1, 2, 3);
BlockVector max = new BlockVector(4, 5, 6);
ProtectedRegion region = new ProtectedCuboidRegion(min, max);
AreaFlags flags = new AreaFlags();
flags.allowFireSpread = AreaFlags.State.ALLOW;
flags.allowPvP = AreaFlags.State.DENY;
flags.allowLighter = AreaFlags.State.DENY;
region.setFlags(flags);
DefaultDomain domain = new DefaultDomain();
domain.addGroup("members");
domain.addGroup("sturmehs");
domain.addPlayer("hollie");
domain.addPlayer("chad");
domain.addPlayer("tetsu");
region.setOwners(domain);
region.setEnterMessage("hello there!");
region.setPriority(444);
return region;
}
private ProtectedRegion getTestRegion2() {
BlockVector min = new BlockVector(7, 8, 9);
BlockVector max = new BlockVector(10, 11, 12);
ProtectedRegion region = new ProtectedCuboidRegion(min, max);
AreaFlags flags = new AreaFlags();
flags.allowFireSpread = AreaFlags.State.DENY;
flags.allowPvP = AreaFlags.State.ALLOW;
flags.allowMobDamage = AreaFlags.State.DENY;
region.setFlags(flags);
DefaultDomain domain = new DefaultDomain();
domain.addGroup("admins");
domain.addPlayer("jon");
domain.addPlayer("ester");
domain.addPlayer("amy");
region.setOwners(domain);
region.setEnterMessage("Testing");
region.setPriority(555);
return region;
}
}
-90
View File
@@ -1,90 +0,0 @@
#
# This is the blacklist for WorldGuard. Comments start with # and they
# are ignored so you can put your own notes.
#
# Format:
# [item1,item2]
# option1=options
# event1=whatToDo1,whatToDo2,whatToDo3
# event2=whatToDo1,whatToDo2
#
# Example to block ore and catch some events:
# [coalore,goldore,ironore]
# on-destroy-with=deny,log,kick
# on-place=deny,tell
#
# Options:
# - ignore-groups (comma-delimited list of groups to not affect)
# - comment (message for yourself that is printed with 'log' and 'notify')
# - message (optional message to show the user instead; %s is the item name)
#
# Events:
# - on-destroy (when a block of this type is being destroyed)
# - on-break (when a block of this type is about to be broken)
# - on-destroy-with (the item/block held by the user while destroying)
# - on-place (a block is being placed)
# - on-use (an item like a lighter is being used)
# - on-right-click (the block is right clicked -- curently INEFFECTIVE)
# - on-drop (the item is being dropped from the player's inventory)
# - on-acquire (the item enters a player's inventory via some method)
#
# Actions (for events):
# - deny (deny completely)
# - notify (notify admins)
# - log (log to console/file/database)
# - tell (tell a player that that's not allowed)
# - kick (kick player)
# - ban (ban player)
#
# With the on-acquire event, it will completely block item pick ups
# (the item will still be on the ground) if you use 'deny' but the other
# actions (notify, log, etc.) won't do anything. However, if the player
# receives the item via a different method (i.e. from a chest), all actions
# will work although the item is removed after a short delay rather than
# blocked from the beginning (as it is part client-side).
#
# Users with the /worldguardnotify permission will be receive notifications.
#
# -------------
#
# You can have the same block or item used in two different sections and
# they will both apply:
#
# [goldblock]
# ignore-groups=vip
# on-destroy=deny
# [goldblock]
# ignore-groups=admins
# on-destroy=tell
#
# However, some events override others. For example, if you disable both
# usage of the diamond pickaxe (with the on-destroy-with event) and
# destruction of gold blocks (with the on-destroy event) and a player tries
# to destroy a gold block with a diamond pickaxe, because the
# on-destroy-with event comes first, the rules for the gold block
# will not be applied (but the player will be denied nevertheless).
#
# -------------
#
# Some examples follow. Remember to remove # in front if you want them
# to work for you!
# Deny lava buckets
#[lavabucket]
#ignore-groups=admins,mods
#on-use=deny,tell
# Deny lighter usage
#[259]
#on-use=deny,tell
# Deny some ore
#[coalore,goldore,ironore]
#ignore-groups=admins,mods
#on-destroy=notify,deny,log
#[cobblestone]
#on-place=deny,tell,log
#[lever]
#on-break=deny,tell
+74
View File
@@ -0,0 +1,74 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.internal.HasConvention
plugins {
id("java-library")
id("net.ltgt.apt-eclipse")
id("net.ltgt.apt-idea")
}
applyPlatformAndCoreConfiguration()
applyShadowConfiguration()
repositories {
maven {
name = "paper"
url = uri("https://papermc.io/repo/repository/maven-public/")
}
maven {
name = "bstats"
url = uri("https://repo.codemc.org/repository/maven-public")
}
}
dependencies {
"compile"(project(":worldguard-core"))
//"compile"(project(":worldguard-libs:bukkit"))
"api"("com.destroystokyo.paper:paper-api:1.15-R0.1-SNAPSHOT")
"implementation"("io.papermc:paperlib:1.0.2")
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
"implementation"("com.sk89q:commandbook:2.3") { isTransitive = false }
"implementation"("org.bstats:bstats-bukkit:1.5")
}
tasks.named<Upload>("install") {
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
pom.whenConfigured {
dependencies.firstOrNull { dep ->
dep!!.withGroovyBuilder {
getProperty("groupId") == "com.destroystokyo.paper" && getProperty("artifactId") == "paper-api"
}
}?.withGroovyBuilder {
setProperty("groupId", "org.bukkit")
setProperty("artifactId", "bukkit")
}
}
}
}
tasks.named<Copy>("processResources") {
filesMatching("plugin.yml") {
expand("internalVersion" to project.ext["internalVersion"])
}
}
tasks.named<Jar>("jar") {
manifest {
attributes("Implementation-Version" to project.version)
}
}
tasks.named<ShadowJar>("shadowJar") {
dependencies {
relocate("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
include(dependency("org.bstats:bstats-bukkit:1.5"))
}
relocate ("io.papermc.lib", "com.sk89q.worldguard.bukkit.paperlib") {
include(dependency("io.papermc:paperlib:1.0.2"))
}
}
}
tasks.named("assemble").configure {
dependsOn("shadowJar")
}
@@ -1,21 +1,24 @@
-- Blacklist table for MySQL.
-- You must still configure WorldGuard to use your database.
-- If you do not plan on using a database for logging blacklist events,
-- you do not need to do anything with this file.
CREATE TABLE `blacklist_events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event` varchar(25) NOT NULL,
`player` varchar(16) NOT NULL,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`z` int(11) NOT NULL,
`item` int(11) NOT NULL,
`time` int(11) NOT NULL,
`comment` varchar(255) NULL,
PRIMARY KEY (`id`)
);
-- Required update if you have an older version of the table:
ALTER TABLE `blacklist_events` ADD `comment` VARCHAR( 255 ) NULL
-- Blacklist table for MySQL.
-- You must still configure WorldGuard to use your database.
-- If you do not plan on using a database for logging blacklist events,
-- you do not need to do anything with this file.
CREATE TABLE `blacklist_events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event` varchar(25) NOT NULL,
`world` varchar(32) NOT NULL,
`player` varchar(16) NOT NULL,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`z` int(11) NOT NULL,
`item` int(11) NOT NULL,
`time` int(11) NOT NULL,
`comment` varchar(255) NULL,
PRIMARY KEY (`id`)
);
-- Required update if you have an older version of the table:
ALTER TABLE `blacklist_events` ADD `comment` VARCHAR( 255 ) NULL
ALTER TABLE `blacklist_events` ADD `world` VARCHAR( 32 ) NOT NULL
@@ -0,0 +1,114 @@
--
-- This file only needs to be run if you are using a very old version
-- of the region database (before 2011/03/25).
--
-- Otherwise, WG knows how to update your tables automatically, as well
-- as set them up initially.
--
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
ALTER TABLE `region_cuboid` DROP FOREIGN KEY `fk_region_cuboid_region` ;
ALTER TABLE `region_flag` DROP FOREIGN KEY `fk_flags_region1` ;
ALTER TABLE `region_groups` DROP FOREIGN KEY `fk_region_groups_region` ;
ALTER TABLE `region_players` DROP FOREIGN KEY `fk_region_players_user` , DROP FOREIGN KEY `fk_region_players_region` ;
ALTER TABLE `region_poly2d` DROP FOREIGN KEY `fk_region_poly2d_region` ;
ALTER TABLE `region_poly2d_point` DROP FOREIGN KEY `fk_region_poly2d_point_region_poly2d` ;
ALTER TABLE `group` COLLATE = utf8_bin ;
ALTER TABLE `region_cuboid` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `min_x` `min_x` BIGINT(20) NOT NULL AFTER `world_id` , CHANGE COLUMN `min_y` `min_y` BIGINT(20) NOT NULL AFTER `min_x` , CHANGE COLUMN `max_x` `max_x` BIGINT(20) NOT NULL AFTER `min_z` , CHANGE COLUMN `max_y` `max_y` BIGINT(20) NOT NULL AFTER `max_x` ,
ADD CONSTRAINT `fk_region_cuboid_region`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region` (`id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`region_id`, `world_id`) ;
ALTER TABLE `region_flag` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `flag` `flag` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
ADD CONSTRAINT `fk_flags_region`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region` (`id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP INDEX `fk_flags_region`
, ADD INDEX `fk_flags_region` (`region_id` ASC, `world_id` ASC) ;
ALTER TABLE `region_groups` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , DROP FOREIGN KEY `fk_region_groups_group` ;
ALTER TABLE `region_groups`
ADD CONSTRAINT `fk_region_groups_group`
FOREIGN KEY (`group_id` )
REFERENCES `group` (`id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_region_groups_region`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region` (`id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`region_id`, `world_id`, `group_id`) ;
ALTER TABLE `region_players` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` ,
ADD CONSTRAINT `fk_region_users_region`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region` (`id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_region_users_user`
FOREIGN KEY (`user_id` )
REFERENCES `user` (`id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`region_id`, `world_id`, `user_id`)
, ADD INDEX `fk_region_users_user` (`user_id` ASC)
, DROP INDEX `fk_region_players_user` ;
ALTER TABLE `region_poly2d` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `min_y` `min_y` INT(11) NOT NULL AFTER `world_id` ,
ADD CONSTRAINT `fk_region_poly2d_region`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region` (`id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`region_id`, `world_id`) ;
ALTER TABLE `region_poly2d_point` COLLATE = utf8_bin , ADD COLUMN `world_id` INT(10) UNSIGNED NOT NULL AFTER `region_id` , CHANGE COLUMN `x` `x` BIGINT(20) NOT NULL AFTER `world_id` ,
ADD CONSTRAINT `fk_region_poly2d_point_region_poly2d`
FOREIGN KEY (`region_id` , `world_id` )
REFERENCES `region_poly2d` (`region_id` , `world_id` )
ON DELETE CASCADE
ON UPDATE CASCADE
, DROP INDEX `fk_region_poly2d_point_region_poly2d`
, ADD INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC, `world_id` ASC) ;
ALTER TABLE `user` COLLATE = utf8_bin ;
ALTER TABLE `world` COLLATE = utf8_bin ;
UPDATE `region_cuboid` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
UPDATE `region_flag` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
UPDATE `region_groups` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
UPDATE `region_players` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
UPDATE `region_poly2d` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
UPDATE `region_poly2d_point` AS c SET c.`world_id` = (SELECT p.`world_id` FROM `region` AS p WHERE p.`id` = c.`region_id`);
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
@@ -0,0 +1,123 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.config.YamlConfigurationManager;
import com.sk89q.worldedit.util.report.Unreported;
import java.io.File;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class BukkitConfigurationManager extends YamlConfigurationManager {
@Unreported private WorldGuardPlugin plugin;
@Unreported private ConcurrentMap<String, BukkitWorldConfiguration> worlds = new ConcurrentHashMap<>();
private boolean hasCommandBookGodMode;
boolean extraStats;
/**
* Construct the object.
*
* @param plugin The plugin instance
*/
public BukkitConfigurationManager(WorldGuardPlugin plugin) {
super();
this.plugin = plugin;
}
public Collection<BukkitWorldConfiguration> getWorldConfigs() {
return worlds.values();
}
@Override
public void load() {
super.load();
this.extraStats = getConfig().getBoolean("custom-metrics-charts", true);
}
@Override
public File getDataFolder() {
return plugin.getDataFolder();
}
@Override
public void copyDefaults() {
// Create the default configuration file
plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
}
@Override
public void unload() {
worlds.clear();
}
@Override
public void postLoad() {
// Load configurations for each world
for (World world : WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWorlds()) {
get(world);
}
getConfig().save();
}
/**
* Get the configuration for a world.
*
* @param world The world to get the configuration for
* @return {@code world}'s configuration
*/
@Override
public BukkitWorldConfiguration get(World world) {
String worldName = world.getName();
BukkitWorldConfiguration config = worlds.get(worldName);
BukkitWorldConfiguration newConfig = null;
while (config == null) {
if (newConfig == null) {
newConfig = new BukkitWorldConfiguration(plugin, worldName, this.getConfig());
}
worlds.putIfAbsent(world.getName(), newConfig);
config = worlds.get(world.getName());
}
return config;
}
public void updateCommandBookGodMode() {
try {
if (plugin.getServer().getPluginManager().isPluginEnabled("CommandBook")) {
Class.forName("com.sk89q.commandbook.GodComponent");
hasCommandBookGodMode = true;
return;
}
} catch (ClassNotFoundException ignore) {}
hasCommandBookGodMode = false;
}
public boolean hasCommandBookGodMode() {
return hasCommandBookGodMode;
}
}
@@ -0,0 +1,230 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.paste.ActorCallbackPaste;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.event.debug.CancelLogging;
import com.sk89q.worldguard.bukkit.event.debug.LoggingBlockBreakEvent;
import com.sk89q.worldguard.bukkit.event.debug.LoggingBlockPlaceEvent;
import com.sk89q.worldguard.bukkit.event.debug.LoggingEntityDamageByEntityEvent;
import com.sk89q.worldguard.bukkit.event.debug.LoggingPlayerInteractEvent;
import com.sk89q.worldguard.bukkit.util.report.CancelReport;
import com.sk89q.worldguard.internal.platform.DebugHandler;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.util.BlockIterator;
import java.util.logging.Logger;
public class BukkitDebugHandler implements DebugHandler {
private static final Logger log = Logger.getLogger(BukkitDebugHandler.class.getCanonicalName());
private static final int MAX_TRACE_DISTANCE = 20;
private final WorldGuardPlugin plugin;
BukkitDebugHandler(WorldGuardPlugin plugin) {
this.plugin = plugin;
}
/**
* Simulate an event and print its report.
*
* @param receiver The receiver of the messages
* @param target The target
* @param event The event
* @param stacktraceMode Whether stack traces should be generated and posted
* @param <T> The type of event
*/
private <T extends Event & CancelLogging> void testEvent(CommandSender receiver, Player target, T event, boolean stacktraceMode) throws
CommandPermissionsException {
boolean isConsole = receiver instanceof ConsoleCommandSender;
if (!receiver.equals(target)) {
if (!isConsole) {
log.info(receiver.getName() + " is simulating an event on " + target.getName());
}
target.sendMessage(
ChatColor.RED + "(Please ignore any messages that may immediately follow.)");
}
Bukkit.getPluginManager().callEvent(event);
int start = new Exception().getStackTrace().length;
CancelReport report = new CancelReport(event, event.getCancels(), start);
report.setDetectingPlugin(!stacktraceMode);
String result = report.toString();
if (stacktraceMode) {
receiver.sendMessage(ChatColor.GRAY + "The report was printed to console.");
log.info("Event report for " + receiver.getName() + ":\n\n" + result);
plugin.checkPermission(receiver, "worldguard.debug.pastebin");
ActorCallbackPaste.pastebin(WorldGuard.getInstance().getSupervisor(), plugin.wrapCommandSender(receiver),
result, "Event debugging report: %s.txt");
} else {
receiver.sendMessage(result.replaceAll("(?m)^", ChatColor.AQUA.toString()));
if (result.length() >= 500 && !isConsole) {
receiver.sendMessage(ChatColor.GRAY + "The report was also printed to console.");
log.info("Event report for " + receiver.getName() + ":\n\n" + result);
}
}
}
/**
* Get the source of the test.
*
* @param sender The message sender
* @param target The provided target
* @param fromTarget Whether the source should be the target
* @return The source
* @throws CommandException Thrown if a condition is not met
*/
private Player getSource(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
if (fromTarget) {
return target;
} else {
if (sender instanceof Player) {
return (Player) sender;
} else {
throw new CommandException(
"If this command is not to be used in-game, use -t to run the test from the viewpoint of the given player rather than yourself.");
}
}
}
/**
* Find the first non-air block in a ray trace.
*
* @param sender The sender
* @param target The target
* @param fromTarget Whether the trace should originate from the target
* @return The block found
* @throws CommandException Throw on an incorrect parameter
*/
private Block traceBlock(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
Player source = getSource(sender, target, fromTarget);
BlockIterator it = new BlockIterator(source);
int i = 0;
while (it.hasNext() && i < MAX_TRACE_DISTANCE) {
Block block = it.next();
if (block.getType() != Material.AIR) {
return block;
}
i++;
}
throw new CommandException("Not currently looking at a block that is close enough.");
}
/**
* Find the first nearby entity in a ray trace.
*
* @param sender The sender
* @param target The target
* @param fromTarget Whether the trace should originate from the target
* @return The entity found
* @throws CommandException Throw on an incorrect parameter
*/
private Entity traceEntity(CommandSender sender, Player target, boolean fromTarget) throws CommandException {
Player source = getSource(sender, target, fromTarget);
BlockIterator it = new BlockIterator(source);
int i = 0;
while (it.hasNext() && i < MAX_TRACE_DISTANCE) {
Block block = it.next();
// A very in-accurate and slow search
Entity[] entities = block.getChunk().getEntities();
for (Entity entity : entities) {
if (!entity.equals(target) && entity.getLocation().distanceSquared(block.getLocation()) < 10) {
return entity;
}
}
i++;
}
throw new CommandException("Not currently looking at an entity that is close enough.");
}
@Override
public void testBreak(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
CommandSender bukkitSender = plugin.unwrapActor(sender);
Player bukkitTarget = BukkitAdapter.adapt(target);
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
sender.print(TextComponent.of("Testing BLOCK BREAK at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
LoggingBlockBreakEvent event = new LoggingBlockBreakEvent(block, bukkitTarget);
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
}
@Override
public void testPlace(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
CommandSender bukkitSender = plugin.unwrapActor(sender);
Player bukkitTarget = BukkitAdapter.adapt(target);
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
sender.print(TextComponent.of("Testing BLOCK PLACE at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
LoggingBlockPlaceEvent event = new LoggingBlockPlaceEvent(block, block.getState(), block.getRelative(BlockFace.DOWN), bukkitTarget.getItemInHand(), bukkitTarget, true);
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
}
@Override
public void testInteract(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
CommandSender bukkitSender = plugin.unwrapActor(sender);
Player bukkitTarget = BukkitAdapter.adapt(target);
Block block = traceBlock(bukkitSender, bukkitTarget, fromTarget);
sender.print(TextComponent.of("Testing BLOCK INTERACT at ", TextColor.AQUA).append(TextComponent.of(block.toString(), TextColor.DARK_AQUA)));
LoggingPlayerInteractEvent event = new LoggingPlayerInteractEvent(bukkitTarget, Action.RIGHT_CLICK_BLOCK, bukkitTarget.getItemInHand(), block, BlockFace.SOUTH);
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
}
@Override
public void testDamage(Actor sender, LocalPlayer target, boolean fromTarget, boolean stackTraceMode) throws CommandException {
CommandSender bukkitSender = plugin.unwrapActor(sender);
Player bukkitTarget = BukkitAdapter.adapt(target);
Entity entity = traceEntity(bukkitSender, bukkitTarget, fromTarget);
sender.print(TextComponent.of("Testing ENTITY DAMAGE at ", TextColor.AQUA).append(TextComponent.of(entity.toString(), TextColor.DARK_AQUA)));
LoggingEntityDamageByEntityEvent event = new LoggingEntityDamageByEntityEvent(bukkitTarget, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 1);
testEvent(bukkitSender, bukkitTarget, event, stackTraceMode);
}
}
@@ -0,0 +1,241 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.weather.WeatherType;
import org.bukkit.OfflinePlayer;
import java.util.UUID;
import javax.annotation.Nullable;
class BukkitOfflinePlayer extends BukkitPlayer {
private final OfflinePlayer player;
BukkitOfflinePlayer(WorldGuardPlugin plugin, OfflinePlayer offlinePlayer) {
super(plugin, offlinePlayer.getPlayer()); // null if they are offline
this.player = offlinePlayer;
}
/// ========================================
/// These are checked for RegionAssociable
/// (to see if a player belongs to a region)
/// ========================================
@Override
public String getName() {
return player.getName();
}
@Override
public UUID getUniqueId() {
return player.getUniqueId();
}
@Override
public boolean hasGroup(String group) {
return plugin.inGroup(player, group);
}
@Override
public String[] getGroups() {
return plugin.getGroups(player);
}
/// ==========================================
/// None of the following should ever be used.
/// ==========================================
@Override
public boolean hasPermission(String perm) {
throw new UnsupportedOperationException();
}
@Override
public void kick(String msg) {
throw new UnsupportedOperationException();
}
@Override
public void ban(String msg) {
throw new UnsupportedOperationException();
}
@Override
public double getHealth() {
throw new UnsupportedOperationException();
}
@Override
public void setHealth(double health) {
throw new UnsupportedOperationException();
}
@Override
public double getMaxHealth() {
throw new UnsupportedOperationException();
}
@Override
public double getFoodLevel() {
throw new UnsupportedOperationException();
}
@Override
public void setFoodLevel(double foodLevel) {
throw new UnsupportedOperationException();
}
@Override
public double getSaturation() {
throw new UnsupportedOperationException();
}
@Override
public void setSaturation(double saturation) {
throw new UnsupportedOperationException();
}
@Override
public float getExhaustion() {
throw new UnsupportedOperationException();
}
@Override
public void setExhaustion(float exhaustion) {
throw new UnsupportedOperationException();
}
@Override
public WeatherType getPlayerWeather() {
throw new UnsupportedOperationException();
}
@Override
public void setPlayerWeather(WeatherType weather) {
throw new UnsupportedOperationException();
}
@Override
public void resetPlayerWeather() {
throw new UnsupportedOperationException();
}
@Override
public boolean isPlayerTimeRelative() {
throw new UnsupportedOperationException();
}
@Override
public long getPlayerTimeOffset() {
throw new UnsupportedOperationException();
}
@Override
public void setPlayerTime(long time, boolean relative) {
throw new UnsupportedOperationException();
}
@Override
public void resetPlayerTime() {
throw new UnsupportedOperationException();
}
@Override
public void printRaw(String msg) {
throw new UnsupportedOperationException();
}
@Override
public void printDebug(String msg) {
throw new UnsupportedOperationException();
}
@Override
public void print(String msg) {
throw new UnsupportedOperationException();
}
@Override
public void printError(String msg) {
throw new UnsupportedOperationException();
}
@Override
public World getWorld() {
throw new UnsupportedOperationException();
}
@Override
public BaseItemStack getItemInHand(HandSide handSide) {
throw new UnsupportedOperationException();
}
@Override
public void giveItem(BaseItemStack itemStack) {
throw new UnsupportedOperationException();
}
@Override
public BlockBag getInventoryBlockBag() {
throw new UnsupportedOperationException();
}
@Override
public void setPosition(Vector3 pos, float pitch, float yaw) {
throw new UnsupportedOperationException();
}
@Nullable
@Override
public BaseEntity getState() {
throw new UnsupportedOperationException();
}
@Override
public Location getLocation() {
throw new UnsupportedOperationException();
}
@Override
public void setCompassTarget(Location location) {
throw new UnsupportedOperationException();
}
@Override
public SessionKey getSessionKey() {
throw new UnsupportedOperationException();
}
@Nullable
@Override
public <T> T getFacet(Class<? extends T> cls) {
throw new UnsupportedOperationException();
}
}
@@ -0,0 +1,212 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import com.sk89q.worldguard.LocalPlayer;
import io.papermc.lib.PaperLib;
import org.bukkit.BanList.Type;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class BukkitPlayer extends com.sk89q.worldedit.bukkit.BukkitPlayer implements LocalPlayer {
protected final WorldGuardPlugin plugin;
private final boolean silenced;
private String name;
public BukkitPlayer(WorldGuardPlugin plugin, Player player) {
this(plugin, player, false);
}
BukkitPlayer(WorldGuardPlugin plugin, Player player, boolean silenced) {
super(player);
this.plugin = plugin;
this.silenced = silenced;
}
@Override
public String getName() {
if (this.name == null) {
// getName() takes longer than before in newer versions of Minecraft
this.name = getPlayer().getName();
}
return name;
}
@Override
public boolean hasGroup(String group) {
return plugin.inGroup(getPlayer(), group);
}
@Override
public void kick(String msg) {
if (!silenced) {
getPlayer().kickPlayer(msg);
}
}
@Override
public void ban(String msg) {
if (!silenced) {
Bukkit.getBanList(Type.NAME).addBan(getName(), null, null, null);
getPlayer().kickPlayer(msg);
}
}
@Override
public double getHealth() {
return getPlayer().getHealth();
}
@Override
public void setHealth(double health) {
getPlayer().setHealth(health);
}
@Override
public double getMaxHealth() {
return getPlayer().getMaxHealth();
}
@Override
public double getFoodLevel() {
return getPlayer().getFoodLevel();
}
@Override
public void setFoodLevel(double foodLevel) {
getPlayer().setFoodLevel((int) foodLevel);
}
@Override
public double getSaturation() {
return getPlayer().getSaturation();
}
@Override
public void setSaturation(double saturation) {
getPlayer().setSaturation((float) saturation);
}
@Override
public float getExhaustion() {
return getPlayer().getExhaustion();
}
@Override
public void setExhaustion(float exhaustion) {
getPlayer().setExhaustion(exhaustion);
}
@Override
public WeatherType getPlayerWeather() {
org.bukkit.WeatherType playerWeather = getPlayer().getPlayerWeather();
return playerWeather == null ? null : playerWeather == org.bukkit.WeatherType.CLEAR ? WeatherTypes.CLEAR : WeatherTypes.RAIN;
}
@Override
public void setPlayerWeather(WeatherType weather) {
getPlayer().setPlayerWeather(weather == WeatherTypes.CLEAR ? org.bukkit.WeatherType.CLEAR : org.bukkit.WeatherType.DOWNFALL);
}
@Override
public void resetPlayerWeather() {
getPlayer().resetPlayerWeather();
}
@Override
public boolean isPlayerTimeRelative() {
return getPlayer().isPlayerTimeRelative();
}
@Override
public long getPlayerTimeOffset() {
return getPlayer().getPlayerTimeOffset();
}
@Override
public void setPlayerTime(long time, boolean relative) {
getPlayer().setPlayerTime(time, relative);
}
@Override
public void resetPlayerTime() {
getPlayer().resetPlayerTime();
}
@Override
public int getFireTicks() {
return getPlayer().getFireTicks();
}
@Override
public void setFireTicks(int fireTicks) {
getPlayer().setFireTicks(fireTicks);
}
@Override
public void setCompassTarget(Location location) {
getPlayer().setCompassTarget(BukkitAdapter.adapt(location));
}
@Override
public void sendTitle(String title, String subtitle) {
getPlayer().sendTitle(title, subtitle, -1, -1, -1);
}
@Override
public void resetFallDistance() {
getPlayer().setFallDistance(0);
}
@Override
public void teleport(Location location, String successMessage, String failMessage) {
PaperLib.teleportAsync(getPlayer(), BukkitAdapter.adapt(location))
.thenApply(success -> {
if (success) {
print(successMessage);
} else {
printError(failMessage);
}
return success;
});
}
@Override
public String[] getGroups() {
return plugin.getGroups(getPlayer());
}
@Override
public void printRaw(String msg) {
if (!silenced) {
super.printRaw(msg);
}
}
@Override
public boolean hasPermission(String perm) {
return plugin.hasPermission(getPlayer(), perm);
}
}
@@ -0,0 +1,132 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
public class BukkitRegionContainer extends RegionContainer {
/**
* Invalidation frequency in ticks.
*/
private static final int CACHE_INVALIDATION_INTERVAL = 2;
private final WorldGuardPlugin plugin;
/**
* Create a new instance.
*
* @param plugin the plugin
*/
public BukkitRegionContainer(WorldGuardPlugin plugin) {
this.plugin = plugin;
}
@Override
public void initialize() {
super.initialize();
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onWorldLoad(WorldLoadEvent event) {
load(BukkitAdapter.adapt(event.getWorld()));
}
@EventHandler
public void onWorldUnload(WorldUnloadEvent event) {
unload(BukkitAdapter.adapt(event.getWorld()));
}
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) {
RegionManager manager = get(BukkitAdapter.adapt(event.getWorld()));
if (manager != null) {
Chunk chunk = event.getChunk();
manager.loadChunk(BlockVector2.at(chunk.getX(), chunk.getZ()));
}
}
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
RegionManager manager = get(BukkitAdapter.adapt(event.getWorld()));
if (manager != null) {
Chunk chunk = event.getChunk();
manager.unloadChunk(BlockVector2.at(chunk.getX(), chunk.getZ()));
}
}
}, plugin);
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, cache::invalidateAll, CACHE_INVALIDATION_INTERVAL, CACHE_INVALIDATION_INTERVAL);
}
public void shutdown() {
container.shutdown();
}
@Override
@Nullable
protected RegionManager load(World world) {
checkNotNull(world);
WorldConfiguration config = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world);
if (!config.useRegions) {
return null;
}
RegionManager manager;
synchronized (lock) {
manager = container.load(world.getName());
if (manager != null) {
// Bias the region data for loaded chunks
List<BlockVector2> positions = new ArrayList<>();
for (Chunk chunk : ((BukkitWorld) world).getWorld().getLoadedChunks()) {
positions.add(BlockVector2.at(chunk.getX(), chunk.getZ()));
}
manager.loadChunks(positions);
}
}
return manager;
}
}
@@ -0,0 +1,246 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.internal.platform.StringMatcher;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
public class BukkitStringMatcher implements StringMatcher {
@Override
public World matchWorld(Actor sender, String filter) throws CommandException {
List<? extends World> worlds = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWorlds();
// Handle special hash tag groups
if (filter.charAt(0) == '#') {
// #main for the main world
if (filter.equalsIgnoreCase("#main")) {
return worlds.get(0);
// #normal for the first normal world
} else if (filter.equalsIgnoreCase("#normal")) {
for (World world : worlds) {
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.NORMAL) {
return world;
}
}
throw new CommandException("No normal world found.");
// #nether for the first nether world
} else if (filter.equalsIgnoreCase("#nether")) {
for (World world : worlds) {
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.NETHER) {
return world;
}
}
throw new CommandException("No nether world found.");
// #end for the first nether world
} else if (filter.equalsIgnoreCase("#end")) {
for (World world : worlds) {
if (BukkitAdapter.adapt(world).getEnvironment() == org.bukkit.World.Environment.THE_END) {
return world;
}
}
throw new CommandException("No end world found.");
// Handle getting a world from a player
} else if (filter.matches("^#player$")) {
String[] parts = filter.split(":", 2);
// They didn't specify an argument for the player!
if (parts.length == 1) {
throw new CommandException("Argument expected for #player.");
}
return matchPlayers(sender, parts[1]).iterator().next().getWorld();
} else {
throw new CommandException("Invalid identifier '" + filter + "'.");
}
}
for (World world : worlds) {
if (world.getName().equals(filter)) {
return world;
}
}
throw new CommandException("No world by that exact name found.");
}
@Override
public List<LocalPlayer> matchPlayerNames(String filter) {
List<LocalPlayer> wgPlayers = Bukkit.getServer().getOnlinePlayers().stream().map(player -> WorldGuardPlugin.inst().wrapPlayer(player)).collect(Collectors.toList());
filter = filter.toLowerCase();
// Allow exact name matching
if (filter.charAt(0) == '@' && filter.length() >= 2) {
filter = filter.substring(1);
for (LocalPlayer player : wgPlayers) {
if (player.getName().equalsIgnoreCase(filter)) {
List<LocalPlayer> list = new ArrayList<>();
list.add(player);
return list;
}
}
return new ArrayList<>();
// Allow partial name matching
} else if (filter.charAt(0) == '*' && filter.length() >= 2) {
filter = filter.substring(1);
List<LocalPlayer> list = new ArrayList<>();
for (LocalPlayer player : wgPlayers) {
if (player.getName().toLowerCase().contains(filter)) {
list.add(player);
}
}
return list;
// Start with name matching
} else {
List<LocalPlayer> list = new ArrayList<>();
for (LocalPlayer player : wgPlayers) {
if (player.getName().toLowerCase().startsWith(filter)) {
list.add(player);
}
}
return list;
}
}
@Override
public Iterable<? extends LocalPlayer> matchPlayers(Actor source, String filter) throws CommandException {
if (Bukkit.getServer().getOnlinePlayers().isEmpty()) {
throw new CommandException("No players matched query.");
}
List<LocalPlayer> wgPlayers = Bukkit.getServer().getOnlinePlayers().stream().map(player -> WorldGuardPlugin.inst().wrapPlayer(player)).collect(Collectors.toList());
if (filter.equals("*")) {
return checkPlayerMatch(wgPlayers);
}
// Handle special hash tag groups
if (filter.charAt(0) == '#') {
// Handle #world, which matches player of the same world as the
// calling source
if (filter.equalsIgnoreCase("#world")) {
List<LocalPlayer> players = new ArrayList<>();
LocalPlayer sourcePlayer = WorldGuard.getInstance().checkPlayer(source);
World sourceWorld = sourcePlayer.getWorld();
for (LocalPlayer player : wgPlayers) {
if (player.getWorld().equals(sourceWorld)) {
players.add(player);
}
}
return checkPlayerMatch(players);
// Handle #near, which is for nearby players.
} else if (filter.equalsIgnoreCase("#near")) {
List<LocalPlayer> players = new ArrayList<>();
LocalPlayer sourcePlayer = WorldGuard.getInstance().checkPlayer(source);
World sourceWorld = sourcePlayer.getWorld();
Vector3 sourceVector = sourcePlayer.getLocation().toVector();
for (LocalPlayer player : wgPlayers) {
if (player.getWorld().equals(sourceWorld) && player.getLocation().toVector().distanceSq(sourceVector) < 900) {
players.add(player);
}
}
return checkPlayerMatch(players);
} else {
throw new CommandException("Invalid group '" + filter + "'.");
}
}
List<LocalPlayer> players = matchPlayerNames(filter);
return checkPlayerMatch(players);
}
@Override
public Actor matchPlayerOrConsole(Actor sender, String filter) throws CommandException {
// Let's see if console is wanted
if (filter.equalsIgnoreCase("#console")
|| filter.equalsIgnoreCase("*console*")
|| filter.equalsIgnoreCase("!")) {
return WorldGuardPlugin.inst().wrapCommandSender(Bukkit.getServer().getConsoleSender());
}
return matchSinglePlayer(sender, filter);
}
@Override
public World getWorldByName(String worldName) {
final org.bukkit.World bukkitW = Bukkit.getServer().getWorld(worldName);
if (bukkitW == null) {
return null;
}
return BukkitAdapter.adapt(bukkitW);
}
@Override
public String replaceMacros(Actor sender, String message) {
Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers();
message = message.replace("%name%", sender.getName());
message = message.replace("%id%", sender.getUniqueId().toString());
message = message.replace("%online%", String.valueOf(online.size()));
if (sender instanceof LocalPlayer) {
LocalPlayer player = (LocalPlayer) sender;
World world = (World) player.getExtent();
message = message.replace("%world%", world.getName());
message = message.replace("%health%", String.valueOf(player.getHealth()));
}
return message;
}
}
@@ -0,0 +1,113 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.blacklist.target.BlockTarget;
import com.sk89q.worldguard.blacklist.target.ItemTarget;
import com.sk89q.worldguard.blacklist.target.Target;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
public class BukkitUtil {
private BukkitUtil() {
}
/**
* Checks if the given potion is a vial of water.
*
* @param item the item to check
* @return true if it's a water vial
*/
public static boolean isWaterPotion(ItemStack item) {
return (item.getDurability() & 0x3F) == 0;
}
/**
* Get just the potion effect bits. This is to work around bugs with potion
* parsing.
*
* @param item item
* @return new bits
*/
public static int getPotionEffectBits(ItemStack item) {
return item.getDurability() & 0x3F;
}
/**
* Get a blacklist target for the given block.
*
* @param block the block
* @param effectiveMaterial The effective material, if different
* @return a target
*/
public static Target createTarget(Block block, Material effectiveMaterial) {
checkNotNull(block);
checkNotNull(block.getType());
if (block.getType() == effectiveMaterial) {
return createTarget(block.getType());
} else {
return createTarget(effectiveMaterial);
}
}
/**
* Get a blacklist target for the given block.
*
* @param block the block
* @return a target
*/
public static Target createTarget(Block block) {
checkNotNull(block);
checkNotNull(block.getType());
return createTarget(block.getType());
}
/**
* Get a blacklist target for the given item.
*
* @param item the item
* @return a target
*/
public static Target createTarget(ItemStack item) {
checkNotNull(item);
checkNotNull(item.getType());
return createTarget(item.getType()); // Delegate it, ItemStacks can contain both Blocks and Items in Spigot
}
/**
* Get a blacklist target for the given material.
*
* @param material the material
* @return a target
*/
public static Target createTarget(Material material) {
checkNotNull(material);
if (material.isBlock()) {
return new BlockTarget(BukkitAdapter.asBlockType(material));
} else {
return new ItemTarget(BukkitAdapter.asItemType(material));
}
}
}
@@ -0,0 +1,432 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.util.yaml.YAMLFormat;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.Blacklist;
import com.sk89q.worldguard.blacklist.BlacklistLoggerHandler;
import com.sk89q.worldguard.blacklist.logger.ConsoleHandler;
import com.sk89q.worldguard.blacklist.logger.DatabaseHandler;
import com.sk89q.worldguard.blacklist.logger.FileHandler;
import com.sk89q.worldguard.blacklist.target.TargetMatcherParseException;
import com.sk89q.worldguard.blacklist.target.TargetMatcherParser;
import com.sk89q.worldguard.bukkit.chest.BukkitSignChestProtection;
import com.sk89q.worldguard.bukkit.internal.TargetMatcherSet;
import com.sk89q.worldguard.chest.ChestProtection;
import com.sk89q.worldguard.commands.CommandUtils;
import com.sk89q.worldguard.config.YamlWorldConfiguration;
import org.bukkit.potion.PotionEffectType;
import org.yaml.snakeyaml.parser.ParserException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
/**
* Holds the configuration for individual worlds.
*
* @author sk89q
* @author Michael
*/
public class BukkitWorldConfiguration extends YamlWorldConfiguration {
private static final TargetMatcherParser matcherParser = new TargetMatcherParser();
@Unreported private String worldName;
@Unreported private ChestProtection chestProtection = new BukkitSignChestProtection();
/* Configuration data start */
public Set<PotionEffectType> blockPotions;
public TargetMatcherSet allowAllInteract;
public TargetMatcherSet blockUseAtFeet;
public boolean usePaperEntityOrigin;
/* Configuration data end */
/**
* Construct the object.
*
* @param plugin The WorldGuardPlugin instance
* @param worldName The world name that this BukkitWorldConfiguration is for.
* @param parentConfig The parent configuration to read defaults from
*/
public BukkitWorldConfiguration(WorldGuardPlugin plugin, String worldName, YAMLProcessor parentConfig) {
File baseFolder = new File(plugin.getDataFolder(), "worlds/" + worldName);
File configFile = new File(baseFolder, "config.yml");
blacklistFile = new File(baseFolder, "blacklist.txt");
this.worldName = worldName;
this.parentConfig = parentConfig;
plugin.createDefaultConfiguration(configFile, "config_world.yml");
plugin.createDefaultConfiguration(blacklistFile, "blacklist.txt");
config = new YAMLProcessor(configFile, true, YAMLFormat.EXTENDED);
loadConfiguration();
if (summaryOnStart) {
log.info("Loaded configuration for world '" + worldName + "'");
}
}
private TargetMatcherSet getTargetMatchers(String node) {
TargetMatcherSet set = new TargetMatcherSet();
List<String> inputs = parentConfig.getStringList(node, null);
if (inputs == null || inputs.isEmpty()) {
parentConfig.setProperty(node, new ArrayList<String>());
return set;
}
for (String input : inputs) {
try {
set.add(matcherParser.fromInput(input));
} catch (TargetMatcherParseException e) {
log.warning("Failed to parse the block / item type specified as '" + input + "'");
}
}
return set;
}
/**
* Load the configuration.
*/
@Override
public void loadConfiguration() {
try {
config.load();
} catch (IOException e) {
log.log(Level.SEVERE, "Error reading configuration for world " + worldName + ": ", e);
} catch (ParserException e) {
log.severe("Error parsing configuration for world " + worldName + ". ");
throw e;
}
summaryOnStart = getBoolean("summary-on-start", true);
opPermissions = getBoolean("op-permissions", true);
buildPermissions = getBoolean("build-permission-nodes.enable", false);
buildPermissionDenyMessage = CommandUtils.replaceColorMacros(
getString("build-permission-nodes.deny-message", "&eSorry, but you are not permitted to do that here."));
strictEntitySpawn = getBoolean("event-handling.block-entity-spawns-with-untraceable-cause", false);
allowAllInteract = getTargetMatchers("event-handling.interaction-whitelist");
blockUseAtFeet = getTargetMatchers("event-handling.emit-block-use-at-feet");
ignoreHopperMoveEvents = getBoolean("event-handling.ignore-hopper-item-move-events", false);
usePaperEntityOrigin = getBoolean("regions.use-paper-entity-origin", false);
itemDurability = getBoolean("protection.item-durability", true);
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
disableObsidianGenerators = getBoolean("protection.disable-obsidian-generators", false);
blockPotions = new HashSet<>();
for (String potionName : getStringList("gameplay.block-potions", null)) {
PotionEffectType effect = PotionEffectType.getByName(potionName);
if (effect == null) {
log.warning("Unknown potion effect type '" + potionName + "'");
} else {
blockPotions.add(effect);
}
}
blockPotionsAlways = getBoolean("gameplay.block-potions-overly-reliably", false);
disableConduitEffects = getBoolean("gameplay.disable-conduit-effects", false);
simulateSponge = getBoolean("simulation.sponge.enable", false);
spongeRadius = Math.max(1, getInt("simulation.sponge.radius", 3)) - 1;
redstoneSponges = getBoolean("simulation.sponge.redstone", false);
pumpkinScuba = getBoolean("default.pumpkin-scuba", false);
disableHealthRegain = getBoolean("default.disable-health-regain", false);
noPhysicsGravel = getBoolean("physics.no-physics-gravel", false);
noPhysicsSand = getBoolean("physics.no-physics-sand", false);
ropeLadders = getBoolean("physics.vine-like-rope-ladders", false);
allowPortalAnywhere = getBoolean("physics.allow-portal-anywhere", false);
preventWaterDamage = new HashSet<>(convertLegacyBlocks(getStringList("physics.disable-water-damage-blocks", null)));
blockTNTExplosions = getBoolean("ignition.block-tnt", false);
blockTNTBlockDamage = getBoolean("ignition.block-tnt-block-damage", false);
blockLighter = getBoolean("ignition.block-lighter", false);
preventLavaFire = getBoolean("fire.disable-lava-fire-spread", false);
disableFireSpread = getBoolean("fire.disable-all-fire-spread", false);
disableFireSpreadBlocks = new HashSet<>(convertLegacyBlocks(getStringList("fire.disable-fire-spread-blocks", null)));
allowedLavaSpreadOver = new HashSet<>(convertLegacyBlocks(getStringList("fire.lava-spread-blocks", null)));
blockCreeperExplosions = getBoolean("mobs.block-creeper-explosions", false);
blockCreeperBlockDamage = getBoolean("mobs.block-creeper-block-damage", false);
blockWitherExplosions = getBoolean("mobs.block-wither-explosions", false);
blockWitherBlockDamage = getBoolean("mobs.block-wither-block-damage", false);
blockWitherSkullExplosions = getBoolean("mobs.block-wither-skull-explosions", false);
blockWitherSkullBlockDamage = getBoolean("mobs.block-wither-skull-block-damage", false);
blockEnderDragonBlockDamage = getBoolean("mobs.block-enderdragon-block-damage", false);
blockEnderDragonPortalCreation = getBoolean("mobs.block-enderdragon-portal-creation", false);
blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false);
blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false);
antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false);
allowTamedSpawns = getBoolean("mobs.allow-tamed-spawns", true);
disableEndermanGriefing = getBoolean("mobs.disable-enderman-griefing", false);
disableSnowmanTrails = getBoolean("mobs.disable-snowman-trails", false);
blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false);
blockEntityItemFrameDestroy = getBoolean("mobs.block-item-frame-destroy", false);
blockEntityArmorStandDestroy = getBoolean("mobs.block-armor-stand-destroy", false);
blockPluginSpawning = getBoolean("mobs.block-plugin-spawning", true);
blockGroundSlimes = getBoolean("mobs.block-above-ground-slimes", false);
blockOtherExplosions = getBoolean("mobs.block-other-explosions", false);
blockZombieDoorDestruction = getBoolean("mobs.block-zombie-door-destruction", false);
disableFallDamage = getBoolean("player-damage.disable-fall-damage", false);
disableLavaDamage = getBoolean("player-damage.disable-lava-damage", false);
disableFireDamage = getBoolean("player-damage.disable-fire-damage", false);
disableLightningDamage = getBoolean("player-damage.disable-lightning-damage", false);
disableDrowningDamage = getBoolean("player-damage.disable-drowning-damage", false);
disableSuffocationDamage = getBoolean("player-damage.disable-suffocation-damage", false);
disableContactDamage = getBoolean("player-damage.disable-contact-damage", false);
teleportOnSuffocation = getBoolean("player-damage.teleport-on-suffocation", false);
disableVoidDamage = getBoolean("player-damage.disable-void-damage", false);
teleportOnVoid = getBoolean("player-damage.teleport-on-void-falling", false);
safeFallOnVoid = getBoolean("player-damage.reset-fall-on-void-teleport", false);
disableExplosionDamage = getBoolean("player-damage.disable-explosion-damage", false);
disableMobDamage = getBoolean("player-damage.disable-mob-damage", false);
disableDeathMessages = getBoolean("player-damage.disable-death-messages", false);
signChestProtection = getBoolean("chest-protection.enable", false);
disableSignChestProtectionCheck = getBoolean("chest-protection.disable-off-check", false);
disableCreatureCropTrampling = getBoolean("crops.disable-creature-trampling", false);
disablePlayerCropTrampling = getBoolean("crops.disable-player-trampling", false);
disallowedLightningBlocks = new HashSet<>(convertLegacyBlocks(getStringList("weather.prevent-lightning-strike-blocks", null)));
preventLightningFire = getBoolean("weather.disable-lightning-strike-fire", false);
disableThunder = getBoolean("weather.disable-thunderstorm", false);
disableWeather = getBoolean("weather.disable-weather", false);
disablePigZap = getBoolean("weather.disable-pig-zombification", false);
disableVillagerZap = getBoolean("weather.disable-villager-witchification", false);
disableCreeperPower = getBoolean("weather.disable-powered-creepers", false);
alwaysRaining = getBoolean("weather.always-raining", false);
alwaysThundering = getBoolean("weather.always-thundering", false);
disableMushroomSpread = getBoolean("dynamics.disable-mushroom-spread", false);
disableIceMelting = getBoolean("dynamics.disable-ice-melting", false);
disableSnowMelting = getBoolean("dynamics.disable-snow-melting", false);
disableSnowFormation = getBoolean("dynamics.disable-snow-formation", false);
disableIceFormation = getBoolean("dynamics.disable-ice-formation", false);
disableLeafDecay = getBoolean("dynamics.disable-leaf-decay", false);
disableGrassGrowth = getBoolean("dynamics.disable-grass-growth", false);
disableMyceliumSpread = getBoolean("dynamics.disable-mycelium-spread", false);
disableVineGrowth = getBoolean("dynamics.disable-vine-growth", false);
disableCropGrowth = getBoolean("dynamics.disable-crop-growth", false);
disableSoilDehydration = getBoolean("dynamics.disable-soil-dehydration", false);
allowedSnowFallOver = new HashSet<>(convertLegacyBlocks(getStringList("dynamics.snow-fall-blocks", null)));
useRegions = getBoolean("regions.enable", true);
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);
regionCancelEmptyChatEvents = getBoolean("regions.cancel-chat-without-recipients", true);
regionNetherPortalProtection = getBoolean("regions.nether-portal-protection", false);
fakePlayerBuildOverride = getBoolean("regions.fake-player-build-override", true);
explosionFlagCancellation = getBoolean("regions.explosion-flags-block-entity-damage", true);
highFreqFlags = getBoolean("regions.high-frequency-flags", false);
checkLiquidFlow = getBoolean("regions.protect-against-liquid-flow", false);
regionWand = convertLegacyItem(getString("regions.wand", ItemTypes.LEATHER.getId()));
maxClaimVolume = getInt("regions.max-claim-volume", 30000);
claimOnlyInsideExistingRegions = getBoolean("regions.claim-only-inside-existing-regions", false);
boundedLocationFlags = getBoolean("regions.location-flags-only-inside-regions", false);
maxRegionCountPerPlayer = getInt("regions.max-region-count-per-player.default", 7);
maxRegionCounts = new HashMap<>();
maxRegionCounts.put(null, maxRegionCountPerPlayer);
for (String key : getKeys("regions.max-region-count-per-player")) {
if (!key.equalsIgnoreCase("default")) {
Object val = getProperty("regions.max-region-count-per-player." + key);
if (val instanceof Number) {
maxRegionCounts.put(key, ((Number) val).intValue());
}
}
}
// useiConomy = getBoolean("iconomy.enable", false);
// buyOnClaim = getBoolean("iconomy.buy-on-claim", false);
// buyOnClaimPrice = getDouble("iconomy.buy-on-claim-price", 1.0);
blockCreatureSpawn = new HashSet<>();
for (String creatureName : getStringList("mobs.block-creature-spawn", null)) {
EntityType creature = EntityTypes.get(creatureName.toLowerCase());
if (creature == null) {
log.warning("Unknown entity type '" + creatureName + "'");
} else {
blockCreatureSpawn.add(creature);
}
}
boolean useBlacklistAsWhitelist = getBoolean("blacklist.use-as-whitelist", false);
// Console log configuration
boolean logConsole = getBoolean("blacklist.logging.console.enable", true);
// Database log configuration
boolean logDatabase = getBoolean("blacklist.logging.database.enable", false);
String dsn = getString("blacklist.logging.database.dsn", "jdbc:mysql://localhost:3306/minecraft");
String user = getString("blacklist.logging.database.user", "root");
String pass = getString("blacklist.logging.database.pass", "");
String table = getString("blacklist.logging.database.table", "blacklist_events");
// File log configuration
boolean logFile = getBoolean("blacklist.logging.file.enable", false);
String logFilePattern = getString("blacklist.logging.file.path", "worldguard/logs/%Y-%m-%d.log");
int logFileCacheSize = Math.max(1, getInt("blacklist.logging.file.open-files", 10));
// Load the blacklist
try {
// If there was an existing blacklist, close loggers
if (blacklist != null) {
blacklist.getLogger().close();
}
// First load the blacklist data from worldguard-blacklist.txt
Blacklist blist = new Blacklist(useBlacklistAsWhitelist);
blist.load(blacklistFile);
// If the blacklist is empty, then set the field to null
// and save some resources
if (blist.isEmpty()) {
this.blacklist = null;
} else {
this.blacklist = blist;
if (summaryOnStart) {
log.log(Level.INFO, "({0}) Blacklist loaded with {1} entries.",
new Object[]{worldName, blacklist.getItemCount()});
}
BlacklistLoggerHandler blacklistLogger = blist.getLogger();
if (logDatabase) {
blacklistLogger.addHandler(new DatabaseHandler(dsn, user, pass, table, worldName, log));
}
if (logConsole) {
blacklistLogger.addHandler(new ConsoleHandler(worldName, log));
}
if (logFile) {
FileHandler handler =
new FileHandler(logFilePattern, logFileCacheSize, worldName, log);
blacklistLogger.addHandler(handler);
}
}
} catch (FileNotFoundException e) {
log.log(Level.WARNING, "WorldGuard blacklist does not exist.");
} catch (IOException e) {
log.log(Level.WARNING, "Could not load WorldGuard blacklist: "
+ e.getMessage());
}
// Print an overview of settings
if (summaryOnStart) {
log.log(Level.INFO, blockTNTExplosions
? "(" + worldName + ") TNT ignition is blocked."
: "(" + worldName + ") TNT ignition is PERMITTED.");
log.log(Level.INFO, blockLighter
? "(" + worldName + ") Lighters are blocked."
: "(" + worldName + ") Lighters are PERMITTED.");
log.log(Level.INFO, preventLavaFire
? "(" + worldName + ") Lava fire is blocked."
: "(" + worldName + ") Lava fire is PERMITTED.");
if (disableFireSpread) {
log.log(Level.INFO, "(" + worldName + ") All fire spread is disabled.");
} else {
if (!disableFireSpreadBlocks.isEmpty()) {
log.log(Level.INFO, "(" + worldName
+ ") Fire spread is limited to "
+ disableFireSpreadBlocks.size() + " block types.");
} else {
log.log(Level.INFO, "(" + worldName
+ ") Fire spread is UNRESTRICTED.");
}
}
}
config.setHeader(CONFIG_HEADER);
config.save();
}
public boolean isChestProtected(Location block, LocalPlayer player) {
if (!signChestProtection) {
return false;
}
if (player.hasPermission("worldguard.chest-protection.override")
|| player.hasPermission("worldguard.override.chest-protection")) {
return false;
}
return chestProtection.isProtected(block, player);
}
public boolean isChestProtected(Location block) {
return signChestProtection && chestProtection.isProtected(block, null);
}
public boolean isChestProtectedPlacement(Location block, LocalPlayer player) {
if (!signChestProtection) {
return false;
}
if (player.hasPermission("worldguard.chest-protection.override")
|| player.hasPermission("worldguard.override.chest-protection")) {
return false;
}
return chestProtection.isProtectedPlacement(block, player);
}
public boolean isAdjacentChestProtected(Location block, LocalPlayer player) {
if (!signChestProtection) {
return false;
}
if (player.hasPermission("worldguard.chest-protection.override")
|| player.hasPermission("worldguard.override.chest-protection")) {
return false;
}
return chestProtection.isAdjacentChestProtected(block, player);
}
public ChestProtection getChestProtection() {
return chestProtection;
}
}
@@ -0,0 +1,279 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.report.ReportList;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.util.profile.resolver.PaperProfileService;
import com.sk89q.worldguard.bukkit.protection.events.flags.FlagContextCreateEvent;
import com.sk89q.worldguard.bukkit.session.BukkitSessionManager;
import com.sk89q.worldguard.bukkit.util.report.PerformanceReport;
import com.sk89q.worldguard.bukkit.util.report.PluginReport;
import com.sk89q.worldguard.bukkit.util.report.SchedulerReport;
import com.sk89q.worldguard.bukkit.util.report.ServerReport;
import com.sk89q.worldguard.bukkit.util.report.ServicesReport;
import com.sk89q.worldguard.bukkit.util.report.WorldReport;
import com.sk89q.worldguard.internal.platform.DebugHandler;
import com.sk89q.worldguard.internal.platform.StringMatcher;
import com.sk89q.worldguard.internal.platform.WorldGuardPlatform;
import com.sk89q.worldguard.protection.flags.FlagContext;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.session.SessionManager;
import com.sk89q.worldguard.util.profile.cache.ProfileCache;
import com.sk89q.worldguard.util.profile.resolver.BukkitPlayerService;
import com.sk89q.worldguard.util.profile.resolver.CacheForwardingService;
import com.sk89q.worldguard.util.profile.resolver.CombinedProfileService;
import com.sk89q.worldguard.util.profile.resolver.HttpRepositoryService;
import com.sk89q.worldguard.util.profile.resolver.ProfileService;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.Permissible;
import javax.annotation.Nullable;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class BukkitWorldGuardPlatform implements WorldGuardPlatform {
private SessionManager sessionManager;
private BukkitConfigurationManager configuration;
private BukkitRegionContainer regionContainer;
private BukkitDebugHandler debugHandler;
private StringMatcher stringMatcher;
public BukkitWorldGuardPlatform() {
}
@Override
public String getPlatformName() {
return "Bukkit-Official";
}
@Override
public String getPlatformVersion() {
return WorldGuardPlugin.inst().getDescription().getVersion();
}
@Override
public void notifyFlagContextCreate(FlagContext.FlagContextBuilder flagContextBuilder) {
Bukkit.getServer().getPluginManager().callEvent(new FlagContextCreateEvent(flagContextBuilder));
}
@Override
public BukkitConfigurationManager getGlobalStateManager() {
return configuration;
}
@Override
public StringMatcher getMatcher() {
return stringMatcher;
}
@Override
public SessionManager getSessionManager() {
return this.sessionManager;
}
@Override
public void broadcastNotification(String message) {
Bukkit.broadcast(message, "worldguard.notify");
Set<Permissible> subs = Bukkit.getPluginManager().getPermissionSubscriptions("worldguard.notify");
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (!(subs.contains(player) && player.hasPermission("worldguard.notify")) &&
WorldGuardPlugin.inst().hasPermission(player, "worldguard.notify")) { // Make sure the player wasn't already broadcasted to.
player.sendMessage(message);
}
}
WorldGuard.logger.info(message);
}
@Override
public void broadcastNotification(TextComponent component) {
List<LocalPlayer>
wgPlayers = Bukkit.getServer().getOnlinePlayers().stream().map(player -> WorldGuardPlugin.inst().wrapPlayer(player)).collect(
Collectors.toList());
for (LocalPlayer player : wgPlayers) {
if (player.hasPermission("worldguard.notify")) {
player.print(component);
}
}
}
@Override
public void load() {
stringMatcher = new BukkitStringMatcher();
sessionManager = new BukkitSessionManager();
configuration = new BukkitConfigurationManager(WorldGuardPlugin.inst());
configuration.load();
regionContainer = new BukkitRegionContainer(WorldGuardPlugin.inst());
regionContainer.initialize();
debugHandler = new BukkitDebugHandler(WorldGuardPlugin.inst());
}
@Override
public void unload() {
configuration.unload();
regionContainer.shutdown();
}
@Override
public RegionContainer getRegionContainer() {
return this.regionContainer;
}
@Override
public DebugHandler getDebugHandler() {
return debugHandler;
}
@Override
public GameMode getDefaultGameMode() {
return GameModes.get(Bukkit.getServer().getDefaultGameMode().name().toLowerCase());
}
@Override
public Path getConfigDir() {
return WorldGuardPlugin.inst().getDataFolder().toPath();
}
@Override
public void stackPlayerInventory(LocalPlayer localPlayer) {
boolean ignoreMax = localPlayer.hasPermission("worldguard.stack.illegitimate");
boolean ignoreDamaged = localPlayer.hasPermission("worldguard.stack.damaged");
Player player = ((BukkitPlayer) localPlayer).getPlayer();
ItemStack[] items = player.getInventory().getContents();
int len = items.length;
int affected = 0;
for (int i = 0; i < len; i++) {
ItemStack item = items[i];
// Avoid infinite stacks and stacks with durability
if (item == null || item.getAmount() <= 0
|| (!ignoreMax && item.getMaxStackSize() == 1)) {
continue;
}
int max = ignoreMax ? 64 : item.getMaxStackSize();
if (item.getAmount() < max) {
int needed = max - item.getAmount(); // Number of needed items until max
// Find another stack of the same type
for (int j = i + 1; j < len; j++) {
ItemStack item2 = items[j];
// Avoid infinite stacks and stacks with durability
if (item2 == null || item2.getAmount() <= 0
|| (!ignoreMax && item.getMaxStackSize() == 1)) {
continue;
}
// Same type?
// Blocks store their color in the damage value
if (item2.getType() == item.getType() &&
(ignoreDamaged || item.getDurability() == item2.getDurability()) &&
((item.getItemMeta() == null && item2.getItemMeta() == null)
|| (item.getItemMeta() != null &&
item.getItemMeta().equals(item2.getItemMeta())))) {
// This stack won't fit in the parent stack
if (item2.getAmount() > needed) {
item.setAmount(max);
item2.setAmount(item2.getAmount() - needed);
break;
// This stack will
} else {
items[j] = null;
item.setAmount(item.getAmount() + item2.getAmount());
needed = max - item.getAmount();
}
affected++;
}
}
}
}
if (affected > 0) {
player.getInventory().setContents(items);
}
}
@Override
public void addPlatformReports(ReportList report) {
report.add(new ServerReport());
report.add(new PluginReport());
report.add(new SchedulerReport());
report.add(new ServicesReport());
report.add(new WorldReport());
report.add(new PerformanceReport());
}
@Override
public ProfileService createProfileService(ProfileCache profileCache) {
List<ProfileService> services = new ArrayList<>();
if (PaperLib.isPaper()) {
// Paper has a shared cache
services.add(PaperProfileService.getInstance());
} else {
services.add(BukkitPlayerService.getInstance());
}
services.add(HttpRepositoryService.forMinecraft());
return new CacheForwardingService(new CombinedProfileService(services),
profileCache);
}
@Nullable
@Override
public ProtectedRegion getSpawnProtection(World world) {
if (world instanceof BukkitWorld) {
org.bukkit.World bWorld = ((BukkitWorld) world).getWorld();
if (bWorld.getUID().equals(Bukkit.getServer().getWorlds().get(0).getUID())) {
int radius = Bukkit.getServer().getSpawnRadius();
if (radius > 0) {
BlockVector3 spawnLoc = BukkitAdapter.asBlockVector(bWorld.getSpawnLocation());
return new ProtectedCuboidRegion("__spawn_protection__",
spawnLoc.subtract(radius, 0, radius).withY(world.getMinimumPoint().getY()),
spawnLoc.add(radius, 0, radius).withY(world.getMaxY()));
}
}
}
return null;
}
}
@@ -0,0 +1,153 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.sk89q.worldguard.bukkit.cause.Cause;
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import com.sk89q.worldguard.bukkit.event.entity.DamageEntityEvent;
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import javax.annotation.Nullable;
import static com.sk89q.worldguard.bukkit.event.DelegateEvents.setSilent;
import static com.sk89q.worldguard.bukkit.util.Events.fireAndTestCancel;
/**
* A helper class to query whether a block or entity is protected by
* WorldGuard.
*/
public class ProtectionQuery {
/**
* Test whether a block can be placed at a given location.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param location the location of the block
* @param newMaterial the new material
* @return true if the action is permitted
*/
public boolean testBlockPlace(@Nullable Object cause, Location location, Material newMaterial) {
return !fireAndTestCancel(setSilent(new PlaceBlockEvent(null, Cause.create(cause), location, newMaterial)));
}
/**
* Test whether a block can be broken.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param block the block broken
* @return true if the action is permitted
*/
public boolean testBlockBreak(@Nullable Object cause, Block block) {
return !fireAndTestCancel(setSilent(new BreakBlockEvent(null, Cause.create(cause), block)));
}
/**
* Test whether a block can be interacted with.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param block the block that is interacted with
* @return true if the action is permitted
*/
public boolean testBlockInteract(@Nullable Object cause, Block block) {
return !fireAndTestCancel(setSilent(new UseBlockEvent(null, Cause.create(cause), block)));
}
/**
* Test whether an entity can be placed.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param location the location that the entity will be spawned at
* @param type the type that is to be spawned
* @return true if the action is permitted
*/
public boolean testEntityPlace(@Nullable Object cause, Location location, EntityType type) {
return !fireAndTestCancel(setSilent(new SpawnEntityEvent(null, Cause.create(cause), location, type)));
}
/**
* Test whether an entity can be destroyed.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param entity the entity broken
* @return true if the action is permitted
*/
public boolean testEntityDestroy(@Nullable Object cause, Entity entity) {
return !fireAndTestCancel(setSilent(new SpawnEntityEvent(null, Cause.create(cause), entity)));
}
/**
* Test whether an entity can be interacted with.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param entity the entity interacted with
* @return true if the action is permitted
*/
public boolean testEntityInteract(@Nullable Object cause, Entity entity) {
return !fireAndTestCancel(setSilent(new UseEntityEvent(null, Cause.create(cause), entity)));
}
/**
* Test whether an entity can be damaged.
*
* <p>The cause does not have to be a player. It can be {@code null}
* if the cause is not known, although the checks will executed
* assuming that the actor is a non-member of all regions.</p>
*
* @param cause the cause, which can be a block, an entity, or a player, or {@code null} if unknown
* @param entity the entity damaged
* @return true if the action is permitted
*/
public boolean testEntityDamage(@Nullable Object cause, Entity entity) {
return !fireAndTestCancel(setSilent(new DamageEntityEvent(null, Cause.create(cause), entity)));
}
}
@@ -0,0 +1,536 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Streams;
import com.sk89q.bukkit.util.CommandsManagerRegistration;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
import com.sk89q.minecraft.util.commands.CommandUsageException;
import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.minecraft.util.commands.MissingNestedCommandException;
import com.sk89q.minecraft.util.commands.SimpleInjector;
import com.sk89q.minecraft.util.commands.WrappedCommandException;
import com.sk89q.wepif.PermissionsResolverManager;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitCommandSender;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.blacklist.Blacklist;
import com.sk89q.worldguard.bukkit.event.player.ProcessPlayerEvent;
import com.sk89q.worldguard.bukkit.listener.BlacklistListener;
import com.sk89q.worldguard.bukkit.listener.BlockedPotionsListener;
import com.sk89q.worldguard.bukkit.listener.BuildPermissionListener;
import com.sk89q.worldguard.bukkit.listener.ChestProtectionListener;
import com.sk89q.worldguard.bukkit.listener.DebuggingListener;
import com.sk89q.worldguard.bukkit.listener.EventAbstractionListener;
import com.sk89q.worldguard.bukkit.listener.InvincibilityListener;
import com.sk89q.worldguard.bukkit.listener.PlayerModesListener;
import com.sk89q.worldguard.bukkit.listener.PlayerMoveListener;
import com.sk89q.worldguard.bukkit.listener.RegionFlagsListener;
import com.sk89q.worldguard.bukkit.listener.RegionProtectionListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardBlockListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardCommandBookListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardEntityListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardHangingListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardPlayerListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardServerListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardVehicleListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardWeatherListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardWorldListener;
import com.sk89q.worldguard.bukkit.listener.WorldRulesListener;
import com.sk89q.worldguard.bukkit.session.BukkitSessionManager;
import com.sk89q.worldguard.bukkit.util.Events;
import com.sk89q.worldguard.bukkit.util.logging.ClassSourceValidator;
import com.sk89q.worldguard.commands.GeneralCommands;
import com.sk89q.worldguard.commands.ProtectionCommands;
import com.sk89q.worldguard.commands.ToggleCommands;
import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.managers.storage.RegionDriver;
import com.sk89q.worldguard.protection.managers.storage.file.DirectoryYamlDriver;
import com.sk89q.worldguard.protection.managers.storage.sql.SQLDriver;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.util.logging.RecordMessagePrefixer;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.JarFile;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
/**
* The main class for WorldGuard as a Bukkit plugin.
*/
public class WorldGuardPlugin extends JavaPlugin {
private static WorldGuardPlugin inst;
private static BukkitWorldGuardPlatform platform;
private final CommandsManager<Actor> commands;
private PlayerMoveListener playerMoveListener;
/**
* Construct objects. Actual loading occurs when the plugin is enabled, so
* this merely instantiates the objects.
*/
public WorldGuardPlugin() {
inst = this;
commands = new CommandsManager<Actor>() {
@Override
public boolean hasPermission(Actor player, String perm) {
return player.hasPermission(perm);
}
};
}
/**
* Get the current instance of WorldGuard
* @return WorldGuardPlugin instance
*/
public static WorldGuardPlugin inst() {
return inst;
}
/**
* Called on plugin enable.
*/
@Override
public void onEnable() {
configureLogger();
getDataFolder().mkdirs(); // Need to create the plugins/WorldGuard folder
PermissionsResolverManager.initialize(this);
WorldGuard.getInstance().setPlatform(platform = new BukkitWorldGuardPlatform()); // Initialise WorldGuard
WorldGuard.getInstance().setup();
BukkitSessionManager sessionManager = (BukkitSessionManager) platform.getSessionManager();
// Set the proper command injector
commands.setInjector(new SimpleInjector(WorldGuard.getInstance()));
// Catch bad things being done by naughty plugins that include
// WorldGuard's classes
ClassSourceValidator verifier = new ClassSourceValidator(this);
verifier.reportMismatches(ImmutableList.of(ProtectedRegion.class, ProtectedCuboidRegion.class, Flag.class));
// Register command classes
final CommandsManagerRegistration reg = new CommandsManagerRegistration(this, commands);
reg.register(ToggleCommands.class);
reg.register(ProtectionCommands.class);
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
if (!platform.getGlobalStateManager().hasCommandBookGodMode()) {
reg.register(GeneralCommands.class);
}
}, 0L);
getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
// Register events
getServer().getPluginManager().registerEvents(sessionManager, this);
(new WorldGuardPlayerListener(this)).registerEvents();
(new WorldGuardBlockListener(this)).registerEvents();
(new WorldGuardEntityListener(this)).registerEvents();
(new WorldGuardWeatherListener(this)).registerEvents();
(new WorldGuardVehicleListener(this)).registerEvents();
(new WorldGuardServerListener(this)).registerEvents();
(new WorldGuardHangingListener(this)).registerEvents();
// Modules
(playerMoveListener = new PlayerMoveListener(this)).registerEvents();
(new BlacklistListener(this)).registerEvents();
(new ChestProtectionListener(this)).registerEvents();
(new RegionProtectionListener(this)).registerEvents();
(new RegionFlagsListener(this)).registerEvents();
(new WorldRulesListener(this)).registerEvents();
(new BlockedPotionsListener(this)).registerEvents();
(new EventAbstractionListener(this)).registerEvents();
(new PlayerModesListener(this)).registerEvents();
(new BuildPermissionListener(this)).registerEvents();
(new InvincibilityListener(this)).registerEvents();
if ("true".equalsIgnoreCase(System.getProperty("worldguard.debug.listener"))) {
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
}
platform.getGlobalStateManager().updateCommandBookGodMode();
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
}
// handle worlds separately to initialize already loaded worlds
WorldGuardWorldListener worldListener = (new WorldGuardWorldListener(this));
for (World world : getServer().getWorlds()) {
worldListener.initWorld(world);
}
worldListener.registerEvents();
Bukkit.getScheduler().runTask(this, () -> {
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
Events.fire(event);
}
});
((SimpleFlagRegistry) WorldGuard.getInstance().getFlagRegistry()).setInitialized(true);
// Enable metrics
final Metrics metrics = new Metrics(this);
if (metrics.isEnabled() && platform.getGlobalStateManager().extraStats) {
setupCustomCharts(metrics);
}
}
private void setupCustomCharts(Metrics metrics) {
metrics.addCustomChart(new Metrics.SingleLineChart("region_count", () ->
platform.getRegionContainer().getLoaded().stream().mapToInt(RegionManager::size).sum()));
metrics.addCustomChart(new Metrics.SimplePie("region_driver", () -> {
RegionDriver driver = platform.getGlobalStateManager().selectedRegionStoreDriver;
return driver instanceof DirectoryYamlDriver ? "yaml" : driver instanceof SQLDriver ? "sql" : "unknown";
}));
metrics.addCustomChart(new Metrics.DrilldownPie("blacklist", () -> {
int empty = 0;
Map<String, Integer> blacklistMap = new HashMap<>();
Map<String, Integer> whitelistMap = new HashMap<>();
for (BukkitWorldConfiguration worldConfig : platform.getGlobalStateManager().getWorldConfigs()) {
Blacklist blacklist = worldConfig.getBlacklist();
if (blacklist != null && !blacklist.isEmpty()) {
Map<String, Integer> target = blacklist.isWhitelist() ? whitelistMap : blacklistMap;
int floor = ((blacklist.getItemCount() - 1) / 10) * 10;
String range = floor >= 100 ? "101+" : (floor + 1) + " - " + (floor + 10);
target.merge(range, 1, Integer::sum);
} else {
empty++;
}
}
Map<String, Map<String, Integer>> blacklistCounts = new HashMap<>();
Map<String, Integer> emptyMap = new HashMap<>();
emptyMap.put("empty", empty);
blacklistCounts.put("empty", emptyMap);
blacklistCounts.put("blacklist", blacklistMap);
blacklistCounts.put("whitelist", whitelistMap);
return blacklistCounts;
}));
metrics.addCustomChart(new Metrics.SimplePie("chest_protection", () ->
"" + platform.getGlobalStateManager().getWorldConfigs().stream().anyMatch(cfg -> cfg.signChestProtection)));
metrics.addCustomChart(new Metrics.SimplePie("build_permissions", () ->
"" + platform.getGlobalStateManager().getWorldConfigs().stream().anyMatch(cfg -> cfg.buildPermissions)));
metrics.addCustomChart(new Metrics.SimplePie("custom_flags", () ->
"" + (WorldGuard.getInstance().getFlagRegistry().size() > Flags.INBUILT_FLAGS.size())));
metrics.addCustomChart(new Metrics.SimplePie("custom_handlers", () ->
"" + (WorldGuard.getInstance().getPlatform().getSessionManager().customHandlersRegistered())));
}
@Override
public void onDisable() {
WorldGuard.getInstance().disable();
this.getServer().getScheduler().cancelTasks(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
try {
Actor actor = wrapCommandSender(sender);
try {
commands.execute(cmd.getName(), args, actor, actor);
} catch (Throwable t) {
Throwable next = t;
do {
try {
WorldGuard.getInstance().getExceptionConverter().convert(next);
} catch (org.enginehub.piston.exception.CommandException pce) {
if (pce.getCause() instanceof CommandException) {
throw ((CommandException) pce.getCause());
}
}
next = next.getCause();
} while (next != null);
throw t;
}
} catch (CommandPermissionsException e) {
sender.sendMessage(ChatColor.RED + "You don't have permission.");
} catch (MissingNestedCommandException e) {
sender.sendMessage(ChatColor.RED + e.getUsage());
} catch (CommandUsageException e) {
sender.sendMessage(ChatColor.RED + e.getMessage());
sender.sendMessage(ChatColor.RED + e.getUsage());
} catch (WrappedCommandException e) {
sender.sendMessage(ChatColor.RED + e.getCause().getMessage());
} catch (CommandException e) {
sender.sendMessage(ChatColor.RED + e.getMessage());
}
return true;
}
/**
* Check whether a player is in a group.
* This calls the corresponding method in PermissionsResolverManager
*
* @param player The player to check
* @param group The group
* @return whether {@code player} is in {@code group}
*/
public boolean inGroup(OfflinePlayer player, String group) {
try {
return PermissionsResolverManager.getInstance().inGroup(player, group);
} catch (Throwable t) {
t.printStackTrace();
return false;
}
}
/**
* Get the groups of a player.
* This calls the corresponding method in PermissionsResolverManager.
* @param player The player to check
* @return The names of each group the playe is in.
*/
public String[] getGroups(OfflinePlayer player) {
try {
return PermissionsResolverManager.getInstance().getGroups(player);
} catch (Throwable t) {
t.printStackTrace();
return new String[0];
}
}
/**
* Checks permissions.
*
* @param sender The sender to check the permission on.
* @param perm The permission to check the permission on.
* @return whether {@code sender} has {@code perm}
*/
public boolean hasPermission(CommandSender sender, String perm) {
if (sender.isOp()) {
if (sender instanceof Player) {
if (platform.getGlobalStateManager().get(BukkitAdapter.adapt(((Player) sender).getWorld())).opPermissions) {
return true;
}
} else {
return true;
}
}
// Invoke the permissions resolver
if (sender instanceof Player) {
Player player = (Player) sender;
return PermissionsResolverManager.getInstance().hasPermission(player.getWorld().getName(), player, perm);
}
return false;
}
/**
* Checks permissions and throws an exception if permission is not met.
*
* @param sender The sender to check the permission on.
* @param perm The permission to check the permission on.
* @throws CommandPermissionsException if {@code sender} doesn't have {@code perm}
*/
public void checkPermission(CommandSender sender, String perm)
throws CommandPermissionsException {
if (!hasPermission(sender, perm)) {
throw new CommandPermissionsException();
}
}
/**
* Gets a copy of the WorldEdit plugin.
*
* @return The WorldEditPlugin instance
* @throws CommandException If there is no WorldEditPlugin available
*/
public WorldEditPlugin getWorldEdit() throws CommandException {
Plugin worldEdit = getServer().getPluginManager().getPlugin("WorldEdit");
if (worldEdit == null) {
throw new CommandException("WorldEdit does not appear to be installed.");
}
if (worldEdit instanceof WorldEditPlugin) {
return (WorldEditPlugin) worldEdit;
} else {
throw new CommandException("WorldEdit detection failed (report error).");
}
}
/**
* Wrap a player as a LocalPlayer.
*
* @param player The player to wrap
* @return The wrapped player
*/
public LocalPlayer wrapPlayer(Player player) {
return new BukkitPlayer(this, player);
}
/**
* Wrap a player as a LocalPlayer.
*
* @param player The player to wrap
* @param silenced True to silence messages
* @return The wrapped player
*/
public LocalPlayer wrapPlayer(Player player, boolean silenced) {
return new BukkitPlayer(this, player, silenced);
}
public Actor wrapCommandSender(CommandSender sender) {
if (sender instanceof Player) {
return wrapPlayer((Player) sender);
}
try {
return new BukkitCommandSender(getWorldEdit(), sender);
} catch (CommandException e) {
e.printStackTrace();
}
return null;
}
public CommandSender unwrapActor(Actor sender) {
if (sender instanceof BukkitPlayer) {
return ((BukkitPlayer) sender).getPlayer();
} else if (sender instanceof BukkitCommandSender) {
return Bukkit.getConsoleSender(); // TODO Fix
} else {
throw new IllegalArgumentException("Unknown actor type. Please report");
}
}
/**
* Wrap a player as a LocalPlayer.
*
* <p>This implementation is incomplete -- permissions cannot be checked.</p>
*
* @param player The player to wrap
* @return The wrapped player
*/
public LocalPlayer wrapOfflinePlayer(OfflinePlayer player) {
return new BukkitOfflinePlayer(this, player);
}
/**
* Return a protection query helper object that can be used by another
* plugin to test whether WorldGuard permits an action at a particular
* place.
*
* @return an instance
*/
public ProtectionQuery createProtectionQuery() {
return new ProtectionQuery();
}
/**
* Configure WorldGuard's loggers.
*/
private void configureLogger() {
RecordMessagePrefixer.register(Logger.getLogger("com.sk89q.worldguard"), "[WorldGuard] ");
}
/**
* Create a default configuration file from the .jar.
*
* @param actual The destination file
* @param defaultName The name of the file inside the jar's defaults folder
*/
public void createDefaultConfiguration(File actual, String defaultName) {
// Make parent directories
File parent = actual.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
if (actual.exists()) {
return;
}
InputStream input = null;
try {
JarFile file = new JarFile(getFile());
ZipEntry copy = file.getEntry("defaults/" + defaultName);
if (copy == null) throw new FileNotFoundException();
input = file.getInputStream(copy);
} catch (IOException e) {
WorldGuard.logger.severe("Unable to read default configuration: " + defaultName);
}
if (input != null) {
FileOutputStream output = null;
try {
output = new FileOutputStream(actual);
byte[] buf = new byte[8192];
int length = 0;
while ((length = input.read(buf)) > 0) {
output.write(buf, 0, length);
}
WorldGuard.logger.info("Default configuration file written: "
+ actual.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
input.close();
} catch (IOException ignore) {
}
try {
if (output != null) {
output.close();
}
} catch (IOException ignore) {
}
}
}
}
public PlayerMoveListener getPlayerMoveListener() {
return playerMoveListener;
}
}
@@ -0,0 +1,306 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.cause;
import com.google.common.base.Joiner;
import com.google.common.collect.Sets;
import com.sk89q.worldguard.bukkit.internal.WGMetadata;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Vehicle;
import org.bukkit.metadata.Metadatable;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* An instance of this object describes the actors that played a role in
* causing an event, with the ability to describe a situation where one actor
* controls several other actors to create the event.
*
* <p>For example, if a player fires an arrow that hits an item frame, the player
* is the initiator, while the arrow is merely controlled by the player to
* hit the item frame.</p>
*/
public final class Cause {
private static final String CAUSE_KEY = "worldguard.cause";
private static final Cause UNKNOWN = new Cause(Collections.emptyList(), false);
private final List<Object> causes;
private final boolean indirect;
/**
* Create a new instance.
*
* @param causes a list of causes
* @param indirect whether the cause is indirect
*/
private Cause(List<Object> causes, boolean indirect) {
checkNotNull(causes);
this.causes = causes;
this.indirect = indirect;
}
/**
* Test whether the traced cause is indirect.
*
* <p>If the cause is indirect, then the root cause may not be notified,
* for example.</p>
*
* @return true if the cause is indirect
*/
public boolean isIndirect() {
return indirect;
}
/**
* Return whether a cause is known. This method will return true if
* the list of causes is empty or the list of causes only contains
* objects that really are not root causes (i.e primed TNT).
*
* @return true if known
*/
public boolean isKnown() {
if (causes.isEmpty()) {
return false;
}
boolean found = false;
for (Object object : causes) {
if (!(object instanceof TNTPrimed) && !(object instanceof Vehicle)) {
found = true;
break;
}
}
return found;
}
@Nullable
public Object getRootCause() {
if (!causes.isEmpty()) {
return causes.get(0);
}
return null;
}
@Nullable
public Player getFirstPlayer() {
for (Object object : causes) {
if (object instanceof Player) {
return (Player) object;
}
}
return null;
}
@Nullable
public Entity getFirstEntity() {
for (Object object : causes) {
if (object instanceof Entity) {
return (Entity) object;
}
}
return null;
}
@Nullable
public Entity getFirstNonPlayerEntity() {
for (Object object : causes) {
if (object instanceof Entity && !(object instanceof Player)) {
return (Entity) object;
}
}
return null;
}
@Nullable
public Block getFirstBlock() {
for (Object object : causes) {
if (object instanceof Block) {
return (Block) object;
}
}
return null;
}
/**
* Find the first type matching one in the given array.
*
* @param types an array of types
* @return a found type or null
*/
@Nullable
public EntityType find(EntityType... types) {
for (Object object : causes) {
if (object instanceof Entity) {
for (EntityType type : types) {
if (((Entity) object).getType() == type) {
return type;
}
}
}
}
return null;
}
@Override
public String toString() {
return Joiner.on(" | ").join(causes);
}
/**
* Create a new instance with the given objects as the cause,
* where the first-most object is the initial initiator and those
* following it are controlled by the previous entry.
*
* @param cause an array of causing objects
* @return a cause
*/
public static Cause create(@Nullable Object... cause) {
if (cause != null) {
Builder builder = new Builder(cause.length);
builder.addAll(cause);
return builder.build();
} else {
return UNKNOWN;
}
}
/**
* Create a new instance that indicates that the cause is not known.
*
* @return a cause
*/
public static Cause unknown() {
return UNKNOWN;
}
/**
* Add a parent cause to a {@code Metadatable} object.
*
* <p>Note that {@code target} cannot be an instance of
* {@link Block} because {@link #create(Object...)} will not bother
* checking for such data on blocks (because it is relatively costly
* to do so).</p>
*
* @param target the target
* @param parent the parent cause
* @throws IllegalArgumentException thrown if {@code target} is an instance of {@link Block}
*/
public static void trackParentCause(Metadatable target, Object parent) {
if (target instanceof Block) {
throw new IllegalArgumentException("Can't track causes on Blocks because Cause doesn't check block metadata");
}
WGMetadata.put(target, CAUSE_KEY, parent);
}
/**
* Builds causes.
*/
private static final class Builder {
private final List<Object> causes;
private final Set<Object> seen = Sets.newHashSet();
private boolean indirect;
private Builder(int expectedSize) {
this.causes = new ArrayList<>(expectedSize);
}
private void addAll(@Nullable Object... element) {
if (element != null) {
for (Object o : element) {
if (o == null || seen.contains(o)) {
continue;
}
seen.add(o);
if (o instanceof TNTPrimed) {
addAll(((TNTPrimed) o).getSource());
} else if (o instanceof Projectile) {
addAll(((Projectile) o).getShooter());
} else if (o instanceof Firework && PaperLib.isPaper()) {
UUID spawningUUID = ((Firework) o).getSpawningEntity();
if (spawningUUID != null) {
Entity spawningEntity = Bukkit.getEntity(spawningUUID);
if (spawningEntity != null) {
addAll(spawningEntity);
}
}
} else if (o instanceof Vehicle) {
((Vehicle) o).getPassengers().forEach(this::addAll);
} else if (o instanceof AreaEffectCloud) {
indirect = true;
addAll(((AreaEffectCloud) o).getSource());
} else if (o instanceof Creature && ((Creature) o).getTarget() != null) {
indirect = true;
addAll(((Creature) o).getTarget());
} else if (o instanceof Tameable) {
indirect = true;
addAll(((Tameable) o).getOwner());
}
// Add manually tracked parent causes
Object source = o;
int index = causes.size();
while (source instanceof Metadatable && !(source instanceof Block)) {
source = WGMetadata.getIfPresent((Metadatable) source, CAUSE_KEY, Object.class);
if (source != null) {
causes.add(index, source);
seen.add(source);
}
}
causes.add(o);
}
}
}
public Cause build() {
return new Cause(causes, indirect);
}
}
}
@@ -0,0 +1,54 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.chest;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.chest.SignChestProtection;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
public class BukkitSignChestProtection extends SignChestProtection {
private Boolean isProtectedSign(Sign sign, LocalPlayer player) {
if (sign.getLine(0).equalsIgnoreCase("[Lock]")) {
if (player == null) { // No player, no access
return true;
}
String name = player.getName();
return !name.equalsIgnoreCase(sign.getLine(1).trim())
&& !name.equalsIgnoreCase(sign.getLine(2).trim())
&& !name.equalsIgnoreCase(sign.getLine(3).trim());
}
return null;
}
@Override
public Boolean isProtectedSign(Location block, LocalPlayer player) {
BlockState state = BukkitAdapter.adapt(block).getBlock().getState();
if (!(state instanceof Sign)) {
return null;
}
return isProtectedSign((Sign) state, player);
}
}
@@ -0,0 +1,39 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event;
import org.bukkit.event.Event.Result;
/**
* A bulk event contains several affected objects in a list.
*/
public interface BulkEvent {
/**
* Get the actual result.
*
* <p>By default, bulk events will set the result to DENY if the number of
* affected objects drops to zero. This method returns the true result.</p>
*
* @return the explicit result
*/
Result getExplicitResult();
}
@@ -0,0 +1,142 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event;
import com.google.common.collect.Lists;
import com.sk89q.worldguard.bukkit.cause.Cause;
import com.sk89q.worldguard.protection.flags.StateFlag;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import javax.annotation.Nullable;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*/
public abstract class DelegateEvent extends Event implements Cancellable, Handleable {
@Nullable
private final Event originalEvent;
private final Cause cause;
private final List<StateFlag> relevantFlags = Lists.newArrayList();
private Result result = Result.DEFAULT;
private boolean silent;
/**
* Create a new instance
*
* @param originalEvent the original event
* @param cause the cause
*/
protected DelegateEvent(@Nullable Event originalEvent, Cause cause) {
checkNotNull(cause);
this.originalEvent = originalEvent;
this.cause = cause;
}
/**
* Get the original event.
*
* @return the original event, which may be {@code null} if unavailable
*/
@Nullable
public Event getOriginalEvent() {
return originalEvent;
}
/**
* Return the cause.
*
* @return the cause
*/
public Cause getCause() {
return cause;
}
/**
* Get a list of relevant flags to consider for this event.
*
* @return A list of relevant flags
*/
public List<StateFlag> getRelevantFlags() {
return relevantFlags;
}
@Override
public boolean isCancelled() {
return getResult() == Result.DENY;
}
@Override
public void setCancelled(boolean cancel) {
if (cancel) {
setResult(Result.DENY);
}
}
@Override
public Result getResult() {
return result;
}
@Override
public void setResult(Result result) {
this.result = result;
}
/**
* Get whether this should be a silent check.
*
* @return true if a silent check
*/
public boolean isSilent() {
return silent;
}
/**
* Set whether this should be a silent check.
*
* @param silent true if silent
* @return the same event
*/
public DelegateEvent setSilent(boolean silent) {
this.silent = silent;
return this;
}
/**
* Set the event to {@link org.bukkit.event.Event.Result#ALLOW} if {@code allowed} is true.
*
* @param allowed true to set the result
* @return the same event
*/
public DelegateEvent setAllowed(boolean allowed) {
if (allowed) {
setResult(Result.ALLOW);
}
return this;
}
}
@@ -0,0 +1,72 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event;
import org.bukkit.event.Event.Result;
/**
* Utility methods for dealing with delegate events.
*/
public final class DelegateEvents {
private DelegateEvents() {
}
/**
* Set an event to be silent.
*
* @param event the event
* @param <T> the type of event
* @return the same event
*/
public static <T extends DelegateEvent> T setSilent(T event) {
event.setSilent(true);
return event;
}
/**
* Set an event to be silent.
*
* @param event the event
* @param silent true to set silent
* @param <T> the type of event
* @return the same event
*/
public static <T extends DelegateEvent> T setSilent(T event, boolean silent) {
event.setSilent(silent);
return event;
}
/**
* Set an event as handled as {@link Result#ALLOW} if {@code allowed} is
* true, otherwise do nothing.
*
* @param event the event
* @param <T> the type of event
* @return the same event
*/
public static <T extends Handleable> T setAllowed(T event, boolean allowed) {
if (allowed) {
event.setResult(Result.ALLOW);
}
return event;
}
}
@@ -0,0 +1,30 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event;
import org.bukkit.event.Event.Result;
public interface Handleable {
Result getResult();
void setResult(Result result);
}
@@ -0,0 +1,186 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.block;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldguard.bukkit.cause.Cause;
import com.sk89q.worldguard.bukkit.event.BulkEvent;
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.event.Event;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*/
abstract class AbstractBlockEvent extends DelegateEvent implements BulkEvent {
private final World world;
private List<Block> blocks;
private final List<BlockState> blockStates;
private final Material effectiveMaterial;
protected AbstractBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<Block> blocks, Material effectiveMaterial) {
super(originalEvent, cause);
checkNotNull(world);
checkNotNull(blocks);
checkNotNull(effectiveMaterial);
this.world = world;
this.blocks = blocks;
this.effectiveMaterial = effectiveMaterial;
this.blockStates = null;
}
protected AbstractBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<BlockState> blocks) {
super(originalEvent, cause);
checkNotNull(world);
checkNotNull(blocks);
checkArgument(!blocks.isEmpty());
this.world = world;
this.blockStates = blocks;
this.blocks = null;
this.effectiveMaterial = blocks.get(0).getType();
}
protected AbstractBlockEvent(@Nullable Event originalEvent, Cause cause, Block block) {
this(originalEvent, cause, block.getWorld(), createList(checkNotNull(block)), block.getType());
}
protected AbstractBlockEvent(@Nullable Event originalEvent, Cause cause, Location target, Material effectiveMaterial) {
this(originalEvent, cause, target.getWorld(), createList(target.getBlock()), effectiveMaterial);
}
private static List<Block> createList(Block block) {
List<Block> blocks = new ArrayList<>();
blocks.add(block);
return blocks;
}
/**
* Get the world.
*
* @return the world
*/
public World getWorld() {
return world;
}
/**
* Get the affected blocks.
*
* @return a list of affected block
*/
public List<Block> getBlocks() {
if (blocks == null) { // be lazy here because we often don't call getBlocks internally, just filter
blocks = blockStates.stream().map(BlockState::getBlock).collect(Collectors.toList());
}
return blocks;
}
/**
* Filter the list of affected blocks with the given predicate. If the
* predicate returns {@code false}, then the block is removed.
*
* @param predicate the predicate
* @param cancelEventOnFalse true to cancel the event and clear the block
* list once the predicate returns {@code false}
* @return true if one or more blocks were filtered out
*/
public boolean filter(Predicate<Location> predicate, boolean cancelEventOnFalse) {
return blocks == null
? filterInternal(blockStates, BlockState::getLocation, predicate, cancelEventOnFalse)
: filterInternal(blocks, Block::getLocation, predicate, cancelEventOnFalse);
}
private <B> boolean filterInternal(List<B> blockList, Function<B, Location> locFunc,
Predicate<Location> predicate, boolean cancelEventOnFalse) {
boolean hasRemoval = false;
Iterator<B> it = blockList.iterator();
while (it.hasNext()) {
if (!predicate.test(locFunc.apply(it.next()))) {
hasRemoval = true;
if (cancelEventOnFalse) {
blockList.clear();
setCancelled(true);
break;
} else {
it.remove();
}
}
}
return hasRemoval;
}
/**
* Filter the list of affected blocks with the given predicate. If the
* predicate returns {@code false}, then the block is removed.
*
* <p>This method will <strong>not</strong> fail fast and
* cancel the event the first instance that the predicate returns
* {@code false}. See {@link #filter(Predicate, boolean)} to adjust
* this behavior.</p>
*
* @param predicate the predicate
* @return true if one or more blocks were filtered out
*/
public boolean filter(Predicate<Location> predicate) {
return filter(predicate, false);
}
/**
* Get the effective material of the block, regardless of what the block
* currently is.
*
* @return the effective material
*/
public Material getEffectiveMaterial() {
return effectiveMaterial;
}
@Override
public Result getResult() {
if (blocks == null ? blockStates.isEmpty() : blocks.isEmpty()) {
return Result.DENY;
}
return super.getResult();
}
@Override
public Result getExplicitResult() {
return super.getResult();
}
}
@@ -0,0 +1,64 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.bukkit.cause.Cause;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import javax.annotation.Nullable;
import java.util.List;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*
* <p>Thrown when a block is broken.</p>
*/
public class BreakBlockEvent extends AbstractBlockEvent {
private static final HandlerList handlers = new HandlerList();
public BreakBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<Block> blocks, Material effectiveMaterial) {
super(originalEvent, cause, world, blocks, effectiveMaterial);
}
public BreakBlockEvent(@Nullable Event originalEvent, Cause cause, Block block) {
super(originalEvent, cause, block);
}
public BreakBlockEvent(@Nullable Event originalEvent, Cause cause, Location target, Material effectiveMaterial) {
super(originalEvent, cause, target, effectiveMaterial);
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -0,0 +1,69 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.bukkit.cause.Cause;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import javax.annotation.Nullable;
import java.util.List;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*
* <p>Thrown when a block is placed.</p>
*/
public class PlaceBlockEvent extends AbstractBlockEvent {
private static final HandlerList handlers = new HandlerList();
public PlaceBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<BlockState> blocks) {
super(originalEvent, cause, world, blocks);
}
public PlaceBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<Block> blocks, Material effectiveMaterial) {
super(originalEvent, cause, world, blocks, effectiveMaterial);
}
public PlaceBlockEvent(@Nullable Event originalEvent, Cause cause, Block block) {
super(originalEvent, cause, block);
}
public PlaceBlockEvent(@Nullable Event originalEvent, Cause cause, Location target, Material effectiveMaterial) {
super(originalEvent, cause, target, effectiveMaterial);
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -0,0 +1,64 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.bukkit.cause.Cause;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import javax.annotation.Nullable;
import java.util.List;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*
* <p>Thrown when a block is interacted with.</p>
*/
public class UseBlockEvent extends AbstractBlockEvent {
private static final HandlerList handlers = new HandlerList();
public UseBlockEvent(@Nullable Event originalEvent, Cause cause, World world, List<Block> blocks, Material effectiveMaterial) {
super(originalEvent, cause, world, blocks, effectiveMaterial);
}
public UseBlockEvent(@Nullable Event originalEvent, Cause cause, Block block) {
super(originalEvent, cause, block);
}
public UseBlockEvent(@Nullable Event originalEvent, Cause cause, Location target, Material effectiveMaterial) {
super(originalEvent, cause, target, effectiveMaterial);
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -0,0 +1,76 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.event.Cancellable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Represents call to {@link Cancellable#setCancelled(boolean)}.
*/
public class CancelAttempt {
private final boolean before;
private final boolean after;
private final StackTraceElement[] stackTrace;
/**
* Create a new instance.
*
* @param before The cancellation flag before the call
* @param after The cancellation flag after the call
* @param stackTrace The stack trace
*/
public CancelAttempt(boolean before, boolean after, StackTraceElement[] stackTrace) {
checkNotNull(stackTrace, "stackTrace");
this.before = before;
this.after = after;
this.stackTrace = stackTrace;
}
/**
* Get the cancellation state before the call.
*
* @return Whether the event was cancelled before
*/
public boolean getBefore() {
return before;
}
/**
* Get the cancellation state after the call.
*
* @return The new cancellation state
*/
public boolean getAfter() {
return after;
}
/**
* Get the stack trace.
*
* @return The stack trace
*/
public StackTraceElement[] getStackTrace() {
return stackTrace;
}
}
@@ -0,0 +1,54 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
/**
* Logs attempts at cancellation.
*/
public class CancelLogger {
private List<CancelAttempt> entries = new ArrayList<>();
/**
* Log a call.
*
* @param before The cancellation flag before the call
* @param after The cancellation flag after the call
* @param stackTrace The stack trace
*/
public void log(boolean before, boolean after, StackTraceElement[] stackTrace) {
entries.add(new CancelAttempt(before, after, stackTrace));
}
/**
* Get an immutable list of cancels.
*
* @return An immutable list
*/
public List<CancelAttempt> getCancels() {
return ImmutableList.copyOf(entries);
}
}
@@ -0,0 +1,35 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.event.Cancellable;
import java.util.List;
public interface CancelLogging extends Cancellable {
/**
* Get an immutable list of cancels.
*
* @return An immutable list
*/
List<CancelAttempt> getCancels();
}
@@ -0,0 +1,46 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import java.util.List;
public class LoggingBlockBreakEvent extends BlockBreakEvent implements CancelLogging {
private final CancelLogger logger = new CancelLogger();
public LoggingBlockBreakEvent(Block block, Player player) {
super(block, player);
}
public List<CancelAttempt> getCancels() {
return logger.getCancels();
}
@Override
public void setCancelled(boolean cancel) {
this.logger.log(isCancelled(), cancel, new Exception().getStackTrace());
super.setCancelled(cancel);
}
}
@@ -0,0 +1,48 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class LoggingBlockPlaceEvent extends BlockPlaceEvent implements CancelLogging {
private final CancelLogger logger = new CancelLogger();
public LoggingBlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) {
super(placedBlock, replacedBlockState, placedAgainst, itemInHand, thePlayer, canBuild);
}
public List<CancelAttempt> getCancels() {
return logger.getCancels();
}
@Override
public void setCancelled(boolean cancel) {
this.logger.log(isCancelled(), cancel, new Exception().getStackTrace());
super.setCancelled(cancel);
}
}
@@ -0,0 +1,45 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import java.util.List;
public class LoggingEntityDamageByEntityEvent extends EntityDamageByEntityEvent implements CancelLogging {
private final CancelLogger logger = new CancelLogger();
public LoggingEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage) {
super(damager, damagee, cause, damage);
}
public List<CancelAttempt> getCancels() {
return logger.getCancels();
}
@Override
public void setCancelled(boolean cancel) {
this.logger.log(isCancelled(), cancel, new Exception().getStackTrace());
super.setCancelled(cancel);
}
}
@@ -0,0 +1,62 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.debug;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class LoggingPlayerInteractEvent extends PlayerInteractEvent implements CancelLogging {
private final CancelLogger logger = new CancelLogger();
public LoggingPlayerInteractEvent(Player who, Action action, ItemStack item, Block clickedBlock, BlockFace clickedFace) {
super(who, action, item, clickedBlock, clickedFace);
}
@Override
public List<CancelAttempt> getCancels() {
return logger.getCancels();
}
@Override
public void setUseInteractedBlock(Result useInteractedBlock) {
this.logger.log(useInteractedBlock() == Result.DENY, useInteractedBlock == Result.DENY, new Exception().getStackTrace());
super.setUseInteractedBlock(useInteractedBlock);
}
@Override
public void setUseItemInHand(Result useItemInHand) {
this.logger.log(useItemInHand() == Result.DENY, useItemInHand == Result.DENY, new Exception().getStackTrace());
super.setUseItemInHand(useItemInHand);
}
@Override
public void setCancelled(boolean cancel) {
this.logger.log(isCancelled(), cancel, new Exception().getStackTrace());
super.setCancelled(cancel);
}
}
@@ -0,0 +1,106 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.entity;
import com.google.common.base.Predicate;
import com.sk89q.worldguard.bukkit.cause.Cause;
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*/
abstract class AbstractEntityEvent extends DelegateEvent {
private final Location target;
@Nullable
private final Entity entity;
protected AbstractEntityEvent(@Nullable Event originalEvent, Cause cause, Entity entity) {
super(originalEvent, cause);
checkNotNull(entity);
this.target = entity.getLocation();
this.entity = entity;
}
protected AbstractEntityEvent(@Nullable Event originalEvent, Cause cause, Location target) {
super(originalEvent, cause);
checkNotNull(target);
this.target = target;
this.entity = null;
}
/**
* Get the world.
*
* @return the world
*/
public World getWorld() {
return target.getWorld();
}
/**
* Get the target location being affected.
*
* @return a location
*/
public Location getTarget() {
return target;
}
/**
* Get the target entity being affected.
*
* @return a entity
*/
@Nullable
public Entity getEntity() {
return entity;
}
/**
* Filter the list of affected entities with the given predicate. If the
* predicate returns {@code false}, then the entity is not affected.
*
* @param predicate the predicate
* @param cancelEventOnFalse true to cancel the event and clear the entity
* list once the predicate returns {@code false}
* @return true if one or more entities were filtered out
*/
public boolean filter(Predicate<Location> predicate, boolean cancelEventOnFalse) {
if (!isCancelled()) {
if (!predicate.apply(getTarget())) {
setCancelled(true);
}
}
return isCancelled();
}
}
@@ -0,0 +1,61 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.bukkit.cause.Cause;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*
* <p>Thrown when an entity is damaged.</p>
*/
public class DamageEntityEvent extends AbstractEntityEvent {
private static final HandlerList handlers = new HandlerList();
public DamageEntityEvent(@Nullable Event originalEvent, Cause cause, Entity target) {
super(originalEvent, cause, checkNotNull(target));
}
@Override
@Nonnull
public Entity getEntity() {
return super.getEntity();
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -0,0 +1,61 @@
/*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.bukkit.cause.Cause;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* This event is an internal event. We do not recommend handling or throwing
* this event or its subclasses as the interface is highly subject to change.
*
* <p>Thrown when an entity is removed.</p>
*/
public class DestroyEntityEvent extends AbstractEntityEvent {
private static final HandlerList handlers = new HandlerList();
public DestroyEntityEvent(@Nullable Event originalEvent, Cause cause, Entity target) {
super(originalEvent, cause, checkNotNull(target));
}
@Override
@Nonnull
public Entity getEntity() {
return super.getEntity();
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
Loaded 100 of 404 files, more files were not shown because too many files have changed in this diff. Show more