Glowstone dust instead of blocks drop (Bottom of page)

Discussion in 'Plugin Development' started by CRAZYxMUNK3Y, Jun 1, 2012.

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

    CRAZYxMUNK3Y

  2. Offline

    makskay

    Coincidentally, I was just working on this myself. Here's the API methods to get permissions for a given player on a given claim. When they return null the player does have the specified permission; otherwise, a valid String error message is returned.

    Code:
    //all these return null when a player DOES have permission
    //they return an explanation message when a player DOES NOT have permission
    
    //allowEdit is the resize permission
    String errorMessage = claim.allowEdit("playerName");
    
    String errorMessage = claim.allowGrantPermission("playerName");
    String errorMessage = claim.allowBuild("playerName");
    String errorMessage = claim.allowBreak("playerName");
    String errorMessage = claim.allowContainers("playerName");
    String errorMessage = claim.allowAccess("playerName");
    
     
  3. Offline

    CRAZYxMUNK3Y

    I saw those, thanks... But what would be the best way to do something like this?
    Code:java
    1.  
    2. If((playerName == claimOwner) || (playerName == trustedPlayer)){
    3. //continue code
    4. }else{
    5. //stop the breaks/placements
    6. }
    7.  

    Use the allowBuild() or allowEdit() method?
     
  4. Offline

    makskay

    Since GriefProtection uses different "levels" of trust and each level includes those less restrictive than itself (for instance, any player who can build can also break, access containers and open doors within the same claim), and the default /trust command operates at one of the highest levels (allowGrantPermission() if I recall correctly), you should probably run an allowGrantPermission() check on the playername and use that to set a boolean like playerIsTrusted. Then you can use if(playerIsTrusted) { do whatever }.
     
  5. Offline

    CRAZYxMUNK3Y

    I decided to do as you suggested, but instead used a null... This is the code (For anyone interested)
    Code:java
    1.  
    2. String canBreak = GriefPrevention.instance.allowBreak(player, block.getLocation());
    3.  
    4. if (plugin.allowedWorlds.contains(world)) {
    5. if (canBreak != null) {
    6. // Do stuff
    7. }else{
    8. return;
    9. }
    10.  


    I do have one small issue though (may as well keep one thread open), i have the following code;
    Code:java
    1.  
    2. block.setType(Material.AIR);
    3. block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(Material.GLOWSTONE, 1));
    4. ev.setCancelled(true);
    5.  


    But for some reason it keeps dropping random dust amounts(same as vanilla), what am i missing? Full code(For method) here.

    Thanks in advanced.
     
  6. Offline

    CRAZYxMUNK3Y

    I don't normally like to bump threads but i really need some help here please.
     
Thread Status:
Not open for further replies.

Share This Page