mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 13:07:29 +01:00
Add option to consider use of an item as a block use at the player's feet.
Closes WORLDGUARD-3151.
This commit is contained in:
parent
59bd11e742
commit
cdab004505
@ -182,6 +182,7 @@ public class WorldConfiguration {
|
|||||||
public boolean disableObsidianGenerators;
|
public boolean disableObsidianGenerators;
|
||||||
public boolean strictEntitySpawn;
|
public boolean strictEntitySpawn;
|
||||||
public TargetMatcherSet allowAllInteract;
|
public TargetMatcherSet allowAllInteract;
|
||||||
|
public TargetMatcherSet blockUseAtFeet;
|
||||||
|
|
||||||
private Map<String, Integer> maxRegionCounts;
|
private Map<String, Integer> maxRegionCounts;
|
||||||
|
|
||||||
@ -346,6 +347,7 @@ private void loadConfiguration() {
|
|||||||
|
|
||||||
strictEntitySpawn = getBoolean("event-handling.block-entity-spawns-with-untraceable-cause", false);
|
strictEntitySpawn = getBoolean("event-handling.block-entity-spawns-with-untraceable-cause", false);
|
||||||
allowAllInteract = getTargetMatchers("event-handling.interaction-whitelist");
|
allowAllInteract = getTargetMatchers("event-handling.interaction-whitelist");
|
||||||
|
blockUseAtFeet = getTargetMatchers("event-handling.emit-block-use-at-feet");
|
||||||
|
|
||||||
itemDurability = getBoolean("protection.item-durability", true);
|
itemDurability = getBoolean("protection.item-durability", true);
|
||||||
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
|
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
|
||||||
|
@ -392,6 +392,16 @@ public void onPlayerInteract(PlayerInteractEvent event) {
|
|||||||
event.setUseItemInHand(Result.DENY);
|
event.setUseItemInHand(Result.DENY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for items that the administrator has configured to
|
||||||
|
// emit a "use block here" event where the player is
|
||||||
|
// standing, which is a hack to protect items that don't
|
||||||
|
// throw events
|
||||||
|
if (item != null && getWorldConfig(player.getWorld()).blockUseAtFeet.test(item)) {
|
||||||
|
if (Events.fireAndTestCancel(new UseBlockEvent(event, cause, player.getLocation().getBlock()))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user