Merge pull request #41 from jstoeckm2/master

Disabling lava/water placing for non builders
This commit is contained in:
Daniel 2019-09-11 16:24:27 +02:00 committed by GitHub
commit 1508202822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import java.io.File; import java.io.File;
import java.util.Objects; import java.util.Objects;
@ -41,6 +42,22 @@ public class BlockListener implements Listener {
} }
} }
@EventHandler
public void onPlaceLiquid(PlayerBucketEmptyEvent e) {
Player p = e.getPlayer();
if (p.hasPermission("ws.build"))
return;
String worldname = p.getWorld().getName();
WorldPlayer wp = new WorldPlayer(p, worldname);
if (!wp.isOnSystemWorld())
return;
if (!wp.isMember())
e.setCancelled(true);
if (!wp.isOwnerofWorld()) {
e.setCancelled(!wp.canBuild());
}
}
@EventHandler @EventHandler
public void onBreak(BlockBreakEvent e) { public void onBreak(BlockBreakEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();