1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

[solved] Chest Vault -personal /private chest in one command

Discussion in 'Requests' started by MC ATECH, Apr 23, 2017.

?

Is this plugin idea even possible?

  1. yeah!

    13 vote(s)
    68.4%
  2. impossible

    1 vote(s)
    5.3%
  3. yes, with time and dedication!

    5 vote(s)
    26.3%
  1. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    It can't be. Try it again.
     
    MC ATECH likes this.
  2. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    ignore me :p
    This code works, However if you type /pv 1 (or any number) it will send a popup with vault opening... but wont acctually move on from there. No error message.
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    suspect you will need to update the way to showing the chest to client
     
    corytortoise likes this.
  4. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    PHP:
    }else {
                                    if(
    $sender->hasPermission("pv.vault." $args[0])) {
                                        
    $sender->addWindow($this->loadVault($sender$args[0]));
                                        
    $sender->sendTip("§aOpening Vault...");
                                        
    $this->using[strtolower($sender->getName())] = (int)$args[0];
                                        return 
    true;
                                    }else {
                                        
    $sender->sendMessage("§6PrivateVault§7>> §cYou do not have permission to open that vault.");
                                        return 
    true;
                                    }
                                }
    loads vault defined here:
    PHP:
    public function loadVault(Player $player$number) {
            
    $itemblock Item::fromString("chest");
            
    $block $itemblock->getBlock();
            
    $player->getLevel()->setBlock(new Vector3($player->getX(), 128$player->getZ()), $block);
            
    $nbt = new CompoundTag("", [
                new 
    ListTag("Items", []),
                new 
    StringTag("id"Tile::CHEST),
                new 
    IntTag("x"$player->getX()),
                new 
    IntTag("y"$player->getY()),
                new 
    IntTag("z"$player->getZ())
            ]);
            
    $nbt->Items->setTagType(NBT::TAG_Compound);
            
    $tile Tile::createTile("Chest"$player->getLevel(), $nbt);
            if(
    $player instanceof Player) {
                
    $player $player->getName();
            }
            
    $player strtolower($player);
            
    $cfg = new Config($this->getDataFolder() . "players/" $player ".yml"Config::YAML);
            
    $tile->getInventory()->clearAll();
            for (
    $i 0$i 26$i++) {
                
    $ite $cfg->getNested("$number.items." $i);
                
    $item Item::get($ite[0]);
                
    $item->setDamage($ite[1]);
                
    $item->setCount($ite[2]);
                foreach (
    $ite[3] as $key => $en) {
                    
    $enchantment Enchantment::getEnchantment($en[0]);
                    
    $enchantment->setLevel($en[1]);
                    
    $item->addEnchantment($enchantment);
                }
                
    $tile->getInventory()->setItem($i$item);
            }
            return 
    $tile->getInventory();
        }
    confused :p
     
  5. LordJoshie

    LordJoshie Silverfish

    Messages:
    22
    GitHub:
    lordjoshie
    I have a working version... bought it tho :p
     
  6. KingResos

    KingResos Spider Jockey

    Messages:
    37
    GitHub:
    kingresos
    Where did u buy it?
     
  7. KelvinCyaX

    KelvinCyaX Silverfish

    Messages:
    18
    GitHub:
    CyanKelv
    Your chest block is at (new Vector3($player->getX(), 128, $player->getZ()).. but the tile is created at $player->getY().. make sure the tile is created at the correct pos :)
     
  8. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Could you explain this a little more please? :p
     
  9. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    basically you are creating a tile and a block in a different space/cords
     
    corytortoise likes this.
  10. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Ok I'll attempt a fix
     
  11. KingResos

    KingResos Spider Jockey

    Messages:
    37
    GitHub:
    kingresos
    If you get a fix can I use it? :p
     
  12. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Just get it off GitHub and do it yourself :p
     
  13. KingResos

    KingResos Spider Jockey

    Messages:
    37
    GitHub:
    kingresos
    Im not to experienced with coding ;-;
     
  14. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Me neither but I try
     
  15. Kabluinc

    Kabluinc Baby Zombie

    Messages:
    129
  16. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Ok I'll try it out later :)
     
  17. padrone

    padrone Witch

    Messages:
    69
    GitHub:
    padreon
  18. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    Why buy it when you can fix it yourself
     
    Thunder33345 likes this.
  19. KingResos

    KingResos Spider Jockey

    Messages:
    37
    GitHub:
    kingresos
    There is some plugins on youtube called Bau, but the problem is it only has 3 PV's but you could look at the code of those to fix it.
     
  20. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    link or so?
    i think it's still the same code just limited PV with the same bugs
     
  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.