Solved WorldGuard

Discussion in 'Plugin Development' started by Nutowen, Mar 29, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    Nutowen

    Code:
    @EventHandler
        public void onBlockBreak(BlockBreakEvent e)
        {
            RegionManager set = wg.getRegionManager(e.getPlayer().getWorld());
            Material block = e.getBlock().getType();
            Player p = e.getPlayer();
           drops = 1;
           if (p.getGameMode()== GameMode.CREATIVE)return;
           if(set.hasRegion("Walls")){
              if(block == Material.SPRUCE_SLAB){
                 
              }
           }
    
    
    Spruce slab isn;t working. My plugin is stopping worldguard and I'm wondering how I could prevent it from stopping WorldGuard. Are there any other ways of doing it?

    I need to block:
    Spruce Fence, Spruce Slab, Spruce Planks, Smooth Brick stairs, Smooth Brick slab, Smooth Brick, Glow Stone, Blue Hardened Clay, and Purple Hardened Clay and Signs
     
  2. Online

    timtower Administrator Administrator Moderator

    @Nutowen What do you mean with "Stopping WorldGuard" ?
    And you need to use material and data values.
     
  3. Offline

    Nutowen

    My plugin ignores worldguard and breaks the blocks anyway
     
  4. Online

    timtower Administrator Administrator Moderator

    That would be because you don't ignore cancelled events. Or even check if they are cancelled already.
     
  5. Offline

    Nutowen

    Code:
    s
    switch (block)
            {
           case SPRUCE_FENCE:
              e.setCancelled(true);
             
              return;
           case SMOOTH_STAIRS:
              e.setCancelled(true);
              return;
           case GLOWSTONE:
              e.setCancelled(true);
              return;
           case SIGN:
              e.setCancelled(true);
           case HARD_CLAY: case e.getBlock().getData() == (byte) 11:
           
             
           return;
    
    How could I make this work? I don't want to change my entire system to using if statements and am wondering if there is a way to make this work. I don't think it works because the switch is a material but i want to check the data for blue stained clay
     
  6. Online

    timtower Administrator Administrator Moderator

    @Nutowen Nested statements are needed though.
    Or you make a list of MaterialData, check the type and data, if same: cancel event.
    You can do that in a loop
     
  7. Offline

    plisov

    @Nutowen
    Maybe because you are OPed and it gives you permission to all the worldguard perms?
     
Thread Status:
Not open for further replies.

Share This Page