Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Custom Kit permissions v.1.3.4 (#108)
Browse files Browse the repository at this point in the history
* Custom Kit permissions

* v1.3.4

* v1.3.4 custom kit perms

* Update README.md

* default perms
  • Loading branch information
Infernus101 authored Apr 23, 2019
1 parent 5c00c5b commit 1462fb5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Select kits from a form! Just do /kit and get kits info and select it if availab
## Permissions
- kit.command - Permission to use /kit
- kit.sign - Permission to make kit sign.
- kit.(kitname) - Permission to use kit specified after kit.
- Custom Kit permissions - You can edit kits.yml to change permission for every kit, default is kit.(kitname).
- kit.freepass - Permission to free pass any kit cooldown and one-kit-per-life check.

## Features
Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: KitUI
author: Infernus101
api: [3.4.0]
main: Infernus101\KitUI\Main
version: 1.3.3
version: 1.3.4
permissions: # kit permissions - kit.<kit name>
kit.command:
description: kit command!
Expand Down
7 changes: 7 additions & 0 deletions resources/kits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ testkit:

# Info to show when selected a Kit in UI form
info: "This kit is too op XD Cost: 50$"

# Custom Kit perms, CaSe sEnSiTiVe
permission: "kit.testkit"
testkit2:

items:
Expand Down Expand Up @@ -72,6 +75,8 @@ testkit2:

info: "Kit 2! Cost: 250$"

permission: "kit.testkit2"

testkit3:

items:
Expand Down Expand Up @@ -99,4 +104,6 @@ testkit3:
image-url: ""

info: "Kit 3! Cost: 150$"

permission: "kit.testkit3"
...
5 changes: 4 additions & 1 deletion src/Infernus101/KitUI/Kit.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public function __construct(Main $pl, array $data, string $name){
if(isset($this->data["money"]) and $this->data["money"] != 0){
$this->cost = (int) $this->data["money"];
}
if(!isset($this->data["permission"])){
$this->data["permission"] = "kit." . $this->name;
}
}

public function getName() : string{
Expand Down Expand Up @@ -160,7 +163,7 @@ public function processTimer(){
}

public function testPermission(Player $player) : bool{
return $player->hasPermission("kit.".strtolower($this->name)) or $player->hasPermission("kit.".$this->name);
return $player->hasPermission($this->data["permission"]);
}

public function save(){
Expand Down

0 comments on commit 1462fb5

Please sign in to comment.