[UnSolved] Permissions (I think) not working since 1.3

Discussion in 'Plugin Development' started by Jogy34, Sep 7, 2012.

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

    Jogy34

    The permissions in one of my plugin Blothera Blocks don't work any more as of 1.3. In 1.2 it worked fine. What my plugin does is limit the usage of blocks to players. If a player has a permission for a block they shouldn't be able to use that block.

    I have it set up so that when a player does virtually anything with a block then I send the item stack to a class that has one static method that cross-checks the material from the item stack with the Material enum and when it gets to the right one then it returns a permission in the form of a string.

    I didn't change any permissions in the plugin.yml except to test it I set a permission to true by default. It still allows me to place/use the blocks that I set the permission to true by default though. Anyone know if anything changed with permissions or ItemStacks or anything else I may be using that would break this?

    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  2. I dont got this problem whit my 1.3 plugins, I dont know what caused it either (sometimes errors in my plugin are caused by that 1 of the files reverted to an old state, or I edited whitout I knowed it)
     
  3. Offline

    Jogy34

    Anyone have any ideas of what might be happening. I can post the code if anyone wants to look through it.
     
  4. Offline

    Assult

    Are you sure you replaced bukkit-1.2.5 with bukkit-1.3 when you started coding after the update?
     
  5. Offline

    Jogy34

    Yes, I have the latest recommended build.
     
  6. Offline

    Slipswhitley

    I can help you here :p

    If you are having problems with permissions may I recommend that you use vault to manage your permissions as it has compatability for ALL permissions systems just add it to you build path and you plugins folder then change a few bits of code.

    You can download here.

    Next add these lines to your code.

    Code:
    public static Permission permission = null;
     
    private boolean setupPermissions()
        {
            RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
            if (permissionProvider != null) {
                permission = permissionProvider.getProvider();
            }
            return (permission != null);
        }
    
    Now add this to onEnable()

    Code:
    public void onEnable() {
    setupPermissions();
    }
    Now change your if statements to look like this.

    Code:
    if(permission.Has(player, "some.random.perm") {
     
      // Your code here :D
     
    }
    Hope this helps :p
     
  7. Offline

    Jogy34

    Slipswhitley
    I've used vault for economy support before but I thought that bukkit has it set up so that if you set it up right that any permissions plugin that retrieves from it right should be able to retrieve/confirm the permissions for plugins without having to do anything extra. This has been my experience in the past at least.
     
  8. Offline

    ThatBox

    Yeah we're going to need code to fix this. And no you don't need vault.
     
  9. Offline

    Jogy34

    Ok, I'm having a feeling that I'm just making a really stupid mistake that I just can't find.

    Main:
    Code:
    package com.xern.jogy34.blotherablocks.general;
     
    import java.util.logging.Logger;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class BlotheraBlocksMain extends JavaPlugin
    {
    private Logger log;
    @Override
    public void onEnable()
    {
    log = this.getLogger();
    new EventListeners(this);
    this.log.info("Blothera Blocks Enabled");
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.BOOKSHELF")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.BOOKSHELF", 0);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.CAKE_BLOCK")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.CAKE_BLOCK", 0);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.DIAMOND_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.DIAMOND_ORE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.GLOWSTONE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.GLOWSTONE", 274);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.GRASS")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.GRASS", 277);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.GOLD_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.GOLD_ORE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.GLASS")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.GLASS", 0);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.HUGE_MUSHROOM_1")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.HUGE_MUSHROOM_1", 359);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.HUGE_MUSHROOM_2")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.HUGE_MUSHROOM_2", 359);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.ICE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.ICE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.IRON_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.IRON_ORE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.LAPIS_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.LAPIS_ORE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.LOG")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.LOG", 271);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.MELON_BLOCK")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.MELON_BLOCK", 359);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.MOB_SPAWNER")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.MOB_SPAWNER", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.MYCEL")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.MYCEL", 277);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.REDSTONE_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.REDSTONE_ORE", 278);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.STONE")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.STONE", 257);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.THIN_GLASS")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.THIN_GLASS", 0);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropTools.WEB")) this.getConfig().set("BlotheraBlocks.SpecialDropTools.WEB", 359);
     
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.BOOKSHELF")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.BOOKSHELF", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.CAKE_BLOCK")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.CAKE_BLOCK", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.DIAMOND_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.DIAMOND_ORE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.GLOWSTONE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.GLOWSTONE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.GRASS")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.GRASS", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.GOLD_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.GOLD_ORE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.GLASS")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.GLASS", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.HUGE_MUSHROOM_1")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.HUGE_MUSHROOM_1", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.HUGE_MUSHROOM_2")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.HUGE_MUSHROOM_2", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.ICE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.ICE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.IRON_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.IRON_ORE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.LAPIS_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.LAPIS_ORE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.LOG")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.LOG", 4);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.MELON_BLOCK")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.MELON_BLOCK", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.MOB_SPAWNER")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.MOB_SPAWNER", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.MYCEL")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.MYCEL", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.REDSTONE_ORE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.REDSTONE_ORE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.STONE")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.STONE", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.THIN_GLASS")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.THIN_GLASS", 1);
    if(!this.getConfig().contains("BlotheraBlocks.SpecialDropAmount.WEB")) this.getConfig().set("BlotheraBlocks.SpecialDropAmount.WEB", 1);
     
    if(!this.getConfig().contains("BlotheraBlocks.AlertMessage")) this.getConfig().set("BlotheraBlocks.AlertMessage", true);
     
    this.saveConfig();
    }
     
    @Override
    public void onDisable()
    {
    this.log.info("Blothera Blocks Disabled");
    }
    }
    
    Event Listener:
    Code:
    package com.xern.jogy34.blotherablocks.general;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.event.block.BlockPlaceEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerItemHeldEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    public class EventListeners implements Listener
    {
    Logger log;
    BlotheraBlocksMain plugin;
        public EventListeners(BlotheraBlocksMain plugin)
        {
            plugin.getServer().getPluginManager().registerEvents(this, plugin);
            log = plugin.getLogger();
            this.plugin = plugin;
        }
       
        @EventHandler
        public void placeBlock(BlockPlaceEvent event)
        {
      System.out.println("" + event.getItemInHand()); //Debugging, Prints the correct block
      System.out.println("" + Permissions.getItemPermission(event.getItemInHand())); //Debugging, Prints the correct permission that I cross checked with the plugin.yml
      if(!event.getPlayer().hasPermission(Permissions.getItemPermission(new ItemStack(event.getBlockPlaced().getType()))) &&
      !event.getPlayer().hasPermission("BlotheraBlocks.*"))
      {
      event.setCancelled(true);
     
      Player player = event.getPlayer();
     
      try
      {
          Inventory inven = player.getInventory();
          inven.setItem(inven.firstEmpty(), player.getItemInHand());
          player.setItemInHand(null);
      }
      catch(Exception e)
      {
      player.getWorld().dropItem(player.getLocation(), player.getItemInHand());
      player.setItemInHand(null);
      }
     
      if(plugin.getConfig().getBoolean("BlotheraBlocks.AlertMessage"))
      {
      player.sendMessage(ChatColor.RED + "[Blothera Blocks] You don't have permission to use this item");
      }
      }
     
        }
        @EventHandler
        public void changeHeldItem(final PlayerItemHeldEvent event)
        {
    plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
    {
          public void run()
          {
          Player player = event.getPlayer();
          if(!player.hasPermission(Permissions.getItemPermission(player.getItemInHand())) &&
          !event.getPlayer().hasPermission("BlotheraBlocks.*"))
          {
          try
          {
          Inventory inven = player.getInventory();
          inven.setItem(inven.firstEmpty(), player.getItemInHand());
          player.setItemInHand(null);
          }
          catch(Exception e)
          {
          player.getWorld().dropItem(player.getLocation(), player.getItemInHand());
          player.setItemInHand(null);
          }
         
          if(plugin.getConfig().getBoolean("BlotheraBlocks.AlertMessage"))
          {
          player.sendMessage(ChatColor.RED + "[Blothera Blocks] You don't have permission to use this item");
          }
          }
          }
      }, 1);
        }
       
        @EventHandler
        public void playerUseItem(PlayerInteractEvent event)
        {
      Player player = event.getPlayer();
      if(!player.hasPermission(Permissions.getItemPermission(player.getItemInHand()))&&
      !event.getPlayer().hasPermission("BlotheraBlocks.*"))
      {
      try
      {
          Inventory inven = player.getInventory();
          inven.setItem(inven.firstEmpty(), player.getItemInHand());
          player.setItemInHand(null);
      }
      catch(Exception e)
      {
      player.getWorld().dropItem(player.getLocation(), player.getItemInHand());
      player.setItemInHand(null);
      }
      }
        }
       
        @EventHandler
        public void differentBlockDrop(BlockBreakEvent event)
        {
      if(!event.getPlayer().hasPermission(Permissions.getItemPermission(new ItemStack(event.getBlock().getType(), 1))) &&
      !event.getPlayer().hasPermission("BlotheraBlocks.*"))
      {
      event.setCancelled(true);
     
      if(plugin.getConfig().getBoolean("BlotheraBlocks.AlertMessage"))
      {
      event.getPlayer().sendMessage(ChatColor.RED + "[Blothera Blocks] You are not allowed to break this type of block");
      }
      }else if(event.getPlayer().hasPermission(NoDrop.getNoDropPermission(new ItemStack(event.getBlock().getType(), 1))) ||
      event.getPlayer().hasPermission("BlotheraBlocks.*.NoDrop"))
      {
      event.setCancelled(true);
      event.getBlock().setTypeId(0);
     
      if(plugin.getConfig().getBoolean("BlotheraBlocks.AlertMessage"))
      {
      event.getPlayer().sendMessage(ChatColor.RED + "[Blothera Blocks] You are not allowed to recieve this drop");
      }
      }else if(BlockDrop.getAllowedBlockDrop(event.getPlayer(), event.getBlock()) != null)
      {
      Material toUse;
      if(event.getBlock().getType() == Material.GLOWING_REDSTONE_ORE)
      {
      toUse = Material.REDSTONE_ORE;
      }else
      {
      toUse = event.getBlock().getType();
      }
      int toolID = plugin.getConfig().getInt("BlotheraBlocks.SpecialDropTools." + toUse.toString(), 0);
      int dropAmt = plugin.getConfig().getInt("BlotheraBlocks.SpecialDropAmount." + toUse.toString(), 1);
      if(toolID == 0)
      {
      ItemStack drop = new ItemStack(BlockDrop.getAllowedBlockDrop(event.getPlayer(), event.getBlock()), dropAmt);
      if(drop != null)
      {
      event.setCancelled(true);
      event.getBlock().setTypeId(0);
      event.getPlayer().getWorld().dropItem(event.getBlock().getLocation(),drop);
      }
      }else if(event.getPlayer().getItemInHand().getTypeId() == toolID)
      {
      ItemStack drop = new ItemStack(BlockDrop.getAllowedBlockDrop(event.getPlayer(), event.getBlock()), dropAmt);
      if(drop != null)
      {
      event.setCancelled(true);
      event.getBlock().setTypeId(0);
      event.getPlayer().getWorld().dropItem(event.getBlock().getLocation(),drop);
      }
      }
      }
        }
    }
    
    Permissions Class
    Code:
    package com.xern.jogy34.blotherablocks.general;
    import org.bukkit.Material;
    import org.bukkit.inventory.ItemStack;
    public class Permissions
    {
    public static String getItemPermission(ItemStack item)
    {
    if(item.getType() == Material.BED ||
    item.getType() == Material.BED_BLOCK)
    {
    return "BlotheraBlocks.Bed";
    }else if(item.getType() == Material.BEDROCK)
    {
    return "BlotheraBlocks.Bedrock";
    }else if(item.getType() == Material.BOAT)
    {
    return "BlotheraBlocks.Boat";
    }else if(item.getType() == Material.BOOKSHELF)
    {
    return "BlotheraBlocks.Bookshelf";
    }else if(item.getType() == Material.BREWING_STAND ||
    item.getType() == Material.BREWING_STAND_ITEM)
    {
    return "BlotheraBlocks.BrewingStand";
    }else if(item.getType() == Material.BRICK)
    {
    return "BlotheraBlocks.Brick";
    }else if(item.getType() == Material.BRICK_STAIRS)
    {
    return "BlotheraBlocks.BrickStairs";
    }
    else if(item.getType() == Material.BROWN_MUSHROOM ||
    item.getType() == Material.RED_MUSHROOM)
    {
    return "BlotheraBlocks.Mushroom";
    }else if(item.getType() == Material.BURNING_FURNACE ||
    item.getType() == Material.FURNACE)
    {
    return "BlotheraBlocks.Furnace";
    }else if(item.getType() == Material.CACTUS)
    {
    return "BlotheraBlocks.Cactus";
    }else if(item.getType() == Material.CAKE ||
    item.getType() == Material.CAKE_BLOCK)
    {
    return "BlotheraBlocks.Cake";
    }else if(item.getType() == Material.CAULDRON ||
    item.getType() == Material.CAULDRON_ITEM)
    {
    return "BlotheraBlocks.Cauldron";
    }else if(item.getType() == Material.CHEST)
    {
    return "BlotheraBlocks.Chest";
    }else if(item.getType() == Material.CLAY_BRICK ||
    item.getType() == Material.CLAY)
    {
    return "BlotheraBlocks.Clay";
    }else if(item.getType() == Material.COAL_ORE)
    {
    return "BlotheraBlocks.CoalOre";
    }else if(item.getType() == Material.COBBLESTONE)
    {
    return "BlotheraBlocks.Cobble";
    }else if(item.getType() == Material.COBBLESTONE_STAIRS)
    {
    return "BlotheraBlocks.CobbleStairs";
    }else if(item.getType() == Material.DEAD_BUSH)
    {
    return "BlotheraBlocks.DeadBush";
    }else if(item.getType() == Material.DETECTOR_RAIL)
    {
    return "BlotheraBlocks.DetectorRail";
    }else if(item.getType() == Material.DIAMOND_ORE)
    {
    return "BlotheraBlocks.DiamondOre";
    }else if(item.getType() == Material.DIODE ||
    item.getType() == Material.DIODE_BLOCK_OFF ||
    item.getType() == Material.DIODE_BLOCK_ON)
    {
    return "BlotheraBlocks.Diode";
    }else if(item.getType() == Material.DIRT)
    {
    return "BlotheraBlocks.Dirt";
    }else if(item.getType() == Material.DISPENSER)
    {
    return "BlotheraBlocks.Dispenser";
    }else if(item.getType() == Material.DOUBLE_STEP)
    {
    return "BlotheraBlocks.DoubleStep";
    }else if(item.getType() == Material.DRAGON_EGG)
    {
    return "BlotheraBlocks.DragonEgg";
    }else if(item.getType() == Material.ENCHANTMENT_TABLE)
    {
    return "BlotheraBlocks.EnchantmentTable";
    }else if(item.getType() == Material.ENDER_PORTAL)
    {
    return "BlotheraBlocks.EnderPortal";
    }else if(item.getType() == Material.ENDER_PORTAL_FRAME)
    {
    return "BlotheraBlocks.EnderPortalFrame";
    }else if(item.getType() == Material.ENDER_STONE)
    {
    return "BlotheraBlocks.EnderStone";
    }else if(item.getType() == Material.FENCE)
    {
    return "BlotheraBlocks.Fence";
    }else if(item.getType() == Material.FENCE_GATE)
    {
    return "BlotheraBlocks.FenceGate";
    }else if(item.getType() == Material.FIRE)
    {
    return "BlotheraBlocks.Fire";
    }else if(item.getType() == Material.GLASS)
    {
    return "BlotheraBlocks.Glass";
    }else if(item.getType() == Material.GLOWING_REDSTONE_ORE ||
    item.getType() == Material.REDSTONE_ORE)
    {
    return "BlotheraBlocks.RedstoneOre";
    }else if(item.getType() == Material.GLOWSTONE)
    {
    return "BlotheraBlocks.GlowStone";
    }else if(item.getType() == Material.GOLD_BLOCK)
    {
    return "BlotheraBlocks.GoldBlock";
    }else if(item.getType() == Material.DIAMOND_BLOCK)
    {
    return "BlotheraBlocks.DiamondBlock";
    }else if(item.getType() == Material.GOLD_ORE)
    {
    return "BlotheraBlocks.GoldOre";
    }else if(item.getType() == Material.GRASS)
    {
    return "BlotheraBlocks.Grass";
    }else if(item.getType() == Material.GRAVEL)
    {
    return "BlotheraBlocks.Gravel";
    }else if(item.getType() == Material.HUGE_MUSHROOM_1 ||
    item.getType() == Material.HUGE_MUSHROOM_2)
    {
    return "BlotheraBlocks.HugeMushroomBlock";
    }else if(item.getType() == Material.ICE)
    {
    return "BlotheraBlocks.Ice";
    }else if(item.getType() == Material.IRON_BLOCK)
    {
    return "BlotheraBlocks.IronBlock";
    }else if(item.getType() == Material.IRON_DOOR ||
    item.getType() == Material.IRON_DOOR_BLOCK)
    {
    return "BlotheraBlocks.IronDoor";
    }else if(item.getType() == Material.IRON_FENCE)
    {
    return "BlotheraBlocks.IronBars";
    }else if(item.getType() == Material.IRON_ORE)
    {
    return "BlotheraBlocks.IronOre";
    }else if(item.getType() == Material.JACK_O_LANTERN)
    {
    return "BlotheraBlocks.JackOLantern";
    }else if(item.getType() == Material.JUKEBOX)
    {
    return "BlotheraBlocks.JukeBox";
    }else if(item.getType() == Material.LADDER)
    {
    return "BlotheraBlocks.Ladder";
    }else if(item.getType() == Material.LAPIS_BLOCK)
    {
    return "BlotheraBlocks.LapisBlock";
    }else if(item.getType() == Material.LAPIS_ORE)
    {
    return "BlotheraBlocks.LapisOre";
    }else if(item.getType() == Material.LAVA)
    {
    return "BlotheraBlocks.LavaBlock";
    }else if(item.getType() == Material.LEAVES)
    {
    return "BlotheraBlocks.Leaves";
    }else if(item.getType() == Material.LEVER)
    {
    return "BlotheraBlocks.Lever";
    }else if(item.getType() == Material.LOCKED_CHEST)
    {
    return "BlotheraBlocks.LockedChest";
    }else if(item.getType() == Material.LOG)
    {
    return "BlotheraBlocks.Log";
    }else if(item.getType() == Material.LONG_GRASS)
    {
    return "BlotheraBlocks.LongGrass";
    }else if(item.getType() == Material.MELON_BLOCK)
    {
    return "BlotheraBlocks.MelonBlock";
    }else if(item.getType() == Material.MELON_STEM)
    {
    return "BlotheraBlocks.MelonStem";
    }else if(item.getType() == Material.MINECART)
    {
    return "BlotheraBlocks.Minecart";
    }else if(item.getType() == Material.MOB_SPAWNER)
    {
    return "BlotheraBlocks.MobSpawner";
    }else if(item.getType() == Material.MOSSY_COBBLESTONE)
    {
    return "BlotheraBlocks.MossyCobble";
    }else if(item.getType() == Material.MYCEL)
    {
    return "BlotheraBlocks.Mycel";
    }else if(item.getType() == Material.NETHER_BRICK)
    {
    return "BlotheraBlocks.NetherBrick";
    }else if(item.getType() == Material.NETHER_BRICK_STAIRS)
    {
    return "BlotheraBlocks.NetherBrickStairs";
    }else if(item.getType() == Material.NETHER_FENCE)
    {
    return "BlotheraBlocks.NetherFence";
    }else if(item.getType() == Material.NETHERRACK)
    {
    return "BlotheraBlocks.NetherRack";
    }else if(item.getType() == Material.NOTE_BLOCK)
    {
    return "BlotheraBlocks.NoteBlock";
    }else if(item.getType() == Material.OBSIDIAN)
    {
    return "BlotheraBlocks.Obsidian";
    }else if(item.getType() == Material.PAINTING)
    {
    return "BlotheraBlocks.Painting";
    }else if(item.getType() == Material.PISTON_BASE ||
    item.getType() == Material.PISTON_EXTENSION ||
    item.getType() == Material.PISTON_MOVING_PIECE)
    {
    return "BlotheraBlocks.Piston";
    }else if(item.getType() == Material.PISTON_STICKY_BASE)
    {
    return "BlotheraBlocks.StickyPiston";
    }else if(item.getType() == Material.POWERED_MINECART)
    {
    return "BlotheraBlocks.PoweredMinecart";
    }else if(item.getType() == Material.POWERED_RAIL)
    {
    return "BlotheraBlocks.PoweredRail";
    }else if(item.getType() == Material.PUMPKIN)
    {
    return "BlotheraBlocks.Pumpkin";
    }else if(item.getType() == Material.PUMPKIN_STEM)
    {
    return "BlotheraBlocks.PumpkinStem";
    }else if(item.getType() == Material.RAILS)
    {
    return "BlotheraBlocks.Rail";
    }else if(item.getType() == Material.RED_ROSE)
    {
    return "BlotheraBlocks.Rose";
    }else if(item.getType() == Material.REDSTONE ||
    item.getType() == Material.REDSTONE_WIRE)
    {
    return "BlotheraBlocks.Redstone";
    }else if(item.getType() == Material.REDSTONE_LAMP_OFF ||
    item.getType() == Material.REDSTONE_LAMP_ON)
    {
    return "BlotheraBlocks.RedstoneLamp";
    }else if(item.getType() == Material.REDSTONE_TORCH_OFF ||
    item.getType() == Material.REDSTONE_TORCH_ON)
    {
    return "BlotheraBlocks.RedstoneTorch";
    }else if(item.getType() == Material.SANDSTONE)
    {
    return "BlotheraBlocks.Sandstone";
    }else if(item.getType() == Material.SAND)
    {
    return "BlotheraBlocks.Sand";
    }else if(item.getType() == Material.SAPLING)
    {
    return "BlotheraBlocks.Sapling";
    }else if(item.getType() == Material.SEEDS)
    {
    return "BlotheraBlocks.Seeds";
    }else if(item.getType() == Material.SIGN ||
    item.getType() == Material.SIGN_POST ||
    item.getType() == Material.WALL_SIGN)
    {
    return "BlotheraBlocks.Sign";
    }else if(item.getType() == Material.SMOOTH_BRICK)
    {
    return "BlotheraBlocks.SmoothBrick";
    }else if(item.getType() == Material.SMOOTH_STAIRS)
    {
    return "BlotheraBlocks.SmoothStairs";
    }else if(item.getType() == Material.SNOW ||
    item.getType() == Material.SNOW_BLOCK)
    {
    return "BlotheraBlocks.Snow";
    }else if(item.getType() == Material.SOIL)
    {
    return "BlotheraBlocks.Soil";
    }else if(item.getType() == Material.SOUL_SAND)
    {
    return "BlotheraBlocks.SoulSand";
    }else if(item.getType() == Material.SPONGE)
    {
    return "BlotheraBlocks.Sponge";
    }else if(item.getType() == Material.STEP)
    {
    return "BlotheraBlocks.Step";
    }else if(item.getType() == Material.STONE)
    {
    return "BlotheraBlocks.Stone";
    }else if(item.getType() == Material.STONE_BUTTON)
    {
    return "BlotheraBlocks.Button";
    }else if(item.getType() == Material.STORAGE_MINECART)
    {
    return "BlotheraBlocks.StorageMinecart";
    }else if(item.getType() == Material.SUGAR_CANE ||
    item.getType() == Material.SUGAR_CANE_BLOCK)
    {
    return "BlotheraBlocks.SugarCane";
    }else if(item.getType() == Material.THIN_GLASS)
    {
    return "BlotheraBlocks.GlassPane";
    }else if(item.getType() == Material.TNT)
    {
    return "BlotheraBlocks.TNT";
    }else if(item.getType() == Material.TORCH)
    {
    return "BlotheraBlocks.Torch";
    }else if(item.getType() == Material.TRAP_DOOR)
    {
    return "BlotheraBlocks.TrapDoor";
    }else if(item.getType() == Material.VINE)
    {
    return "BlotheraBlocks.Vine";
    }else if(item.getType() == Material.WATER)
    {
    return "BlotheraBlocks.Water";
    }else if(item.getType() == Material.WATER_LILY)
    {
    return "BlotheraBlocks.WaterLily";
    }else if(item.getType() == Material.WEB)
    {
    return "BlotheraBlocks.Web";
    }else if(item.getType() == Material.WOOD)
    {
    return "BlotheraBlocks.Wood";
    }else if(item.getType() == Material.WOOD_PLATE)
    {
    return "BlotheraBlocks.WoodPlate";
    }else if(item.getType() == Material.WOOD_STAIRS)
    {
    return "BlotheraBlocks.WoodStairs";
    }else if(item.getType() == Material.WOODEN_DOOR)
    {
    return "BlotheraBlocks.WoodDoor";
    }else if(item.getType() == Material.WOOL)
    {
    return "BlotheraBlocks.Wool";
    }else if(item.getType() == Material.WORKBENCH)
    {
    return "BlotheraBlocks.WorkBench";
    }else if(item.getType() == Material.YELLOW_FLOWER)
    {
    return "BlotheraBlocks.YellowFlower";
    }
     
    return "BlotheraBlocks.OtherItems";
    }
    }
    
    The NoDrop and BlockDrop classes are the same thing except they return different strings
     
  10. Offline

    jacklin213

    Do all the permissions not work or just specific ones
     
  11. Offline

    Sleaker

    Correct, and you shouldn't really use Vault's hasPermission (or has()) if all you need is to check permissions. You should be able to just check player.hasPermission("somepermission"); - If this isn't evaluating properly for you, the player may not be getting the permission.
     
  12. Offline

    Jogy34

    I've tried a few of them by setting them to true by default in the plugin.yml and none of them worked so I don't think any of them are working.
     
  13. Offline

    jacklin213

    can we c the plugin.yml?
     
  14. Offline

    Jogy34

    Sure

    This is with most everything set to false as default. When I want to test some permission I just set it to true as default instead of getting an actual permission plugin.
    Code:
    name: Blothera Blocks
    main: com.xern.jogy34.blotherablocks.general.BlotheraBlocksMain
    version: 0.2
    author: Jogy34
    description: Limit the ability of players to use Blocks
    permissions:
        BlotheraBlocks.Bed:
            default: false
        BlotheraBlocks.Bedrock:
            default: false
        BlotheraBlocks.Boat:
            default: false
        BlotheraBlocks.Bookshelf:
            default: false
        BlotheraBlocks.Brick:
            default: false
        BlotheraBlocks.BrickStairs:
            default: false
        BlotheraBlocks.Mushroom:
            default: false
        BlotheraBlocks.Furnace:
            default: false
        BlotheraBlocks.Cactus:
            default: false
        BlotheraBlocks.Cake:
            default: false
        BlotheraBlocks.Cauldron:
            default: false
        BlotheraBlocks.Chest:
            default: false
        BlotheraBlocks.Clay:
            default: false
        BlotheraBlocks.CoalOre:
            default: false
        BlotheraBlocks.Cobble:
            default: false
        BlotheraBlocks.CobbleStairs:
            default: false
        BlotheraBlocks.DeadBush:
            default: false
        BlotheraBlocks.DetectorRail:
            default: false
        BlotheraBlocks.DiamondOre:
            default: false
        BlotheraBlocks.Diode:
            default: false
        BlotheraBlocks.Dirt:
            default: false
        BlotheraBlocks.Dispenser:
            default: false
        BlotheraBlocks.DoubleStep:
            default: false
        BlotheraBlocks.DragonEgg:
            default: false
        BlotheraBlocks.EnchantmentTable:
            default: false
        BlotheraBlocks.EnderPortal:
            default: false
        BlotheraBlocks.EnderPortalFrame:
            default: false
        BlotheraBlocks.EnderStone:
            default: false
        BlotheraBlocks.Fence:
            default: false
        BlotheraBlocks.FenceGate:
            default: false
        BlotheraBlocks.Fire:
            default: false
        BlotheraBlocks.Glass:
            default: false
        BlotheraBlocks.RedstoneOre:
            default: false
        BlotheraBlocks.GlowStone:
            default: false
        BlotheraBlocks.GoldBlock:
            default: false
        BlotheraBlocks.DiamondBlock:
            default: false
        BlotheraBlocks.GoldOre:
            default: false
        BlotheraBlocks.Grass:
            default: false
        BlotheraBlocks.Gravel:
            default: false
        BlotheraBlocks.HugeMushroomBlock:
            default: false
        BlotheraBlocks.Ice:
            default: false
        BlotheraBlocks.IronBlock:
            default: false
        BlotheraBlocks.IronDoor:
            default: false
        BlotheraBlocks.IronBars:
            default: false
        BlotheraBlocks.IronOre:
            default: false
        BlotheraBlocks.JackOLantern:
            default: false
        BlotheraBlocks.JukeBox:
            default: false
        BlotheraBlocks.Ladder:
            default: false
        BlotheraBlocks.LapisBlock:
            default: false
        BlotheraBlocks.LapisOre:
            default: false
        BlotheraBlocks.LavaBlock:
            default: false
        BlotheraBlocks.Leaves:
            default: false
        BlotheraBlocks.Lever:
            default: false
        BlotheraBlocks.LockedChest:
            default: false
        BlotheraBlocks.Log:
            default: false
        BlotheraBlocks.LongGrass:
            default: false
        BlotheraBlocks.MelonBlock:
            default: false
        BlotheraBlocks.MelonStem:
            default: false
        BlotheraBlocks.Minecart:
            default: false
        BlotheraBlocks.MobSpawner:
            default: false
        BlotheraBlocks.MossyCobble:
            default: false
        BlotheraBlocks.Mycel:
            default: false
        BlotheraBlocks.NetherBrick:
            default: false
        BlotheraBlocks.NetherBrickStairs:
            default: false
        BlotheraBlocks.NetherFence:
            default: false
        BlotheraBlocks.NetherRack:
            default: false
        BlotheraBlocks.NoteBlock:
            default: false
        BlotheraBlocks.Obsidian:
            default: false
        BlotheraBlocks.Painting:
            default: false
        BlotheraBlocks.Piston:
            default: false
        BlotheraBlocks.StickyPiston:
            default: false
        BlotheraBlocks.PoweredMinecart:
            default: false
        BlotheraBlocks.PoweredRail:
            default: false
        BlotheraBlocks.Pumpkin:
            default: false
        BlotheraBlocks.PumpkinStem:
            default: false
        BlotheraBlocks.Rail:
            default: false
        BlotheraBlocks.Rose:
            default: false
        BlotheraBlocks.Redstone:
            default: false
        BlotheraBlocks.RedstoneLamp:
            default: false
        BlotheraBlocks.RedstoneTorch:
            default: false
        BlotheraBlocks.Sandstone:
            default: false
        BlotheraBlocks.Sand:
            default: false
        BlotheraBlocks.Sapling:
            default: false
        BlotheraBlocks.Seeds:
            default: false
        BlotheraBlocks.Sign:
            default: false
        BlotheraBlocks.SmoothBrick:
            default: false
        BlotheraBlocks.SmoothStairs:
            default: false
        BlotheraBlocks.Snow:
            default: false
        BlotheraBlocks.Soil:
            default: false
        BlotheraBlocks.SoulSand:
            default: false
        BlotheraBlocks.Sponge:
            default: false
        BlotheraBlocks.Step:
            default: false
        BlotheraBlocks.Stone:
            default: false
        BlotheraBlocks.Button:
            default: false
        BlotheraBlocks.StorageMinecart:
            default: false
        BlotheraBlocks.SugarCane:
            default: false
        BlotheraBlocks.GlassPane:
            default: false
        BlotheraBlocks.TNT:
            default: false
        BlotheraBlocks.Torch:
            default: false
        BlotheraBlocks.TrapDoor:
            default: false
        BlotheraBlocks.Vine:
            default: false
        BlotheraBlocks.Water:
            default: false
        BlotheraBlocks.WaterLily:
            default: false
        BlotheraBlocks.Web:
            default: false
        BlotheraBlocks.WoodPlate:
            default: false
        BlotheraBlocks.WoodStairs:
            default: false
        BlotheraBlocks.WoodDoor:
            default: false
        BlotheraBlocks.Wool:
            default: false
        BlotheraBlocks.WorkBench:
            default: false
        BlotheraBlocks.YellowFlower:
            default: false
        BlotheraBlocks.Bed.NoDrop:
            default: false
        BlotheraBlocks.Bedrock.NoDrop:
            default: false
        BlotheraBlocks.Boat.NoDrop:
            default: false
        BlotheraBlocks.Bookshelf.NoDrop:
            default: false
        BlotheraBlocks.Brick.NoDrop:
            default: false
        BlotheraBlocks.BrickStairs.NoDrop:
            default: false
        BlotheraBlocks.Mushroom.NoDrop:
            default: false
        BlotheraBlocks.Furnace.NoDrop:
            default: false
        BlotheraBlocks.Cactus.NoDrop:
            default: false
        BlotheraBlocks.Cake.NoDrop:
            default: false
        BlotheraBlocks.Cauldron.NoDrop:
            default: false
        BlotheraBlocks.Chest.NoDrop:
            default: false
        BlotheraBlocks.Clay.NoDrop:
            default: false
        BlotheraBlocks.CoalOre.NoDrop:
            default: false
        BlotheraBlocks.Cobble.NoDrop:
            default: false
        BlotheraBlocks.CobbleStairs.NoDrop:
            default: false
        BlotheraBlocks.DeadBush.NoDrop:
            default: false
        BlotheraBlocks.DetectorRail.NoDrop:
            default: false
        BlotheraBlocks.DiamondOre.NoDrop:
            default: false
        BlotheraBlocks.Diode.NoDrop:
            default: false
        BlotheraBlocks.Dirt.NoDrop:
            default: false
        BlotheraBlocks.Dispenser.NoDrop:
            default: false
        BlotheraBlocks.DoubleStep.NoDrop:
            default: false
        BlotheraBlocks.DragonEgg.NoDrop:
            default: false
        BlotheraBlocks.EnchantmentTable.NoDrop:
            default: false
        BlotheraBlocks.EnderPortal.NoDrop:
            default: false
        BlotheraBlocks.EnderPortalFrame.NoDrop:
            default: false
        BlotheraBlocks.EnderStone.NoDrop:
            default: false
        BlotheraBlocks.Fence.NoDrop:
            default: false
        BlotheraBlocks.FenceGate.NoDrop:
            default: false
        BlotheraBlocks.Fire.NoDrop:
            default: false
        BlotheraBlocks.Glass.NoDrop:
            default: false
        BlotheraBlocks.Grass.NoDrop:
            default: false
        BlotheraBlocks.RedstoneOre.NoDrop:
            default: false
        BlotheraBlocks.GlowStone.NoDrop:
            default: false
        BlotheraBlocks.GoldBlock.NoDrop:
            default: false
        BlotheraBlocks.DiamondBlock.NoDrop:
            default: false
        BlotheraBlocks.GoldOre.NoDrop:
            default: false
        BlotheraBlocks.Grass.NoDrop:
            default: false
        BlotheraBlocks.Gravel.NoDrop:
            default: false
        BlotheraBlocks.HugeMushroomBlock.NoDrop:
            default: false
        BlotheraBlocks.Ice.NoDrop:
            default: false
        BlotheraBlocks.IronBlock.NoDrop:
            default: false
        BlotheraBlocks.IronDoor.NoDrop:
            default: false
        BlotheraBlocks.IronBars.NoDrop:
            default: false
        BlotheraBlocks.IronOre.NoDrop:
            default: false
        BlotheraBlocks.JackOLantern.NoDrop:
            default: false
        BlotheraBlocks.JukeBox.NoDrop:
            default: false
        BlotheraBlocks.Ladder.NoDrop:
            default: false
        BlotheraBlocks.LapisBlock.NoDrop:
            default: false
        BlotheraBlocks.LapisOre.NoDrop:
            default: false
        BlotheraBlocks.LavaBlock.NoDrop:
            default: false
        BlotheraBlocks.Leaves.NoDrop:
            default: false
        BlotheraBlocks.Lever.NoDrop:
            default: false
        BlotheraBlocks.LockedChest.NoDrop:
            default: false
        BlotheraBlocks.Log.NoDrop:
            default: false
        BlotheraBlocks.LongGrass.NoDrop:
            default: false
        BlotheraBlocks.MelonBlock.NoDrop:
            default: false
        BlotheraBlocks.MelonStem.NoDrop:
            default: false
        BlotheraBlocks.Minecart.NoDrop:
            default: false
        BlotheraBlocks.MobSpawner.NoDrop:
            default: false
        BlotheraBlocks.MossyCobble.NoDrop:
            default: false
        BlotheraBlocks.Mycel.NoDrop:
            default: false
        BlotheraBlocks.NetherBrick.NoDrop:
            default: false
        BlotheraBlocks.NetherBrickStairs.NoDrop:
            default: false
        BlotheraBlocks.NetherFence.NoDrop:
            default: false
        BlotheraBlocks.NetherRack.NoDrop:
            default: false
        BlotheraBlocks.NoteBlock.NoDrop:
            default: false
        BlotheraBlocks.Obsidian.NoDrop:
            default: false
        BlotheraBlocks.Painting.NoDrop:
            default: false
        BlotheraBlocks.Piston.NoDrop:
            default: false
        BlotheraBlocks.StickyPiston.NoDrop:
            default: false
        BlotheraBlocks.PoweredMinecart.NoDrop:
            default: false
        BlotheraBlocks.PoweredRail.NoDrop:
            default: false
        BlotheraBlocks.Pumpkin.NoDrop:
            default: false
        BlotheraBlocks.PumpkinStem.NoDrop:
            default: false
        BlotheraBlocks.Rail.NoDrop:
            default: false
        BlotheraBlocks.Rose.NoDrop:
            default: false
        BlotheraBlocks.Redstone.NoDrop:
            default: false
        BlotheraBlocks.RedstoneLamp.NoDrop:
            default: false
        BlotheraBlocks.RedstoneTorch.NoDrop:
            default: false
        BlotheraBlocks.Sandstone.NoDrop:
            default: false
        BlotheraBlocks.Sand.NoDrop:
            default: false
        BlotheraBlocks.Sapling.NoDrop:
            default: false
        BlotheraBlocks.Seeds.NoDrop:
            default: false
        BlotheraBlocks.Sign.NoDrop:
            default: false
        BlotheraBlocks.SmoothBrick.NoDrop:
            default: false
        BlotheraBlocks.SmoothStairs.NoDrop:
            default: false
        BlotheraBlocks.Snow.NoDrop:
            default: false
        BlotheraBlocks.Soil.NoDrop:
            default: false
        BlotheraBlocks.SoulSand.NoDrop:
            default: false
        BlotheraBlocks.Sponge.NoDrop:
            default: false
        BlotheraBlocks.Step.NoDrop:
            default: false
        BlotheraBlocks.Stone.NoDrop:
            default: false
        BlotheraBlocks.Button.NoDrop:
            default: false
        BlotheraBlocks.StorageMinecart.NoDrop:
            default: false
        BlotheraBlocks.SugarCane.NoDrop:
            default: false
        BlotheraBlocks.GlassPane.NoDrop:
            default: false
        BlotheraBlocks.TNT.NoDrop:
            default: false
        BlotheraBlocks.Torch.NoDrop:
            default: false
        BlotheraBlocks.TrapDoor.NoDrop:
            default: false
        BlotheraBlocks.Vine.NoDrop:
            default: false
        BlotheraBlocks.Water.NoDrop:
            default: false
        BlotheraBlocks.WaterLily.NoDrop:
            default: false
        BlotheraBlocks.Web.NoDrop:
            default: false
        BlotheraBlocks.WoodPlate.NoDrop:
            default: false
        BlotheraBlocks.WoodStairs.NoDrop:
            default: false
        BlotheraBlocks.WoodDoor.NoDrop:
            default: false
        BlotheraBlocks.Wool.NoDrop:
            default: false
        BlotheraBlocks.WorkBench.NoDrop:
            default: false
        BlotheraBlocks.YellowFlower.NoDrop:
            default: false
        BlotheraBlocks.*.NoDrop:
            default: false
        BlotheraBlocks.*:
            default: op
        BlotheraBlocks.*.Drop:
            default: op
        BlotheraBlocks.OtherItems:
            default: true
    
     
  15. Offline

    jacklin213

    Wait how do u test it without a permsssions plugin
     
  16. Offline

    StevasaurousREX

    I believe this

    Code:
        BlotheraBlocks.*.Drop:
            default: op
    
    Shouldn't work because you didn't define it anywhere (that I saw anyways). Also I'd like to add I've had a problem with setting permissions to true and not getting them also, I had to get pex (the one I use most, any will do) to actually test perms
     
  17. Offline

    Jogy34

    In the plugin.yml I set the different defaults to true. That has worked for me in every previous version of bukkit before 1.3

    I use BlotheraBlocks.*.Drop in a different class that is basically the same as my Permissions class except it checks materials along with permissions then returns a material or null. I don't have it set up so that if you have that permission then you actually have the rest of the permissions that are like that, I just check to see if the player has that one and if they do then I bypass the other permission.

    Also I'll try it with a permissions plugin.
     
  18. Offline

    Sleaker

    just fyi, with bukkit perms * doesn't mean all. it means *, as in it's a valid path, thus I would suggest never ever using it as it gets confusing and is pretty much useless. If you want a way to include all of them I suggest using the word, 'all' in place, and checking explicitly for that permission if the player doesn't have the other one set. This means you need to check about 3 variables to use an 'all' permission like you intend to, not just a single permission check.
     
  19. Offline

    Jogy34

    I am intending to use * as a valid path. I am using it so that if a player has that permission then it ignores whether or not they have any of the other permissions in that group. I am using it as if it has all of the permissions of that group as "children" except without putting all of them there because it is really annoying to do that with the number of permissions that I have.

    You lost me in that last part though.
     
  20. Offline

    Sleaker

    This should be fine, there can be problems with PEX or GM depending on how it actually resolves the permissions and if one of the permissions is actually set to false, causing unusual behavior, but these usually only come about if you're using * as not all of the permissions.
     
Thread Status:
Not open for further replies.

Share This Page