Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlaceClaimBlock(BlockPlaceEvent e){
- Player player = e.getPlayer();
- Block block = e.getBlock();
- BlockVector p1 = null,p2 = null;
- if(block.getType().equals(Material.SAND)){
- BlockVector loc = new BlockVector(block.getX(), block.getY(), block.getZ());
- player.sendMessage("Location: " + loc);
- }
- if(block.getTypeId() == 19){
- int radius = 1;
- //p1: 295,254,339
- //p2: 293,0,341
- p2 = new BlockVector(block.getX() - radius, 0, block.getZ() + radius);
- p1 = new BlockVector(block.getX() + radius, block.getWorld().getMaxHeight(), block.getZ() - radius);
- player.sendMessage(p1 + " " + p2);
- ProtectedCuboidRegion region = new ProtectedCuboidRegion("plot_" + player.getName(), new BlockVector(p1), new BlockVector(p2));
- DefaultDomain owners = new DefaultDomain();
- owners.addPlayer(player.getName());
- region.setOwners(owners);
- plugin.getWorldGuard().getRegionManager(player.getWorld()).addRegion(region); // <--- NPE on this line --
- player.sendMessage(ChatColor.AQUA + "Claimed new land. " + region.getId());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement