Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. public class WorldGuardClass {
  2.    
  3.     public static String wgMethod(Clipboard clipboard, int X, int Y, int Z, Player player, World AdaptedWorld) {
  4.        
  5.         BlockVector3 loc = clipboard.getDimensions();
  6.         BlockVector3 locatios = clipboard.getOrigin(); //Not used yet
  7.        
  8.        
  9.         RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
  10.         RegionManager regions = container.get(AdaptedWorld);
  11.        
  12.         int maxX = X + (loc.getBlockX() / 2); int minX = X - (loc.getBlockX() / 2);
  13.         int maxY = Y + (loc.getBlockY() / 2); int minY = Y - (loc.getBlockY() / 2);
  14.         int maxZ = Z + (loc.getBlockZ() / 2); int minZ = Z - (loc.getBlockZ() / 2);
  15.        
  16.         BlockVector3 min = BlockVector3.at(minX, minY, minZ);
  17.         BlockVector3 max = BlockVector3.at(maxX, maxY, maxZ);
  18.        
  19.         String name = player.getUniqueId().toString();
  20.  
  21.         ProtectedRegion region = new ProtectedCuboidRegion(name, min, max);
  22.         DefaultDomain members = region.getMembers();
  23.  
  24.         members.addPlayer(UUID.fromString(name));
  25.         regions.addRegion(region);
  26.        
  27.        
  28.         for(ProtectedRegion rg : regions.getApplicableRegions(regions.getRegion(name))) {
  29.             if(!rg.getMembers().contains(UUID.fromString(name))) {
  30.                 regions.removeRegion(name);
  31.                 return null;
  32.             }
  33.            
  34.         }
  35.         regions.removeRegion(name);
  36.        
  37.     return "false";
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement