@EventHandler
 public static void onPlayerMove(PlayerMoveEvent e) {
   Player player = e.getPlayer();
   Location locTo = e.getTo();
   Location locFrom = e.getFrom();
   if (PBMethods.WGSupportEnabled) {
     if (PBMethods.getWorldGuard() != null) {
       ApplicableRegionSet set =
           WGBukkit.getRegionManager(locTo.getWorld()).getApplicableRegions(locTo);
       for (ProtectedRegion region : set) {
         if (region != null) {
           // Checks if the player can enter the field during a Probending Match
           if (region.getId().equalsIgnoreCase(PBMethods.ProbendingField)) {
             if (PBMethods.matchStarted) {
               String teamName = PBMethods.getPlayerTeam(player.getUniqueId());
               if (teamName != null) {
                 if (!PBMethods.playingTeams.contains(teamName.toLowerCase())) {
                   player.sendMessage(Strings.Prefix + Strings.CantEnterField);
                   player.teleport(locFrom);
                   e.setCancelled(true);
                 }
               }
               if (teamName == null) {
                 player.sendMessage(Strings.Prefix + Strings.CantEnterField);
                 player.teleport(locFrom);
                 e.setCancelled(true);
               }
             }
           }
         }
       }
     }
   }
 }
  @Command(
      aliases = {"reload"},
      desc = "Reload WorldGuard configuration",
      max = 0)
  @CommandPermissions({"worldguard.reload"})
  public void reload(CommandContext args, CommandSender sender) throws CommandException {

    LoggerToChatHandler handler = null;
    Logger minecraftLogger = null;

    if (sender instanceof Player) {
      handler = new LoggerToChatHandler(sender);
      handler.setLevel(Level.ALL);
      minecraftLogger = Logger.getLogger("Minecraft");
      minecraftLogger.addHandler(handler);
    }

    try {
      plugin.getGlobalStateManager().unload();
      plugin.getGlobalRegionManager().unload();
      plugin.getGlobalStateManager().load();
      plugin.getGlobalRegionManager().preload();
      WGBukkit.cleanCache();
      sender.sendMessage("WorldGuard configuration reloaded.");
    } catch (Throwable t) {
      sender.sendMessage("Error while reloading: " + t.getMessage());
    } finally {
      if (minecraftLogger != null) {
        minecraftLogger.removeHandler(handler);
      }
    }
  }
  @Override
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 0) {
      plugin.sendMessageWarning(
          sender,
          ChatColor.translateAlternateColorCodes(
              '&', plugin.languageGetConfig().getString("buyland.general.parameters")));
      plugin.sendMessageInfo(sender, "Usage: /buyland list");
    } else {
      // See if the person requesting the information is a player
      if (sender instanceof Player) {
        Player player = (Player) sender;
        String playerName = player.getName();

        // See if the player has permission to this command
        if (player.hasPermission("buyland.list") || player.hasPermission("buyland.all")) {
          // State who the list is for
          plugin.sendMessageInfo(sender, "You own regions: ");

          // Loop through all the worlds
          for (World world : Bukkit.getWorlds()) {
            // get the list of regions for the selected world
            Map<String, ProtectedRegion> regionMap = WGBukkit.getRegionManager(world).getRegions();
            // Loop through all the regions
            for (ProtectedRegion region : regionMap.values()) {
              // see if the person is an owner of the region
              if (region.isOwner(playerName)) {
                // see if the region is buyable
                if (region.getFlag(DefaultFlag.BUYABLE) == null) {
                  // if it is null, it is not purchased by anyone.
                } else {
                  // See if the region was purchased.
                  if (region.getFlag(DefaultFlag.BUYABLE) == false) {
                    // list this as owned by the player in question
                    plugin.sendMessageInfo(
                        sender, " " + world.getName() + ": " + region.getId(), false);
                  }
                }
              }
            }
          }
        }
      } else {
        plugin.sendMessageInfo(sender, "Currently not available at console.");
      }
    }

    // command was utilized.
    return true;
  }
 @EventHandler
 public void onPlayerBreakBlock(BlockBreakEvent e) {
   Player player = e.getPlayer();
   Location loc = player.getLocation();
   if (PBMethods.WGSupportEnabled) {
     if (PBMethods.getWorldGuard() != null) {
       ApplicableRegionSet set =
           WGBukkit.getRegionManager(loc.getWorld()).getApplicableRegions(loc);
       for (ProtectedRegion region : set) {
         if (region != null) {
           if (region.getId().equalsIgnoreCase(PBMethods.ProbendingField)) {
             if (PBMethods.buildDisabled) {
               if (!player.hasPermission("probending.worldguard.buildonfield")) {
                 e.setCancelled(true);
               }
             }
           }
         }
       }
     }
   }
 }
 public static Boolean canHurt(Player p, Player t) {
   return WGBukkit.getPlugin().createProtectionQuery().testEntityDamage(p, t);
 }
 public static Boolean canBuild(Location l, Player p) {
   return WGBukkit.getPlugin().canBuild(p, l);
 }