mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-25 20:15:55 +01:00
Add compatibility for all the plugins which abuse the BlockCanBuildEvent
This commit is contained in:
parent
60a1b476ba
commit
7b62608832
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user