mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-28 22:57:29 +02:00
Allow right clicking hostile mobs in protected regions too.
Fixes WORLDGUARD-3144.
This commit is contained in:
parent
438bc59fbc
commit
f776d15e03
@ -372,8 +372,19 @@ public void onUseEntity(UseEntityEvent event) {
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
boolean canUse = query.testState(target, associable, DefaultFlag.BUILD) || query.testState(target, associable, DefaultFlag.USE);
|
||||
String what = "use that";
|
||||
boolean canUse;
|
||||
String what;
|
||||
|
||||
/* Hostile / ambient mob override */
|
||||
if (Entities.isHostile(event.getEntity()) || Entities.isAmbient(event.getEntity())) {
|
||||
canUse = true;
|
||||
what = "use that";
|
||||
|
||||
/* Everything else */
|
||||
} else {
|
||||
canUse = query.testState(target, associable, DefaultFlag.BUILD) || query.testState(target, associable, DefaultFlag.USE);
|
||||
what = "use that";
|
||||
}
|
||||
|
||||
if (!canUse) {
|
||||
tellErrorMessage(event, event.getCause(), target, what);
|
||||
|
Loading…
Reference in New Issue
Block a user