From 3128cad5856cd264ac1e927c40847f76c2445cca Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:29:23 +1000
Subject: [PATCH 01/22] Delete resources directory
---
resources/config.yml | 20 ------------
resources/kits.yml | 77 --------------------------------------------
2 files changed, 97 deletions(-)
delete mode 100644 resources/config.yml
delete mode 100644 resources/kits.yml
diff --git a/resources/config.yml b/resources/config.yml
deleted file mode 100644
index 1c2707f..0000000
--- a/resources/config.yml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-# Users are able to get only one kit per life
-one-kit-per-life: true
-
-# Users are able to get a kit if they log out even if they did not die (only works if one-kit-per-life: true)
-reset-on-logout: true
-
-# If true, you will need to give players the permission advancedkits.kitname with your permissions manager of choice to let them get a kit
-# If false, no permissions will be used for kits. You will have to specify manually the players/worlds that can get a kit from the kits.yml file
-permissions-mode: true
-
-# Sign text (capitals and color codes don't matter)
-sign-text: "[AdvancedKits]"
-
-# Kits you don't have the permission to get will be hidden from the kits list
-hide-no-perm-kits: false
-
-# Show the kit list as a form when a player runs the command /kit (without arguments)
-show-form-no-args: true
-...
\ No newline at end of file
diff --git a/resources/kits.yml b/resources/kits.yml
deleted file mode 100644
index f35f867..0000000
--- a/resources/kits.yml
+++ /dev/null
@@ -1,77 +0,0 @@
----
-testkit:
- # ITEM FORMAT: "id:damage:count:name:ench_name:ench_level"
- # NO enchantments and NO custom name: "id:damage:count"
-
- # ONLY custom name: "id:damage:count:custom name"
-
- # ONLY enchantments: "id:damage:count:DEFAULT:enchantment1:level"
- # (Put DEFAULT in the name field if you do not want a custom name)
- # You can put as many enchantments as you want like this: "id:damage:count:DEFAULT:enchantment1:level:enchantment2:level" etc.
-
- # Enchantments AND custom name: "id:damage:count:custom name:enchantment1:level"
- # You can put as many enchantments as you want like this: "id:damage:count:custom name:enchantment1:level:enchantment2:level" etc.
-
- # You can write both numeric or string IDs
- items:
- - "260:0:10"
- - "267:0:1:Sword Name"
- helmet: "diamond_helmet:0:1"
- chestplate: "diamond_chestplate:0:1:DEFAULT:protection:1"
- leggings: "diamond_leggings:0:1:Leggings Name"
- boots: "diamond_boots:0:1"
-
- # Set items for specific slots, will override existing items. Only use if you want to assign items to specific slots, otherwise delete this.
- slots:
- 9: "golden_apple:0:5"
- 12: "bow:0:1"
-
- commands:
- - "tell {player} you got an awesome kit thanks to AdvancedKits plugin!"
-
- cooldown:
- hours: 24
- minutes: 30
-
- # EFFECT FORMAT: "name:seconds:amplifier"
- effects:
- - "speed:120:2"
-
- # Add a cost for the kit. Compatible with EconomyAPI, PocketMoney and MassiveEconomy
- # Put 0 if you want the kit to be free
- money: 50
-
- # If you do not use pureperms, use 'worlds' to specify in which worlds you want this kit to be used
- # Leave blank to let use the kit in all worlds
- worlds:
- - "kitpvp"
-
- # If you do not use pureperms, use 'users' to specify which players will be able to get this kit
- # Leave blank to let all the players use this kit
- users:
- - "luca28pet"
- - "dioconsole"
-
- # FormAPI users:
- # Img type: 'url' or 'path'
- img-type: ''
- # Put here the image URL/path
- img-data: ''
- # How the kit is displayed on the form
- form-name: 'Test Kit: 50$'
-
-sgkit:
- items:
- - 'bow:0:1'
- - 'arrow:0:5'
- - 'stone_sword:0:1'
- - 'apple:0:5'
- helmet: 'leather_cap:0:1'
- chestplate: 'leather_tunic:0:1'
- commands:
- - 'tell {player} You got a SG example kit'
- cooldown:
- hours: 1
- minutes: 0
- money: 0
-...
From b69eb2b4d19c7420021d4d5107d3c080556cd578 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:29:35 +1000
Subject: [PATCH 02/22] Delete src/AdvancedKits directory
---
src/AdvancedKits/EventListener.php | 66 ----
src/AdvancedKits/Kit.php | 339 --------------------
src/AdvancedKits/Main.php | 184 -----------
src/AdvancedKits/economy/EconomyManager.php | 50 ---
src/AdvancedKits/lang/LangManager.php | 61 ----
src/AdvancedKits/tasks/CoolDownTask.php | 22 --
6 files changed, 722 deletions(-)
delete mode 100644 src/AdvancedKits/EventListener.php
delete mode 100644 src/AdvancedKits/Kit.php
delete mode 100644 src/AdvancedKits/Main.php
delete mode 100644 src/AdvancedKits/economy/EconomyManager.php
delete mode 100644 src/AdvancedKits/lang/LangManager.php
delete mode 100644 src/AdvancedKits/tasks/CoolDownTask.php
diff --git a/src/AdvancedKits/EventListener.php b/src/AdvancedKits/EventListener.php
deleted file mode 100644
index ca4e4fb..0000000
--- a/src/AdvancedKits/EventListener.php
+++ /dev/null
@@ -1,66 +0,0 @@
-ak = $ak;
- }
-
- public function onSign(PlayerInteractEvent $event) : void{
- $id = $event->getBlock()->getId();
- if($id === Block::SIGN_POST || $id === Block::WALL_SIGN){
- $tile = $event->getPlayer()->getLevel()->getTile($event->getBlock());
- if($tile instanceof Sign){
- $text = $tile->getText();
- if(strtolower(TextFormat::clean($text[0])) === strtolower($this->ak->getConfig()->get('sign-text'))){
- $event->setCancelled();
- if(empty($text[1])){
- $event->getPlayer()->sendMessage($this->ak->langManager->getTranslation('no-sign-on-kit'));
- return;
- }
- $kit = $this->ak->getKit($text[1]);
- if($kit === null){
- $event->getPlayer()->sendMessage($this->ak->langManager->getTranslation('no-kit', $text[1]));
- return;
- }
- $kit->handleRequest($event->getPlayer());
- }
- }
- }
- }
-
- public function onSignChange(SignChangeEvent $event) : void{
- if(strtolower(TextFormat::clean($event->getLine(0))) === strtolower($this->ak->getConfig()->get('sign-text')) && !$event->getPlayer()->hasPermission('advancedkits.admin')){
- $event->getPlayer()->sendMessage($this->ak->langManager->getTranslation('no-perm-sign'));
- $event->setCancelled();
- }
- }
-
- public function onDeath(PlayerDeathEvent $event) : void{
- if(isset($this->ak->hasKit[$event->getPlayer()->getLowerCaseName()])){
- unset($this->ak->hasKit[$event->getPlayer()->getLowerCaseName()]);
- }
- }
-
- public function onLogOut(PlayerQuitEvent $event) : void{
- if($this->ak->getConfig()->get('reset-on-logout') && isset($this->ak->hasKit[strtolower($event->getPlayer()->getName())])){
- unset($this->ak->hasKit[$event->getPlayer()->getLowerCaseName()]);
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/AdvancedKits/Kit.php b/src/AdvancedKits/Kit.php
deleted file mode 100644
index 8cea927..0000000
--- a/src/AdvancedKits/Kit.php
+++ /dev/null
@@ -1,339 +0,0 @@
- null, 'chestplate' => null, 'leggings' => null, 'boots' => null];
- /** @var Item[] */
- private $slots = [];
- /** @var EffectInstance[] */
- private $effects = [];
-
- /** @var int */
- private $imgType;
- /** @var string */
- private $imgData;
- /** @var string */
- private $formName;
-
- public function __construct(Main $ak, array $data, string $name){
- $this->ak = $ak;
- $this->data = $data;
- $this->name = $name;
- $this->coolDown = $this->getCoolDownMinutes();
-
- if(isset($this->data['money']) && $this->data['money'] !== 0){
- $this->cost = (int) $this->data['money'];
- }
- if(file_exists($this->ak->getDataFolder().'cooldowns/'.strtolower($this->name).'.sl')){
- $this->coolDowns = unserialize(file_get_contents($this->ak->getDataFolder().'cooldowns/'.strtolower($this->name).'.sl'), ['allowed_classes' => false]);
- }
-
- foreach($this->data['items'] as $itemString){
- $item = $this->loadItem($itemString);
- if($item !== null){
- $this->items[] = $item;
- }
- }
- isset($this->data['helmet']) && ($this->armor['helmet'] = $this->loadItem($this->data['helmet']));
- isset($this->data['chestplate']) && ($this->armor['chestplate'] = $this->loadItem($this->data['chestplate']));
- isset($this->data['leggings']) && ($this->armor['leggings'] = $this->loadItem($this->data['leggings']));
- isset($this->data['boots']) && ($this->armor['boots'] = $this->loadItem($this->data['boots']));
-
- if(isset($this->data['slots']) && is_array($this->data['slots'])){
- foreach($this->data['slots'] as $index => $itemString){
- $item = $this->loadItem($itemString);
- if($item !== null){
- $this->slots[$index] = $item;
- }
- }
- }
-
- if(isset($this->data['effects']) && is_array($this->data['effects'])){
- foreach($this->data['effects'] as $effectString){
- $effect = $this->loadEffect($effectString);
- if($effect !== null){
- $this->effects[] = $effect;
- }
- }
- }
-
- if(isset($data['img-type'])){
- if($data['img-type'] === 'url'){
- $this->imgType = 1;
- }elseif($data['img-type'] === 'path'){
- $this->imgType = 0;
- }else{
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Image type '.$data['img-type'].' not supported. Please use \'path\' or \'url\'');
- }
- }
- if(isset($data['img-data'])){
- $this->imgData = $data['img-data'];
- }
- if(isset($data['form-name'])){
- $this->formName = $data['form-name'];
- }
- }
-
- public function getName() : string{
- return $this->name;
- }
-
- public function getImageType() : ?int{
- return $this->imgType;
- }
-
- public function getImageData() : ?string{
- return $this->imgData;
- }
-
- public function hasValidImage() : bool{
- return isset($this->imgType, $this->imgData);
- }
-
- public function getFormName() : ?string{
- return $this->formName;
- }
-
- public function handleRequest(Player $player) : bool{
- if($this->testPermission($player)){
- if(!isset($this->coolDowns[$player->getLowerCaseName()])){
- if(!($this->ak->getConfig()->get('one-kit-per-life') && isset($this->ak->hasKit[strtolower($player->getName())]))){
- if($this->cost){
- if($this->ak->economy->grantKit($player, $this->cost)){
- $this->addTo($player);
- $player->sendMessage($this->ak->langManager->getTranslation('sel-kit', $this->name));
- return true;
- }
- $player->sendMessage($this->ak->langManager->getTranslation('cant-afford', $this->name));
- }else{
- $this->addTo($player);
- $player->sendMessage($this->ak->langManager->getTranslation('sel-kit', $this->name));
- return true;
- }
- }else{
- $player->sendMessage($this->ak->langManager->getTranslation('one-per-life'));
- }
- }else{
- $player->sendMessage($this->ak->langManager->getTranslation('cooldown1', $this->name));
- $player->sendMessage($this->ak->langManager->getTranslation('cooldown2', $this->getCoolDownLeft($player)));
- }
- }else{
- $player->sendMessage($this->ak->langManager->getTranslation('no-perm', $this->name));
- }
- return false;
- }
-
- public function addTo(Player $player) : void{
- foreach($this->items as $item){
- $player->getInventory()->addItem($item);
- }
-
- $this->armor['helmet'] !== null && $player->getArmorInventory()->setHelmet($this->armor['helmet']);
- $this->armor['chestplate'] !== null && $player->getArmorInventory()->setChestplate($this->armor['chestplate']);
- $this->armor['leggings'] !== null && $player->getArmorInventory()->setLeggings($this->armor['leggings']);
- $this->armor['boots'] !== null && $player->getArmorInventory()->setBoots($this->armor['boots']);
-
- foreach($this->slots as $slot => $item){
- $player->getInventory()->setItem($slot, $item);
- }
-
- foreach($this->effects as $effect){
- $player->addEffect(clone $effect);
- }
-
- if(isset($this->data['commands']) && is_array($this->data['commands'])){
- foreach($this->data['commands'] as $cmd){
- $this->ak->getServer()->dispatchCommand(new ConsoleCommandSender(), str_replace('{player}', $player->getName(), $cmd));
- }
- }
- if($this->coolDown){
- $this->coolDowns[$player->getLowerCaseName()] = $this->coolDown;
- }
- $this->ak->hasKit[$player->getLowerCaseName()] = $this->name;
- }
-
-
- private function loadItem(string $itemString) : ?Item{
- $array = explode(':', $itemString);
- if(count($array) < 2){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Item '.$itemString.' could not be loaded because name and damage are not specified');
- return null;
- }
-
- $name = array_shift($array);
- $damage = array_shift($array);
- try{
- $item = Item::fromString($name.':'.$damage);
- }catch(InvalidArgumentException $exception){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Item '.$itemString.' could not be loaded');
- $this->ak->getLogger()->warning($exception->getMessage());
- return null;
- }
-
- if(!empty($array)){
- $count = array_shift($array);
- if(is_numeric($count)){
- $item->setCount((int) $count);
- }else{
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Item '.$itemString.' could not be loaded because the count is not a number');
- return null;
- }
- }
-
- if(!empty($array)){
- $name = array_shift($array);
- if(strtolower($name) !== 'default'){
- $item->setCustomName($name);
- }
- }
-
- if(!empty($array)){
- $enchantmentsArrays = array_chunk($array, 2);
- foreach ($enchantmentsArrays as $enchantmentsData){
- if(count($enchantmentsData) !== 2){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Enchantments must be specified in the format name:level. Enchantment: '.$enchantmentsData[0].' will not be included in the item '.$itemString);
- continue;
- }
-
- $enchantment = Enchantment::getEnchantmentByName($enchantmentsData[0]);
- if($enchantment === null){ //If the specified enchantment is not a vanilla enchantment
- if($this->ak->piggyCustomEnchantsInstance !== null && $this->ak->piggyCustomEnchantsInstance->isEnabled()){ //Check if PiggyCustomEnchants is loaded and try to load the enchantment from there
- $enchantment = CustomEnchantManager::getEnchantmentByName($enchantmentsData[0]);
- if($enchantment === null){ //If the specified enchantment is not a custom enchantment
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Enchantment '.$enchantmentsData[0].' in item '.$itemString.' could not be loaded because the enchantment does not exist');
- continue;
- }
- }else{
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Enchantment '.$enchantmentsData[0].' in item '.$itemString.' could not be loaded because the enchantment does not exist');
- continue;
- }
- }
-
- if(!is_numeric($array[1])){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Enchantment '.$enchantmentsData[0].' in item '.$itemString.' could not be loaded because the level is not a number');
- continue;
- }
-
- $item->addEnchantment(new EnchantmentInstance($enchantment, (int) $enchantmentsData[1]));
- }
- }
- return $item;
- }
-
- private function loadEffect(string $effectString) : ?EffectInstance{
- $array = explode(':', $effectString);
- if(count($array) < 2){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Effect '.$effectString.' could not be loaded because name and level are not specified');
- return null;
- }
- $name = array_shift($array);
- $duration = array_shift($array);
- if(!is_numeric($duration)){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Effect '.$effectString.' could not be loaded because the duration is not a number');
- return null;
- }
-
- if(!empty($array)){
- $amplifier = array_shift($array);
- if(!is_numeric($amplifier)){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Effect '.$effectString.' could not be loaded because the amplifier is not a number');
- return null;
- }
- }else{
- $amplifier = 0;
- }
-
- $e = Effect::getEffectByName($name);
- if($e === null){
- $this->ak->getLogger()->warning('Bad configuration in kit '.$this->name.'. Effect '.$effectString.' could not be loaded because the effect does not exist');
- return null;
- }
- return new EffectInstance($e, (int) $duration * 20, (int) $amplifier);
- }
-
- private function getCoolDownMinutes() : int{
- $min = 0;
- if(isset($this->data['cooldown']['minutes'])){
- $min += (int) $this->data['cooldown']['minutes'];
- }
- if(isset($this->data['cooldown']['hours'])){
- $min += (int) $this->data['cooldown']['hours'] * 60;
- }
- return $min;
- }
-
- private function getCoolDownLeft(Player $player) : string{
- if(($minutes = $this->coolDowns[$player->getLowerCaseName()]) < 60){
- return $this->ak->langManager->getTranslation('cooldown-format1', $minutes);
- }
- if(($modulo = $minutes % 60) !== 0){
- return $this->ak->langManager->getTranslation('cooldown-format2', floor($minutes / 60), $modulo);
- }
- return $this->ak->langManager->getTranslation('cooldown-format3', $minutes / 60);
- }
-
- public function processCoolDown() : void{
- foreach($this->coolDowns as $player => $min){
- --$this->coolDowns[$player];
- if($this->coolDowns[$player] <= 0){
- unset($this->coolDowns[$player]);
- }
- }
- }
-
- public function testPermission(Player $player) : bool{
- if($this->ak->permissionsMode){
- return $player->hasPermission('advancedkits.'.strtolower($this->name)) || $player->hasPermission('advancedkits.'.$this->name);
- }
-
- return
- (isset($this->data['users']) ? in_array($player->getLowerCaseName(), $this->data['users'], true) : true)
- &&
- (isset($this->data['worlds']) ? in_array(strtolower($player->getLevel()->getName()), $this->data['worlds'], true) : true)
- ;
- }
-
- public function save() : void{
- if(!empty($this->coolDowns)){
- file_put_contents($this->ak->getDataFolder().'cooldowns/'.strtolower($this->name).'.sl', serialize($this->coolDowns));
- }
- }
-
-}
diff --git a/src/AdvancedKits/Main.php b/src/AdvancedKits/Main.php
deleted file mode 100644
index b0e2433..0000000
--- a/src/AdvancedKits/Main.php
+++ /dev/null
@@ -1,184 +0,0 @@
-saveDefaultConfig();
- if(!class_exists(SimpleForm::class) && $this->getConfig()->get('show-form-no-args', true)){
- $this->getLogger()->error('libFormAPI virion not found. Please use the phar on poggit or use DEVirion or put \'show-form-no-args: false\' in the config.yml');
- $this->getServer()->getPluginManager()->disablePlugin($this);
- return;
- }
- if(!is_dir($this->getDataFolder().'cooldowns/')){
- if(!mkdir($this->getDataFolder().'cooldowns/', 0777, true) && !is_dir($this->getDataFolder().'cooldowns/')){
- $this->getLogger()->error('Unable to create cooldowns folder');
- $this->getServer()->getPluginManager()->disablePlugin($this);
- return;
- }
- }
- if(($plugin = $this->getServer()->getPluginManager()->getPlugin('PiggyCustomEnchants')) !== null){
- $this->piggyCustomEnchantsInstance = $plugin;
- $this->getLogger()->notice('PiggyCustomEnchants detected. Activated custom enchants support');
- }
- $this->loadKits();
- $this->economy = new EconomyManager($this);
- $this->langManager = new LangManager($this);
- $this->permissionsMode = $this->getConfig()->get('permissions-mode', true);
- $this->getScheduler()->scheduleDelayedRepeatingTask(new CoolDownTask($this), 1200, 1200);
- $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
- }
-
- public function onDisable() : void{
- foreach($this->kits as $kit){
- $kit->save();
- }
- $this->kits = [];
- $this->piggyCustomEnchantsInstance = null;
- }
-
- public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{
- switch(strtolower($command->getName())){
- case 'kit':
- if(!($sender instanceof Player)){
- $sender->sendMessage($this->langManager->getTranslation('in-game'));
- return true;
- }
- if(!isset($args[0])){
- $kits = ((bool) $this->getConfig()->get('hide-no-perm-kits', false)) ? array_filter($this->kits, static function (Kit $kit) use($sender){
- return $kit->testPermission($sender);
- }) : $this->kits;
- if($this->getConfig()->get('show-form-no-args', true)){
- $this->openKitUI($sender, $kits);
- }else{
- $sender->sendMessage($this->langManager->getTranslation('av-kits', implode(', ', array_keys($kits))));
- }
- return true;
- }
- $kit = $this->getKit($args[0]);
- if($kit === null){
- $sender->sendMessage($this->langManager->getTranslation('no-kit', $args[0]));
- return true;
- }
- $kit->handleRequest($sender);
- return true;
- case 'akreload':
- foreach($this->kits as $kit){
- $kit->save();
- }
- $this->kits = [];
- $this->loadKits();
- $sender->sendMessage($this->langManager->getTranslation('reload'));
- return true;
- }
- return true;
- }
-
- /**
- * @param Player $player
- * @param Kit[] $kits
- */
- public function openKitUI(Player $player, array $kits) : void{
- $form = new SimpleForm([$this, 'onPlayerSelection']);
- $form->setTitle($this->langManager->getTranslation('form-title'));
- foreach($kits as $kit){
- $form->addButton($kit->getFormName() ?? $kit->getName(), $kit->hasValidImage() ? $kit->getImageType() : -1, $kit->hasValidImage() ? $kit->getImageData() : '', $kit->getName());
- }
- $player->sendForm($form);
- }
-
- public function onPlayerSelection(Player $player, ?string $data) : void{
- if($data === null){
- return;
- }
- $kit = $this->getKit($data);
- if($kit === null){
- return;
- }
- $kit->handleRequest($player);
- }
-
- private function loadKits() : void{
- $this->saveResource('kits.yml');
- $kitsData = yaml_parse_file($this->getDataFolder().'kits.yml');
- $this->fixConfig($kitsData);
- foreach($kitsData as $kitName => $kitData){
- $this->kits[$kitName] = new Kit($this, $kitData, $kitName);
- }
- }
-
- private function fixConfig(array &$config) : void{
- foreach($config as $name => $kit){
- if(isset($kit['users'])){
- $users = array_map('strtolower', $kit['users']);
- $config[$name]['users'] = $users;
- }
- if(isset($kit['worlds'])){
- $worlds = array_map('strtolower', $kit['worlds']);
- $config[$name]['worlds'] = $worlds;
- }
- }
- }
-
- /**
- * @param string $kitName
- * @return Kit|null
- */
- public function getKit(string $kitName) : ?Kit{
- /**@var Kit[] $lowerKeys*/
- $lowerKeys = array_change_key_case($this->kits, CASE_LOWER);
- if(isset($lowerKeys[strtolower($kitName)])){
- return $lowerKeys[strtolower($kitName)];
- }
- return null;
- }
-
- /**
- * @param $player
- * @return string|null
- */
- public function getPlayerKit($player) : ?string{
- if($player instanceof Player){
- $player = $player->getLowerCaseName();
- }else{
- $player = strtolower($player);
- }
- return $this->hasKit[$player] ?? null;
- }
-
-}
\ No newline at end of file
diff --git a/src/AdvancedKits/economy/EconomyManager.php b/src/AdvancedKits/economy/EconomyManager.php
deleted file mode 100644
index 2025f36..0000000
--- a/src/AdvancedKits/economy/EconomyManager.php
+++ /dev/null
@@ -1,50 +0,0 @@
-getServer()->getPluginManager()->getPlugin($ecoPluginName)) !== null){
- $this->economy = $ecoPluginName;
- $this->api = $ecoPlugin;
- break;
- }
- }
- }
-
- public function grantKit(Player $player, int $money) : bool{
- if($this->economy === null){
- return false;
- }
- switch($this->economy){
- case 'EconomyAPI':
- if($this->api->reduceMoney($player, $money) === 1){
- return true;
- }
- break;
- case 'PocketMoney':
- if($this->api->getMoney($player->getName()) < $money){
- return false;
- }
- if($this->api->setMoney($player->getName(), $this->api->getMoney($player->getName()) - $money)){
- return true;
- }
- break;
- case 'MassiveEconomy':
- if($this->api->takeMoney($player->getName(), $money) === 2){
- return true;
- }
- break;
- }
- return false;
- }
-
-}
\ No newline at end of file
diff --git a/src/AdvancedKits/lang/LangManager.php b/src/AdvancedKits/lang/LangManager.php
deleted file mode 100644
index 57bb11f..0000000
--- a/src/AdvancedKits/lang/LangManager.php
+++ /dev/null
@@ -1,61 +0,0 @@
-ak = $ak;
- $this->defaults = [
- 'lang-version' => self::LANG_VERSION,
- 'in-game' => self::PREFIX.'Please run this command in game',
- 'av-kits' => self::PREFIX.'Available kits: {%0}',
- 'no-kit' => self::PREFIX.'Kit {%0} does not exist',
- 'reload' => self::PREFIX.'Reloaded kits settings',
- 'sel-kit' => self::PREFIX.'Selected kit: {%0}',
- 'cant-afford' => self::PREFIX.'You cannot afford kit: {%0}',
- 'one-per-life' => self::PREFIX.'You can only get one kit per life',
- 'cooldown1' => self::PREFIX.'Kit {%0} is in coolDown at the moment',
- 'cooldown2' => self::PREFIX.'You will be able to get it in {%0}',
- 'no-perm' => self::PREFIX.'You haven\'t the permission to use kit {%0}',
- 'cooldown-format1' => self::PREFIX.'{%0} minutes',
- 'cooldown-format2' => self::PREFIX.'{%0} hours and {%1} minutes',
- 'cooldown-format3' => self::PREFIX.'{%0} hours',
- 'no-sign-on-kit' => self::PREFIX.'On this sign, the kit is not specified',
- 'no-perm-sign' => self::PREFIX.'You don\'t have permission to create a sign kit',
- 'form-title' => self::PREFIX.'Available Kits'
- ];
- $this->data = new Config($this->ak->getDataFolder().'lang.properties', Config::PROPERTIES, $this->defaults);
- if($this->data->get('lang-version') != self::LANG_VERSION){
- $this->ak->getLogger()->warning('Translation file is outdated. The old file has been renamed and a new one has been created');
- @rename($this->ak->getDataFolder().'lang.properties', $this->ak->getDataFolder().'lang.properties.old');
- $this->data = new Config($this->ak->getDataFolder().'lang.properties', Config::PROPERTIES, $this->defaults);
- }
- }
-
- public function getTranslation(string $dataKey, ...$args) : string{
- if(!isset($this->defaults[$dataKey])){
- $this->ak->getLogger()->error('Invalid datakey '.$dataKey.' passed to method LangManager::getTranslation()');
- return '';
- }
- $str = $this->data->get($dataKey, $this->defaults[$dataKey]);
- foreach($args as $key => $arg){
- $str = str_replace('{%'.$key.'}', $arg, $str);
- }
- return str_replace('&', TextFormat::ESCAPE, $str);
- }
-
-}
\ No newline at end of file
diff --git a/src/AdvancedKits/tasks/CoolDownTask.php b/src/AdvancedKits/tasks/CoolDownTask.php
deleted file mode 100644
index 768a382..0000000
--- a/src/AdvancedKits/tasks/CoolDownTask.php
+++ /dev/null
@@ -1,22 +0,0 @@
-plugin = $plugin;
- }
-
- public function onRun(int $tick) : void{
- foreach($this->plugin->kits as $kit){
- $kit->processCoolDown();
- }
- }
-
-}
\ No newline at end of file
From 9ed67824a98d10e0522812f469a1a81390988e67 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:30:08 +1000
Subject: [PATCH 03/22] Delete .poggit.yml
---
.poggit.yml | 10 ----------
1 file changed, 10 deletions(-)
delete mode 100644 .poggit.yml
diff --git a/.poggit.yml b/.poggit.yml
deleted file mode 100644
index 5aeaffd..0000000
--- a/.poggit.yml
+++ /dev/null
@@ -1,10 +0,0 @@
---- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/luca28pet/AdvancedKits
-branches:
-- master
-projects:
- AdvancedKits:
- path: ""
- libs:
- - src: jojoe77777/FormAPI/libFormAPI
- version: ^1.3
-...
From 8388abbdd7dbb6fbf936b67d65e33c33babdbbed Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:30:21 +1000
Subject: [PATCH 04/22] Delete LICENSE
---
LICENSE | 661 --------------------------------------------------------
1 file changed, 661 deletions(-)
delete mode 100644 LICENSE
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 0ad25db..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
From db998f42b923aece8ba5f3c5b3e184dff1ee722b Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:30:34 +1000
Subject: [PATCH 05/22] Delete README.md
---
README.md | 153 ------------------------------------------------------
1 file changed, 153 deletions(-)
delete mode 100644 README.md
diff --git a/README.md b/README.md
deleted file mode 100644
index 2b1ac3f..0000000
--- a/README.md
+++ /dev/null
@@ -1,153 +0,0 @@
-AdvancedKits
-============
-
-A PocketMine-MP plugin that adds kits to your server with many features and support for UIs (FormAPI plugin) and custom enchantments (PiggyCustomEnchants)
-
-*Latest release: https://poggit.pmmp.io/p/AdvancedKits/*
-
-*Latest development phars: https://poggit.pmmp.io/ci/luca28pet/AdvancedKits/AdvancedKits*
-
-This plugin only supports PocketMine-MP. It might work on other forks as well, but please Do NOT open issues if you have problems with AdvancedKits and you are using a fork.
-
-**Features overview:**
-
-- Highly configurable
-- UI (user interface) support using libFormAPI (already included in the phars)
-- Custom enchantments support using PiggyCustomEnchants plugin
-- Custom permissions support
-- Built in permissions system if you don't want to use any permissions manager (see kits.yml)
-- Economy support: pay to get a kit. Support for EconomyS, PocketMoney and MassiveEconomy
-- Sign support: write a sign to let users get a kit
-- Time limit (cooldown) for kits
-- Option for one kit per life (see config.yml)
-- Execute commands with kits
-- Easy translation system
-
-**Commands:**
-The main command: /kit
-Alias for /kit: /ak, /advancedkits .
-
-- /kit [kitname] - Selects a kit. If no argument is kit name, opens the UI if possible or display a list of available kits.
-- /akreload - reloads kits.yml (when edited while the server is running)
-
-
-
-**Signs:**
-To let users get a kit through a sign, you can create one like this: (capitals don't matter)
-
-Line 1: [AdvancedKits]
-
-Line 2: kitname
-
-Line 3 & 4: Whatever you like
-
-
-The default kit is: testkit.
-You can add kits editing kits.yml (see "Kit settings").
-
-**UI support:**
-You don't need to install the plugin FormAPI as it is already included in the latest phars from poggit.
-To let users select a kit using a UI, enable 'show-form-no-args' in the config.yml
-Then, to open the UI, use /kit
-If you run this plugin in folder format, you will have to use DEVirion and manually install FormAPI, or disable 'show-form-no-args' in the config.yml
-
-**Permissions:**
-If 'permissions-mode' in the config.yml is true: with the permission advancedkits.kitname, a player will be able to get the kit named "kitname".
-Note: in the permission, the kit name HAS to be ALL in lowercase letters.
-If 'permissions-mode' in the config.yml is false, you can specify in the kits.yml which users (and in which worlds) can get a kit. (see kit settings)
-
-**Kit Settings:**
-
-In order to add a kit you will need to edit the config kits.yml .
-If you open that file with bloc notes, you will be not able to edit because it will be all in one line, so open it with WordPad, Notepad ++, ...
-You can add lots of kits, but remember to keep this format:
-
-```
-testkit:
- # ITEM FORMAT: "id:damage:count:name:ench_name:ench_level"
- # NO enchantments and NO custom name: "id:damage:count"
-
- # ONLY custom name: "id:damage:count:custom name"
-
- # ONLY enchantments: "id:damage:count:DEFAULT:enchantment1:level"
- # (Put DEFAULT in the name field if you do not want a custom name)
- # You can put as many enchantments as you want like this: "id:damage:count:DEFAULT:enchantment1:level:enchantment2:level" etc.
-
- # Enchantments AND custom name: "id:damage:count:custom name:enchantment1:level"
- # You can put as many enchantments as you want like this: "id:damage:count:custom name:enchantment1:level:enchantment2:level" etc.
-
- # You can write both numeric or string IDs
- items:
- - "260:0:10"
- - "267:0:1:Sword Name"
- helmet: "diamond_helmet:0:1"
- chestplate: "diamond_chestplate:0:1:DEFAULT:protection:1"
- leggings: "diamond_leggings:0:1:Leggings Name"
- boots: "diamond_boots:0:1"
-
- # Set items for specific slots, will override existing items. Only use if you want to assign items to specific slots, otherwise delete this.
- slots:
- 9: "golden_apple:0:5"
- 12: "bow:0:1"
-
- commands:
- - "tell {player} you got an awesome kit thanks to AdvancedKits plugin!"
-
- cooldown:
- hours: 24
- minutes: 30
-
- # EFFECT FORMAT: "name:seconds:amplifier"
- effects:
- - "speed:120:2"
-
- # Add a cost for the kit. Compatible with EconomyAPI, PocketMoney and MassiveEconomy
- # Put 0 if you want the kit to be free
- money: 50
-
- # If you do not use pureperms, use 'worlds' to specify in which worlds you want this kit to be used
- # Leave blank to let use the kit in all worlds
- worlds:
- - "kitpvp"
-
- # If you do not use pureperms, use 'users' to specify which players will be able to get this kit
- # Leave blank to let all the players use this kit
- users:
- - "luca28pet"
- - "dioconsole"
-
- # FormAPI users:
- # Img type: 'url' or 'path'
- img-type: ''
- # Put here the image URL/path
- img-data: ''
- # How the kit is displayed on the form
- form-name: 'Test Kit: 50$'
-```
-
-You can find a list of available enchantments in the file Enchantment.php in the pmmp source code: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/enchantment/Enchantment.php
-
-If you don't specify users or world, then the kit will be available to all users or in all worlds.
-If 'permissions-mode' in the config.yml is true, these parameters will be ignored
-
-
-**Translations:**
-
-You can easily translate plugin messages by editing the lang.properties file inside the plugin folder. Remember to don't change the "lang-version" parameter, as it is used for internal proposes.
-
-**Config:**
-```
----
-# Users are able to get only one kit per life
-one-kit-per-life: true
-
-# Users are able to get a kit if they log out even if they did not die (only works if one-kit-per-life: true)
-reset-on-logout: true
-
-# Use built in permission system even if using PurePerms
-force-builtin-permissions: false
-
-# Sign text (capitals and color codes don't matter)
-sign-text: "[AdvancedKits]"
-...
-```
From bfef6fdde625f2470352c278860cb7579d47365d Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:30:43 +1000
Subject: [PATCH 06/22] Delete plugin.yml
---
plugin.yml | 29 -----------------------------
1 file changed, 29 deletions(-)
delete mode 100644 plugin.yml
diff --git a/plugin.yml b/plugin.yml
deleted file mode 100644
index 98aa213..0000000
--- a/plugin.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: AdvancedKits
-main: AdvancedKits\Main
-version: 5.3.0
-api: [3.0.0]
-author: luca28pet
-description: Add kits to your server
-website: https://github.com/luca28pet/AdvancedKits
-softdepend: [PiggyCustomEnchants]
-commands:
- kit:
- description: Get a kit!
- usage: "/kit "
- aliases: [ak, advancedkits]
- permission: advancedkits.command
- akreload:
- descrpition: Reload Kits settings
- usage: "/akreload"
- permission: advancedkits.admin
-permissions:
- advancedkits:
- description: "Root permission"
- default: false
- children:
- advancedkits.command:
- description: "Allows the user to run /kit command"
- default: true
- advancedkits.admin:
- description: "Allows to manage admin features"
- default: op
From 97421d8c354a2e78fd11104d1b8d7e65f6867b52 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:32:05 +1000
Subject: [PATCH 07/22] Add files via upload
---
Makefile | 22 ++
composer.json | 51 ++++
plugin.yml | 28 ++
resources/config.yml | 20 ++
resources/kits.yml | 52 ++++
src/AdvancedKits/AdvancedKits.php | 192 ++++++++++++
src/AdvancedKits/ConfigParser.php | 285 ++++++++++++++++++
src/AdvancedKits/event/KitRequestEvent.php | 81 +++++
src/AdvancedKits/kit/Kit.php | 126 ++++++++
src/AdvancedKits/kit/KitsManager.php | 100 ++++++
src/AdvancedKits/lang/LangManager.php | 62 ++++
.../perm/DefaultPermissionChecker.php | 26 ++
src/AdvancedKits/perm/PermissionChecker.php | 16 +
13 files changed, 1061 insertions(+)
create mode 100644 Makefile
create mode 100644 composer.json
create mode 100644 plugin.yml
create mode 100644 resources/config.yml
create mode 100644 resources/kits.yml
create mode 100644 src/AdvancedKits/AdvancedKits.php
create mode 100644 src/AdvancedKits/ConfigParser.php
create mode 100644 src/AdvancedKits/event/KitRequestEvent.php
create mode 100644 src/AdvancedKits/kit/Kit.php
create mode 100644 src/AdvancedKits/kit/KitsManager.php
create mode 100644 src/AdvancedKits/lang/LangManager.php
create mode 100644 src/AdvancedKits/perm/DefaultPermissionChecker.php
create mode 100644 src/AdvancedKits/perm/PermissionChecker.php
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6ce4efa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,22 @@
+include config.mk
+
+PHAR := AdvancedKits.phar
+
+all: $(PHAR)
+
+phpstan:
+ $(PHP_PM) $(COMPOSER_PHAR) install
+ $(PHP_PM) vendor/bin/phpstan analyse
+
+clean:
+ rm -rf shaded $(PHAR)
+
+shade: clean phpstan
+ $(PHP_PM) $(COMPOSER_PHAR) install --no-dev
+ $(PHP_PM) $(SHADER_SCRIPT)
+
+$(PHAR): shade
+ $(PHP_PM) $(DEVTOOLS_PHAR) --make shaded --out $(PHAR)
+
+.PHONY: phpstan shade clean all
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..89f205c
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,51 @@
+{
+ "name": "luca28pet/advancedkits",
+ "description": "Kits plugin",
+ "version": "6.0.0",
+ "minimum-stability": "stable",
+ "license": "AGPL-3.0",
+ "authors": [
+ {
+ "name": "luca28pet"
+ }
+ ],
+ "require-dev": {
+ "phpstan/phpstan": "^1.2.0",
+ "phpstan/extension-installer": "^1.1.0",
+ "phpstan/phpstan-strict-rules": "^1.1.0",
+ "pocketmine/pocketmine-mp": "^4.0.0"
+ },
+ "require": {
+ "dktapps/pmforms": "2.0.0"
+ },
+ "repositories": [
+ {
+ "type": "package",
+ "package": {
+ "name": "dktapps/pmforms",
+ "version": "2.0.0",
+ "dist": {
+ "url": "https://poggit.pmmp.io/r/149990/pmforms_dev-12.phar",
+ "type": "phar",
+ "shasum": "bb28be9c3e877645e163b260468a8e879314d956"
+ },
+ "source": {
+ "type": "git",
+ "url": "https://github.com/dktapps-pm-pl/pmforms.git",
+ "reference": "80b10dfcc68633a3a659c57cc9e2bd50cd2166e4"
+ },
+ "autoload": {
+ "psr-0": {
+ "dktapps\\pmforms\\": "src"
+ }
+ }
+ }
+ }
+ ],
+ "autoload": {
+ "psr-0": {
+ "AdvancedKits\\": "src"
+ }
+ }
+}
+
diff --git a/plugin.yml b/plugin.yml
new file mode 100644
index 0000000..161bd96
--- /dev/null
+++ b/plugin.yml
@@ -0,0 +1,28 @@
+name: AdvancedKits
+main: AdvancedKits\AdvancedKits
+version: 6.0.0
+api: 4.0.0
+author: luca28pet
+description: Add kits to your server
+website: https://github.com/luca28pet/AdvancedKits
+commands:
+ kit:
+ description: Get a kit!
+ usage: /kit
+ permission: advancedkits.command.kit
+ akreload:
+ descrpition: Reload Kits settings
+ usage: /akreload
+ permission: advancedkits.command.akreload
+ givekit:
+ description: Give a kit to someone
+ usage: /givekit
+ permission: advancedkits.command.givekit
+permissions:
+ advancedkits.command.kit:
+ default: true
+ advancedkits.command.akreload:
+ default: op
+ advancedkits.command.givekit:
+ default: op
+
diff --git a/resources/config.yml b/resources/config.yml
new file mode 100644
index 0000000..256060b
--- /dev/null
+++ b/resources/config.yml
@@ -0,0 +1,20 @@
+---
+# Users are able to get only one kit per life
+one-kit-per-life: true
+
+# Users are able to get a kit if they log out even if they did not die (only works if one-kit-per-life: true)
+reset-on-logout: true
+
+# If true, you will need to give players the permission advancedkits.kitname with your permissions manager of choice to let them get a kit
+# If false, no permissions will be used for kits. You will have to specify manually the players/worlds that can get a kit from the kits.yml file
+permissions-mode: true
+
+# Sign text (capitals and color codes don't matter)
+sign-text: "[AdvancedKits]"
+
+# Kits you don't have the permission to get will be hidden from the kits list
+hide-no-perm-kits: false
+
+# "form" or "chat"
+kit-list-type: "form"
+...
diff --git a/resources/kits.yml b/resources/kits.yml
new file mode 100644
index 0000000..f389e1c
--- /dev/null
+++ b/resources/kits.yml
@@ -0,0 +1,52 @@
+---
+- name: TestKit
+ # Items list
+ items:
+ - alias: diamond_sword
+ count: 1
+ custom-name: My Diamond Sword
+ enchantments:
+ - name: protection
+ level: 1
+ - alias: apple
+ count: 5
+
+ # Armor
+ helmet:
+ alias: diamond_helmet
+ chestplate:
+ alias: diamond_chestplate
+ leggings:
+ alias: diamond_leggings
+ boots:
+ alias: diamond_boots
+
+ # Set items for specific slots, will override existing items. Only use if you want to assign items to specific slots, otherwise delete this.
+ slots:
+ 12:
+ alias: bow
+ count: 1
+
+ commands:
+ - "tell {player} you got an awesome kit thanks to AdvancedKits plugin!"
+
+ cooldown:
+ hours: 24
+ minutes: 30
+
+ # EFFECT FORMAT: "name:seconds:amplifier"
+ effects:
+ - "speed:120:2"
+
+ # Add a cost for the kit. Compatible with EconomyAPI, PocketMoney and MassiveEconomy
+ # Put 0 if you want the kit to be free
+ money: 50
+
+ # FormAPI users:
+ # Img type: 'url' or 'path'
+ img-type: ''
+ # Put here the image URL/path
+ img-data: ''
+ # How the kit is displayed on the form
+ form-name: 'Test Kit: 50$'
+...
diff --git a/src/AdvancedKits/AdvancedKits.php b/src/AdvancedKits/AdvancedKits.php
new file mode 100644
index 0000000..29b5a4d
--- /dev/null
+++ b/src/AdvancedKits/AdvancedKits.php
@@ -0,0 +1,192 @@
+loadKitsSettings();
+ if ($kits === null) {
+ return;
+ }
+ $this->loadOtherSettings();
+ $this->langManager = new LangManager($this->getDataFolder().'lang.properties', $this->getLogger());
+ $this->permChecker = new DefaultPermissionChecker($kits);
+ $this->kitsManager = new KitsManager(
+ array_combine(array_map(fn(Kit $kit) => $kit->getName(), $kits), $kits),
+ $this->permChecker,
+ $this->langManager
+ );
+ }
+
+ private function loadOtherSettings() : void {
+ $this->saveResource('config.yml');
+ $contents = file_get_contents($this->getDataFolder().'config.yml');
+ if ($contents === false) {
+ $this->getLogger()->error('Unable to open config.yml');
+ $this->getServer()->getPluginManager()->disablePlugin($this);
+ return;
+ }
+ $data = yaml_parse($contents);
+ if (!is_array($data)) {
+ $this->getLogger()->error('Configuration error in config.yml');
+ $this->getServer()->getPluginManager()->disablePlugin($this);
+ return;
+ }
+ try {
+ $this->kitListType = ConfigParser::getStringAlternative($data['kit-list-type'] ?? null, ['chat', 'form']);
+ $this->hideNoPermKits = ConfigParser::getBool($data['hide-no-perm-kits'] ?? null);
+ } catch (\InvalidArgumentException $e) {
+ $this->getLogger()->error('Configuration error in config.yml, details:');
+ do {
+ $this->getLogger()->error($e->getMessage());
+ } while (($e = $e->getPrevious()) !== null);
+ $this->getServer()->getPluginManager()->disablePlugin($this);
+ return;
+ }
+ }
+
+ /**
+ * @return array
+ */
+ private function loadKitsSettings() : ?array {
+ $this->saveResource('kits.yml');
+ $contents = file_get_contents($this->getDataFolder().'kits.yml');
+ if ($contents === false) {
+ $this->getLogger()->error('Unable to open kits.yml');
+ $this->getServer()->getPluginManager()->disablePlugin($this);
+ return null;
+ }
+ $data = yaml_parse($contents);
+ try {
+ $kits = ConfigParser::getList($data, [ConfigParser::class, 'getKit']);
+ } catch (\InvalidArgumentException $e) {
+ $this->getLogger()->error('Configuration error in kits.yml, details:');
+ do {
+ $this->getLogger()->error($e->getMessage());
+ } while (($e = $e->getPrevious()) !== null);
+ $this->getServer()->getPluginManager()->disablePlugin($this);
+ return null;
+ }
+ return $kits;
+ }
+
+ public function getKitsManager() : KitsManager {
+ return $this->kitsManager;
+ }
+
+ public function getLangManager() : LangManager {
+ return $this->langManager;
+ }
+
+ private function doKitRequest(Player $p, Kit $kit) : void {
+ $this->kitsManager->kitRequest($p, $kit, function(bool $reqAccepted, ?string $reason) use ($p, $kit) : void {
+ if (!$p->isOnline()) {
+ return;
+ }
+ if ($reqAccepted) {
+ $kit->giveTo($p);
+ $p->sendMessage($this->langManager->getTranslation('sel-kit', [$kit->getName()]));
+ } else {
+ $p->sendMessage($reason ?? '');
+ }
+ });
+ }
+
+ public function onCommand(CommandSender $sn, Command $cmd, string $lbl, array $args) : bool {
+ switch($cmd->getName()) {
+ case 'kit':
+ switch (count($args)) {
+ case 0:
+ if ($sn instanceof Player && $this->hideNoPermKits) {
+ $kits = array_filter($this->kitsManager->getKits(),
+ fn(Kit $kit) => $this->permChecker->canPlayerGetKit($sn, $kit));
+ } else {
+ $kits = $this->kitsManager->getKits();
+ }
+ switch ($this->kitListType) {
+ case 'chat':
+ $sn->sendMessage($this->langManager->getTranslation(
+ 'av-kits', [implode(', ', array_map(fn(Kit $kit) => $kit->getName(), $kits))]));
+ break;
+ case 'form':
+ $options = array_map(fn(Kit $kit) => new MenuOption($kit->getName()), $kits);
+ $form = new MenuForm($this->langManager->getTranslation('form-title', []), '', $options, function(Player $p, int $opt) use (&$form) : void {
+ $option = $form?->getOption($opt);
+ if ($option === null) {
+ return;
+ }
+ $kit = $this->kitsManager->getKitByName($option->getText());
+ if ($kit === null) {
+ return;
+ }
+ $this->doKitRequest($p, $kit);
+ });
+ break;
+ default:
+ throw new \LogicException('This should never happen');
+ }
+ return true;
+ case 1:
+ if (!($sn instanceof Player)) {
+ return true;
+ }
+ $kitName =& $args[0];
+ $kit = $this->kitsManager->getKitByName($kitName);
+ if ($kit !== null) {
+ $this->doKitRequest($sn, $kit);
+ } else {
+ $sn->sendMessage($this->langManager->getTranslation('no-kit', [$kitName]));
+ }
+ return true;
+ default:
+ return false;
+ }
+ case 'givekit':
+ if (count($args) !== 2) {
+ return false;
+ }
+ $kitName =& $args[0];
+ $playerName =& $args[1];
+ $kit = $this->kitsManager->getKitByName($kitName);
+ if ($kit === null) {
+ $sn->sendMessage($this->langManager->getTranslation('no-kit', [$kitName]));
+ return true;
+ }
+ $player = $this->getServer()->getPlayerByPrefix($playerName);
+ if ($player === null) {
+ $sn->sendMessage($this->langManager->getTranslation('player-offline', [$playerName]));
+ return true;
+ }
+ $kit->giveTo($player);
+ return true;
+ case 'akreload':
+ //todo
+ return true;
+ }
+ return true;
+ }
+}
+
diff --git a/src/AdvancedKits/ConfigParser.php b/src/AdvancedKits/ConfigParser.php
new file mode 100644
index 0000000..9e73024
--- /dev/null
+++ b/src/AdvancedKits/ConfigParser.php
@@ -0,0 +1,285 @@
+ null, 'chestplate' => null, 'leggings' => null, 'boots' => null];
+ foreach ($armor as $k => $_) {
+ if (isset($node[$k])) {
+ try {
+ $tmp = self::getItem($node[$k]);
+ if (!($tmp instanceof Armor) && !($tmp->equals(ItemFactory::air()))) {
+ throw new \InvalidArgumentException('Armor item is not an armor');
+ }
+ $armor[$k] = $tmp;
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Kit node: error loading '.$k, previous: $e);
+ }
+ }
+ }
+
+ $cost = 0;
+ if (isset($node['cost'])) {
+ try {
+ $cost = self::getInt($node['cost']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Kit node: error loading cost', previous: $e);
+ }
+ }
+
+ $commands = [];
+ if (isset($node['commands'])) {
+ try {
+ $commands = self::getList($node['commands'], [self::class, 'getString']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Kit node: error loading commands', previous: $e);
+ }
+ }
+
+ if (!isset($node['clear-inventory'])) {
+ throw new \InvalidArgumentException('Kiit node must have a \'clear-inventory\' field');
+ }
+ try {
+ $clearInventory = self::getBool($node['clear-inventory']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Kit node: error loading clear-inventory', previous: $e);
+ }
+
+ if (!isset($node['overwrite-armor'])) {
+ throw new \InvalidArgumentException('Kiit node must have a \'overwrite-armor\' field');
+ }
+ try {
+ $overWriteArmor = self::getBool($node['overwrite-armor']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Kit node: error loading overwrite-armor', previous: $e);
+ }
+
+ return new Kit(
+ $name,
+ $slotFreeItems,
+ $slottedItems,
+ $armor['helmet'], $armor['chestplate'], $armor['leggings'], $armor['boots'],
+ $cost,
+ $commands,
+ $clearInventory,
+ $overWriteArmor
+ );
+ }
+
+ public static function getItem(mixed $node) : Item {
+ if (!is_array($node)) {
+ throw new \InvalidArgumentException('Item node must be an array, '.gettype($node).' found');
+ }
+
+ if (!isset($node['alias'])) {
+ throw new \InvalidArgumentException('Item node must have an \'alias\' field');
+ }
+ try {
+ $alias = self::getString($node['alias']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Item node: error loading alias', previous: $e);
+ }
+ $item = StringToItemParser::getInstance()->parse($alias);
+ if ($item === null) {
+ throw new \InvalidArgumentException('Item node has unknown alias '.$alias);
+ }
+
+ $item->setCount(1);
+ if(isset($node['count'])) {
+ try {
+ $count = self::getInt($node['count']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Item node: error loading count', previous: $e);
+ }
+ $item->setCount($count);
+ }
+
+ if (isset($node['custom-name'])) {
+ try {
+ $customName = self::getString($node['custom-name']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Item node: error loading custom-name', previous: $e);
+ }
+ $item->setCustomName($customName);
+ }
+
+ if (isset($node['enchantments'])) {
+ try {
+ $enchs = self::getList($node['enchantments'], [self::class, 'getEnchantmentInstance']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Item node: error loading enchantments', previous: $e);
+ }
+ foreach ($enchs as $ench) {
+ $item->addEnchantment($ench);
+ }
+ }
+
+ if (isset($node['custom-nbt'])) {
+ try {
+ $nbtData = self::getString($node['custom-nbt']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Item node: error loading custom-nbt', previous: $e);
+ }
+ try {
+ $nbt = JsonNbtParser::parseJson($nbtData);
+ $item->setNamedTag($nbt);
+ } catch (NbtDataException $e) {
+ throw new \InvalidArgumentException('Item node: error loading custom-nbt', previous: $e);
+ }
+ }
+
+ return $item;
+ }
+
+ public static function getString(mixed $node) : string {
+ if (!is_string($node)) {
+ throw new \InvalidArgumentException('String node contains wrong type '.gettype($node));
+ }
+ return $node;
+ }
+
+ public static function getInt(mixed $node) : int {
+ if (!is_int($node)) {
+ throw new \InvalidArgumentException('Int node contains wrong type '.gettype($node));
+ }
+ return $node;
+ }
+
+ public static function getBool(mixed $node) : bool {
+ if (!is_bool($node)) {
+ throw new \InvalidArgumentException('Bool node contains wrong type '.gettype($node));
+ }
+ return $node;
+ }
+
+ /**
+ * @param array $alternatives
+ */
+ public static function getStringAlternative(mixed $node, array $alternatives) : string {
+ if (!is_string($node)) {
+ throw new \InvalidArgumentException('String alternative node contains wrong type '.gettype($node));
+ }
+ foreach ($alternatives as $alt) {
+ if ($node === $alt) {
+ return $alt;
+ }
+ }
+ throw new \InvalidArgumentException(
+ 'String alternative node contains unknown option '.$node.', possible values: '.implode(', ', $alternatives));
+ }
+
+ public static function getEnchantmentInstance(mixed $node) : EnchantmentInstance {
+ if (!is_array($node)) {
+ throw new \InvalidArgumentException('Enchantment node must be an array, '.gettype($node).' found');
+ }
+
+ if (!isset($node['name'])) {
+ throw new \InvalidArgumentException('Enchantment node must have a \'name\' field');
+ }
+ $ench = StringToEnchantmentParser::getInstance()->parse($node['name']);
+ if ($ench === null) {
+ throw new \InvalidArgumentException('Enchantment node has unknown name '.$node['name']);
+ }
+
+ if (!isset($node['level'])) {
+ throw new \InvalidArgumentException('Enchantment node must have a \'level\' field');
+ }
+ try {
+ $level = self::getInt($node['level']);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Enchantment node: error loading level', previous: $e);
+ }
+
+ return new EnchantmentInstance($ench, $level);
+ }
+
+ /**
+ * @template T
+ * @param callable(mixed) : T $getter a function that returns T or throws an InvalidArgumentException if not possible
+ * @return list
+ */
+ public static function getList(mixed $node, callable $getter) : array {
+ if (!is_array($node)) {
+ throw new \InvalidArgumentException('List node must be of type array, '.gettype($node).' found');
+ }
+ $list = [];
+ foreach ($node as $n) {
+ try {
+ $list[] = $getter($n);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('List node: error loading element', previous: $e);
+ }
+ }
+ return $list;
+ }
+
+ /**
+ * @template K of int|string
+ * @template V
+ * @param callable(mixed) : K $keyGetter a function that returns K or throws an InvalidArgumentException if not possible
+ * @param callable(mixed) : V $valueGetter a function that returns V or throws an InvalidArgumentException if not possible
+ * @return array
+ */
+ public static function getMap(mixed $node, callable $keyGetter, callable $valueGetter) : array {
+ if (!is_array($node)) {
+ throw new \InvalidArgumentException('Map node must be of type array, '.gettype($node).' found');
+ }
+ $map = [];
+ foreach ($node as $nk => $nv) {
+ try {
+ $map[$keyGetter($nk)] = $valueGetter($nv);
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Map node: error loading pair', previous: $e);
+ }
+ }
+ return $map;
+ }
+}
+
diff --git a/src/AdvancedKits/event/KitRequestEvent.php b/src/AdvancedKits/event/KitRequestEvent.php
new file mode 100644
index 0000000..72c8f7a
--- /dev/null
+++ b/src/AdvancedKits/event/KitRequestEvent.php
@@ -0,0 +1,81 @@
+ */
+ private array $denialReasons = [];
+
+ private Player $player;
+ private Kit $kit;
+
+ public function __construct(Player $player, Kit $kit) {
+ $this->player = $player;
+ $this->kit = $kit;
+ }
+
+ public function getPlayer() : Player {
+ return $this->player;
+ }
+
+ public function getKit() : Kit {
+ return $this->kit;
+ }
+
+ public function deny(int $flag, string $reason) : void {
+ if (!in_array($flag, self::REQUEST_DENIAL_REASONS_PRIORITY, true)) {
+ throw new \DomainException('invalid flag');
+ }
+ $this->denialReasons[$flag] = $reason;
+ }
+
+ public function allow() : void {
+ $this->denialReasons = [];
+ }
+
+ /**
+ * @return array
+ */
+ public function getDenialReasons() : array {
+ return $this->denialReasons;
+ }
+
+ public function isAllowed() : bool {
+ return count($this->denialReasons) === 0;
+ }
+
+ public function getFinalReason() : ?string {
+ foreach (self::REQUEST_DENIAL_REASONS_PRIORITY as $flag) {
+ if (isset($this->denialReasons[$flag])) {
+ return $this->denialReasons[$flag];
+ }
+ }
+ return null;
+ }
+
+ public function isCancelled() : bool {
+ return !$this->isAllowed();
+ }
+}
+
diff --git a/src/AdvancedKits/kit/Kit.php b/src/AdvancedKits/kit/Kit.php
new file mode 100644
index 0000000..a9b6bf9
--- /dev/null
+++ b/src/AdvancedKits/kit/Kit.php
@@ -0,0 +1,126 @@
+ */
+ private array $slotFreeItems,
+ /** @var array */
+ private array $slotItems,
+ private ?Item $helmet,
+ private ?Item $chestplate,
+ private ?Item $leggings,
+ private ?Item $boots,
+ private int $cost,
+ /** @var list */
+ private array $commands,
+ private bool $clearInventory,
+ private bool $overWriteArmor
+ ) {
+ if ($this->cost < 0) {
+ throw new \DomainException('$cost must be non negative');
+ }
+ }
+
+ public function getName() : string {
+ return $this->name;
+ }
+
+ /**
+ * @return array-
+ */
+ public function getSlotFreeItems() : array {
+ return $this->slotFreeItems;
+ }
+
+ /**
+ * @return array
+ */
+ public function getSlotItems() : array {
+ return $this->slotItems;
+ }
+
+ public function getHelmet() : ?Item {
+ return $this->helmet;
+ }
+
+ public function getChestplate() : ?Item {
+ return $this->chestplate;
+ }
+
+ public function getLeggigns() : ?Item {
+ return $this->leggings;
+ }
+
+ public function getBoots() : ?Item {
+ return $this->boots;
+ }
+
+ /**
+ * @return array
+ */
+ public function getCommands() : array {
+ return $this->commands;
+ }
+
+ public function getClearInventory() : bool {
+ return $this->clearInventory;
+ }
+
+ public function getOverWriteArmor() : bool {
+ return $this->overWriteArmor;
+ }
+
+ /**
+ * Give the kit to a player without performing any additional checks
+ */
+ public function giveTo(Player $p) : void {
+ if ($this->clearInventory) {
+ $p->getInventory()->clearAll();
+ $p->getArmorInventory()->clearAll();
+ }
+ foreach ($this->slotItems as $slot => $item) {
+ $p->getInventory()->setItem($slot, $item);
+ }
+ $p->getInventory()->addItem(...$this->slotFreeItems);
+ if ($this->helmet !== null) {
+ if ($p->getArmorInventory()->getHelmet()->isNull() || $this->overWriteArmor) {
+ $p->getArmorInventory()->setHelmet($this->helmet);
+ } else {
+ $p->getInventory()->addItem($this->helmet);
+ }
+ }
+ if ($this->chestplate !== null) {
+ if ($p->getArmorInventory()->getChestplate()->isNull() || $this->overWriteArmor) {
+ $p->getArmorInventory()->setChestplate($this->chestplate);
+ } else {
+ $p->getInventory()->addItem($this->chestplate);
+ }
+ }
+ if ($this->leggings !== null) {
+ if ($p->getArmorInventory()->getLeggings()->isNull() || $this->overWriteArmor) {
+ $p->getArmorInventory()->setLeggings($this->leggings);
+ } else {
+ $p->getInventory()->addItem($this->leggings);
+ }
+ }
+ if ($this->boots !== null) {
+ if ($p->getArmorInventory()->getBoots()->isNull() || $this->overWriteArmor) {
+ $p->getArmorInventory()->setBoots($this->boots);
+ } else {
+ $p->getInventory()->addItem($this->boots);
+ }
+ }
+ foreach ($this->commands as $command) {
+ $p->getServer()->dispatchCommand(new ConsoleCommandSender($p->getServer(), $p->getServer()->getLanguage()), $command);
+ }
+ }
+}
+
diff --git a/src/AdvancedKits/kit/KitsManager.php b/src/AdvancedKits/kit/KitsManager.php
new file mode 100644
index 0000000..0d8d96f
--- /dev/null
+++ b/src/AdvancedKits/kit/KitsManager.php
@@ -0,0 +1,100 @@
+ */
+ private array $kits;
+ private PermissionChecker $permChecker;
+ private LangManager $langManager;
+
+ /**
+ * @param array $kits
+ */
+ public function __construct(array $kits, PermissionChecker $permChecker, LangManager $langManager) {
+ $this->kits = array_change_key_case($kits, CASE_LOWER);
+ if (count($this->kits) !== count($kits)) {
+ throw new \InvalidArgumentException('Kit names are case insensitive');
+ }
+ $this->permChecker = $permChecker;
+ $this->langManager = $langManager;
+ }
+
+ /**
+ * @return array
+ */
+ public function getKits() : array {
+ return $this->kits;
+ }
+
+ public function getKitByName(string $name) : ?Kit {
+ return $this->kits[strtolower($name)] ?? null;
+ }
+
+ /**
+ * @param callable(bool $accepted, ?string $reason) : void $callback
+ */
+ public function kitRequest(Player $p, Kit $kit, callable $callback) : void {
+ $ev = new KitRequestEvent($p, $kit);
+
+ if (!$this->permChecker->canPlayerGetKit($p, $kit)) {
+ $ev->deny(KitRequestEvent::REQUEST_DENIAL_REASON_PERMISSION, $this->langManager->getTranslation('no-perm', [$kit->getName()]));
+ }
+
+ if (!self::inventoryCheck($p->getInventory(), $kit)) {
+ $ev->deny(KitRequestEvent::REQUEST_DENIAL_REASON_FULL_INVENTORY, $this->langManager->getTranslation('full-inv', [$kit->getName()]));
+ }
+
+ //todo check economy, cooldown
+ $ev->call();
+ $callback($ev->isAllowed(), $ev->getFinalReason());
+ }
+
+ private static function inventoryCheck(Inventory $inv, Kit $kit) : bool {
+ $tmpInv = new SimpleInventory($inv->getSize());
+ $tmpInv->setContents($inv->getContents());
+ foreach ($kit->getSlotItems() as $slot => $item) {
+ $tmpInv->setItem($slot, $item);
+ }
+ foreach ($kit->getSlotFreeItems() as $item) {
+ if (!$tmpInv->canAddItem($item)) {
+ return false;
+ }
+ $tmpInv->addItem($item);
+ }
+ if ($kit->getHelmet()?->isNull() === false && !$kit->getOverWriteArmor()) {
+ if (!$tmpInv->canAddItem($kit->getHelmet())) {
+ return false;
+ }
+ $tmpInv->addItem($kit->getHelmet());
+ }
+ if ($kit->getChestplate()?->isNull() === false && !$kit->getOverWriteArmor()) {
+ if (!$tmpInv->canAddItem($kit->getChestplate())) {
+ return false;
+ }
+ $tmpInv->addItem($kit->getChestplate());
+ }
+ if ($kit->getLeggigns()?->isNull() === false && !$kit->getOverWriteArmor()) {
+ if (!$tmpInv->canAddItem($kit->getLeggigns())) {
+ return false;
+ }
+ $tmpInv->addItem($kit->getLeggigns());
+ }
+ if ($kit->getBoots()?->isNull() === false && !$kit->getOverWriteArmor()) {
+ if (!$tmpInv->canAddItem($kit->getBoots())) {
+ return false;
+ }
+ $tmpInv->addItem($kit->getBoots());
+ }
+ return true;
+ }
+}
+
diff --git a/src/AdvancedKits/lang/LangManager.php b/src/AdvancedKits/lang/LangManager.php
new file mode 100644
index 0000000..e5a6381
--- /dev/null
+++ b/src/AdvancedKits/lang/LangManager.php
@@ -0,0 +1,62 @@
+ self::LANG_VERSION,
+ 'in-game' => self::PREFIX.'Please run this command in game',
+ 'av-kits' => self::PREFIX.'Available kits: {%0}',
+ 'no-kit' => self::PREFIX.'Kit {%0} does not exist',
+ 'reload' => self::PREFIX.'Reloaded kits settings',
+ 'sel-kit' => self::PREFIX.'Selected kit: {%0}',
+ 'cant-afford' => self::PREFIX.'You cannot afford kit: {%0}',
+ 'one-per-life' => self::PREFIX.'You can only get one kit per life',
+ 'cooldown1' => self::PREFIX.'Kit {%0} is in coolDown at the moment',
+ 'cooldown2' => self::PREFIX.'You will be able to get it in {%0}',
+ 'no-perm' => self::PREFIX.'You haven\'t the permission to use kit {%0}',
+ 'cooldown-format1' => self::PREFIX.'{%0} minutes',
+ 'cooldown-format2' => self::PREFIX.'{%0} hours and {%1} minutes',
+ 'cooldown-format3' => self::PREFIX.'{%0} hours',
+ 'no-sign-on-kit' => self::PREFIX.'On this sign, the kit is not specified',
+ 'no-perm-sign' => self::PREFIX.'You don\'t have permission to create a sign kit',
+ 'form-title' => self::PREFIX.'Available Kits',
+ 'full-inv' => self::PREFIX.'Your inventory is full, kit {%0} was not given',
+ 'player-offline' => self::PREFIX.'Player {%0} is not online'
+ ];
+ private const PREFIX = TextFormat::AQUA.'['.TextFormat::RED.'AdvancedKits'.TextFormat::AQUA.'] '.TextFormat::WHITE;
+
+ /** @var array */
+ private array $data;
+
+ public function __construct(string $configPath, ?\Logger $logger){
+ $this->data = (new Config($configPath, Config::PROPERTIES, self::DEFAULTS))->getAll();
+ if(!isset($this->data['lang-version']) || $this->data['lang-version'] != self::LANG_VERSION){
+ if ($logger !== null) {
+ $logger->warning('Translation file is outdated. The old file has been renamed and a new one has been created');
+ }
+ @rename($configPath, $configPath.'.old');
+ $this->data = (new Config($configPath, Config::PROPERTIES, self::DEFAULTS))->getAll();
+ }
+ }
+
+ /**
+ * @param list $args
+ */
+ public function getTranslation(string $dataKey, array $args) : string{
+ if(!isset(self::DEFAULTS[$dataKey])){
+ throw new \InvalidArgumentException('Invalid datakey '.$dataKey.' passed to method LangManager::getTranslation()');
+ }
+ $str = $this->data[$dataKey] ?? self::DEFAULTS[$dataKey];
+ foreach($args as $key => $arg){
+ $str = str_replace('{%'.$key.'}', $arg, strval($str));
+ }
+ return TextFormat::colorize(strval($str));
+ }
+}
+
diff --git a/src/AdvancedKits/perm/DefaultPermissionChecker.php b/src/AdvancedKits/perm/DefaultPermissionChecker.php
new file mode 100644
index 0000000..4075822
--- /dev/null
+++ b/src/AdvancedKits/perm/DefaultPermissionChecker.php
@@ -0,0 +1,26 @@
+ $kits
+ */
+ public function __construct(array $kits) {
+ foreach ($kits as $kit) {
+ PermissionManager::getInstance()->addPermission(new Permission('advancedkits.'.strtolower($kit->getName())));
+ }
+ }
+
+ public function canPlayerGetKit(Player $p, Kit $kit) : bool {
+ return $p->hasPermission('advancedkits.'.strtolower($kit->getName()));
+ }
+}
+
diff --git a/src/AdvancedKits/perm/PermissionChecker.php b/src/AdvancedKits/perm/PermissionChecker.php
new file mode 100644
index 0000000..21c3b15
--- /dev/null
+++ b/src/AdvancedKits/perm/PermissionChecker.php
@@ -0,0 +1,16 @@
+
Date: Fri, 11 Aug 2023 07:32:37 +1000
Subject: [PATCH 08/22] Update plugin.yml
---
plugin.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugin.yml b/plugin.yml
index 161bd96..5ad9a34 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,7 +1,7 @@
name: AdvancedKits
main: AdvancedKits\AdvancedKits
-version: 6.0.0
-api: 4.0.0
+version: 7.0.0
+api: 5.0.0
author: luca28pet
description: Add kits to your server
website: https://github.com/luca28pet/AdvancedKits
From cfe7b68bdcf618a662843419a59749e76848c636 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:32:55 +1000
Subject: [PATCH 09/22] Add files via upload
---
README.md | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2b1ac3f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,153 @@
+AdvancedKits
+============
+
+A PocketMine-MP plugin that adds kits to your server with many features and support for UIs (FormAPI plugin) and custom enchantments (PiggyCustomEnchants)
+
+*Latest release: https://poggit.pmmp.io/p/AdvancedKits/*
+
+*Latest development phars: https://poggit.pmmp.io/ci/luca28pet/AdvancedKits/AdvancedKits*
+
+This plugin only supports PocketMine-MP. It might work on other forks as well, but please Do NOT open issues if you have problems with AdvancedKits and you are using a fork.
+
+**Features overview:**
+
+- Highly configurable
+- UI (user interface) support using libFormAPI (already included in the phars)
+- Custom enchantments support using PiggyCustomEnchants plugin
+- Custom permissions support
+- Built in permissions system if you don't want to use any permissions manager (see kits.yml)
+- Economy support: pay to get a kit. Support for EconomyS, PocketMoney and MassiveEconomy
+- Sign support: write a sign to let users get a kit
+- Time limit (cooldown) for kits
+- Option for one kit per life (see config.yml)
+- Execute commands with kits
+- Easy translation system
+
+**Commands:**
+The main command: /kit
+Alias for /kit: /ak, /advancedkits .
+
+- /kit [kitname] - Selects a kit. If no argument is kit name, opens the UI if possible or display a list of available kits.
+- /akreload - reloads kits.yml (when edited while the server is running)
+
+
+
+**Signs:**
+To let users get a kit through a sign, you can create one like this: (capitals don't matter)
+
+Line 1: [AdvancedKits]
+
+Line 2: kitname
+
+Line 3 & 4: Whatever you like
+
+
+The default kit is: testkit.
+You can add kits editing kits.yml (see "Kit settings").
+
+**UI support:**
+You don't need to install the plugin FormAPI as it is already included in the latest phars from poggit.
+To let users select a kit using a UI, enable 'show-form-no-args' in the config.yml
+Then, to open the UI, use /kit
+If you run this plugin in folder format, you will have to use DEVirion and manually install FormAPI, or disable 'show-form-no-args' in the config.yml
+
+**Permissions:**
+If 'permissions-mode' in the config.yml is true: with the permission advancedkits.kitname, a player will be able to get the kit named "kitname".
+Note: in the permission, the kit name HAS to be ALL in lowercase letters.
+If 'permissions-mode' in the config.yml is false, you can specify in the kits.yml which users (and in which worlds) can get a kit. (see kit settings)
+
+**Kit Settings:**
+
+In order to add a kit you will need to edit the config kits.yml .
+If you open that file with bloc notes, you will be not able to edit because it will be all in one line, so open it with WordPad, Notepad ++, ...
+You can add lots of kits, but remember to keep this format:
+
+```
+testkit:
+ # ITEM FORMAT: "id:damage:count:name:ench_name:ench_level"
+ # NO enchantments and NO custom name: "id:damage:count"
+
+ # ONLY custom name: "id:damage:count:custom name"
+
+ # ONLY enchantments: "id:damage:count:DEFAULT:enchantment1:level"
+ # (Put DEFAULT in the name field if you do not want a custom name)
+ # You can put as many enchantments as you want like this: "id:damage:count:DEFAULT:enchantment1:level:enchantment2:level" etc.
+
+ # Enchantments AND custom name: "id:damage:count:custom name:enchantment1:level"
+ # You can put as many enchantments as you want like this: "id:damage:count:custom name:enchantment1:level:enchantment2:level" etc.
+
+ # You can write both numeric or string IDs
+ items:
+ - "260:0:10"
+ - "267:0:1:Sword Name"
+ helmet: "diamond_helmet:0:1"
+ chestplate: "diamond_chestplate:0:1:DEFAULT:protection:1"
+ leggings: "diamond_leggings:0:1:Leggings Name"
+ boots: "diamond_boots:0:1"
+
+ # Set items for specific slots, will override existing items. Only use if you want to assign items to specific slots, otherwise delete this.
+ slots:
+ 9: "golden_apple:0:5"
+ 12: "bow:0:1"
+
+ commands:
+ - "tell {player} you got an awesome kit thanks to AdvancedKits plugin!"
+
+ cooldown:
+ hours: 24
+ minutes: 30
+
+ # EFFECT FORMAT: "name:seconds:amplifier"
+ effects:
+ - "speed:120:2"
+
+ # Add a cost for the kit. Compatible with EconomyAPI, PocketMoney and MassiveEconomy
+ # Put 0 if you want the kit to be free
+ money: 50
+
+ # If you do not use pureperms, use 'worlds' to specify in which worlds you want this kit to be used
+ # Leave blank to let use the kit in all worlds
+ worlds:
+ - "kitpvp"
+
+ # If you do not use pureperms, use 'users' to specify which players will be able to get this kit
+ # Leave blank to let all the players use this kit
+ users:
+ - "luca28pet"
+ - "dioconsole"
+
+ # FormAPI users:
+ # Img type: 'url' or 'path'
+ img-type: ''
+ # Put here the image URL/path
+ img-data: ''
+ # How the kit is displayed on the form
+ form-name: 'Test Kit: 50$'
+```
+
+You can find a list of available enchantments in the file Enchantment.php in the pmmp source code: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/enchantment/Enchantment.php
+
+If you don't specify users or world, then the kit will be available to all users or in all worlds.
+If 'permissions-mode' in the config.yml is true, these parameters will be ignored
+
+
+**Translations:**
+
+You can easily translate plugin messages by editing the lang.properties file inside the plugin folder. Remember to don't change the "lang-version" parameter, as it is used for internal proposes.
+
+**Config:**
+```
+---
+# Users are able to get only one kit per life
+one-kit-per-life: true
+
+# Users are able to get a kit if they log out even if they did not die (only works if one-kit-per-life: true)
+reset-on-logout: true
+
+# Use built in permission system even if using PurePerms
+force-builtin-permissions: false
+
+# Sign text (capitals and color codes don't matter)
+sign-text: "[AdvancedKits]"
+...
+```
From b4ac1b2664a75a2a1e7784fe509c07dad4474cc2 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:34:18 +1000
Subject: [PATCH 10/22] Update plugin.yml
---
plugin.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugin.yml b/plugin.yml
index 5ad9a34..1d907a9 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -2,9 +2,9 @@ name: AdvancedKits
main: AdvancedKits\AdvancedKits
version: 7.0.0
api: 5.0.0
-author: luca28pet
+author: [luca28pet,skyss0fly]
description: Add kits to your server
-website: https://github.com/luca28pet/AdvancedKits
+website: https://github.com/skyss0fly/AdvancedKits
commands:
kit:
description: Get a kit!
From 9abccf859abb1f6cb9c0ea7c8a12425fe2567b53 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:34:58 +1000
Subject: [PATCH 11/22] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2b1ac3f..98996c1 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ A PocketMine-MP plugin that adds kits to your server with many features and supp
*Latest release: https://poggit.pmmp.io/p/AdvancedKits/*
-*Latest development phars: https://poggit.pmmp.io/ci/luca28pet/AdvancedKits/AdvancedKits*
+*Latest development phars: https://poggit.pmmp.io/ci/skyss0fly/AdvancedKits/AdvancedKits*
This plugin only supports PocketMine-MP. It might work on other forks as well, but please Do NOT open issues if you have problems with AdvancedKits and you are using a fork.
From e241777f6f8c5e4352d1509f1fe658f2add5558d Mon Sep 17 00:00:00 2001
From: poggit-bot
Date: Fri, 11 Aug 2023 07:36:10 +1000
Subject: [PATCH 12/22] Create .poggit.yml Poggit-CI is enabled for this repo
by @skyss0fly Visit the Poggit-CI page for this repo at
https://poggit.pmmp.io/ci/skyss0fly/AdvancedKits
---
.poggit.yml | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 .poggit.yml
diff --git a/.poggit.yml b/.poggit.yml
new file mode 100644
index 0000000..82c625b
--- /dev/null
+++ b/.poggit.yml
@@ -0,0 +1,8 @@
+--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/skyss0fly/AdvancedKits
+build-by-default: true
+branches:
+- master
+projects:
+ AdvancedKits:
+ path: ""
+...
From 0d6fbc4b57f0a2fa9f332405894c2137e5f546d2 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:37:14 +1000
Subject: [PATCH 13/22] Delete composer.json
---
composer.json | 51 ---------------------------------------------------
1 file changed, 51 deletions(-)
delete mode 100644 composer.json
diff --git a/composer.json b/composer.json
deleted file mode 100644
index 89f205c..0000000
--- a/composer.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "name": "luca28pet/advancedkits",
- "description": "Kits plugin",
- "version": "6.0.0",
- "minimum-stability": "stable",
- "license": "AGPL-3.0",
- "authors": [
- {
- "name": "luca28pet"
- }
- ],
- "require-dev": {
- "phpstan/phpstan": "^1.2.0",
- "phpstan/extension-installer": "^1.1.0",
- "phpstan/phpstan-strict-rules": "^1.1.0",
- "pocketmine/pocketmine-mp": "^4.0.0"
- },
- "require": {
- "dktapps/pmforms": "2.0.0"
- },
- "repositories": [
- {
- "type": "package",
- "package": {
- "name": "dktapps/pmforms",
- "version": "2.0.0",
- "dist": {
- "url": "https://poggit.pmmp.io/r/149990/pmforms_dev-12.phar",
- "type": "phar",
- "shasum": "bb28be9c3e877645e163b260468a8e879314d956"
- },
- "source": {
- "type": "git",
- "url": "https://github.com/dktapps-pm-pl/pmforms.git",
- "reference": "80b10dfcc68633a3a659c57cc9e2bd50cd2166e4"
- },
- "autoload": {
- "psr-0": {
- "dktapps\\pmforms\\": "src"
- }
- }
- }
- }
- ],
- "autoload": {
- "psr-0": {
- "AdvancedKits\\": "src"
- }
- }
-}
-
From 24d5c9a501b8d435712b207c613109c54a542c1f Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:37:28 +1000
Subject: [PATCH 14/22] Delete Makefile
---
Makefile | 22 ----------------------
1 file changed, 22 deletions(-)
delete mode 100644 Makefile
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 6ce4efa..0000000
--- a/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-include config.mk
-
-PHAR := AdvancedKits.phar
-
-all: $(PHAR)
-
-phpstan:
- $(PHP_PM) $(COMPOSER_PHAR) install
- $(PHP_PM) vendor/bin/phpstan analyse
-
-clean:
- rm -rf shaded $(PHAR)
-
-shade: clean phpstan
- $(PHP_PM) $(COMPOSER_PHAR) install --no-dev
- $(PHP_PM) $(SHADER_SCRIPT)
-
-$(PHAR): shade
- $(PHP_PM) $(DEVTOOLS_PHAR) --make shaded --out $(PHAR)
-
-.PHONY: phpstan shade clean all
-
From 49c774a8c0a62eec0dd2df33c713fbd1f8311373 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:43:39 +1000
Subject: [PATCH 15/22] Update ConfigParser.php
---
src/AdvancedKits/ConfigParser.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/AdvancedKits/ConfigParser.php b/src/AdvancedKits/ConfigParser.php
index 9e73024..aaa5d17 100644
--- a/src/AdvancedKits/ConfigParser.php
+++ b/src/AdvancedKits/ConfigParser.php
@@ -10,7 +10,6 @@
use pocketmine\item\enchantment\StringToEnchantmentParser;
use pocketmine\item\Armor;
use pocketmine\item\VanillaItems;
-use pocketmine\item\ItemFactory;
use pocketmine\nbt\JsonNbtParser;
use pocketmine\nbt\NbtDataException;
From e997bfae5e22b85b180920bba08a58854a5685e6 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:48:35 +1000
Subject: [PATCH 16/22] Update ConfigParser.php
---
src/AdvancedKits/ConfigParser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/AdvancedKits/ConfigParser.php b/src/AdvancedKits/ConfigParser.php
index aaa5d17..a8eed64 100644
--- a/src/AdvancedKits/ConfigParser.php
+++ b/src/AdvancedKits/ConfigParser.php
@@ -54,7 +54,7 @@ public static function getKit(mixed $node) : Kit {
if (isset($node[$k])) {
try {
$tmp = self::getItem($node[$k]);
- if (!($tmp instanceof Armor) && !($tmp->equals(ItemFactory::air()))) {
+ if (!($tmp instanceof Armor) && !($tmp->equals(VanillaItems::air()))) {
throw new \InvalidArgumentException('Armor item is not an armor');
}
$armor[$k] = $tmp;
From 6ae468d61b362ab11c5780111f6db82613fcd44c Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:50:53 +1000
Subject: [PATCH 17/22] Update ConfigParser.php
---
src/AdvancedKits/ConfigParser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/AdvancedKits/ConfigParser.php b/src/AdvancedKits/ConfigParser.php
index a8eed64..7d9eb05 100644
--- a/src/AdvancedKits/ConfigParser.php
+++ b/src/AdvancedKits/ConfigParser.php
@@ -54,7 +54,7 @@ public static function getKit(mixed $node) : Kit {
if (isset($node[$k])) {
try {
$tmp = self::getItem($node[$k]);
- if (!($tmp instanceof Armor) && !($tmp->equals(VanillaItems::air()))) {
+ if (!($tmp instanceof Armor) && !($tmp->equals(VanillaItems::AIR()))) {
throw new \InvalidArgumentException('Armor item is not an armor');
}
$armor[$k] = $tmp;
From 2310d4bc9bd88dde9c78939347a9426e435321ed Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 07:56:14 +1000
Subject: [PATCH 18/22] Update AdvancedKits.php
---
src/AdvancedKits/AdvancedKits.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/AdvancedKits/AdvancedKits.php b/src/AdvancedKits/AdvancedKits.php
index 29b5a4d..e14f7b5 100644
--- a/src/AdvancedKits/AdvancedKits.php
+++ b/src/AdvancedKits/AdvancedKits.php
@@ -16,8 +16,8 @@
use pocketmine\player\Player;
use AdvancedKits\lang\LangManager;
use AdvancedKits\perm\PermissionChecker;
-use dktapps\pmforms\MenuForm;
-use dktapps\pmforms\MenuOption;
+use dktapps\pmforms\{MenuForm, MenuOption};
+
final class AdvancedKits extends PluginBase {
private KitsManager $kitsManager;
From 466c0739407604ec80efe974141c0e4d0ed2f490 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 11 Aug 2023 15:43:45 +1000
Subject: [PATCH 19/22] Update .poggit.yml
---
.poggit.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.poggit.yml b/.poggit.yml
index 82c625b..b3cf9a1 100644
--- a/.poggit.yml
+++ b/.poggit.yml
@@ -5,4 +5,7 @@ branches:
projects:
AdvancedKits:
path: ""
+ libs:
+ - src: dktapps-pm-pl/pmforms/pmforms
+ version: ^2.1.0
...
From 905cb603bd98efbc9af4088f6ae6d51dad7730e5 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Tue, 29 Aug 2023 15:29:05 +1000
Subject: [PATCH 20/22] Update plugin.yml
---
plugin.yml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugin.yml b/plugin.yml
index 1d907a9..c98866d 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -9,20 +9,20 @@ commands:
kit:
description: Get a kit!
usage: /kit
- permission: advancedkits.command.kit
+ permission: AdvancedKitsAK.command.kit
akreload:
descrpition: Reload Kits settings
usage: /akreload
- permission: advancedkits.command.akreload
+ permission: AdvancedKitsAK.command.akreload
givekit:
description: Give a kit to someone
usage: /givekit
- permission: advancedkits.command.givekit
+ permission: AdvancedKitsAK.command.givekit
permissions:
- advancedkits.command.kit:
+ AdvancedKitsAK.command.kit:
default: true
- advancedkits.command.akreload:
+ AdvancedKitsAK.command.akreload:
default: op
- advancedkits.command.givekit:
+ AdvancedKitsAK.command.givekit:
default: op
From 30cc5b6a698af0ceee1718cb2a8e8f400e1ac572 Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Tue, 29 Aug 2023 15:29:53 +1000
Subject: [PATCH 21/22] Create LICENSE
---
LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 661 insertions(+)
create mode 100644 LICENSE
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0ad25db
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
From 722422000ab7427f6128b7f44729c83124f67f9c Mon Sep 17 00:00:00 2001
From: skyss0fly <100278495+skyss0fly@users.noreply.github.com>
Date: Fri, 15 Sep 2023 15:28:59 +1000
Subject: [PATCH 22/22] Update DefaultPermissionChecker.php
---
src/AdvancedKits/perm/DefaultPermissionChecker.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/AdvancedKits/perm/DefaultPermissionChecker.php b/src/AdvancedKits/perm/DefaultPermissionChecker.php
index 4075822..9d99003 100644
--- a/src/AdvancedKits/perm/DefaultPermissionChecker.php
+++ b/src/AdvancedKits/perm/DefaultPermissionChecker.php
@@ -15,12 +15,12 @@ class DefaultPermissionChecker implements PermissionChecker {
*/
public function __construct(array $kits) {
foreach ($kits as $kit) {
- PermissionManager::getInstance()->addPermission(new Permission('advancedkits.'.strtolower($kit->getName())));
+ PermissionManager::getInstance()->addPermission(new Permission('AdvancedKitsAK.'.strtolower($kit->getName())));
}
}
public function canPlayerGetKit(Player $p, Kit $kit) : bool {
- return $p->hasPermission('advancedkits.'.strtolower($kit->getName()));
+ return $p->hasPermission('AdvancedKitsAK.'.strtolower($kit->getName()));
}
}