mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 11:36:11 +01:00
Changed how the player item event was handled.
This commit is contained in:
parent
194108336b
commit
627de1aebd
@ -117,8 +117,9 @@ public void onPlayerQuit(PlayerEvent event) {
|
|||||||
public void onPlayerItem(PlayerItemEvent event) {
|
public void onPlayerItem(PlayerItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlockClicked();
|
Block block = event.getBlockClicked();
|
||||||
|
ItemStack item = event.getItem();
|
||||||
|
|
||||||
if (plugin.useRegions && !event.isBlock() && event.getBlockClicked() != null) {
|
if (plugin.useRegions && !event.isBlock() && block != null) {
|
||||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||||
|
|
||||||
@ -131,10 +132,11 @@ public void onPlayerItem(PlayerItemEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block != null && plugin.blacklist != null) {
|
if (item != null && plugin.blacklist != null && block != null) {
|
||||||
if (!plugin.blacklist.check(
|
if (!plugin.blacklist.check(
|
||||||
new ItemUseBlacklistEvent(plugin.wrapPlayer(player), toVector(block),
|
new ItemUseBlacklistEvent(plugin.wrapPlayer(player),
|
||||||
block.getTypeId()), false, false)) {
|
toVector(block.getRelative(event.getBlockFace())),
|
||||||
|
item.getTypeId()), false, false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user