From 7b6260883236317de2c91332e67692a2f7bd82a2 Mon Sep 17 00:00:00 2001 From: Max Lee Date: Tue, 26 Jan 2016 03:17:51 +0100 Subject: [PATCH] Add compatibility for all the plugins which abuse the BlockCanBuildEvent --- .../bukkit/plugin/RandomTeleport/RandomTeleport.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java b/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java index 4516353..3baafe8 100644 --- a/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java +++ b/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java @@ -15,6 +15,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.plugin.java.JavaPlugin; import java.io.File; @@ -591,6 +592,13 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor { private boolean checkforRegion(Player player, Location location, Boolean forceRegions) { if(!forceRegions) { Block block = location.getWorld().getBlockAt(location); + + BlockCanBuildEvent canBuildEvent = new BlockCanBuildEvent(block, block.getTypeId(), true); + getServer().getPluginManager().callEvent(canBuildEvent); + if(!canBuildEvent.isBuildable()) { + return false; + } + if(worldguard && !com.sk89q.worldguard.bukkit.WGBukkit.getPlugin().canBuild(player, block)) { return false; }