Permission Won't Registered

Discussion in 'Development' started by CocoonBuilder, Nov 4, 2018.

  1. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    So i have been working on spawner level


    if($block->getId() == 52 && $block->getDamage() == 12){
    if($player->hasPermission("lv1.spawner")){

    }else{
    $player->sendMessage("You Need To Be Level 3 To Place This Spawner");
    $event->setCancelled(true);
    }
    }

    if($block->getId() == 52 && $block->getDamage() == 14){
    if($player->hasPermission("lv2.spawner")){

    }else{
    $player->sendMessage("You Need To Be Level 7 To Place This Spawnerl");
    $event->setCancelled(true);
    }
    }

    if($block->getId() == 52 && $block->getDamage() == 18){
    if($player->hasPermission("lv3.spawner")){

    }else{
    $player->sendMessage("You Need To Be Level 10 To Place This Spawner");
    $event->setCancelled(true);
    }
    }

    I actually have a lot more spawner put in code but three should be enough as an example. So the first 2 spawner got cancel if i try to place without having perm but when i try to place another spawner that is not the first two, my spawner was placed. No error whatsoever and the plugin.yml seem to be correct
     
  2. Akuroma

    Akuroma Silverfish

    Messages:
    15
    GitHub:
    Akuroma
    Could you send us your plugin.yml?
     
  3. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    name: SpawnerLevel
    main: SpawnerLevel\Main
    version: 1.0.0
    api: [3.0.0, 3.0.0-ALPHA12, 4.0.0]
    author: Cocoon


    permissions:
    lv1.spawner:
    default: op
    description: Place Level 1 Spawner
    lv2.spawner:
    default: op
    description: Place Level 2 Spawner
    lv3.spawner:
    default: op
    description: Place Level 3 Spawner
     
  4. GamakCZ

    GamakCZ Baby Zombie

    Messages:
    151
    GitHub:
    GamakCZ
    try this
    Code:
    permissions:
      lv1.spawner:
        default: op
        description: Place Level 1 Spawner
      lv2.spawner:
        default: op
        description: Place Level 2 Spawner
      lv3.spawner:
        default: op
        description: Place Level 3 Spawner
     
  5. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    what is the different? if it is the spacing it just that my plugin.yml is spaced but when i copied it and paste it here it dont space out
     
  6. Muqsit

    Muqsit Wither Skeleton Verified

    Messages:
    1,410
    GitHub:
    muqsit
    Your issue is where you check for block's meta to be 18. The block metadata should be in the range 0 to 15. Maybe replace $block with $item (= $event->getItem()). I believe that's BlockPlaceEvent?
    Yeah, indentation makes a difference in YAML. Anyway, you can use this format when you're writing code on this forum to avoid such issues and make your code more readable at the same time.

    [CODE]
    //your code here
    [/CODE]
     
    CocoonBuilder likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.