Added container trust for rotating item frames
This commit is contained in:
parent
f5a99cefd3
commit
4776000c30
|
|
@ -48,6 +48,7 @@ import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Fish;
|
import org.bukkit.entity.Fish;
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Llama;
|
import org.bukkit.entity.Llama;
|
||||||
import org.bukkit.entity.Mule;
|
import org.bukkit.entity.Mule;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
@ -623,7 +624,7 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't allow interaction with item frames or armor stands in claimed areas without build permission
|
//don't allow interaction with item frames or armor stands in claimed areas without build permission
|
||||||
if (entity.getType() == EntityType.ARMOR_STAND || entity instanceof Hanging)
|
if (entity.getType() == EntityType.ARMOR_STAND || entity instanceof Hanging && !(entity instanceof ItemFrame))
|
||||||
{
|
{
|
||||||
String noBuildReason = instance.allowBuild(player, entity.getLocation(), Material.ITEM_FRAME);
|
String noBuildReason = instance.allowBuild(player, entity.getLocation(), Material.ITEM_FRAME);
|
||||||
if (noBuildReason != null)
|
if (noBuildReason != null)
|
||||||
|
|
@ -634,6 +635,17 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//don't allow interaction with item frames in claimed areas without container permission
|
||||||
|
if (entity instanceof ItemFrame) {
|
||||||
|
Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, playerData.lastClaim);
|
||||||
|
Supplier<String> stringSupplier = claim.checkPermission(player, ClaimPermission.Access, event);
|
||||||
|
if (stringSupplier != null) {
|
||||||
|
instance.sendMessage(player, TextMode.Err, stringSupplier.get());
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//always allow interactions when player is in ignore claims mode
|
//always allow interactions when player is in ignore claims mode
|
||||||
if (playerData.ignoreClaims) return;
|
if (playerData.ignoreClaims) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user