mirror of
https://github.com/SydMontague/ImageMaps.git
synced 2025-02-16 20:11:27 +01:00
Cancel placement if player interact event was cancelled
This commit is contained in:
parent
b70a163c3c
commit
ba9ec1d4c1
@ -22,6 +22,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -312,6 +313,13 @@ public class ImageMaps extends JavaPlugin implements Listener {
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (event.isCancelled()
|
||||
|| event.useInteractedBlock() == Event.Result.DENY
|
||||
|| event.useItemInHand() == Event.Result.DENY) {
|
||||
player.removeMetadata(PLACEMENT_METADATA, this);
|
||||
return;
|
||||
}
|
||||
|
||||
PlacementData data = (PlacementData) player.getMetadata(PLACEMENT_METADATA).get(0).value();
|
||||
PlacementResult result = placeImage(player, event.getClickedBlock(), event.getBlockFace(), data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user