Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void preProcessCommand(PlayerCommandPreprocessEvent e)
- {
- if (e.getMessage().equalsIgnoreCase("classes"))
- {
- Player wgplayer = e.getPlayer();
- LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(wgplayer);
- World world = localPlayer.getWorld();
- Location loc = new Location(world, localPlayer.getLocation().getX(), localPlayer.getLocation().getY(), localPlayer.getLocation().getZ());
- RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
- RegionQuery query = container.createQuery();
- ApplicableRegionSet set = query.getApplicableRegions(loc);
- List<ProtectedRegion> regions = Lists.newArrayList(set);
- for (ProtectedRegion region : set)
- {
- if (!region.getId().equalsIgnoreCase("spawn"))
- {
- wgplayer.sendMessage("You are not allowed to do that!");
- e.setCancelled(true);
- }
- return;
- }
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement